Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.95 KB

README.md

File metadata and controls

31 lines (20 loc) · 1.95 KB

SerialPort

License: MIT Build Status Maintainability Test Coverage

PHP class \kbATeam\SerialPort\SerialPort to connect to serial ports using streams. Nothing more. Only socket (TCP) streams are implemented at the moment.

You need to create classes implementing \kbATeam\SerialPort\Interfaces\Communication\Command, \kbATeam\SerialPort\Interfaces\Communication\Container and \kbATeam\SerialPort\Interfaces\Communication\Value. The implementations of these interfaces depend on the device you want to communicate with.

Usage

Use pySerial to map a serial device to a TCP port.

Use Streams\Socket to create a connection to a SerialPort use SerialPort->invoke() to invoke a Communication\Command and get either NULL or a Communication\Container containing at least one Communication\Value.

A Communication\Command instance is a string sent to a SerialPort instance. The SerialPort instance invokes the Communication\Command using its Stream instance.

Your implementation of Communication\Command needs to define how to read the string returned by the device and either return a Communication\Container containing at least one Communication\Value, or NULL.