add: config loading

This commit is contained in:
Tobias Reisinger 2020-04-17 01:38:25 +02:00
parent 3cd6668f9c
commit 25ba0ff723
22 changed files with 5799 additions and 75 deletions

View file

@ -6,6 +6,8 @@
#include <models/controller.h>
#include <macros.h>
#include <config.h>
#include <constants.h>
controller_t*
controller_create(void)
@ -13,10 +15,12 @@ controller_create(void)
controller_t *new_controller = malloc(sizeof(*new_controller));
uuid_generate(new_controller->id);
strcpy(new_controller->name, "new emgauwa device");
strncpy(new_controller->name, global_config.name, MAX_NAME_LENGTH);
new_controller->name[MAX_NAME_LENGTH] = '\0';
new_controller->command_port = 0;
new_controller->discovery_port = 4421;
new_controller->relay_count = 10;
new_controller->discovery_port = global_config.discovery_port;
new_controller->relay_count = global_config.relay_count;
new_controller->relays = malloc(sizeof(relay_t) * new_controller->relay_count);
uint8_t i;