From 6b32790a93911c2303a12431196cfcda39b00e19 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 21 Oct 2024 17:38:56 -0400 Subject: [PATCH] FIx up zm_mqtt.cpp to actually compile --- src/zm_mqtt.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/zm_mqtt.cpp b/src/zm_mqtt.cpp index 043751e8a..666368f9b 100644 --- a/src/zm_mqtt.cpp +++ b/src/zm_mqtt.cpp @@ -1,18 +1,20 @@ - -#ifdef MOSQUITTOPP_FOUND #include "zm.h" #include "zm_logger.h" -#include "zm_mqtt.h" #include "zm_monitor.h" +#include "zm_mqtt.h" +#ifdef MOSQUITTOPP_FOUND #include "zm_time.h" #include #include MQTT::MQTT(Monitor *monitor) : - mosquittopp("ZoneMinder"+std::to_string(monitor->Id()), monitor_(monitor), - connected_(false) { + connected_(false) +{ + std::string name="ZoneMinder"+std::to_string(monitor->Id()); + mosquittopp(name.c_str()); + mosqpp::lib_init(); connect(); } @@ -51,7 +53,7 @@ void MQTT::on_connect(int rc) { } void MQTT::on_message(const struct mosquitto_message *message) { - Debug(1, "MQTT: Have message %s: %s", message->topic, message->payload); + Debug(1, "MQTT: Have message %s: %s", message->topic, static_cast(message->payload)); } void MQTT::on_subscribe(int mid, int qos_count, const int *granted_qos) {