Skip to content

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

License

Notifications You must be signed in to change notification settings

the-kbA-team/SerialPort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages