35 std::shared_ptr<GatewayClientHandlerCollection> a_GatewayClientHandlerCollection) {
37 assert(a_ConfigServerHandlerCollection);
38 assert(a_GatewayClientHandlerCollection);
39 m_ConfigServerHandlerCollection = a_ConfigServerHandlerCollection;
40 m_GatewayClientHandlerCollection = a_GatewayClientHandlerCollection;
45 m_ConfigServerHandlerCollection.reset();
46 m_GatewayClientHandlerCollection.reset();
47 for (
auto l_HandlerIterator = m_HdlcdClientHandlerMap.begin(); l_HandlerIterator != m_HdlcdClientHandlerMap.end(); ++l_HandlerIterator) {
48 auto& l_Handler = l_HandlerIterator->second;
56 for (
auto l_HandlerIterator = m_HdlcdClientHandlerMap.begin(); l_HandlerIterator != m_HdlcdClientHandlerMap.end(); ++l_HandlerIterator) {
57 auto& l_Handler = l_HandlerIterator->second;
63 m_HdlcdClientHandlerMap.clear();
68 if (m_HdlcdClientHandlerMap.find(a_SerialPortNbr) == m_HdlcdClientHandlerMap.end()) {
70 auto l_NewHdlcdClientHandler = std::make_shared<HdlcdClientHandler>(m_IOService, m_ConfigServerHandlerCollection, m_GatewayClientHandlerCollection,
71 a_RemoteAddress, a_TcpPortNbr, a_SerialPortNbr);
72 m_HdlcdClientHandlerMap[a_SerialPortNbr] = l_NewHdlcdClientHandler;
79 m_ConfigServerHandlerCollection->HdlcdClientCreated(a_SerialPortNbr);
84 auto l_HandlerIterator = m_HdlcdClientHandlerMap.find(a_SerialPortNbr);
85 if (l_HandlerIterator == m_HdlcdClientHandlerMap.end()) {
90 l_HandlerIterator->second->Close();
91 l_HandlerIterator->second.reset();
92 m_HdlcdClientHandlerMap.erase(l_HandlerIterator);
96 m_ConfigServerHandlerCollection->HdlcdClientDestroyed(a_SerialPortNbr);
101 auto l_HandlerIterator = m_HdlcdClientHandlerMap.find(a_SerialPortNbr);
102 if (l_HandlerIterator == m_HdlcdClientHandlerMap.end()) {
107 l_HandlerIterator->second->Suspend();
113 auto l_HandlerIterator = m_HdlcdClientHandlerMap.find(a_SerialPortNbr);
114 if (l_HandlerIterator == m_HdlcdClientHandlerMap.end()) {
119 l_HandlerIterator->second->Resume();
125 auto l_HandlerIterator = m_HdlcdClientHandlerMap.find(a_SerialPortNbr);
126 if (l_HandlerIterator != m_HdlcdClientHandlerMap.end()) {
128 l_HandlerIterator->second->SendPacket(a_Payload);
void Initialize(std::shared_ptr< ConfigServerHandlerCollection > a_ConfigServerHandlerCollection, std::shared_ptr< GatewayClientHandlerCollection > a_GatewayClientHandlerCollection)
void ResumeHdlcdClient(uint16_t a_SerialPortNbr)
void DestroyHdlcdClient(uint16_t a_SerialPortNbr)
void CreateHdlcdClient(const std::string &a_RemoteAddress, uint16_t a_TcpPortNbr, uint16_t a_SerialPortNbr)
void SuspendHdlcdClient(uint16_t a_SerialPortNbr)
HdlcdClientHandlerCollection(boost::asio::io_service &a_IOService)
void SendPacket(uint16_t a_SerialPortNbr, const std::vector< unsigned char > &a_Payload)