Woman, Life, Freedom |
|
OBD-II Emulator
Linux ODB-II Emulator public and protected interfaces documentation
|
Serial port communication layer. More...
#include <serial_communication.h>
Public Member Functions | |
| SerialCommunication (std::string serialPort, speed_t baudrate, int timeout=1) | |
| Constructor. More... | |
| bool | TryStart (std::vector< uint8_t > &&configuration) override |
| Try to start the communication. More... | |
| bool | TrySendAsync (std::vector< uint8_t > &&data) override |
| Try to buffer data for sending. More... | |
| bool | TryStop () override |
| Try to stop the communication. More... | |
Public Member Functions inherited from ObdEmulator::CommunicationLayer | |
| void | SetCallback (CallbackType &&callback) |
| Set a data received callback and reset the asynchronized callback. More... | |
| void | SetCallback (AsyncCallbackType &&asyncCallback) |
| Set a data received asynchronous callback and reset the synchronized callback. More... | |
| void | ResetCallback () noexcept |
| Reset both data received synchronized and asynchronized callbacks. More... | |
Additional Inherited Members | |
Public Types inherited from ObdEmulator::CommunicationLayer | |
| using | CallbackType = std::function< bool(std::vector< uint8_t > &&, std::vector< uint8_t > &)> |
| Data received callback type. More... | |
| using | AsyncCallbackType = std::function< void(std::vector< uint8_t > &&)> |
| Data received callback type to handle the data asynchronously. | |
Protected Attributes inherited from ObdEmulator::CommunicationLayer | |
| CallbackType | Callback |
| Callback to be invoked when data received. | |
| AsyncCallbackType | AsyncCallback |
| Callback to be invoked when data received asynch. | |
Serial port communication layer.
| ObdEmulator::SerialCommunication::SerialCommunication | ( | std::string | serialPort, |
| speed_t | baudrate, | ||
| int | timeout = 1 |
||
| ) |
Constructor.
| serialPort | Serial port address |
| baudrate | Serial communication baud rate |
| timeout | Polling timeout in milliseconds (1 ms by default) |
| std::runtime_error | Throws if the flow control signal creation failed |
|
overridevirtual |
Try to buffer data for sending.
| data | Data to be buffered for sending |
Implements ObdEmulator::CommunicationLayer.
|
overridevirtual |
Try to start the communication.
| configuration | Configuration packet to sent to the endpoint right after the communication start |
Implements ObdEmulator::CommunicationLayer.
|
overridevirtual |
Try to stop the communication.
Implements ObdEmulator::CommunicationLayer.