@@ -32,15 +32,15 @@ using namespace std::placeholders;
3232
3333namespace ksf ::comps
3434{
35+ ksMqttConnector::~ksMqttConnector () = default ;
36+
3537 ksMqttConnector::ksMqttConnector (bool sendConnectionStatus, bool usePersistentSession)
3638 : reconnectTimer(KSF_MQTT_RECONNECT_DELAY_MS)
3739 {
3840 bitflags.sendConnectionStatus = sendConnectionStatus;
3941 bitflags.usePersistentSession = usePersistentSession;
4042 }
4143
42- ksMqttConnector::~ksMqttConnector () = default ;
43-
4444 bool ksMqttConnector::init (ksApplication* app)
4545 {
4646 ksMqttConfigProvider cfgProvider;
@@ -67,10 +67,9 @@ namespace ksf::comps
6767
6868 void ksMqttConnector::setupConnection (const std::string broker, const std::string& port, std::string login, std::string password, std::string prefix, const std::string& fingerprint)
6969 {
70- /* Set up secure connection if a fingerprint is provided. */
7170 if (!fingerprint.empty ())
7271 {
73- auto secureClient = std::make_unique<ksMqttConnectorNetClientSecure_t>();
72+ auto secureClient{ std::make_unique<ksMqttConnectorNetClientSecure_t>()} ;
7473 certFingerprint = std::make_unique<misc::ksCertFingerprintHolder>();
7574 if (certFingerprint->setup (secureClient.get (), fingerprint))
7675 netClientUq = std::move (secureClient);
@@ -80,7 +79,7 @@ namespace ksf::comps
8079 /* Whoops, it looks like fingerprint validation failed. */
8180 if (!netClientUq)
8281 return ;
83-
82+
8483 /* Set socket timeouts. */
8584 netClientUq->setTimeout (KSF_MQTT_TIMEOUT_MS);
8685
@@ -92,7 +91,7 @@ namespace ksf::comps
9291 ksf::from_chars (port, portNumber);
9392
9493 /* Create MQTT client. */
95- mqttClientUq = std::make_unique<PubSubClient>(*netClientUq);
94+ mqttClientUq = std::make_unique<PubSubClient>(*netClientUq. get () );
9695 }
9796
9897 void ksMqttConnector::mqttConnectedInternal ()
@@ -104,8 +103,8 @@ namespace ksf::comps
104103
105104 void ksMqttConnector::mqttMessageInternal (const char * topic, const uint8_t * payload, uint32_t length)
106105 {
107- auto handlesDeviceMessage{onDeviceMessage->isBound ()};
108- auto handlesAnyMessage{onAnyMessage->isBound ()};
106+ bool handlesDeviceMessage{onDeviceMessage->isBound ()};
107+ bool handlesAnyMessage{onAnyMessage->isBound ()};
109108
110109 if (!handlesDeviceMessage && !handlesAnyMessage)
111110 return ;
@@ -134,7 +133,8 @@ namespace ksf::comps
134133
135134 void ksMqttConnector::subscribe (const std::string& topic, bool skipDevicePrefix, ksMqttConnector::QosLevel qos)
136135 {
137- mqttClientUq->subscribe (skipDevicePrefix ? topic.c_str () : std::string (prefix + topic).c_str (), static_cast <uint8_t >(qos));
136+ uint8_t qosLevel{static_cast <uint8_t >(qos)};
137+ mqttClientUq->subscribe (skipDevicePrefix ? topic.c_str () : std::string (prefix + topic).c_str (), qosLevel);
138138 }
139139
140140 void ksMqttConnector::unsubscribe (const std::string& topic, bool skipDevicePrefix)
0 commit comments