X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fhomescreen.cpp;h=eeba7677c8ea95ae71cdecaf8dcdc1a5cc18d6cc;hb=1df2ef6a38ad21d34353dc4728964055d0a1c986;hp=c02f62b1a53269569f989fc2fae17fb7beb00b4c;hpb=6a151ec022b2520f5c68fc1c8af483afd4c887c7;p=apps%2Fagl-service-homescreen.git 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; } /**