diff options
author | 2018-05-14 18:39:23 +0900 | |
---|---|---|
committer | 2018-05-14 18:39:23 +0900 | |
commit | a21dd2b748731f1bbe956da6d22a87cc1412de30 (patch) | |
tree | d5b1fd447ded544b3a20385d1e48362b10f58c6f /src/policy_manager | |
parent | bfadb522b21256fde7283746b90116c237e57a5b (diff) |
Add transmission gear position event in PolicyManager
Change-Id: Ibf528b5ab3877d2cf094920fd0723873fb12647c
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager')
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.c | 55 | ||||
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.h | 24 |
2 files changed, 59 insertions, 20 deletions
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c index 968b086..095e5b0 100644 --- a/src/policy_manager/zipc/dummy_stm.c +++ b/src/policy_manager/zipc/dummy_stm.c @@ -4,6 +4,8 @@ const char* gStmEventName[] = { "activate", "deactivate", + "trans_gear_neutral", + "trans_gear_not_neutral", "parking_brake_off", "parking_brake_on", "accel_pedal_off", @@ -16,6 +18,8 @@ const char* gStmEventName[] = { const int gStmEventNo[] = { STM_EVT_NO_ACTIVATE, STM_EVT_NO_DEACTIVATE, + STM_EVT_NO_TRANS_GEAR_N, + STM_EVT_NO_TRANS_GEAR_NOT_N, STM_EVT_NO_PARKING_BRAKE_OFF, STM_EVT_NO_PARKING_BRAKE_ON, STM_EVT_NO_ACCEL_PEDAL_OFF, @@ -68,6 +72,11 @@ const int gStmAreaNo[] = { }; // String for state +const char* gStmTransGearStateNo2Name[] = { + "trans_gear_neutral", + "trans_gear_not_neutral" +}; + const char* gStmParkingBrakeStateNo2Name[] = { "parking_brake_off", "parking_brake_on" @@ -117,6 +126,7 @@ void stmInitialize() { g_prv_state.layer.restriction.state = gStmLayoutNoNone; g_prv_state.layer.apps.state = gStmLayoutNoNone; g_prv_state.layer.homescreen.state = gStmLayoutNoNone; + g_prv_state.trans_gear.state = gStmTransGearStateNoN; g_prv_state.parking_brake.state = gStmParkingBrakeStateNoOn; g_prv_state.accel_pedal.state = gStmAccelPedalStateNoOff; g_prv_state.car.state = gStmCarStateNoStop; @@ -129,7 +139,7 @@ void stmInitialize() { int stmTransitionState(int event, stm_state_t* state) { int event_no, category_no, area_no; int restriction_state, apps_state; - int parking_brake_state, accel_pedal_state, car_state, lamp_state; + int trans_gear_state, parking_brake_state, accel_pedal_state, car_state, lamp_state; event_no = event & STM_MSK_EVT_NO; category_no = event & STM_MSK_CTG_NO; @@ -140,21 +150,23 @@ int stmTransitionState(int event, stm_state_t* state) { // Get previous 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; + apps_state = g_prv_state.layer.apps.state; + trans_gear_state = g_prv_state.trans_gear.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; // Clear flags - g_crr_state.layer.on_screen.is_changed = STM_FALSE; + g_crr_state.layer.on_screen.is_changed = STM_FALSE; g_crr_state.layer.restriction.is_changed = STM_FALSE; - g_crr_state.layer.apps.is_changed = STM_FALSE; - g_crr_state.layer.homescreen.is_changed = STM_FALSE; + g_crr_state.layer.apps.is_changed = STM_FALSE; + g_crr_state.layer.homescreen.is_changed = STM_FALSE; + g_crr_state.trans_gear.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; + 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; switch (event_no) { case STM_EVT_NO_ACTIVATE: @@ -362,6 +374,18 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; + case STM_EVT_NO_TRANS_GEAR_N: + if (gStmTransGearStateNoN != trans_gear_state) { + g_crr_state.trans_gear.state = gStmTransGearStateNoN; + g_crr_state.trans_gear.is_changed = STM_TRUE; + } + break; + case STM_EVT_NO_TRANS_GEAR_NOT_N: + if (gStmTransGearStateNoNotN != trans_gear_state) { + g_crr_state.trans_gear.state = gStmTransGearStateNoNotN; + g_crr_state.trans_gear.is_changed = STM_TRUE; + } + break; case STM_EVT_NO_PARKING_BRAKE_OFF: if (gStmParkingBrakeStateNoOff != parking_brake_state) { g_crr_state.parking_brake.state = gStmParkingBrakeStateNoOff; @@ -404,10 +428,17 @@ int stmTransitionState(int event, stm_state_t* state) { } // Set car state +#if 1 // FOR ALS if (g_crr_state.parking_brake.is_changed || g_crr_state.accel_pedal.is_changed) { if ((gStmParkingBrakeStateNoOff == g_crr_state.parking_brake.state) && (gStmAccelPedalStateNoOn == g_crr_state.accel_pedal.state)){ +#else + if (g_crr_state.parking_brake.is_changed + || g_crr_state.trans_gear.is_changed) { + if ((gStmParkingBrakeStateNoOff == g_crr_state.parking_brake.state) + && (gStmTransGearStateNoNotN == g_crr_state.trans_gear.state)){ +#endif if (gStmCarStateNoRun != car_state) { // Car state is changed stop -> run g_crr_state.car.state = gStmCarStateNoRun; diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h index 42c5148..bb99af7 100644 --- a/src/policy_manager/zipc/dummy_stm.h +++ b/src/policy_manager/zipc/dummy_stm.h @@ -26,13 +26,15 @@ // Event number #define STM_EVT_NO_ACTIVATE 0x01 #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_ACCEL_PEDAL_OFF 0x05 -#define STM_EVT_NO_ACCEL_PEDAL_ON 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_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 // Category number #define STM_CTG_NO_HOMESCREEN 0x0100 @@ -59,11 +61,16 @@ #define STM_MSK_ARA_NO 0xFF0000 // Number of events, categories and areas -#define STM_NUM_EVT 9 +#define STM_NUM_EVT 11 #define STM_NUM_CTG 7 #define STM_NUM_ARA 8 // Enum for state +enum stm_trans_gear_state_ { + gStmTransGearStateNoN = 0, + gStmTransGearStateNoNotN +}; + enum stm_parking_brake_state_ { gStmParkingBrakeStateNoOff = 0, gStmParkingBrakeStateNoOn @@ -129,6 +136,7 @@ typedef struct stm_layer_state_ { } stm_layer_state; typedef struct { + stm_base_state trans_gear; stm_base_state parking_brake; stm_base_state accel_pedal; stm_base_state car; |