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

21 lines
519 B
PHP

<?php
require_once(get_cfg_var('COMMON_PATH') . "/ditest-php/test_framework.php");
$test = new DiTest("Test device:ping");
$test->goal("Verify device ping requests");
$wfd = di_can_open("vcan0");
$rfd = di_can_open("vcan0");
$msg = [];
$msg['msgtype'] = DI_CAN_MSGTYPE_RAW;
$msg['ttype'] = DI_CAN_TRANSFERTYPE_REPLY;
$msg['dtype'] = DI_CAN_RAW_DTYPE_DEVICE_UID;
$msg['dst_id'] = DI_CAN_NODEID_BROADCAST;
di_can_send($wfd, $msg);
$msg = di_can_recv($rfd);
print_r($msg);
di_can_close($wfd);
di_can_close($rfd);