Class which manages the logic relative to send/receive messages from Synchronous Serial Port. This class implements all the logic necessary to communicate with UART port.
#include <syncSerialPort.h>
|
| | SyncSerialPort (const char *port, int baud_rate, boost::asio::serial_port_base::flow_control::type flow, TypeRec type=nocanonical) |
| | Constructor of the class. More...
|
| |
|
| SyncSerialPort () |
| | Constructor of the class.
|
| |
|
virtual | ~SyncSerialPort () |
| | Destructor of the class.
|
| |
| bool | send (const char *buffer, int size) |
| | Method to send data to serial port synchronously. More...
|
| |
| size_t | readWithTimeout (char *buff, size_t max_length, int timeout_ms) |
| | Method to create a synchronous read of the Serial Port non blocking. More...
|
| |
| | SerialPort (boost::asio::io_service &io, const char *port, int baud_rate, boost::asio::serial_port_base::flow_control::type flow, TypeRec type=nocanonical) |
| | Constructor of the class. More...
|
| |
| | SerialPort (boost::asio::io_service &io) |
| | Constructor of the class. More...
|
| |
|
virtual | ~SerialPort () |
| | Destructor of the class.
|
| |
| bool | setPort (const char *port, int baud_rate, boost::asio::serial_port_base::flow_control::type flow) |
| | Method to establish serial port when it is not established in constructor. More...
|
| |
| const char * | getPort () const |
| | Method to take the serial port path. More...
|
| |
| bool | open (boost::system::error_code &ec) |
| | Method to open serial port. More...
|
| |
| bool | isOpened () const |
| | Method to query if serial port is opened by the current app. More...
|
| |
| bool | isBusy () const |
| | Method to query if serial port is opened by any app. More...
|
| |
| bool | isBusyOp () const |
| | Method to query if serial port is opened by any app. More...
|
| |
|
void | close () |
| | Method to close serial port.
|
| |
| bool | flush () |
| | Method to clear the serial port buffer. More...
|
| |
- Parameters
-
| port | Path to the serial port |
| baud_rate | Rate of serial port to work |
| flow | UART flow control |
| type | Type of serial port configuration |
| size_t readWithTimeout |
( |
char * |
buff, |
|
|
size_t |
max_length, |
|
|
int |
timeout_ms |
|
) |
| |
- Parameters
-
| buff | Buffer to save bytes received |
| max_length | Max length of bytes received |
| timeout_ms | Timeout to stop reading in milliseconds |
- Returns
- 0 if not data read, number of read bytes in the other case
| bool send |
( |
const char * |
buffer, |
|
|
int |
size |
|
) |
| |
|
virtual |
- Parameters
-
| buffer | Data buffer to be sent |
| size | Data length in bytes of the data buffer |
- Returns
- true if serial port is opened and write took place
Implements SerialPort.