Satellite-Gateway
ConfigServerHandler.h
Go to the documentation of this file.
1 
24 #ifndef CONFIG_SERVER_HANDLER_H
25 #define CONFIG_SERVER_HANDLER_H
26 
27 #include <memory>
28 #include <boost/asio.hpp>
30 #include "HdlcdClientErrorCodes.h"
34 class ConfigFrame;
35 class ConfigServer;
36 
37 class ConfigServerHandler: public std::enable_shared_from_this<ConfigServerHandler> {
38 public:
39  // CTOR, initializer, and resetter
40  ConfigServerHandler(boost::asio::io_service& a_IOService, boost::asio::ip::tcp::tcp::socket& a_TcpSocket, std::shared_ptr<GatewayClientHandlerCollection> a_GatewayClientHandlerCollection,
41  std::shared_ptr<HdlcdClientHandlerCollection> a_HdlcdClientHandlerCollection);
42  void Start(std::shared_ptr<ConfigServerHandlerCollection> a_ConfigServerHandlerCollection);
43  void Close();
44 
45  // Methods to be called by a gateway client entity
46  void GatewayClientCreated (uint16_t a_ReferenceNbr);
47  void GatewayClientDestroyed (uint16_t a_ReferenceNbr);
48  void GatewayClientConnected (uint16_t a_ReferenceNbr);
49  void GatewayClientDisconnected(uint16_t a_ReferenceNbr);
50  void GatewayClientError (uint16_t a_ReferenceNbr, E_GATEWAY_CLIENT_ERROR a_ErrorCode);
51 
52  // Methods to be called by a HDLCd client entity
53  void HdlcdClientCreated (uint16_t a_SerialPortNbr);
54  void HdlcdClientDestroyed (uint16_t a_SerialPortNbr);
55  void HdlcdClientConnected (uint16_t a_SerialPortNbr);
56  void HdlcdClientDisconnected(uint16_t a_SerialPortNbr);
57  void HdlcdClientNewStatus (uint16_t a_SerialPortNbr, bool a_bIsResumed, bool a_bIsAlive);
58  void HdlcdClientError (uint16_t a_SerialPortNbr, E_HDLCD_CLIENT_ERROR a_ErrorCode);
59 
60 private:
61  // Members
62  boost::asio::io_service& m_IOService;
63  std::shared_ptr<GatewayClientHandlerCollection> m_GatewayClientHandlerCollection;
64  std::shared_ptr<HdlcdClientHandlerCollection> m_HdlcdClientHandlerCollection;
65  std::shared_ptr<ConfigServerHandlerCollection> m_ConfigServerHandlerCollection;
66 
67  // One config server handler is responsible for one config server object
68  std::shared_ptr<ConfigServer> m_ConfigServer;
69  bool m_Registered;
70 };
71 
72 #endif // CONFIG_SERVER_HANDLER_H
void GatewayClientDisconnected(uint16_t a_ReferenceNbr)
void GatewayClientError(uint16_t a_ReferenceNbr, E_GATEWAY_CLIENT_ERROR a_ErrorCode)
E_GATEWAY_CLIENT_ERROR
void HdlcdClientError(uint16_t a_SerialPortNbr, E_HDLCD_CLIENT_ERROR a_ErrorCode)
void GatewayClientCreated(uint16_t a_ReferenceNbr)
void HdlcdClientCreated(uint16_t a_SerialPortNbr)
void HdlcdClientDisconnected(uint16_t a_SerialPortNbr)
E_HDLCD_CLIENT_ERROR
void GatewayClientDestroyed(uint16_t a_ReferenceNbr)
void HdlcdClientConnected(uint16_t a_SerialPortNbr)
void GatewayClientConnected(uint16_t a_ReferenceNbr)
void HdlcdClientDestroyed(uint16_t a_SerialPortNbr)
void Start(std::shared_ptr< ConfigServerHandlerCollection > a_ConfigServerHandlerCollection)
void HdlcdClientNewStatus(uint16_t a_SerialPortNbr, bool a_bIsResumed, bool a_bIsAlive)
ConfigServerHandler(boost::asio::io_service &a_IOService, boost::asio::ip::tcp::tcp::socket &a_TcpSocket, std::shared_ptr< GatewayClientHandlerCollection > a_GatewayClientHandlerCollection, std::shared_ptr< HdlcdClientHandlerCollection > a_HdlcdClientHandlerCollection)