#ifndef MQTT_CLIENT_H #define MQTT_CLIENT_H #include typedef struct { 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