diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 18:04:16 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 18:04:16 +0900 |
commit | fdb31e2fa50280efc789b1854f5df831b1870c9d (patch) | |
tree | 1f378be4c328271548142139d2cc1263c68eb5e2 /src/policy_manager/policy_manager.cpp | |
parent | 2d05cf8f8f939bfdfee4858437a28479aaa47200 (diff) |
Add none event and category
Change-Id: I02bab5812170d867b4e144c8c2ec926cedccd27c
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager/policy_manager.cpp')
-rw-r--r-- | src/policy_manager/policy_manager.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp index ebc45a9..89a939c 100644 --- a/src/policy_manager/policy_manager.cpp +++ b/src/policy_manager/policy_manager.cpp @@ -718,7 +718,7 @@ int PolicyManager::setInputEventData(json_object* json_in) { // Get event from json_object const char* event = this->getStringFromJson(json_in, "event"); - int event_no = 0; + int event_no = stm::gStmEventNoNone; if (nullptr != event) { // Convert name to number auto itr = this->eventname2no.find(event); @@ -738,7 +738,7 @@ int PolicyManager::setInputEventData(json_object* json_in) { // Get role from json_object const char* role = this->getStringFromJson(json_in, "role"); - int category_no = 0; + int category_no = stm::gStmCategoryNoNone; if (nullptr != role) { HMI_DEBUG("wm:pm", "role(%s)", role); @@ -747,23 +747,20 @@ int PolicyManager::setInputEventData(json_object* json_in) { auto itr = this->role2category.find(role); if (this->role2category.end() != itr) { category = this->role2category[role]; - } - else { - HMI_ERROR("wm:pm", "Invalid role name!!"); - return -1; - } - // Convert name to number - category_no = categoryname2no[category]; - HMI_DEBUG("wm:pm", "role(%s), category(%s:%d)", role, category.c_str(), category_no); + // Convert name to number + category_no = categoryname2no[category]; + HMI_DEBUG("wm:pm", "role(%s), category(%s:%d)", role, category.c_str(), category_no); + } } - else { + + if (stm::gStmCategoryNoNone == category_no) { role = ""; } // Get areat from json_object const char* area = this->getStringFromJson(json_in, "area"); - int area_no = 0; + int area_no = stm::gStmAreaNoNone; if (nullptr != area) { auto itr = this->areaname2no.find(area); if (this->areaname2no.end() != itr) { @@ -773,7 +770,8 @@ int PolicyManager::setInputEventData(json_object* json_in) { } // If role is set and area is not set, use default area - if ((nullptr == area) && (0 != strcmp("", role))) { + if ((stm::gStmAreaNoNone == area_no) + && (stm::gStmCategoryNoNone != category_no)) { std::string def_area = this->role2defaultarea[role]; area_no = this->areaname2no[def_area]; HMI_DEBUG("wm:pm", "area(%s:%d)", def_area.c_str(), area_no); |