aboutsummaryrefslogtreecommitdiffstats
path: root/src/policy_manager
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-05-14 13:10:00 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-05-14 13:10:00 +0900
commitb126caef1760902eb863af8ea892c4db9b9663f9 (patch)
treeb70b06dd54bb585ab29d9109e9e608754ef1a0f8 /src/policy_manager
parent3a3f1ddf5c67403d61341034d5d189d13a900474 (diff)
Add policy of switchng accel pedal status to dummy stm
Change-Id: Iea389d3899f2d01430400374ed0ab0f2fe882ec8 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager')
-rw-r--r--src/policy_manager/policy_manager.cpp13
-rw-r--r--src/policy_manager/zipc/dummy_stm.c34
-rw-r--r--src/policy_manager/zipc/dummy_stm.h25
3 files changed, 63 insertions, 9 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index 20c1e79..a40bb48 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -145,6 +145,19 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
stm::gStmParkingBrakeStateNo2Name[crr_state.parking_brake.state],
json_out);
+ // "accel_pedal": {
+ // "is_changed": <bool>,
+ // "state": <const char*>
+ // },
+ HMI_DEBUG("wm", "accelerator pedal state (is_changed:%d state:%d:%s)",
+ crr_state.accel_pedal.is_changed,
+ crr_state.accel_pedal.state,
+ stm::gStmAccelPedalStateNo2Name[crr_state.accel_pedal.state]);
+ this->addStateToJson("accel_pedal",
+ crr_state.accel_pedal.is_changed,
+ stm::gStmAccelPedalStateNo2Name[crr_state.accel_pedal.state],
+ json_out);
+
// "car": {
// "is_changed": <bool>,
// "state": <const char*>
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 0246141..f174866 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -6,6 +6,8 @@ const char* gStmEventName[] = {
"deactivate",
"parking_brake_off",
"parking_brake_on",
+ "accel_pedal_off",
+ "accel_pedal_on",
"car_stop",
"car_run",
"timer_expired",
@@ -18,6 +20,8 @@ const int gStmEventNo[] = {
STM_EVT_NO_DEACTIVATE,
STM_EVT_NO_PARKING_BRAKE_OFF,
STM_EVT_NO_PARKING_BRAKE_ON,
+ STM_EVT_NO_ACCEL_PEDAL_OFF,
+ STM_EVT_NO_ACCEL_PEDAL_ON,
STM_EVT_NO_CAR_STOP,
STM_EVT_NO_CAR_RUN,
STM_EVT_NO_TIMER_EXPIRED,
@@ -73,6 +77,11 @@ const char* gStmParkingBrakeStateNo2Name[] = {
"parking_brake_on"
};
+const char* gStmAccelPedalStateNo2Name[] = {
+ "accel_pedal_off",
+ "accel_pedal_on"
+};
+
const char* gStmCarStateNo2Name[] = {
"car_stop",
"car_run"
@@ -112,6 +121,7 @@ void stmInitialize() {
g_prv_state.layer.apps.state = gStmLayoutNoNone;
g_prv_state.layer.homescreen.state = gStmLayoutNoNone;
g_prv_state.parking_brake.state = gStmParkingBrakeStateNoOn;
+ g_prv_state.accel_pedal.state = gStmAccelPedalStateNoOff;
g_prv_state.car.state = gStmCarStateNoStop;
g_prv_state.lamp.state = gStmLampStateNoOff;
@@ -121,7 +131,8 @@ void stmInitialize() {
int stmTransitionState(int event, stm_state_t* state) {
int event_no, category_no, area_no;
- int restriction_state, apps_state, parking_brake_state, car_state, lamp_state;
+ int restriction_state, apps_state;
+ int parking_brake_state, accel_pedal_state, car_state, lamp_state;
event_no = event & STM_MSK_EVT_NO;
category_no = event & STM_MSK_CTG_NO;
@@ -134,6 +145,7 @@ int stmTransitionState(int event, stm_state_t* state) {
restriction_state = g_prv_state.layer.restriction.state;
apps_state = g_prv_state.layer.apps.state;
parking_brake_state = g_prv_state.parking_brake.state;
+ accel_pedal_state = g_prv_state.accel_pedal.state;
car_state = g_prv_state.car.state;
lamp_state = g_prv_state.lamp.state;
@@ -143,6 +155,7 @@ int stmTransitionState(int event, stm_state_t* state) {
g_crr_state.layer.apps.is_changed = STM_FALSE;
g_crr_state.layer.homescreen.is_changed = STM_FALSE;
g_crr_state.parking_brake.is_changed = STM_FALSE;
+ g_crr_state.accel_pedal.is_changed = STM_FALSE;
g_crr_state.car.is_changed = STM_FALSE;
g_crr_state.lamp.is_changed = STM_FALSE;
@@ -364,6 +377,25 @@ int stmTransitionState(int event, stm_state_t* state) {
g_crr_state.parking_brake.is_changed = STM_TRUE;
}
break;
+ case STM_EVT_NO_ACCEL_PEDAL_OFF:
+ if (gStmAccelPedalStateNoOff != accel_pedal_state) {
+ g_crr_state.layer.apps.state = g_prv_apps_state_car_stop;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+
+ g_crr_state.accel_pedal.state = gStmAccelPedalStateNoOff;
+ g_crr_state.accel_pedal.is_changed = STM_TRUE;
+ }
+ break;
+ case STM_EVT_NO_ACCEL_PEDAL_ON:
+ if (gStmAccelPedalStateNoOn != accel_pedal_state) {
+ g_prv_apps_state_car_stop = apps_state;
+ g_crr_state.layer.apps.state = gStmLayoutNoM1;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+
+ g_crr_state.accel_pedal.state = gStmAccelPedalStateNoOn;
+ g_crr_state.accel_pedal.is_changed = STM_TRUE;
+ }
+ break;
case STM_EVT_NO_CAR_STOP:
if (gStmCarStateNoStop != car_state) {
g_crr_state.layer.apps.state = g_prv_apps_state_car_stop;
diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h
index 38d3912..4c71ac7 100644
--- a/src/policy_manager/zipc/dummy_stm.h
+++ b/src/policy_manager/zipc/dummy_stm.h
@@ -28,11 +28,13 @@
#define STM_EVT_NO_DEACTIVATE 0x02
#define STM_EVT_NO_PARKING_BRAKE_OFF 0x03
#define STM_EVT_NO_PARKING_BRAKE_ON 0x04
-#define STM_EVT_NO_CAR_STOP 0x05
-#define STM_EVT_NO_CAR_RUN 0x06
-#define STM_EVT_NO_TIMER_EXPIRED 0x07
-#define STM_EVT_NO_LAMP_OFF 0x08
-#define STM_EVT_NO_LAMP_ON 0x09
+#define STM_EVT_NO_ACCEL_PEDAL_OFF 0x05
+#define STM_EVT_NO_ACCEL_PEDAL_ON 0x06
+#define STM_EVT_NO_CAR_STOP 0x07
+#define STM_EVT_NO_CAR_RUN 0x08
+#define STM_EVT_NO_TIMER_EXPIRED 0x09
+#define STM_EVT_NO_LAMP_OFF 0x0A
+#define STM_EVT_NO_LAMP_ON 0x0B
// Category number
#define STM_CTG_NO_HOMESCREEN 0x0100
@@ -59,9 +61,9 @@
#define STM_MSK_ARA_NO 0xFF0000
// Number of events, categories and areas
-#define STM_NUM_EVT 9
-#define STM_NUM_CTG 7
-#define STM_NUM_ARA 8
+#define STM_NUM_EVT 11
+#define STM_NUM_CTG 7
+#define STM_NUM_ARA 8
// Enum for state
enum stm_parking_brake_state_ {
@@ -69,6 +71,11 @@ enum stm_parking_brake_state_ {
gStmParkingBrakeStateNoOn
};
+enum stm_accel_pedal_state_ {
+ gStmAccelPedalStateNoOff = 0,
+ gStmAccelPedalStateNoOn
+};
+
enum stm_car_state_ {
gStmCarStateNoStop = 0,
gStmCarStateNoRun
@@ -105,6 +112,7 @@ extern const int gStmAreaNo[];
// String for state
extern const char* gStmParkingBrakeStateNo2Name[];
+extern const char* gStmAccelPedalStateNo2Name[];
extern const char* gStmCarStateNo2Name[];
extern const char* gStmLampStateNo2Name[];
extern const char* gStmLayoutNo2Name[];
@@ -124,6 +132,7 @@ typedef struct stm_layer_state_ {
typedef struct {
stm_base_state parking_brake;
+ stm_base_state accel_pedal;
stm_base_state car;
stm_base_state lamp;
stm_layer_state layer;