BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
#include <MosquittoClient.h>
Public Types | |
typedef Poco::SharedPtr < MosquittoClient > | Ptr |
Public Types inherited from BeeeOn::StoppableRunnable | |
typedef Poco::SharedPtr < StoppableRunnable > | Ptr |
Public Types inherited from BeeeOn::MqttClient | |
typedef Poco::SharedPtr < MqttClient > | Ptr |
Public Member Functions | |
void | run () override |
void | stop () override |
void | setHost (const std::string &host) |
void | setPort (int port) |
void | setSubTopics (const std::list< std::string > &subTopics) |
void | setReconnectTimeout (const Poco::Timespan &timeout) |
void | setClientID (const std::string &id) |
std::string | clientID () const |
void | publish (const MqttMessage &msq) override |
MqttMessage | receive (const Poco::Timespan &timeout) override |
Protected Member Functions | |
virtual std::string | buildClientID () const |
void | connect () |
Mosquitto client runs in a thread. Before its run it is necessary to set following parameters:
|
protected |
Non-blocking connection to broker request. After set client name must be call MosquittoClient::connect();
|
overridevirtual |
Publish a message on a given topic.
Implements BeeeOn::MqttClient.
|
overridevirtual |
Waiting for a new message according to given timeout. Returns message, if some message is in queue, otherwise waiting for a new message or timeout exception.
This method should not be called by multiple threads, received message could be given to only one thread.
Timeout:
Implements BeeeOn::MqttClient.
|
override |
Keeps communication between the client and broker working.
void MosquittoClient::setReconnectTimeout | ( | const Poco::Timespan & | timeout | ) |
Timeout between reconnecting to the server when server connection is lost.
void MosquittoClient::setSubTopics | ( | const std::list< std::string > & | subTopics | ) |
Subscribe to a topic.
|
overridevirtual |
Stop the runnable. The call should not block.
Implements BeeeOn::StoppableRunnable.