This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_allocator.c
44 lines (40 loc) · 1.64 KB
/
config_allocator.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "config_utils.h"
config_t* newConfig() {
config_t *config = (config_t*) malloc(sizeof(config_t));
config->mqtt.host = strdup("localhost");
config->mqtt.port = 1883;
config->mqtt.data_topic = strdup("telemetria");
config->mqtt.log_topic = strdup("telemetria_log");
config->mongodb.host = strdup("localhost");
config->mongodb.port = 27017;
config->mongodb.db = strdup("eagle_test");
config->mongodb.collection = strdup("chimera");
config->gps.plugged = 1;
config->gps.simulated = 1;
config->gps.interface = strdup("/dev/pts/4");
config->pilots_count = 6;
config->pilots = (char**) malloc(sizeof(char*) * config->pilots_count);
config->pilots[0] = strdup("default");
config->pilots[1] = strdup("Ivan");
config->pilots[2] = strdup("Filippo");
config->pilots[3] = strdup("Mirco");
config->pilots[4] = strdup("Nicola");
config->pilots[5] = strdup("Davide");
config->races_count = 5;
config->races = (char**) malloc(sizeof(char*) * config->races_count);
config->races[0] = strdup("default");
config->races[1] = strdup("Autocross");
config->races[2] = strdup("Skidpad");
config->races[3] = strdup("Endurance");
config->races[4] = strdup("Acceleration");
config->circuits_count = 4;
config->circuits = (char**) malloc(sizeof(char*) * config->circuits_count);
config->circuits[0] = strdup("default");
config->circuits[1] = strdup("Vadena");
config->circuits[2] = strdup("Varano");
config->circuits[3] = strdup("Povo");
config->can_interface = strdup("can0");
config->sending_rate = 500;
config->verbose = 0;
return config;
}