13 #ifndef __BAOSLIB_TRANSPORT_TCP_IO_H__
14 #define __BAOSLIB_TRANSPORT_TCP_IO_H__
16 #include "baos/BaosLib_export.h"
20 #include "wzcpp/features/concurrent/executor.h"
35 namespace wz::baos::ip
40 namespace wz::baos::transport
56 using UPtr = std::unique_ptr<TransportTcpIO>;
77 TransportTcpIO(
BaosMsgQueue& msgQueue, std::unique_ptr<ip::Ip4Driver>& driver, wzcpp::ExecutorBase& executor, wzcpp::TimerManager<Clock>& timerManager);
84 ip::Ip4Driver& getDriver();
104 void open(
const std::string& ip4Address, std::uint16_t port);
125 void eventHandler()
override;
127 void sendToIo(
const Buffer& frame)
override;
Code regarding Input/Output Events.
Specialization for a TCP IP v4 BAOSConnection.
Base class for the transport protocol io used by BaosConnections.
std::variant< std::monostate, ip::Ip4SocketAddress, std::unique_ptr< Buffer >, TimerIdList > EventDataType
datatypes inside an IOEvent
Definition: IOEvent.h:50
Base class for a TCP input output connection.
Definition: TcpIO.h:115
Base class for a Transport input output connection.
Definition: TransportIO.h:56
std::unique_ptr< TransportIO > UPtr
Alias for a std::unique_ptr to this class.
Definition: TransportIO.h:59
std::unique_lock< std::mutex > UniqueLock
Alias for unique lock used by this class.
Definition: TransportIO.h:60
Base class for a Transport input output connection.
Definition: TransportTcpIO.h:54
TransportTcpIO(BaosMsgQueue &msgQueue, wzcpp::ExecutorBase &executor, wzcpp::TimerManager< Clock > &timerManager)
Construct a new TransportTcpIO object with a given message queue and executor.
ip::TcpIO tcpIO_
Definition: TransportTcpIO.h:130
void waitForFinished() override
Wait till the worker of this class has finished.
void send(const Buffer &buf) override
Send a byte list out.
void close() override
Close the Transport connection.
void open(const std::string &ip4Address, std::uint16_t port)
Open the TCP connection to the remote device.
bool isOpen() override
Get the open state of the Transport connection.
Global types and configuration for the whole SDK.
std::vector< std::uint8_t > Buffer
An alias type for a byte buffer.
Definition: config.h:71
wzcpp::ConcurrentDeque< IOEvent > BaosMsgQueue
Alias for a concurrent queue with IOEvents.
Definition: IOEvent.h:96