#include <stdio.h>
#include <common/cfgparse.h>
+#include <common/errors.h>
#include <proto/arg.h>
#include <proto/log.h>
#include <proto/proto_http.h>
#define DA_COOKIENAME_DEFAULT "DAPROPS"
-int init_deviceatlas(void)
+/*
+ * module init / deinit functions. Returns 0 if OK, or a combination of ERR_*.
+ */
+static int init_deviceatlas(void)
{
- da_status_t status = DA_SYS;
+ int err_code = 0;
+
if (global.deviceatlas.jsonpath != 0) {
FILE *jsonp;
da_property_decl_t extraprops[] = {{0, 0}};
if (jsonp == 0) {
Alert("deviceatlas : '%s' json file has invalid path or is not readable.\n",
global.deviceatlas.jsonpath);
+ err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
if (status != DA_OK) {
Alert("deviceatlas : '%s' json file is invalid.\n",
global.deviceatlas.jsonpath);
+ err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
if (status != DA_OK) {
Alert("deviceatlas : data could not be compiled.\n");
+ err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
}
out:
- return status == DA_OK;
+ return err_code;
}
void deinit_deviceatlas(void)
sample_register_convs(&conv_kws);
cfg_register_keywords(&dacfg_kws);
hap_register_build_opts("Built with DeviceAtlas support.", 0);
+ hap_register_post_check(init_deviceatlas);
}
/* now we know the buffer size, we can initialize the channels and buffers */
init_buffer();
-#if defined(USE_DEVICEATLAS)
- init_deviceatlas();
-#endif
list_for_each_entry(pcf, &post_check_list, list) {
err_code |= pcf->fct();