aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-06-22 16:24:59 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-06-22 16:24:59 +0900
commitc1ba5e531c3b104a3618b84bd711079b469ed76f (patch)
treeb6fcbadd22bc9787ec5249d4bf59d3338f61623d
parentddfed81a6473151910fdd88f84962c28339a1116 (diff)
Modify file name from app.db to drawing_name.db
Change-Id: Idbe7bc37c549c759a74559cffdd6b5c2d1a1e11b Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/app.cpp48
-rw-r--r--src/app.hpp7
-rw-r--r--src/db/drawing_name.db (renamed from src/db/app.db)2
4 files changed, 35 insertions, 24 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0819305..fe2f69a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -130,7 +130,7 @@ add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/layout_manager/db/area.db ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/${PLUGIN_PM}/db/layout.db ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/${PLUGIN_PM}/db/role.db ${PROJECT_BINARY_DIR}/package/root/etc
- COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/db/app.db ${PROJECT_BINARY_DIR}/package/root/etc
+ COMMAND cp -f ${PROJECT_SOURCE_DIR}/src/db/drawing_name.db ${PROJECT_BINARY_DIR}/package/root/etc
COMMAND cp -f ${PROJECT_BINARY_DIR}/src/policy_manager/libpolicy_manager.so ${PROJECT_BINARY_DIR}/package/root/lib
)
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\" \
} \
] \
}";
diff --git a/src/app.hpp b/src/app.hpp
index 3fc5738..abe663f 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -264,14 +264,9 @@ private:
void updateCarElements(json_object* json_out);
void updateLayers(json_object* json_out);
void setSurfaceSize(const char* role, const char* area);
- int loadAppDb();
+ int loadDrawingNameDb();
const char* convertDrawingNameToRole(char const *drawing_name);
-#if 0
- struct id_allocator app_id_alloc;
- std::unordered_map<std::string, int> appname2appid;
-#endif
-
optional<int> lookup_id(char const *name);
optional<std::string> lookup_name(int id);
diff --git a/src/db/app.db b/src/db/drawing_name.db
index f1f937b..c30fa34 100644
--- a/src/db/app.db
+++ b/src/db/drawing_name.db
@@ -1,5 +1,5 @@
{
- "apps": [
+ "drawing_names": [
{
"name": "HomeScreen",
"role": "homescreen"