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 | |
parent | 2d05cf8f8f939bfdfee4858437a28479aaa47200 (diff) |
Add none event and category
Change-Id: I02bab5812170d867b4e144c8c2ec926cedccd27c
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
-rw-r--r-- | src/policy_manager/policy_manager.cpp | 24 | ||||
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.c | 4 | ||||
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.h | 58 |
3 files changed, 46 insertions, 40 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); diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c index 83c6a6f..32e18c5 100644 --- a/src/policy_manager/zipc/dummy_stm.c +++ b/src/policy_manager/zipc/dummy_stm.c @@ -3,6 +3,7 @@ #include "hmi-debug.h" const char* gStmEventName[] = { + "none", "activate", "deactivate", "trans_gear_neutral", @@ -21,6 +22,7 @@ const char* gStmEventName[] = { }; const int gStmEventNo[] = { + STM_EVT_NO_NONE, STM_EVT_NO_ACTIVATE, STM_EVT_NO_DEACTIVATE, STM_EVT_NO_TRANS_GEAR_N, @@ -39,6 +41,7 @@ const int gStmEventNo[] = { }; const char* gStmCategoryName[] = { + "none", "homescreen", "map", "general", @@ -50,6 +53,7 @@ const char* gStmCategoryName[] = { }; const int gStmCategoryNo[] = { + STM_CTG_NO_NONE, STM_CTG_NO_HOMESCREEN, STM_CTG_NO_MAP, STM_CTG_NO_GENERAL, diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h index 5dd0bcc..a994376 100644 --- a/src/policy_manager/zipc/dummy_stm.h +++ b/src/policy_manager/zipc/dummy_stm.h @@ -24,31 +24,33 @@ #define STM_FALSE 0 // Event number -#define STM_EVT_NO_ACTIVATE 0x01 -#define STM_EVT_NO_DEACTIVATE 0x02 -#define STM_EVT_NO_TRANS_GEAR_N 0x03 -#define STM_EVT_NO_TRANS_GEAR_NOT_N 0x04 -#define STM_EVT_NO_PARKING_BRAKE_OFF 0x05 -#define STM_EVT_NO_PARKING_BRAKE_ON 0x06 -#define STM_EVT_NO_ACCEL_PEDAL_OFF 0x07 -#define STM_EVT_NO_ACCEL_PEDAL_ON 0x08 -#define STM_EVT_NO_TIMER_EXPIRED 0x09 -#define STM_EVT_NO_LAMP_OFF 0x0A -#define STM_EVT_NO_LAMP_ON 0x0B -#define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0C -#define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON 0x0D -#define STM_EVT_NO_RESTRICTION_MODE_OFF 0x0E -#define STM_EVT_NO_RESTRICTION_MODE_ON 0x0F +#define STM_EVT_NO_NONE 0x01 +#define STM_EVT_NO_ACTIVATE 0x02 +#define STM_EVT_NO_DEACTIVATE 0x03 +#define STM_EVT_NO_TRANS_GEAR_N 0x04 +#define STM_EVT_NO_TRANS_GEAR_NOT_N 0x05 +#define STM_EVT_NO_PARKING_BRAKE_OFF 0x06 +#define STM_EVT_NO_PARKING_BRAKE_ON 0x07 +#define STM_EVT_NO_ACCEL_PEDAL_OFF 0x08 +#define STM_EVT_NO_ACCEL_PEDAL_ON 0x09 +#define STM_EVT_NO_TIMER_EXPIRED 0x0A +#define STM_EVT_NO_LAMP_OFF 0x0B +#define STM_EVT_NO_LAMP_ON 0x0C +#define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0D +#define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON 0x0E +#define STM_EVT_NO_RESTRICTION_MODE_OFF 0x0F +#define STM_EVT_NO_RESTRICTION_MODE_ON 0x10 // Category number -#define STM_CTG_NO_HOMESCREEN 0x0100 -#define STM_CTG_NO_MAP 0x0200 -#define STM_CTG_NO_GENERAL 0x0300 -#define STM_CTG_NO_SPLITABLE 0x0400 -#define STM_CTG_NO_POPUP 0x0500 -#define STM_CTG_NO_SYSTEM_ALERT 0x0600 -#define STM_CTG_NO_RESTRICTION 0x0700 -#define STM_CTG_NO_SYSTEM 0x0800 +#define STM_CTG_NO_NONE 0x0100 +#define STM_CTG_NO_HOMESCREEN 0x0200 +#define STM_CTG_NO_MAP 0x0300 +#define STM_CTG_NO_GENERAL 0x0400 +#define STM_CTG_NO_SPLITABLE 0x0500 +#define STM_CTG_NO_POPUP 0x0600 +#define STM_CTG_NO_SYSTEM_ALERT 0x0700 +#define STM_CTG_NO_RESTRICTION 0x0800 +#define STM_CTG_NO_SYSTEM 0x0900 // Area number #define STM_ARA_NO_NONE 0x010000 @@ -125,7 +127,8 @@ enum stm_layout_ { }; enum stm_event_ { - gStmEventNoActive = 0, + gStmEventNoNone = 0, + gStmEventNoActive, gStmEventNoDeactive, gStmEventNoTransGearN, gStmEventNoTransGearNotN, @@ -143,12 +146,13 @@ enum stm_event_ { gStmEventNoNum, - gStmEventNoMin = gStmEventNoActive, + gStmEventNoMin = gStmEventNoNone, gStmEventNoMax = gStmEventNoNum - 1, }; enum stm_category_ { - gStmCategoryNoHomescreen = 0, + gStmCategoryNoNone = 0, + gStmCategoryNoHomescreen, gStmCategoryNoMap, gStmCategoryNoGeneral, gStmCategoryNoSplitable, @@ -158,7 +162,7 @@ enum stm_category_ { gStmCategoryNoNum, - gStmCategoryNoMin = gStmCategoryNoHomescreen, + gStmCategoryNoMin = gStmCategoryNoNone, gStmCategoryNoMax = gStmCategoryNoNum - 1, }; |