kba-team/serial-port

Connect to serial ports using TCP connections.

Maintainers

Package info

github.com/the-kbA-team/SerialPort

pkg:composer/kba-team/serial-port

Statistics

Installs: 18

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2020-12-17 10:03 UTC

README

License: MIT

PHP class 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 Command, Container and 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 TcpSocket to create a connection to a SerialPort use SerialPort->invoke() to invoke a Command and get either null or a Container containing at least one Value.

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

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