feat(pico-sensor): added callback in mqtt client to process incomming messages in application

This commit is contained in:
SylvanArnold
2025-05-20 09:52:21 +02:00
committed by Klagarge
parent 257788e1d7
commit 5595d47e3f
3 changed files with 49 additions and 17 deletions

View File

@@ -136,6 +136,10 @@ static void MqttTask(void *pv) {
} /* for */
}
static void MyMqttMessageCallback(topic_ID_e topic, const unsigned char *payload, size_t len) {
McuLog_info("MQTT message received, topic: %d, payload: %.*s", topic, (int)len, payload);
}
#endif
void App_Init(void) {
@@ -154,6 +158,7 @@ void App_Init(void) {
}
#endif
#if PL_CONFIG_USE_MQTT_CLIENT
MqttClient_RegisterMessageCallback(MyMqttMessageCallback); // register the callback for incoming messages
if (xTaskCreate(
MqttTask, /* pointer to the task */
"mqtt", /* task name for kernel awareness debugging */