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