hi all,
iam using application with multi-sensor so i need to subscribe to may topic ,
usign ** mqtt_event_handler(esp_mqtt_event_handle_t event) ** https://github.com/espressif/espidf/blo ... app_main.c
the examples works fine, but to be honest I have not understood the concept how to use it right.
for subscribe iam using case MQTT_EVENT_DATA i dont know if there another method ?
so i want to decode topic but i have problem :
decode topic MQTT for multi-sensor
decode topic MQTT for multi-sensor
- Attachments
-
- topic.png (55.35 KiB) Viewed 2522 times
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: decode topic MQTT for multi-sensor
'topic' is not a zero-terminated string, so you cannot use 'strdup' on it. Suggest you malloc() a char array of the needed length (+1 for the zero terminator) manually, memcpy() the string into it and add the terminating zero at the right location.
Who is online
Users browsing this forum: No registered users and 71 guests