aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-06-20 22:12:58 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-06-20 22:12:58 +0900
commitac6a264383ea7846433057450242b126f2b459db (patch)
tree58b2cb98c6f64cb2c7f88ab6f93f7f252f205713 /src
parentaab3a29a957c7063c53290b911e1b59bc8666268 (diff)
Modify string of car state
Change-Id: I91b43b01571f0597de4064d46d68c9049bc3d407 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp20
-rw-r--r--src/policy_manager/policy_manager.cpp10
-rw-r--r--src/policy_manager/zipc/dummy_stm.c63
-rw-r--r--src/policy_manager/zipc/dummy_stm.h22
4 files changed, 52 insertions, 63 deletions
diff --git a/src/app.cpp b/src/app.cpp
index c82c98c..4ce9df6 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -126,13 +126,13 @@ void App::updateCarElements(json_object* json_out) {
if (changed) {
if ("parking_brake" == car_ele_name) {
- if ("parking_brake_off" == state) {
+ if ("off" == state) {
this->crr_car_info.parking_brake_stt = false;
#if 0 // FOR ALS: using lightstatus brake, so do not emit parking brake event
this->emitParkingBrakeOff();
#endif
}
- else if ("parking_brake_on" == state) {
+ else if ("on" == state) {
this->crr_car_info.parking_brake_stt = true;
#if 0 // FOR ALS: using lightstatus brake, so do not emit parking brake event
this->emitParkingBrakeOn();
@@ -143,10 +143,10 @@ void App::updateCarElements(json_object* json_out) {
}
}
else if ("accel_pedal" == car_ele_name) {
- if ("accel_pedal_off" == state) {
+ if ("off" == state) {
this->crr_car_info.accel_pedal_stt = false;
}
- else if ("accel_pedal_on" == state) {
+ else if ("on" == state) {
this->crr_car_info.accel_pedal_stt = true;
}
else {
@@ -154,11 +154,11 @@ void App::updateCarElements(json_object* json_out) {
}
}
else if ("lightstatus_brake" == car_ele_name) {
- if ("lightstatus_brake_off" == state) {
+ if ("off" == state) {
this->crr_car_info.lightstatus_brake_stt = false;
this->emitLightstatusBrakeOff();
}
- else if ("lightstatus_brake_on" == state) {
+ else if ("on" == state) {
this->crr_car_info.lightstatus_brake_stt = true;
this->emitLightstatusBrakeOn();
}
@@ -167,11 +167,11 @@ void App::updateCarElements(json_object* json_out) {
}
}
else if ("running" == car_ele_name) {
- if ("car_stop" == state) {
+ if ("stop" == state) {
this->crr_car_info.car_stt = "stop";
this->emitCarStop();
}
- else if ("car_run" == state) {
+ else if ("run" == state) {
this->crr_car_info.car_stt = "run";
this->emitCarRun();
}
@@ -180,11 +180,11 @@ void App::updateCarElements(json_object* json_out) {
}
}
else if ("lamp" == car_ele_name) {
- if ("lamp_off" == state) {
+ if ("off" == state) {
this->crr_car_info.headlamp_stt = false;
this->emitHeadlampOff();
}
- else if ("lamp_on" == state) {
+ else if ("on" == state) {
this->crr_car_info.headlamp_stt = true;
this->emitHeadlampOn();
}
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index ddcb1d6..e7ef9de 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -153,10 +153,10 @@ static void initializeLocalCarElementState() {
static void initializeLocalLayerState() {
pm::AreaState init_area;
pm::LayoutState init_layout;
- init_area.name = "none";
- init_area.category = "none";
- init_area.role = "none";
- init_layout.name = "none";
+ init_area.name = stm::gStmAreaName[stm::gStmAreaNoNone];
+ init_area.category = "";
+ init_area.role = "";
+ init_layout.name = stm::gStmLayoutName[stm::gStmLayoutNoNone];
init_layout.area_list.push_back(init_area);
for (int i = stm::gStmLayerNoMin; i <= stm::gStmLayerNoMax; i++) {
@@ -303,7 +303,7 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
// Get current layout name of this layer
int crr_layout_state_no = crr_state.layer[layer_no].state;
- std::string crr_layout_name = std::string(stm::gStmLayoutNo2Name[crr_layout_state_no]);
+ std::string crr_layout_name = std::string(stm::gStmLayoutName[crr_layout_state_no]);
pm::LayoutState crr_layout_state;
#if 1
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 50efaf3..660f8a1 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -3,7 +3,6 @@
#include "hmi-debug.h"
const char* gStmEventName[] = {
- "none",
"activate",
"deactivate",
"trans_gear_neutral",
@@ -22,7 +21,6 @@ const char* gStmEventName[] = {
};
const int gStmEventNo[] = {
- STM_EVT_NO_NONE,
STM_EVT_NO_ACTIVATE,
STM_EVT_NO_DEACTIVATE,
STM_EVT_NO_TRANS_GEAR_N,
@@ -41,7 +39,6 @@ const int gStmEventNo[] = {
};
const char* gStmCategoryName[] = {
- "none",
"homescreen",
"map",
"general",
@@ -53,7 +50,6 @@ const char* gStmCategoryName[] = {
};
const int gStmCategoryNo[] = {
- STM_CTG_NO_NONE,
STM_CTG_NO_HOMESCREEN,
STM_CTG_NO_MAP,
STM_CTG_NO_GENERAL,
@@ -89,42 +85,42 @@ const int gStmAreaNo[] = {
};
// String for state
-const char* gStmTransGearStateNo2Name[] = {
- "trans_gear_neutral",
- "trans_gear_not_neutral"
+const char* gStmTransGearStateName[] = {
+ "neutral",
+ "not_neutral"
};
-const char* gStmParkingBrakeStateNo2Name[] = {
- "parking_brake_off",
- "parking_brake_on"
+const char* gStmParkingBrakeStateName[] = {
+ "off",
+ "on"
};
-const char* gStmAccelPedalStateNo2Name[] = {
- "accel_pedal_off",
- "accel_pedal_on"
+const char* gStmAccelPedalStateName[] = {
+ "off",
+ "on"
};
-const char* gStmRunningNo2Name[] = {
- "car_stop",
- "car_run"
+const char* gStmRunningStateNo2Name[] = {
+ "stop",
+ "run"
};
-const char* gStmLampStateNo2Name[] = {
- "lamp_off",
- "lamp_on"
+const char* gStmLampStateName[] = {
+ "off",
+ "on"
};
-const char* gStmLightstatusBrakeStateNo2Name[] = {
- "lightstatus_brake_off",
- "lightstatus_brake_on"
+const char* gStmLightstatusBrakeStateName[] = {
+ "off",
+ "on"
};
-const char* gStmRestrictionModeStateNo2Name[] = {
- "restriction_mode_off",
- "restriction_mode_on"
+const char* gStmRestrictionModeStateName[] = {
+ "off",
+ "on"
};
-const char* gStmLayoutNo2Name[] = {
+const char* gStmLayoutName[] = {
"none",
"pu",
"sa",
@@ -142,7 +138,6 @@ const char* gStmLayoutNo2Name[] = {
};
const char* gStmLayerName[] = {
- "none",
"homescreen",
"apps",
"restriction",
@@ -160,13 +155,13 @@ const char* gStmCarElementName[] = {
};
const char** gStmCarStateNameList[] = {
- gStmTransGearStateNo2Name,
- gStmParkingBrakeStateNo2Name,
- gStmAccelPedalStateNo2Name,
- gStmRunningNo2Name,
- gStmLampStateNo2Name,
- gStmLightstatusBrakeStateNo2Name,
- gStmRestrictionModeStateNo2Name,
+ gStmTransGearStateName,
+ gStmParkingBrakeStateName,
+ gStmAccelPedalStateName,
+ gStmRunningStateNo2Name,
+ gStmLampStateName,
+ gStmLightstatusBrakeStateName,
+ gStmRestrictionModeStateName,
};
stm_state_t g_crr_state;
diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h
index 3748ecd..4c4a980 100644
--- a/src/policy_manager/zipc/dummy_stm.h
+++ b/src/policy_manager/zipc/dummy_stm.h
@@ -24,7 +24,6 @@
#define STM_FALSE 0
// Event number
-#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
@@ -42,7 +41,6 @@
#define STM_EVT_NO_RESTRICTION_MODE_ON 0x10
// Category number
-#define STM_CTG_NO_NONE 0x0100
#define STM_CTG_NO_HOMESCREEN 0x0200
#define STM_CTG_NO_MAP 0x0300
#define STM_CTG_NO_GENERAL 0x0400
@@ -122,8 +120,7 @@ enum stm_layout_ {
};
enum stm_event_ {
- gStmEventNoNone = 0,
- gStmEventNoActive,
+ gStmEventNoActive = 0,
gStmEventNoDeactive,
gStmEventNoTransGearN,
gStmEventNoTransGearNotN,
@@ -141,13 +138,12 @@ enum stm_event_ {
gStmEventNoNum,
- gStmEventNoMin = gStmEventNoNone,
+ gStmEventNoMin = gStmEventNoActive,
gStmEventNoMax = gStmEventNoNum - 1,
};
enum stm_category_ {
- gStmCategoryNoNone = 0,
- gStmCategoryNoHomescreen,
+ gStmCategoryNoHomescreen = 0,
gStmCategoryNoMap,
gStmCategoryNoGeneral,
gStmCategoryNoSplitable,
@@ -157,7 +153,7 @@ enum stm_category_ {
gStmCategoryNoNum,
- gStmCategoryNoMin = gStmCategoryNoNone,
+ gStmCategoryNoMin = gStmCategoryNoHomescreen,
gStmCategoryNoMax = gStmCategoryNoNum - 1,
};
@@ -179,15 +175,14 @@ enum stm_area_ {
};
enum stm_layer_ {
- gStmLayerNoNone = 0,
- gStmLayerNoHomescreen,
+ gStmLayerNoHomescreen = 0,
gStmLayerNoApps,
gStmLayerNoRestriction,
gStmLayerNoOnScreen,
gStmLayerNoNum,
- gStmLayerNoMin = gStmLayerNoNone,
+ gStmLayerNoMin = gStmLayerNoHomescreen,
gStmLayerNoMax = gStmLayerNoNum - 1,
};
@@ -206,17 +201,16 @@ enum stm_car_element_ {
gStmCarElementNoMax = gStmCarElementNoNum - 1,
};
+// String for state
extern const char* gStmEventName[];
extern const int gStmEventNo[];
extern const char* gStmCategoryName[];
extern const int gStmCategoryNo[];
extern const char* gStmAreaName[];
extern const int gStmAreaNo[];
+extern const char* gStmLayoutName[];
extern const char* gStmLayerName[];
extern const char* gStmCarElementName[];
-
-// String for state
-extern const char* gStmLayoutNo2Name[];
extern const char** gStmCarStateNameList[];
// Struct for state