event_handler_arg in Esp_mqtt component. How do I access the arg from the handler?
Posted: Fri May 05, 2023 12:26 pm
Hi,
I think this question has already been answered, because I think I read it a few days ago, but I swear I can't get to find the discussion anymore. So my question is, in the esp_mqtt component, when I register an event like this: being mqtt_topic_bk a pointer to a struct... how do I get in the event handler, the pointer to that struct back? Is it inside of:
I mean... How is it structured? data is a pointer to? "Data associated with this event" https://docs.espressif.com/projects/esp ... tt_event_tThat means? Is it the data I passed when I registered the event or when it gets data from the broker (Looking at the examples provided, that seems to be what is happening). But then I dont get where does my event handler get the event_handler_arg
I think this question has already been answered, because I think I read it a few days ago, but I swear I can't get to find the discussion anymore. So my question is, in the esp_mqtt component, when I register an event like this:
Code: Select all
esp_mqtt_client_register_event(client, MQTT_EVENT_CONNECTED, mqtt_connected_handler, mqtt_topic_bk);
Code: Select all
((esp_mqtt_event_handle_t *)event_data)->data