diff options
Diffstat (limited to 'src/policy_manager/zipc/dummy_stm.c')
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.c | 34 |
1 files changed, 33 insertions, 1 deletions
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; |