diff options
Diffstat (limited to 'src/homescreen.cpp')
-rw-r--r-- | src/homescreen.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/homescreen.cpp b/src/homescreen.cpp index c02f62b..eeba767 100644 --- a/src/homescreen.cpp +++ b/src/homescreen.cpp @@ -32,6 +32,14 @@ const char _display_message[] = "display_message"; const char _reply_message[] = "reply_message"; const char _keyData[] = "data"; const char _keyId[] = "id"; +const char _HS_CONF_JSON[] = "hs-conf.json"; +const char _LASTMODE_JSON[] = "lastmode.json"; + +struct hs_config { + struct json_object *hs_conf; + struct json_object *lastmode; +}; +static struct hs_config g_hs_config; struct hs_instance { HS_ClientManager *client_manager; // the connection session manager @@ -533,8 +541,20 @@ static const afb_verb_t verbs[]= { */ static int preinit(afb_api_t api) { - AFB_DEBUG("binding preinit (was register)"); - return 0; + AFB_DEBUG("binding preinit (was register)"); + auto rootdir = std::string(getenv("AFM_APP_INSTALL_DIR")); + auto path = rootdir + "/etc/" + _HS_CONF_JSON; + if(readJsonFile(path.c_str(), &g_hs_config.hs_conf) < 0) { + AFB_ERROR("read %s failed.", _HS_CONF_JSON); + return -1; + } + + path = rootdir + "/etc/" + _LASTMODE_JSON; + if(readJsonFile(path.c_str(), &g_hs_config.lastmode) < 0) { + AFB_ERROR("read %s failed.", _LASTMODE_JSON); + return -1; + } + return 0; } /** |