diff options
Diffstat (limited to 'cethcan/main.c')
-rw-r--r-- | cethcan/main.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cethcan/main.c b/cethcan/main.c index cc3522b..99a32c5 100644 --- a/cethcan/main.c +++ b/cethcan/main.c @@ -7,7 +7,7 @@ int main(int argc, char **argv) int optch = 0; const char *cfgfile = "cethcan.json"; json_error_t je; - json_t *config, *ethercfg, *lightcfg, *beancfg, *socancfg; + json_t *config; do { optch = getopt(argc, argv, "c:"); @@ -40,34 +40,41 @@ int main(int argc, char **argv) can_init(); - ethercfg = json_object_get(config, "ethernet"); + json_t *ethercfg = json_object_get(config, "ethernet"); for (size_t i = 0; i < json_array_size(ethercfg); i++) { json_t *c = json_array_get(ethercfg, i); if (ether_init(c)) return 1; } - lightcfg = json_object_get(config, "lights"); + json_t *lightcfg = json_object_get(config, "lights"); for (size_t i = 0; i < json_array_size(lightcfg); i++) { json_t *c = json_array_get(lightcfg, i); if (light_init_conf(c)) return 1; } - beancfg = json_object_get(config, "beans"); + json_t *beancfg = json_object_get(config, "beans"); for (size_t i = 0; i < json_array_size(beancfg); i++) { json_t *c = json_array_get(beancfg, i); if (bean_init_conf(c)) return 1; } - socancfg = json_object_get(config, "socketcan"); + json_t *socancfg = json_object_get(config, "socketcan"); for (size_t i = 0; i < json_array_size(socancfg); i++) { json_t *c = json_array_get(socancfg, i); if (socan_init(c)) return 1; } + json_t *espcfg = json_object_get(config, "espnet"); + for (size_t i = 0; i < json_array_size(espcfg); i++) { + json_t *c = json_array_get(espcfg, i); + if (espnet_init_conf(c)) + return 1; + } + http_init(); event_base_loop(ev_base, 0); |