Satellite-Gateway
ConfigServerHandlerCollection.h
Go to the documentation of this file.
1 
24 #ifndef CONFIG_SERVER_HANDLER_COLLECTION_H
25 #define CONFIG_SERVER_HANDLER_COLLECTION_H
26 
27 #include <memory>
28 #include <boost/asio.hpp>
30 #include "HdlcdClientErrorCodes.h"
34 
35 class ConfigServerHandlerCollection: public std::enable_shared_from_this<ConfigServerHandlerCollection> {
36 public:
37  // CTOR, initializer, and resetter
38  ConfigServerHandlerCollection(boost::asio::io_service& a_IOService, uint16_t a_TcpPortNbr);
39  void Initialize(std::shared_ptr<GatewayClientHandlerCollection> a_GatewayClientHandlerCollection,
40  std::shared_ptr<HdlcdClientHandlerCollection> a_HdlcdClientHandlerCollection);
41  void SystemShutdown();
42 
43  // Self-registering and -deregistering of ConfigServerHandler objects
44  void RegisterConfigServerHandler (std::shared_ptr<ConfigServerHandler> a_ConfigServerHandler);
45  void DeregisterConfigServerHandler(std::shared_ptr<ConfigServerHandler> a_ConfigServerHandler);
46 
47  // Methods to be called by a gateway client entity
48  void GatewayClientCreated (uint16_t a_ReferenceNbr);
49  void GatewayClientDestroyed (uint16_t a_ReferenceNbr);
50  void GatewayClientConnected (uint16_t a_ReferenceNbr);
51  void GatewayClientDisconnected(uint16_t a_ReferenceNbr);
52  void GatewayClientError (uint16_t a_ReferenceNbr, E_GATEWAY_CLIENT_ERROR a_ErrorCode);
53 
54  // Methods to be called by a HDLCd client entity
55  void HdlcdClientCreated (uint16_t a_SerialPortNbr);
56  void HdlcdClientDestroyed (uint16_t a_SerialPortNbr);
57  void HdlcdClientConnected (uint16_t a_SerialPortNbr);
58  void HdlcdClientDisconnected(uint16_t a_SerialPortNbr);
59  void HdlcdClientNewStatus (uint16_t a_SerialPortNbr, bool a_bIsResumed, bool a_bIsAlive);
60  void HdlcdClientError (uint16_t a_SerialPortNbr, E_HDLCD_CLIENT_ERROR a_ErrorCode);
61 
62 private:
63  // Internal helpers
64  void DoAccept();
65 
66  // Members
67  boost::asio::io_service& m_IOService;
68  std::shared_ptr<GatewayClientHandlerCollection> m_GatewayClientHandlerCollection;
69  std::shared_ptr<HdlcdClientHandlerCollection> m_HdlcdClientHandlerCollection;
70 
71  // The config server handler entity
72  std::shared_ptr<ConfigServerHandler> m_ConfigServerHandler;
73 
74  // Accept incoming TCP connections
75  boost::asio::ip::tcp::tcp::acceptor m_TcpAcceptor;
76  boost::asio::ip::tcp::tcp::socket m_TcpSocket;
77 };
78 
79 #endif // CONFIG_SERVER_HANDLER_COLLECTION_H
void GatewayClientCreated(uint16_t a_ReferenceNbr)
void HdlcdClientConnected(uint16_t a_SerialPortNbr)
void DeregisterConfigServerHandler(std::shared_ptr< ConfigServerHandler > a_ConfigServerHandler)
E_GATEWAY_CLIENT_ERROR
void HdlcdClientError(uint16_t a_SerialPortNbr, E_HDLCD_CLIENT_ERROR a_ErrorCode)
void GatewayClientConnected(uint16_t a_ReferenceNbr)
void HdlcdClientDisconnected(uint16_t a_SerialPortNbr)
E_HDLCD_CLIENT_ERROR
void HdlcdClientDestroyed(uint16_t a_SerialPortNbr)
ConfigServerHandlerCollection(boost::asio::io_service &a_IOService, uint16_t a_TcpPortNbr)
void HdlcdClientCreated(uint16_t a_SerialPortNbr)
void RegisterConfigServerHandler(std::shared_ptr< ConfigServerHandler > a_ConfigServerHandler)
void GatewayClientDestroyed(uint16_t a_ReferenceNbr)
void GatewayClientError(uint16_t a_ReferenceNbr, E_GATEWAY_CLIENT_ERROR a_ErrorCode)
void HdlcdClientNewStatus(uint16_t a_SerialPortNbr, bool a_bIsResumed, bool a_bIsAlive)
void Initialize(std::shared_ptr< GatewayClientHandlerCollection > a_GatewayClientHandlerCollection, std::shared_ptr< HdlcdClientHandlerCollection > a_HdlcdClientHandlerCollection)
void GatewayClientDisconnected(uint16_t a_ReferenceNbr)