mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 12:06:58 +03:00
v10.2.0
This commit is contained in:
@@ -111,10 +111,20 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
|
||||
};
|
||||
|
||||
client = esp_mqtt_client_init(&mqtt_cfg);
|
||||
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
|
||||
esp_mqtt_client_start(client);
|
||||
if (client)
|
||||
{
|
||||
if (esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client) != ESP_OK)
|
||||
LogFile.WriteToFile("MQTT - Could not register event!");
|
||||
if (esp_mqtt_client_start(client) != ESP_OK)
|
||||
LogFile.WriteToFile("MQTT - Could not start client!");
|
||||
|
||||
MQTTPublish(_LWTContext, "", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile.WriteToFile("MQTT - Could not Init MQTT Client!");
|
||||
}
|
||||
|
||||
MQTTPublish(_LWTContext, "", 1);
|
||||
}
|
||||
|
||||
void MQTTdestroy() {
|
||||
|
||||
Reference in New Issue
Block a user