|
@ -117,6 +117,17 @@ bool XD0MQTT::begin(void) { |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void XD0MQTT::end(void) { |
|
|
|
|
|
//for (const auto &subscription : subscriptions_) {
|
|
|
|
|
|
// int msg_id = esp_mqtt_client_unsubscribe(client, subscription.topic);
|
|
|
|
|
|
// ESP_LOGI(TAG, "sent unsubscribe successful, msg_id=%d", msg_id);
|
|
|
|
|
|
//}
|
|
|
|
|
|
subscriptions_.clear(); |
|
|
|
|
|
esp_mqtt_client_stop(client); |
|
|
|
|
|
delay(10); |
|
|
|
|
|
esp_mqtt_client_destroy(client); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool XD0MQTT::publish(const char* topic, const char* data, int len, int qos, int retain) { |
|
|
bool XD0MQTT::publish(const char* topic, const char* data, int len, int qos, int retain) { |
|
|
int msg_id = esp_mqtt_client_publish(client, topic, data, len, qos, retain); |
|
|
int msg_id = esp_mqtt_client_publish(client, topic, data, len, qos, retain); |
|
|
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id); |
|
|
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id); |
|
|