|
BAOS SDK v2
1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
|
Base class for a Transport input output connection. More...
#include <baos/transport/TransportTcpIO.h>
Inheritance diagram for TransportTcpIO:Public Types | |
| using | UPtr = std::unique_ptr< TransportTcpIO > |
| Alias for a std::unique_ptr to this class. | |
| using | UniqueLock = std::unique_lock< std::mutex > |
| Alias for unique lock used by this class. | |
Public Types inherited from TransportIO | |
| 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. | |
Public Member Functions | |
| TransportTcpIO (BaosMsgQueue &msgQueue, wzcpp::ExecutorBase &executor, wzcpp::TimerManager< Clock > &timerManager) | |
| Construct a new TransportTcpIO object with a given message queue and executor. More... | |
| void | stop () override |
| void | send (const Buffer &buf) override |
| Send a byte list out. More... | |
| void | open (const std::string &ip4Address, std::uint16_t port) |
| Open the TCP connection to the remote device. More... | |
| void | open (IOEvent::EventDataType arg) |
| void | close () override |
| Close the Transport connection. | |
| void | waitForFinished () override |
| Wait till the worker of this class has finished. | |
| bool | isOpen () override |
| Get the open state of the Transport connection. More... | |
Public Member Functions inherited from TransportIO | |
| TransportIO (BaosMsgQueue &msgQueue, wzcpp::ExecutorBase &executor, wzcpp::TimerManager< Clock > &timerManager) | |
| Construct a new TransportIO object with a given message queue and executor. More... | |
| TransportIO (const TransportIO &)=delete | |
| TransportIO & | operator= (const TransportIO &)=delete |
| TransportIO (TransportIO &&)=delete | |
| TransportIO & | operator= (TransportIO &&)=delete |
| template<typename LayerType > | |
| void | addLayer (std::uint32_t layerId) |
| ProtocolLayer & | getLayer (unsigned int layerId) |
| void | start () |
| bool | isIdle () const |
| Get the idle state of the Transport connection. More... | |
| void | onTimersElapsed (wzcpp::TimerManager< Clock >::TimerIdList &timerIds) |
Protected Attributes | |
| ip::TcpIO | tcpIO_ |
Protected Attributes inherited from TransportIO | |
| 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. | |
Additional Inherited Members | |
Static Protected Attributes inherited from TransportIO | |
| 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.
| TransportTcpIO | ( | BaosMsgQueue & | msgQueue, |
| wzcpp::ExecutorBase & | executor, | ||
| wzcpp::TimerManager< Clock > & | timerManager | ||
| ) |
Construct a new TransportTcpIO object with a given message queue and executor.
| 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 |
|
overridevirtual |
Stops the protocol stack
Implements TransportIO.
|
overridevirtual |
| void open | ( | const std::string & | ip4Address, |
| std::uint16_t | port | ||
| ) |
Open the TCP connection to the remote device.
| ip4Address | The IPv4 Address as string in the form "xxx.xxx.xxx.xxx" |
| port | The tcp port of the remote device |
|
overridevirtual |
Get the open state of the Transport connection.
Reimplemented from TransportIO.
|
protected |
The underlying TcpIO used for the actual TCP connection