aboutsummaryrefslogtreecommitdiffstats
path: root/analysis/rtt/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'analysis/rtt/src/main.c')
-rw-r--r--analysis/rtt/src/main.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/analysis/rtt/src/main.c b/analysis/rtt/src/main.c
new file mode 100644
index 0000000..13f7716
--- /dev/null
+++ b/analysis/rtt/src/main.c
@@ -0,0 +1,28 @@
1
2#include "logger.h"
3#include "mqtt_client.h"
4#include <stdio.h>
5
6#define BROKER_ADDRESS "192.168.1.101"
7#define BROKER_PORT 1883
8#define TOPIC "device/echo/in"
9#define CSV_FILE "rtt_throughput_log.csv"
10
11int main() {
12 mqtt_client_t client;
13
14 logger_init(CSV_FILE);
15
16 if (mqtt_client_init(&client, BROKER_ADDRESS, BROKER_PORT, TOPIC) != 0) {
17 fprintf(stderr, "MQTT initialization error\n");
18 return 1;
19 }
20
21 printf("Connection established.Waiting for messages...\n");
22 mqtt_client_loop(&client);
23
24 logger_cleanup();
25 mqtt_client_cleanup(&client);
26
27 return 0;
28}