feat(pico-sensor): added callback in mqtt client to process incomming messages in application
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user