Satellite-Gateway
GatewayClient.h
Go to the documentation of this file.
1 
24 #ifndef GATEWAY_CLIENT_H
25 #define GATEWAY_CLIENT_H
26 
27 #include <memory>
28 #include <boost/asio.hpp>
29 #include "GatewayFrame.h"
30 #include "FrameEndpoint.h"
34 
36 public:
37  // CTOR and DTOR
38  GatewayClient(boost::asio::io_service& a_IOService, boost::asio::ip::tcp::resolver::iterator a_EndpointIterator, std::shared_ptr<ConfigServerHandlerCollection> a_ConfigServerHandlerCollection,
39  std::shared_ptr<HdlcdClientHandlerCollection> a_HdlcdClientHandlerCollection, GatewayClientConnectGuard& a_GatewayClientConnectGuard, uint16_t a_ReferenceNbr);
41 
42  void Shutdown();
43  void Close();
44 
45  // Methods to be called by a HDLCd client entity
46  void SendPacket(uint16_t a_SerialPortNbr, const std::vector<unsigned char> &a_Payload);
47 
48  void SetOnClosedCallback(std::function<void()> a_OnClosedCallback);
49 
50 private:
51  // Internal helpers
52  bool OnFrame(std::shared_ptr<Frame> a_Frame);
53  void OnClosed();
54 
55  // Members
56  boost::asio::io_service& m_IOService;
57  std::shared_ptr<ConfigServerHandlerCollection> m_ConfigServerHandlerCollection;
58  std::shared_ptr<HdlcdClientHandlerCollection> m_HdlcdClientHandlerCollection;
59  GatewayClientConnectGuard m_GatewayClientConnectGuard;
60 
61  // The communication end point
62  boost::asio::ip::tcp::socket m_TcpSocket;
63  std::shared_ptr<FrameEndpoint> m_FrameEndpoint;
64  uint16_t m_ReferenceNbr;
65  bool m_bClosed;
66 
67  std::function<void()> m_OnClosedCallback;
68 };
69 
70 #endif // GATEWAY_CLIENT_H
This file contains the header declaration of class FrameEndpoint.
void SetOnClosedCallback(std::function< void()> a_OnClosedCallback)
GatewayClient(boost::asio::io_service &a_IOService, boost::asio::ip::tcp::resolver::iterator a_EndpointIterator, std::shared_ptr< ConfigServerHandlerCollection > a_ConfigServerHandlerCollection, std::shared_ptr< HdlcdClientHandlerCollection > a_HdlcdClientHandlerCollection, GatewayClientConnectGuard &a_GatewayClientConnectGuard, uint16_t a_ReferenceNbr)
void SendPacket(uint16_t a_SerialPortNbr, const std::vector< unsigned char > &a_Payload)