7 #ifndef __BeaconClient_h__ 8 #define __BeaconClient_h__ 14 #define KEEP_ALIVE_REFRESH_TIME 4000 17 #define BEACON_ALIVE_TIME_LIMIT 6000 19 class FE_DL_EXPORT BeaconClient :
virtual public BeaconClientStartupI
23 virtual ~BeaconClient();
25 virtual bool startup(
const char *fileName) {
return true; }
28 virtual bool registerWithBeacon(
const BeaconConfig &config,
29 bool timeSync)
override;
31 virtual void shutdown()
override;
32 virtual uint8_t getID()
override {
return m_myID; }
33 virtual int64_t getTimeOffset()
override;
34 virtual int64_t getBeaconTime()
override;
35 virtual int64_t getLatency()
override;
39 bool isListUpdated()
override;
41 void getList(std::list<Node> ®isteredNode)
override;
44 bool isBeaconAlive()
override;
47 virtual bool dictionaryGet(
48 std::vector<std::pair<fe::String,fe::String>> &list)
override;
49 virtual bool dictionarySet(
50 const std::vector<std::pair<fe::String,fe::String>> &list)
override;
51 virtual bool dictionaryUnset(
52 const std::vector<std::pair<fe::String,fe::String>> &list)
override;
53 virtual bool dictionaryClear()
override;
54 virtual bool dictionaryGetRegex(
const fe::String searchString,
55 std::vector<std::pair<fe::String,fe::String>> &list)
override;
56 virtual uint64_t dictionaryGetUpdateCounter()
override;
59 BeaconConfig m_config;
68 int64_t m_lastSendTime;
71 uint16_t m_responsePort;
73 std::atomic<bool> m_running;
74 std::atomic<int64_t> m_lastRecTime;
75 std::atomic<uint64_t> m_updateCounter;
77 std::thread* m_monitorThread;
83 std::list<Node> m_registeredNodes;
84 std::mutex m_nodeListMutex;
88 bool syncTimeWithBeacon();
89 bool getBeaconMessage(fe::ext::Messagegram *msg);
92 int64_t getCurrentTime();
94 void sendRegisterRequest();
97 bool sendRequest(
const fe::ext::Messagegram &m);
99 const std::vector<std::pair<fe::String,fe::String>> &list,
100 const bool includeValues,
101 const NodeMessageType requestType);
102 bool waitForResponse(uint8_t **msg, uint32_t &bytesRecv,
103 char *fromIPaddress);
109 #endif // __BeaconClient_h__ Automatically reference-counted string container.
Definition: String.h:128
Definition: BeaconClient.cc:16