src.dualinventive.com/dinet/libdi-php/tests/can_send_log.php

25 lines
640 B
PHP

<?php
/* Send rpc config:set request messages to set device token and activation state */
$fd = di_can_open("vcan0");
// Send config:reset request
$msg = [];
$msg['msgtype'] = DI_CAN_MSGTYPE_LOG;
$msg['ptype'] = DI_CAN_PTYPE_MSGPACK;
$msg['ttype'] = DI_CAN_TRANSFERTYPE_PUBLISH;
$msg['dst_id'] = DI_CAN_NODEID_BROADCAST;
$msg['dtype'] = DI_LOG_LEVEL_INFO;
$lmsg = [];
$lmsg['timestamp'] = 1234;
$lmsg['loglevel'] = DI_LOG_LEVEL_INFO;
$lmsg['component'] = DI_LOG_COMPONENT_FW_APP;
$lmsg['module'] = 1337;
$lmsg['msg'] = "Hello world!";
$msg['msg'] = msgpack_pack($lmsg);
di_can_send($fd, $msg);
di_can_close($fd);