mqtt user argument test

This commit is contained in:
Bogdan Pilyugin 2023-04-14 21:20:38 +02:00
parent 020798c68a
commit 217dfdd486
3 changed files with 5 additions and 2 deletions

@ -1 +1 @@
Subproject commit d5cf42b17d39ed631184bd20492332685f343b1a
Subproject commit 37d410623cc54b37fc94f5d33dd5e9d660ed5f95

View File

@ -9,11 +9,13 @@ int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var, int arg);
HTTP_IO_RESULT AfterPostHandlerCustom(httpd_req_t *req, const char *filename, char *PostData);
void UserMQTTEventHndlr(int idx, void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data);
const char my_context_data[] = "MyContextDataPassedIntoMQTTHandler";
void app_main(void)
{
regHTTPPrintCustom(&HTTPPrintCustom);
regAfterPostHandlerCustom(&AfterPostHandlerCustom);
regUserEventHandler(&UserMQTTEventHndlr);
regUserEventHandler(&UserMQTTEventHndlr, (void*)my_context_data);
WebGuiAppInit();
void test_cron_job_sample_callback(cron_job *job)

View File

@ -52,6 +52,7 @@ void UserMQTTEventHndlr(int idx, void *handler_args, esp_event_base_t base, int3
esp_mqtt_event_handle_t event = event_data;
esp_mqtt_client_handle_t client = event->client;
//mqtt_client_t *ctx = (mqtt_client_t*) event->user_context;
ESP_LOGI(TAG, "%s", (char*)(((mqtt_client_t*)(handler_args))->user_arg));
int msg_id;
char topic[CONFIG_WEBGUIAPP_MQTT_MAX_TOPIC_LENGTH];
switch ((esp_mqtt_event_id_t) event_id)