From 01713bbe20d2cf5aafbe5eb32721d3e4fc5823d8 Mon Sep 17 00:00:00 2001 From: Filip Wandzio Date: Fri, 5 Sep 2025 03:30:24 +0200 Subject: Standarize the project directory for monorepo-like developer experience Move the clang formatter to the root of the three so all nested projects could use it Provide README for all other projects Refactor the code in rtt agregator Signed-off-by: Filip Wandzio --- analysis/rtt/src/mqtt_client.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'analysis/rtt/src/mqtt_client.h') diff --git a/analysis/rtt/src/mqtt_client.h b/analysis/rtt/src/mqtt_client.h index 781e742..1faa4ad 100644 --- a/analysis/rtt/src/mqtt_client.h +++ b/analysis/rtt/src/mqtt_client.h @@ -1,16 +1,39 @@ - #ifndef MQTT_CLIENT_H #define MQTT_CLIENT_H #include typedef struct { - struct mosquitto *mosq; + struct mosquitto *mosq; } mqtt_client_t; +/** + * @brief Initialize the MQTT client, connect to the broker, and subscribe to a + * topic. + * + * @param client Pointer to mqtt_client_t struct. + * @param broker_address MQTT broker IP or hostname. + * @param port Broker port number. + * @param topic Topic to subscribe to. + * @return int 0 on success, 1 on failure. + */ int mqtt_client_init(mqtt_client_t *client, const char *broker_address, int port, const char *topic); + +/** + * @brief Cleanup MQTT client resources and free associated memory. + * + * @param client Pointer to mqtt_client_t struct. + */ void mqtt_client_cleanup(mqtt_client_t *client); + +/** + * @brief Run the MQTT client loop to process network events. + * + * This function blocks indefinitely. + * + * @param client Pointer to mqtt_client_t struct. + */ void mqtt_client_loop(mqtt_client_t *client); -#endif // MQTT_CLIENT_H +#endif -- cgit v1.2.3