BayEOS-PHP
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
bayeos-serial-router-php
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
12
$BaySerial
=
new
BaySerial
();
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
$frame
Definition:
testPHP.php:14
BaySerial
Definition:
bayeosSerial.php:19
BayEOS\parseFrame
static parseFrame($frame, $ts=FALSE, $origin='', $rssi=FALSE)
Definition:
BayEOSGatewayClient.php:243
$BaySerial
$BaySerial
Definition:
testPHP.php:12
Generated on Wed Jul 22 2015 13:09:58 for BayEOS-PHP by
1.8.6