diff options
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/src/app.cpp b/src/app.cpp index fedd227..d7ec53d 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -342,7 +342,7 @@ int App::init() { // TODO: This process is necessary for checking right of requested role. // If other module check it, this process will be removed. // Load app.db - this->loadAppDb(); + this->loadDrawingNameDb(); // Initialize PolicyManager this->pm.initialize(); @@ -1050,8 +1050,8 @@ void App::setAccelPedalPos(double val) { this->crr_car_info.accel_pedal_pos = val; } -extern const char* kDefaultAppDb; -int App::loadAppDb() { +extern const char* kDefaultDrawingNameDb; +int App::loadDrawingNameDb() { HMI_DEBUG("wm", "Call"); // Get afm application installed dir @@ -1063,22 +1063,22 @@ int App::loadAppDb() { HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined"); } else { - file_name = std::string(afm_app_install_dir) + std::string("/etc/app.db"); + file_name = std::string(afm_app_install_dir) + std::string("/etc/drawing_name.db"); } - // Load app.db + // Load drawing_name.db json_object* json_obj; int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj); if (0 > ret) { - HMI_ERROR("wm", "Could not open app.db, so use default role information"); - json_obj = json_tokener_parse(kDefaultAppDb); + HMI_ERROR("wm", "Could not open drawing_name.db, so use default drawing_name information"); + json_obj = json_tokener_parse(kDefaultDrawingNameDb); } HMI_DEBUG("wm", "json_obj dump:%s", json_object_get_string(json_obj)); // Perse apps - HMI_DEBUG("wm", "Perse apps"); + HMI_DEBUG("wm", "Perse drawing_names"); json_object* json_cfg; - if (!json_object_object_get_ex(json_obj, "apps", &json_cfg)) { + if (!json_object_object_get_ex(json_obj, "drawing_names", &json_cfg)) { HMI_ERROR("wm", "Parse Error!!"); return -1; } @@ -1091,12 +1091,12 @@ int App::loadAppDb() { json_object* json_tmp = json_object_array_get_idx(json_cfg, i); HMI_DEBUG("wm", "> json_tmp dump:%s", json_object_get_string(json_tmp)); - const char* app = jh::getStringFromJson(json_tmp, "name"); - if (nullptr == app) { + const char* drawing_name = jh::getStringFromJson(json_tmp, "name"); + if (nullptr == drawing_name) { HMI_ERROR("wm", "Parse Error!!"); return -1; } - HMI_DEBUG("wm", "> app:%s", app); + HMI_DEBUG("wm", "> drawing_name:%s", drawing_name); const char* role = jh::getStringFromJson(json_tmp, "role"); if (nullptr == role) { @@ -1105,13 +1105,13 @@ int App::loadAppDb() { } HMI_DEBUG("wm", "> role:%s", role); - this->drawingname2role[app] = std::string(role); + this->drawingname2role[drawing_name] = std::string(role); } // Check for(auto itr = this->drawingname2role.begin(); itr != this->drawingname2role.end(); ++itr) { - HMI_DEBUG("wm", "app:%s role:%s", + HMI_DEBUG("wm", "drawing_name:%s role:%s", itr->first.c_str(), itr->second.c_str()); } @@ -1122,8 +1122,8 @@ int App::loadAppDb() { } -const char* kDefaultAppDb = "{ \ - \"apps\": [ \ +const char* kDefaultDrawingNameDb = "{ \ + \"drawing_names\": [ \ { \ \"name\": \"HomeScreen\", \ \"role\": \"homescreen\" \ @@ -1179,6 +1179,22 @@ const char* kDefaultAppDb = "{ \ { \ \"name\": \"Mixer\", \ \"role\": \"mixer\" \ + }, \ + { \ + \"name\": \"Splitable1\", \ + \"role\": \"splitable1\" \ + }, \ + { \ + \"name\": \"Splitable2\", \ + \"role\": \"splitable2\" \ + }, \ + { \ + \"name\": \"Restriction\", \ + \"role\": \"restriction\" \ + }, \ + { \ + \"name\": \"^OnScreen.*\", \ + \"role\": \"pop_up\" \ } \ ] \ }"; |