#include "logger.h" #include "mqtt_client.h" #include #define BROKER_ADDRESS "192.168.1.101" #define BROKER_PORT 1883 #define TOPIC "device/echo/in" #define CSV_FILE "rtt_throughput_log.csv" /** * @brief Entry point for MQTT client program. * * Initializes the logger and MQTT client, then enters the MQTT loop to receive * messages. Cleans up resources on exit. * * @return int Exit code (0 on success, 1 on failure). */ int main(void) { mqtt_client_t client; logger_init(CSV_FILE); if (mqtt_client_init(&client, BROKER_ADDRESS, BROKER_PORT, TOPIC)) return fprintf(stderr, "MQTT initialization error\n"), 1; printf("Connection established. Waiting for messages...\n"); mqtt_client_loop(&client); logger_cleanup(); mqtt_client_cleanup(&client); return 0; }