Base class for a Transport input output connection.
More...
#include <baos/transport/TransportIO.h>
|
| enum class | PromiseState {
UNUSED
,
SET
,
RESOLVED
} |
| |
|
using | Clock = std::chrono::system_clock |
| | An alias for the clock internaly used.
|
| |
|
using | UPtr = std::unique_ptr< TransportIO > |
| | Alias for a std::unique_ptr to this class.
|
| |
|
using | UniqueLock = std::unique_lock< std::mutex > |
| | Alias for unique lock used by this class.
|
| |
|
|
virtual void | eventHandler ()=0 |
| | Handles the incoming IOEvents.
|
| |
|
virtual void | sendToIo (const Buffer &frame)=0 |
| |
|
|
std::unique_ptr< ProtocolStack > | transportStack_ |
| | The transport stack to use for actual sending and receiving.
|
| |
|
std::atomic< bool > | shouldStop_ {false} |
| | Flag to indicate that the receiver worker should stop.
|
| |
|
std::condition_variable | cvFinished_ |
| | Condition variable which is set when the receiver worker has stopped.
|
| |
|
std::mutex | cvFinished_mut_ |
| | The correponding mutex for the cvFinished_ condition variable.
|
| |
| bool | stopped_ {false} |
| |
|
std::atomic< bool > | isOpen_ {false} |
| | Flag to show if the Transport connection is open or not.
|
| |
|
TransportMsgQueue | msgQueue_ |
| | Reference to the message queue in which events will be posted by this class.
|
| |
|
BaosMsgQueue & | bMsgQ_ |
| | Reference to the message queue in which baos events will be posted by this class.
|
| |
|
wzcpp::ExecutorBase & | executor_ |
| | Reference to the executor to use for running the receive(RX) worker.
|
| |
|
wzcpp::TimerManager< Clock > & | timerManager_ |
| | Reference to the timer manager used by this transport IO.
|
| |
|
wzcpp::TimerManager< Clock >::AllTimersCallbackId | timerCallbackId_ {0} |
| | The id of the callback registered in the timer manager to handle timer events for this transport io.
|
| |
|
BaosPromise | connectionPromise_ |
| | A promise to be resolved when the connection is established, or disconnected.
|
| |
|
|
static std::atomic< std::uint64_t > | msgId |
| | Used to generate a continuous unique message id.
|
| |
Base class for a Transport input output connection.
This establishes a Transport connection to the BAOS devices. It sends and receives raw bytes.
◆ TransportIO() [1/3]
Construct a new TransportIO object with a given message queue and executor.
- Parameters
-
| msgQueue | An external message queue to post events into |
| executor | An external executor to run this class worker in |
| timerManager | An external timer manager to manage timers for this transport io |
◆ TransportIO() [2/3]
Copy constructor is not supported
◆ TransportIO() [3/3]
Move constructor is not supported
◆ operator=() [1/2]
Copy assignment operator is not supported
◆ operator=() [2/2]
Move assignment operator is not supported
◆ start()
Starts the protocol stack
◆ stop()
◆ send()
| virtual void send |
( |
const Buffer & |
frame | ) |
|
|
pure virtual |
Send a baos frame.
- Parameters
-
| frame | The baos frame to send |
Implemented in TransportTcpIO.
◆ close()
◆ waitForFinished()
| virtual void waitForFinished |
( |
| ) |
|
|
pure virtual |
Wait till the worker of this class has finished.
Implemented in TransportTcpIO.
◆ isOpen()
Get the open state of the Transport connection.
- Returns
- true if the Transport connection is established false otherwise
Reimplemented in TransportTcpIO.
◆ isIdle()
Get the idle state of the Transport connection.
- Returns
- true if the Transport connection is idle false otherwise
◆ stopped_
Flag to show the actual state of the receive worker. Because condition variables may suffer from spurious wakeups.
The documentation for this class was generated from the following file: