aboutsummaryrefslogtreecommitdiffstats
path: root/analysis/rtt/src/main.c
diff options
context:
space:
mode:
authorFilip Wandzio <contact@philw.dev>2025-09-05 03:30:24 +0200
committerFilip Wandzio <contact@philw.dev>2025-09-05 03:30:24 +0200
commit01713bbe20d2cf5aafbe5eb32721d3e4fc5823d8 (patch)
tree33748d0019e3939bd0daf50940407e51d4325a8f /analysis/rtt/src/main.c
parent1ba21da6cbc63c0c549fb92731e25bedc482eb51 (diff)
downloade1-01713bbe20d2cf5aafbe5eb32721d3e4fc5823d8.tar.gz
e1-01713bbe20d2cf5aafbe5eb32721d3e4fc5823d8.zip
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 <contact@philw.dev>
Diffstat (limited to 'analysis/rtt/src/main.c')
-rw-r--r--analysis/rtt/src/main.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/analysis/rtt/src/main.c b/analysis/rtt/src/main.c
index 13f7716..163b5f6 100644
--- a/analysis/rtt/src/main.c
+++ b/analysis/rtt/src/main.c
@@ -1,4 +1,3 @@
1
2#include "logger.h" 1#include "logger.h"
3#include "mqtt_client.h" 2#include "mqtt_client.h"
4#include <stdio.h> 3#include <stdio.h>
@@ -8,21 +7,26 @@
8#define TOPIC "device/echo/in" 7#define TOPIC "device/echo/in"
9#define CSV_FILE "rtt_throughput_log.csv" 8#define CSV_FILE "rtt_throughput_log.csv"
10 9
11int main() { 10/**
12 mqtt_client_t client; 11 * @brief Entry point for MQTT client program.
13 12 *
14 logger_init(CSV_FILE); 13 * Initializes the logger and MQTT client, then enters the MQTT loop to receive
15 14 * messages. Cleans up resources on exit.
16 if (mqtt_client_init(&client, BROKER_ADDRESS, BROKER_PORT, TOPIC) != 0) { 15 *
17 fprintf(stderr, "MQTT initialization error\n"); 16 * @return int Exit code (0 on success, 1 on failure).
18 return 1; 17 */
19 } 18int main(void)
20 19{
21 printf("Connection established.Waiting for messages...\n"); 20 mqtt_client_t client;
22 mqtt_client_loop(&client); 21 logger_init(CSV_FILE);
23 22
24 logger_cleanup(); 23 if (mqtt_client_init(&client, BROKER_ADDRESS, BROKER_PORT, TOPIC))
25 mqtt_client_cleanup(&client); 24 return fprintf(stderr, "MQTT initialization error\n"), 1;
26 25
27 return 0; 26 printf("Connection established. Waiting for messages...\n");
27 mqtt_client_loop(&client);
28 logger_cleanup();
29 mqtt_client_cleanup(&client);
30
31 return 0;
28} 32}