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

@@ -70,6 +70,32 @@ void MqttClient_Deinit(void);
*/
void MqttClient_Init(void);
typedef enum topic_ID_e {
Topic_ID_None,
#if MQTT_CLIENT_IS_EV_CHARGER
Topic_ID_Solar_Power, /* power from PV panels */
Topic_ID_Site_Power, /* power to the house/site */
Topic_ID_Grid_Power, /* power from/to grid */
Topic_ID_Battery_Power, /* power from/to battery */
Topic_ID_Battery_Percentage,/* battery level percentage */
Topic_ID_Charging_Power, /* actual charging power */
#elif MQTT_CLIENT_IS_SENSOR
Topic_ID_Sensor_Update,
#endif
} topic_ID_e;
/*!
* \brief Callback function for incoming messages
*/
typedef void (*MqttClient_MessageCallback_t)(topic_ID_e topic, const unsigned char *payload, size_t len);
/*!
* \brief Register a callback function for incoming messages
* \param cb Callback function to be registered
*/
void MqttClient_RegisterMessageCallback(MqttClient_MessageCallback_t cb);
#ifdef __cplusplus
} /* extern "C" */
#endif