diff --git a/README.md b/README.md index e240307..39c934b 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,115 @@ later the "pub" part. If all went well, you should see two screens in sync runni Open terminal 2 $ bin/test_mqtt_pub ``` -Screen 2 is sending, Screen 1 is receiving. \ No newline at end of file +Screen 2 is sending, Screen 1 is receiving. + +# Using the library. +Using mqtt-cpp is pretty straight forward. No real magic is happening. Beware of the fact that the library uses the namespace : +``` + osdev::components::mqtt +``` + +## Publishing.. +To create a publisher, a simple member needs to be created. +Header : +``` + #pragma once + + // std + #include + #include + + // osdev::components::mqtt + #include "mqttclient.h" + #include "compat-c++14.h" + + class Publisher + { + public: + Publisher(const std::string &client_id); + + virtual ~Publisher() {} + + void connect( const std::string &hostname, int portnumber = 1883, const std::string &username = std::string(), const std::string &password = std::string() ); + + void publish( const std::string &message_topic, const std::string &message_payload ); + + private: + osdev::components::mqtt::MqttClient m_mqtt_client; + }; +``` + +Implementation +``` + + // osdev::components::mqtt + // #include "token.h" + + // mqtt_tests + #include "publisher.h" + + Publisher::Publisher(const std::string &client_id) + : m_mqtt_client( client_id ) + { + + } + + void Publisher::connect( const std::string &hostname, int portnumber, const std::string &username, const std::string &password ) + { + m_mqtt_client.connect( hostname, portnumber, osdev::components::mqtt::Credentials( username, password ) ); + std::cout << "Client state : " << m_mqtt_client.state() << std::endl; + } + + void Publisher::publish( const std::string &message_topic, const std::string &message_payload ) + { + osdev::components::mqtt::MqttMessage message( message_topic, true, false, message_payload ); + std::cout << "[Publisher::publish] - Publising message : " << message_payload << " to topic : " << message_topic << std::endl; + osdev::components::mqtt::Token t_result = m_mqtt_client.publish( message, 0 ); + } +``` + +## Subscribing +TO create a subscriber, a bit more work is involved. A subscription is dependant on a callback in which the data is handled to your liking. It is necessary to inherit from MqttSubscriberBase and override the "receive_data" method. + +subscriber.h +``` +#pragma once + +// std +#include + +// mqtt-cpp +#include "mqttsubscriberbase.h" + +class Subscriber : public MqttSubscriberBase +{ +public: + Subscriber( const std::string &client_id ); + + virtual ~Subscriber() {} + +protected: + void receive_data( const std::string &message_topic, const std::string &message_payload ); + +}; +``` + +In the receive_data, the logic will be implemented to handle, decode and store the payload. +``` +#include "subscriber.h" + +#include + +Subscriber::Subscriber( const std::string &client_id ) + : MqttSubscriberBase( client_id ) +{ + +} + +void Subscriber::receive_data( const std::string &message_topic, const std::string &message_payload ) +{ + std::cout << "[Subscriber::receive_data] - Received message : " << message_payload << " from topic : " << message_topic << std::endl; +} +``` + +Now it will be very easy to send and receive messages from a broker without the hassle of administration. diff --git a/examples/pub/CMakeLists.txt b/examples/pub/CMakeLists.txt index 0e3c279..d26ac52 100644 --- a/examples/pub/CMakeLists.txt +++ b/examples/pub/CMakeLists.txt @@ -5,7 +5,7 @@ include(projectheader) project_header(test_mqtt_pub) include_directories( SYSTEM - ${CMAKE_CURRENT_SOURCE_DIR}/../../src + ${CMAKE_CURRENT_SOURCE_DIR}/../../include ) include(compiler) @@ -21,7 +21,7 @@ add_executable( ${PROJECT_NAME} target_link_libraries( ${PROJECT_NAME} - mqtt + mqtt-cpp ) set_target_properties( ${PROJECT_NAME} PROPERTIES diff --git a/examples/pub/main.cpp b/examples/pub/main.cpp index dd85a8e..ab06dfc 100644 --- a/examples/pub/main.cpp +++ b/examples/pub/main.cpp @@ -83,14 +83,18 @@ int main( int argc, char* argv[] ) // Assume we are connected now, start publishing. while( 1 ) { - std::string payload = "" ; - pPublisher->publish( std::string( "test/publisher/TestPublisher" ), payload ); - - sleepcp( 1, T_SECONDS ); - if( messageNumber > 2000000000 ) - messageNumber = -1; - - messageNumber++; + for( unsigned int nCount = 0; nCount < 10; nCount++ ) + { + std::string payload = "" ; + pPublisher->publish( std::string( "test/publisher/TestPublisher_" + std::to_string( nCount ) ), payload ); + + if( messageNumber > 2000000000 ) + { + messageNumber = -1; + } + messageNumber++; + } + sleepcp( 1, T_MICRO ); } } else diff --git a/examples/pub/publisher.cpp b/examples/pub/publisher.cpp index f41785b..efd9dfe 100644 --- a/examples/pub/publisher.cpp +++ b/examples/pub/publisher.cpp @@ -20,9 +20,6 @@ * DEALINGS IN THE SOFTWARE. * * ***************************************************************************/ -// osdev::components::mqtt -#include "token.h" - // mqtt_tests #include "publisher.h" diff --git a/examples/sub/CMakeLists.txt b/examples/sub/CMakeLists.txt index f118452..281089e 100644 --- a/examples/sub/CMakeLists.txt +++ b/examples/sub/CMakeLists.txt @@ -5,7 +5,7 @@ include(projectheader) project_header(test_mqtt_sub) include_directories( SYSTEM - ${CMAKE_CURRENT_SOURCE_DIR}/../../src + ${CMAKE_CURRENT_SOURCE_DIR}/../../include ) include(compiler) @@ -21,7 +21,7 @@ add_executable( ${PROJECT_NAME} target_link_libraries( ${PROJECT_NAME} - mqtt + mqtt-cpp ) set_target_properties( ${PROJECT_NAME} PROPERTIES diff --git a/examples/sub/main.cpp b/examples/sub/main.cpp index 8288545..a9c18fb 100644 --- a/examples/sub/main.cpp +++ b/examples/sub/main.cpp @@ -71,19 +71,19 @@ int main( int argc, char* argv[] ) std::cout << "Creating the subscriber : "; // Create the subscriber - Subscriber *pSubscriber = new Subscriber(); + Subscriber *pSubscriber = new Subscriber( "Test_Subscriber" ); if( pSubscriber != nullptr ) { std::cout << "[OK]" << std::endl; std::cout << "Connecting to the test-broker : " << std::endl; pSubscriber->connect( "localhost", 1883, "", "" ); std::cout << "Subscribing to the test-topic....." << std::endl; - pSubscriber->subscribe( "test/publisher/TestPublisher" ); + pSubscriber->subscribe( "test/publisher/#" ); // Start a loop to give the subscriber the possibility to do its work. while( 1 ) { - sleepcp( 1, T_SECONDS ); // Sleep 1 Sec to give the scheduler the change to interfene. + sleepcp( 1, T_MICRO ); // Sleep 1 Sec to give the scheduler the change to interfene. } } else diff --git a/examples/sub/subscriber.cpp b/examples/sub/subscriber.cpp index 61d0d5e..8354dd6 100644 --- a/examples/sub/subscriber.cpp +++ b/examples/sub/subscriber.cpp @@ -20,27 +20,13 @@ * DEALINGS IN THE SOFTWARE. * * ***************************************************************************/ #include "subscriber.h" -#include "mqttmessage.h" -#include "credentials.h" -Subscriber::Subscriber() - : m_mqtt_client( "TestSubscriber" ) -{ - -} +#include -void Subscriber::connect( const std::string &hostname, int portnumber, const std::string &username, const std::string &password ) +Subscriber::Subscriber( const std::string &client_id ) + : MqttSubscriberBase( client_id ) { - m_mqtt_client.connect( hostname, portnumber, osdev::components::mqtt::Credentials( username, password ) ); - std::cout << "Client state : " << m_mqtt_client.state() << std::endl; -} -void Subscriber::subscribe( const std::string &message_topic ) -{ - m_mqtt_client.subscribe( message_topic, 1, [this](const osdev::components::mqtt::MqttMessage &message) - { - this->receive_data(message.topic(), message.payload() ); - }); } void Subscriber::receive_data( const std::string &message_topic, const std::string &message_payload ) diff --git a/examples/sub/subscriber.h b/examples/sub/subscriber.h index a24fcca..8c67ef4 100644 --- a/examples/sub/subscriber.h +++ b/examples/sub/subscriber.h @@ -22,27 +22,19 @@ #pragma once // std -#include #include -// osdev::components::mqtt -#include "mqttclient.h" -#include "compat-c++14.h" +// mqtt-cpp +#include "mqttsubscriberbase.h" -class Subscriber +class Subscriber : public MqttSubscriberBase { public: - Subscriber(); + Subscriber( const std::string &client_id ); virtual ~Subscriber() {} - void connect( const std::string &hostname, int portnumber, const std::string &username, const std::string &password ); - - void subscribe( const std::string &message_topic ); - -private: +protected: void receive_data( const std::string &message_topic, const std::string &message_payload ); -private: - osdev::components::mqtt::MqttClient m_mqtt_client; }; diff --git a/src/bimap.h b/include/bimap.h index e862792..e862792 100644 --- a/src/bimap.h +++ b/include/bimap.h diff --git a/src/clientpaho.h b/include/clientpaho.h index 2fc83b5..2fc83b5 100644 --- a/src/clientpaho.h +++ b/include/clientpaho.h diff --git a/src/commondefs.h b/include/commondefs.h index 2f0de8f..2f0de8f 100644 --- a/src/commondefs.h +++ b/include/commondefs.h diff --git a/src/compat-c++14.h b/include/compat-c++14.h index df7ffbd..df7ffbd 100644 --- a/src/compat-c++14.h +++ b/include/compat-c++14.h diff --git a/src/compat-chrono.h b/include/compat-chrono.h index cec6df8..c383852 100644 --- a/src/compat-chrono.h +++ b/include/compat-chrono.h @@ -48,7 +48,11 @@ To ceil(const std::chrono::duration& d) { To t = std::chrono::duration_cast(d); if (t < d) + { return t + To{ 1 }; + } + + // or else... return t; } diff --git a/src/compiletimedigits.h b/include/compiletimedigits.h index 2fd6071..2fd6071 100644 --- a/src/compiletimedigits.h +++ b/include/compiletimedigits.h diff --git a/src/compiletimestring.h b/include/compiletimestring.h index 5a7604b..5a7604b 100644 --- a/src/compiletimestring.h +++ b/include/compiletimestring.h diff --git a/src/connectionstatus.h b/include/connectionstatus.h index 7eae71a..7eae71a 100644 --- a/src/connectionstatus.h +++ b/include/connectionstatus.h diff --git a/src/credentials.h b/include/credentials.h index 3c61c55..3c61c55 100644 --- a/src/credentials.h +++ b/include/credentials.h diff --git a/src/date.h b/include/date.h index 8e4ee81..8e4ee81 100644 --- a/src/date.h +++ b/include/date.h diff --git a/src/errorcode.h b/include/errorcode.h index 9dac305..9dac305 100644 --- a/src/errorcode.h +++ b/include/errorcode.h diff --git a/src/histogram.h b/include/histogram.h index aa4ed2c..aa4ed2c 100644 --- a/src/histogram.h +++ b/include/histogram.h diff --git a/src/histogramprovider.h b/include/histogramprovider.h index 18360af..18360af 100644 --- a/src/histogramprovider.h +++ b/include/histogramprovider.h diff --git a/src/ihistogram.h b/include/ihistogram.h index 18e0b42..18e0b42 100644 --- a/src/ihistogram.h +++ b/include/ihistogram.h diff --git a/src/imqttclient.h b/include/imqttclient.h index d42c8ae..d42c8ae 100644 --- a/src/imqttclient.h +++ b/include/imqttclient.h diff --git a/src/imqttclientimpl.h b/include/imqttclientimpl.h index f32f737..f32f737 100644 --- a/src/imqttclientimpl.h +++ b/include/imqttclientimpl.h diff --git a/src/istatecallback.h b/include/istatecallback.h index 7b0db7f..7b0db7f 100644 --- a/src/istatecallback.h +++ b/include/istatecallback.h diff --git a/src/lockguard.h b/include/lockguard.h index b5ded35..b5ded35 100644 --- a/src/lockguard.h +++ b/include/lockguard.h diff --git a/src/macrodefs.h b/include/macrodefs.h index 8cd1cdd..8cd1cdd 100644 --- a/src/macrodefs.h +++ b/include/macrodefs.h diff --git a/src/measure.h b/include/measure.h index f2520af..f2520af 100644 --- a/src/measure.h +++ b/include/measure.h diff --git a/src/metaprogrammingdefs.h b/include/metaprogrammingdefs.h index 57346ac..57346ac 100644 --- a/src/metaprogrammingdefs.h +++ b/include/metaprogrammingdefs.h diff --git a/src/mqttclient.h b/include/mqttclient.h index c160b02..c160b02 100644 --- a/src/mqttclient.h +++ b/include/mqttclient.h diff --git a/src/mqttfailure.h b/include/mqttfailure.h index 4f48a84..4f48a84 100644 --- a/src/mqttfailure.h +++ b/include/mqttfailure.h diff --git a/src/mqttidgenerator.h b/include/mqttidgenerator.h index 8baf591..8baf591 100644 --- a/src/mqttidgenerator.h +++ b/include/mqttidgenerator.h diff --git a/src/mqttmessage.h b/include/mqttmessage.h index 1a6e9c3..1a6e9c3 100644 --- a/src/mqttmessage.h +++ b/include/mqttmessage.h diff --git a/include/mqttpublisherbase.h b/include/mqttpublisherbase.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/include/mqttpublisherbase.h diff --git a/src/mqttstream.h b/include/mqttstream.h index e9d9a94..e9d9a94 100644 --- a/src/mqttstream.h +++ b/include/mqttstream.h diff --git a/include/mqttsubscriberbase.h b/include/mqttsubscriberbase.h new file mode 100644 index 0000000..942d807 --- /dev/null +++ b/include/mqttsubscriberbase.h @@ -0,0 +1,82 @@ +/* **************************************************************************** + * Copyright 2019 Open Systems Development BV * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the "Software"), * + * to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, * + * and/or sell copies of the Software, and to permit persons to whom the * + * Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in * + * all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * + * DEALINGS IN THE SOFTWARE. * + * ***************************************************************************/ +#pragma once + +// std +#include +#include + +// osdev::components::mqtt +#include "mqttclient.h" + + +class MqttSubscriberBase +{ +public: + /*! + * \brief SubscriberBase + */ + MqttSubscriberBase( const std::string &client_id ); + + /*! + * \brief ~SubscriberBase + */ + virtual ~MqttSubscriberBase() {} + + /*! + * \brief getClientId + * \return + */ + std::string getClientId() const; + + /*! + * \brief connect + * \param hostname + * \param portnumber + * \param username + * \param password + */ + void connect( const std::string &hostname, int portnumber, const std::string &username, const std::string &password ); + + /*! + * \brief subscribe + * \param message_topic + */ + void subscribe( const std::string &message_topic ); + + /*! + * \brief disconnect + */ + void disconnect(); + +protected: + /*! + * \brief receive_data + * \param message_topic + * \param message_payload + */ + virtual void receive_data( const std::string &message_topic, const std::string &message_payload ) = 0; + +private: + osdev::components::mqtt::MqttClient m_mqtt_client; + +}; diff --git a/src/mqttsuccess.h b/include/mqttsuccess.h index 34c7940..34c7940 100644 --- a/src/mqttsuccess.h +++ b/include/mqttsuccess.h diff --git a/src/mqtttypeconverter.h b/include/mqtttypeconverter.h index 2b7b983..2b7b983 100644 --- a/src/mqtttypeconverter.h +++ b/include/mqtttypeconverter.h diff --git a/src/mqttutil.h b/include/mqttutil.h index ae7e945..ae7e945 100644 --- a/src/mqttutil.h +++ b/include/mqttutil.h diff --git a/src/scopeguard.h b/include/scopeguard.h index 7c34847..7c34847 100644 --- a/src/scopeguard.h +++ b/include/scopeguard.h diff --git a/src/serverstate.h b/include/serverstate.h index d54b39a..d54b39a 100644 --- a/src/serverstate.h +++ b/include/serverstate.h diff --git a/src/sharedreaderlock.h b/include/sharedreaderlock.h index d91be15..d91be15 100644 --- a/src/sharedreaderlock.h +++ b/include/sharedreaderlock.h diff --git a/src/stringify.h b/include/stringify.h index 4f55f25..4f55f25 100644 --- a/src/stringify.h +++ b/include/stringify.h diff --git a/src/stringutils.h b/include/stringutils.h index 44b7df0..44b7df0 100644 --- a/src/stringutils.h +++ b/include/stringutils.h diff --git a/src/synchronizedqueue.h b/include/synchronizedqueue.h index 9b71987..9b71987 100644 --- a/src/synchronizedqueue.h +++ b/include/synchronizedqueue.h diff --git a/src/timemeasurement.h b/include/timemeasurement.h index 850c1fe..850c1fe 100644 --- a/src/timemeasurement.h +++ b/include/timemeasurement.h diff --git a/src/token.h b/include/token.h index 7db2917..7db2917 100644 --- a/src/token.h +++ b/include/token.h diff --git a/src/uriparser.h b/include/uriparser.h index b628aae..b628aae 100644 --- a/src/uriparser.h +++ b/include/uriparser.h diff --git a/src/uriutils.h b/include/uriutils.h index 0bd97e4..0bd97e4 100644 --- a/src/uriutils.h +++ b/include/uriutils.h diff --git a/src/utils.h b/include/utils.h index f630e60..f630e60 100644 --- a/src/utils.h +++ b/include/utils.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 543ce86..6820971 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,22 +23,22 @@ endif() # ============================================================================== include(projectheader) -project_header(mqtt) +project_header(mqtt-cpp) find_package( Boost REQUIRED COMPONENTS regex ) include(compiler) include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/../logutils + ${CMAKE_SOURCE_DIR}/include ) set(SRC_LIST + ${CMAKE_CURRENT_SOURCE_DIR}/mqttpublisherbase.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/mqttsubscriberbase.cpp ${CMAKE_CURRENT_SOURCE_DIR}/clientpaho.cpp ${CMAKE_CURRENT_SOURCE_DIR}/commondefs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/connectionstatus.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/compiletimedigits.h - ${CMAKE_CURRENT_SOURCE_DIR}/compiletimestring.h ${CMAKE_CURRENT_SOURCE_DIR}/credentials.cpp ${CMAKE_CURRENT_SOURCE_DIR}/errorcode.cpp ${CMAKE_CURRENT_SOURCE_DIR}/token.cpp @@ -59,24 +59,6 @@ set(SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/sharedreaderlock.cpp ${CMAKE_CURRENT_SOURCE_DIR}/stringutils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/uriparser.cpp - # Helper files ( Utillities ) - ${CMAKE_CURRENT_SOURCE_DIR}/bimap.h - ${CMAKE_CURRENT_SOURCE_DIR}/compat-c++14.h - ${CMAKE_CURRENT_SOURCE_DIR}/compat-chrono.h - ${CMAKE_CURRENT_SOURCE_DIR}/histogram.h - ${CMAKE_CURRENT_SOURCE_DIR}/histogramprovider.h - ${CMAKE_CURRENT_SOURCE_DIR}/imqttclient.h - ${CMAKE_CURRENT_SOURCE_DIR}/imqttclientimpl.h - ${CMAKE_CURRENT_SOURCE_DIR}/lockguard.h - ${CMAKE_CURRENT_SOURCE_DIR}/macrodefs.h - ${CMAKE_CURRENT_SOURCE_DIR}/measure.h - ${CMAKE_CURRENT_SOURCE_DIR}/metaprogrammingdefs.h - ${CMAKE_CURRENT_SOURCE_DIR}/mqttstream.h - ${CMAKE_CURRENT_SOURCE_DIR}/stringify.h - ${CMAKE_CURRENT_SOURCE_DIR}/stringutils.h - ${CMAKE_CURRENT_SOURCE_DIR}/synchronizedqueue.h - ${CMAKE_CURRENT_SOURCE_DIR}/utils.h - ${CMAKE_CURRENT_SOURCE_DIR}/uriutils.h ) include(library) diff --git a/src/mqttpublisherbase.cpp b/src/mqttpublisherbase.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/mqttpublisherbase.cpp diff --git a/src/mqttsubscriberbase.cpp b/src/mqttsubscriberbase.cpp new file mode 100644 index 0000000..d32bd0f --- /dev/null +++ b/src/mqttsubscriberbase.cpp @@ -0,0 +1,57 @@ +/* **************************************************************************** + * Copyright 2019 Open Systems Development BV * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the "Software"), * + * to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, * + * and/or sell copies of the Software, and to permit persons to whom the * + * Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in * + * all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * + * DEALINGS IN THE SOFTWARE. * + * ***************************************************************************/ + +// osdev::components::mqtt +#include "mqttclient.h" +#include "mqttsubscriberbase.h" +#include "mqttmessage.h" +#include "credentials.h" + +MqttSubscriberBase::MqttSubscriberBase( const std::string &client_id ) + : m_mqtt_client( client_id ) +{ + +} + +std::string MqttSubscriberBase::getClientId() const +{ + return m_mqtt_client.clientId(); +} + +void MqttSubscriberBase::connect(const std::string &hostname, int portnumber, + const std::string &username, const std::string &password) +{ + m_mqtt_client.connect( hostname, portnumber, osdev::components::mqtt::Credentials( username, password ) ); +} + +void MqttSubscriberBase::subscribe( const std::string &message_topic ) +{ + m_mqtt_client.subscribe( message_topic, 1, [this]( const osdev::components::mqtt::MqttMessage &message ) + { + this->receive_data( message.topic(), message.payload() ); + }); +} + +void MqttSubscriberBase::disconnect() +{ + m_mqtt_client.disconnect(); +}