2020-01-07 01:23:16 +00:00
|
|
|
#ifndef CONTROLLER_CONFIG_H
|
|
|
|
#define CONTROLLER_CONFIG_H
|
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
#include <stdint.h>
|
2020-07-26 19:05:41 +00:00
|
|
|
#include <confini.h>
|
2020-02-08 12:50:54 +00:00
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
#include <constants.h>
|
|
|
|
#include <enums.h>
|
2020-01-07 01:23:16 +00:00
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint8_t pin;
|
2020-04-18 00:09:50 +00:00
|
|
|
int inverted;
|
2020-08-20 19:51:42 +00:00
|
|
|
int init;
|
2020-04-16 23:38:25 +00:00
|
|
|
relay_driver_t driver;
|
2020-06-27 16:27:49 +00:00
|
|
|
uint8_t pulse_duration;
|
2020-04-16 23:38:25 +00:00
|
|
|
} config_relay_t;
|
2020-01-07 01:23:16 +00:00
|
|
|
|
2020-07-26 19:05:41 +00:00
|
|
|
int
|
|
|
|
config_load(IniDispatch *disp, void *config_void);
|
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2020-04-17 23:24:36 +00:00
|
|
|
char *file;
|
2020-07-14 18:43:58 +00:00
|
|
|
char database[256];
|
2020-07-26 19:05:41 +00:00
|
|
|
char user[256];
|
|
|
|
char group[256];
|
|
|
|
int log_level;
|
|
|
|
FILE *log_file;
|
2020-04-17 23:24:36 +00:00
|
|
|
run_type_t run_type;
|
2020-04-16 23:38:25 +00:00
|
|
|
char name[MAX_NAME_LENGTH + 1];
|
|
|
|
uint16_t discovery_port;
|
2020-06-25 23:28:00 +00:00
|
|
|
uint16_t mqtt_port;
|
2020-07-14 18:43:58 +00:00
|
|
|
char mqtt_host[256];
|
2020-04-16 23:38:25 +00:00
|
|
|
uint8_t relay_count;
|
2020-08-20 19:51:42 +00:00
|
|
|
int relays_init;
|
2020-04-16 23:38:25 +00:00
|
|
|
config_relay_t *relay_configs;
|
|
|
|
} config_t;
|
2020-02-23 00:13:27 +00:00
|
|
|
|
2020-04-16 23:38:25 +00:00
|
|
|
extern config_t global_config;
|
2020-02-08 12:50:54 +00:00
|
|
|
|
2020-01-07 01:23:16 +00:00
|
|
|
#endif //CONTROLLER_CONFIG_H
|