forked from hmbar/epd-embedded-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_main.c.patch
42 lines (38 loc) · 1.27 KB
/
app_main.c.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
diff --git a/main/app_main.c b/main/app_main.c
index 45b2a73..4fd9d26 100755
--- a/main/app_main.c
+++ b/main/app_main.c
@@ -64,20 +64,22 @@ void data_cb(void *self, void *params)
free(topic);
}
- // char *data = malloc(event_data->data_length + 1);
- // memcpy(data, event_data->data, event_data->data_length);
- // data[event_data->data_length] = 0;
+ char *data = malloc(event_data->data_length + 1);
+ memcpy(data, event_data->data, event_data->data_length);
+ data[event_data->data_length] = 0;
+
ESP_LOGI(MQTT_TAG, "[APP] Publish data[%d/%d bytes]",
event_data->data_length + event_data->data_offset,
event_data->data_total_length);
- // data);
- // free(data);
+ ESP_LOGI(MQTT_TAG, "[APP] Publish data[%s]", data);
+
+ free(data);
}
mqtt_settings settings = {
- .host = "test.mosquitto.org",
+ .host = "192.168.34.18",
#if defined(CONFIG_MQTT_SECURITY_ON)
.port = 8883, // encrypted
#else
@@ -94,7 +96,7 @@ mqtt_settings settings = {
.lwt_retain = 0,
.connected_cb = connected_cb,
.disconnected_cb = disconnected_cb,
- .reconnect_cb = reconnect_cb,
+// .reconnect_cb = reconnect_cb,
.subscribe_cb = subscribe_cb,
.publish_cb = publish_cb,
.data_cb = data_cb