6 #include <Poco/Clock.h>
7 #include <Poco/Mutex.h>
8 #include <Poco/SharedPtr.h>
9 #include <Poco/Timespan.h>
11 #include "iqrf/IQRFJsonResponse.h"
12 #include "loop/StopControl.h"
13 #include "loop/StoppableRunnable.h"
14 #include "model/GlobalID.h"
15 #include "net/MqttClient.h"
16 #include "util/Loggable.h"
17 #include "util/WaitCondition.h"
31 typedef Poco::SharedPtr<IQRFMqttConnector> Ptr;
38 void setPublishTopic(
const std::string &topic);
41 MqttClient::Ptr mqttClient);
43 void setDataTimeout(
const Poco::Timespan &timeout);
44 void setReceiveTimeout(
const Poco::Timespan &timeout);
45 void checkPublishTopic();
50 void send(
const std::string &msg);
57 const GlobalID &
id,
const Poco::Timespan &timeout);
60 void removeExpiredMessages(
const Poco::Timespan &timeout);
67 Poco::Clock receivedAt;
68 IQRFJsonResponse::Ptr message;
73 std::map<GlobalID, ReceivedData> m_data;
74 Poco::Timespan m_messageTimeout;
75 Poco::Timespan m_receiveTimeout;
78 Poco::FastMutex m_dataLock;
80 MqttClient::Ptr m_mqttClient;
81 std::string m_publishTopic;
IQRFJsonResponse::Ptr receive(const GlobalID &id, const Poco::Timespan &timeout)
Receive message with given timeout and identification of message.
Definition: IQRFMqttConnector.cpp:114
void stop() override
Definition: IQRFMqttConnector.cpp:103
Definition: GlobalID.h:10
StopControl implements the stop mechanism generically.
Definition: StopControl.h:12
Definition: Loggable.h:19
void send(const std::string &msg)
Send message using mqtt client to specific topic.
Definition: IQRFMqttConnector.cpp:109
Definition: StoppableRunnable.h:8
WaitCondition works as a barrier that waits until some condition is met. When the condition is met an...
Definition: WaitCondition.h:19
IQRFMqttConnector provides sending and receiving messages. During data receiving, it is necessary to ...
Definition: IQRFMqttConnector.h:27