BayEOS-PHP
 All Data Structures Namespaces Files Functions Variables Pages
testPHP.php
Go to the documentation of this file.
1 <?php
2 /*
3  * BaySerial Reader
4  *
5  * may read e.g. Arduino sending via BaySerial-USB
6  */
7 
8 require 'bayeosSerial.php';
9 //require 'BayEOSGatewayClient.php';
10 require '../bayeos-gateway-client-php/BayEOSGatewayClient.php';
11 
13 $BaySerial->confDefaults();
14 $BaySerial->confBaudRate(38400);
15 $BaySerial->deviceSet("/dev/ttyUSB0");
16 $BaySerial->open();
17 while(1){
18  $frame=$BaySerial->getFrame();
19  if($frame!==FALSE){
20  echo "got frame: ".array_pop(unpack('H*',$frame['frame']))."\n";
21  print_r(BayEOS::parseFrame($frame['frame']));
22  }
23  usleep(50000);
24 }
25 
26 
27 ?>
$frame
Definition: testPHP.php:14
static parseFrame($frame, $ts=FALSE, $origin='', $rssi=FALSE)
$BaySerial
Definition: testPHP.php:12