25 using boost::asio::ip::tcp;
28 m_IOService(a_IOService), m_SerialPortHandlerCollection(a_SerialPortHandlerCollection), m_TcpAcceptor(a_IOService, tcp::endpoint(tcp::v4(), a_TcpPortNbr)), m_TcpSocket(a_IOService) {
30 assert(m_SerialPortHandlerCollection);
38 m_TcpAcceptor.close();
41 while (!m_HdlcdServerHandlerList.empty()) {
42 (*m_HdlcdServerHandlerList.begin())->Stop();
46 assert(m_HdlcdServerHandlerList.empty());
47 m_SerialPortHandlerCollection.reset();
51 m_HdlcdServerHandlerList.emplace_back(std::move(a_HdlcdServerHandler));
55 m_HdlcdServerHandlerList.remove(a_HdlcdServerHandler);
58 void HdlcdServerHandlerCollection::DoAccept() {
59 m_TcpAcceptor.async_accept(m_TcpSocket, [
this](boost::system::error_code a_ErrorCode) {
62 auto l_HdlcdServerHandler = std::make_shared<HdlcdServerHandler>(m_IOService, shared_from_this(), m_TcpSocket);
63 l_HdlcdServerHandler->Start(m_SerialPortHandlerCollection);
HdlcdServerHandlerCollection(boost::asio::io_service &a_IOService, std::shared_ptr< SerialPortHandlerCollection > a_SerialPortHandlerCollection, uint16_t a_TcpPortNbr)
The HDLC Deamon implements the HDLC protocol to easily talk to devices connected via serial communica...
void RegisterHdlcdServerHandler(std::shared_ptr< HdlcdServerHandler > a_HdlcdServerHandler)
void DeregisterHdlcdServerHandler(std::shared_ptr< HdlcdServerHandler > a_HdlcdServerHandler)
The HDLC Deamon implements the HDLC protocol to easily talk to devices connected via serial communica...