Satellite-Gateway
HdlcdClientConnectGuard.h
Go to the documentation of this file.
1 
24 #ifndef HDLCD_CLIENT_CONNECT_GUARD_H
25 #define HDLCD_CLIENT_CONNECT_GUARD_H
26 
27 #include <memory>
29 
31 public:
32  // CTOR
33  HdlcdClientConnectGuard(std::shared_ptr<ConfigServerHandlerCollection> a_ConfigServerHandlerCollection, uint16_t a_SerialPortNbr): m_ConfigServerHandlerCollection(a_ConfigServerHandlerCollection), m_SerialPortNbr(a_SerialPortNbr), m_bConnected(false) {
34  }
35 
36  void IsConnected() {
37  if (!m_bConnected) {
38  m_bConnected = true;
39  m_ConfigServerHandlerCollection->HdlcdClientConnected(m_SerialPortNbr);
40  } // if
41  }
42 
43  void IsDisconnected() {
44  if (m_bConnected) {
45  m_bConnected = false;
46  m_ConfigServerHandlerCollection->HdlcdClientDisconnected(m_SerialPortNbr);
47  } // if
48  }
49 
50 private:
51  std::shared_ptr<ConfigServerHandlerCollection> m_ConfigServerHandlerCollection;
52  uint16_t m_SerialPortNbr;
53  bool m_bConnected;
54 };
55 
56 #endif // HDLCD_CLIENT_CONNECT_GUARD_H
HdlcdClientConnectGuard(std::shared_ptr< ConfigServerHandlerCollection > a_ConfigServerHandlerCollection, uint16_t a_SerialPortNbr)