40 lines
1016 B
PHP
40 lines
1016 B
PHP
<?php
|
|
/* Send rpc config:set request messages to set device token and activation state */
|
|
$fd = di_can_open("vcan0");
|
|
|
|
$msg = [];
|
|
|
|
$msg['msgtype'] = DI_CAN_MSGTYPE_RPC;
|
|
$msg['ptype'] = DI_CAN_PTYPE_MSGPACK;
|
|
$msg['ttype'] = DI_CAN_TRANSFERTYPE_REQUEST;
|
|
$msg['dtype'] = DI_RPC_TYPE_CONFIG_SET;
|
|
|
|
// config:set
|
|
// DI_RPC_UID_CONFIG_DEVICE_TOKEN = 1337
|
|
$params = [];
|
|
$params['uid'] = DI_RPC_UID_CONFIG_DEVICE_TOKEN;
|
|
$params['value'] = 1337;
|
|
$msg['msg'] = msgpack_pack($params);
|
|
di_can_send($fd, $msg);
|
|
|
|
// config:set
|
|
// DI_RPC_UID_CONFIG_DEVICE_ACTIVATION = true
|
|
// FIXME for some reason we cannot recycle the $msg
|
|
$msg = [];
|
|
|
|
$msg['msgtype'] = DI_CAN_MSGTYPE_RPC;
|
|
$msg['ptype'] = DI_CAN_PTYPE_MSGPACK;
|
|
$msg['ttype'] = DI_CAN_TRANSFERTYPE_REQUEST;
|
|
$msg['dtype'] = DI_RPC_TYPE_CONFIG_SET;
|
|
|
|
$params = [];
|
|
$params['uid'] = DI_RPC_UID_CONFIG_DEVICE_ACTIVATION;
|
|
$params['value'] = true;
|
|
$msg['msg'] = msgpack_pack($params);
|
|
di_can_send($fd, $msg);
|
|
|
|
sleep(1);
|
|
|
|
di_can_close($fd);
|
|
?>
|