HDLC-Daemon
|
Class HdlcdClient. More...
#include <HdlcdClient.h>
Public Member Functions | |
HdlcdClient (boost::asio::io_service &a_IOService, const std::string &a_SerialPortName, HdlcdSessionDescriptor a_HdlcdSessionDescriptor) | |
The constructor of HdlcdClient objects. More... | |
void | AsyncConnect (boost::asio::ip::tcp::resolver::iterator a_EndpointIterator, std::function< void(bool a_bSuccess)> a_OnConnectedCallback) |
Perform an asynchronous connect procedure regarding both TCP sockets. More... | |
~HdlcdClient () | |
The destructor of HdlcdClient objects. More... | |
void | Shutdown () |
Shuts all TCP connections down. More... | |
void | Close () |
Close the client entity. More... | |
void | SetOnDataCallback (std::function< void(const HdlcdPacketData &a_PacketData)> a_OnDataCallback) |
Provide a callback method to be called for received data packets. More... | |
void | SetOnCtrlCallback (std::function< void(const HdlcdPacketCtrl &a_PacketCtrl)> a_OnCtrlCallback) |
Provide a callback method to be called for received control packets. More... | |
void | SetOnClosedCallback (std::function< void()> a_OnClosedCallback) |
Provide a callback method to be called if this client entity is closing. More... | |
bool | Send (const HdlcdPacketData &a_PacketData, std::function< void()> a_OnSendDoneCallback=nullptr) |
Send a single data packet to the peer entity. More... | |
bool | Send (const HdlcdPacketCtrl &a_PacketCtrl, std::function< void()> a_OnSendDoneCallback=nullptr) |
Send a single control packet to the peer entity. More... | |
Class HdlcdClient.
The main helper class to easily implement clients of the HDLCd access protocol. It implements the HDLCd access protocol and makes use of two TCP sockets: one TCP socket is dedicated to the exchange of user data, the second solely to the exchange of control packets. However, all the socket handling is performed internally and is not visible to the user of this class.
This class provides an asynchronous interface, but it can also be used in a quasi-synchronous way.
Definition at line 60 of file HdlcdClient.h.
|
inline |
The constructor of HdlcdClient objects.
a_IOService | the boost IOService object |
a_SerialPortName | the name of the serial port device |
a_HdlcdSessionDescriptor | the indentifier of the session, see "service access point" |
Definition at line 68 of file HdlcdClient.h.
|
inline |
The destructor of HdlcdClient objects.
All open connections will automatically be closed by the destructor
Definition at line 118 of file HdlcdClient.h.
|
inline |
Perform an asynchronous connect procedure regarding both TCP sockets.
a_EndpointIterator | the boost endpoint iteratior referring to the destination |
a_OnConnectedCallback | the callback to be called if a result is available. |
Definition at line 84 of file HdlcdClient.h.
|
inline |
Close the client entity.
Close the client entity and all its TCP connections
Definition at line 143 of file HdlcdClient.h.
|
inline |
Send a single data packet to the peer entity.
Send a single data packet to the peer entity. Due to the asynchronous mode the data packet is enqueued for later transmission.
a_PacketData | the data packet to be transmitted |
a_OnSendDoneCallback | the callback handler to be called if the provided data packet was sent (optional) |
true | the data packet was enqueued for transmission |
false | the data packet was not enqueued, e.g., the send queue was full or a problem with one of the sockets occured |
Definition at line 209 of file HdlcdClient.h.
|
inline |
Send a single control packet to the peer entity.
Send a single control packet to the peer entity. Due to the asynchronous mode the control packet is enqueued for later transmission.
a_PacketCtrl | the control packet to be transmitted |
a_OnSendDoneCallback | the callback handler to be called if the provided control packet was sent (optional) |
true | the control packet was enqueued for transmission |
false | the control packet was not enqueued, e.g., the send queue was full or a problem with one of the sockets occured |
Definition at line 233 of file HdlcdClient.h.
|
inline |
Provide a callback method to be called if this client entity is closing.
This method can be used to provide a function pointer callback to be called if this entoty is closing, e.g., the peer closed its endpoint
a_OnClosedCallback | the funtion pointer to the callback method, may be an empty function pointer to remove the callback |
Definition at line 194 of file HdlcdClient.h.
|
inline |
Provide a callback method to be called for received control packets.
Control packets are received in an asynchronous way. Use this method to specify a callback method to be called on reception of single control packets
a_OnCtrlCallback | the funtion pointer to the callback method, may be an empty function pointer to remove the callback |
Definition at line 184 of file HdlcdClient.h.
|
inline |
Provide a callback method to be called for received data packets.
Data packets are received in an asynchronous way. Use this method to specify a callback method to be called on reception of single data packets
a_OnDataCallback | the funtion pointer to the callback method, may be an empty function pointer to remove the callback |
Definition at line 174 of file HdlcdClient.h.
|
inline |
Shuts all TCP connections down.
Initiates a shutdown procedure for correct teardown of all TCP connections
Definition at line 129 of file HdlcdClient.h.