From e6d867b95a5e32ce5f50106b05020bd9888ae8a3 Mon Sep 17 00:00:00 2001 From: Yuta Doi Date: Wed, 9 May 2018 16:09:40 +0900 Subject: Add policy of switching parking brake state to dummy stm for validation Change-Id: I547e578526d6ce934c9fa8aa86170cea5a2f17e7 Signed-off-by: Yuta Doi --- src/policy_manager/policy_manager.cpp | 2 +- src/policy_manager/zipc/dummy_stm.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/policy_manager') diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp index 47d9eac..9ece573 100644 --- a/src/policy_manager/policy_manager.cpp +++ b/src/policy_manager/policy_manager.cpp @@ -139,7 +139,7 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) { HMI_DEBUG("wm", "parking brake state (is_changed:%d state:%d:%s)", this->current_state_.parking_brake.is_changed, this->current_state_.parking_brake.state, - stm::gStmCarStateNo2Name[this->current_state_.parking_brake.state]); + stm::gStmParkingBrakeStateNo2Name[this->current_state_.parking_brake.state]); this->addStateToJson("parking_brake", this->current_state_.parking_brake.is_changed, stm::gStmParkingBrakeStateNo2Name[this->current_state_.parking_brake.state], diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c index 78e25d7..459f58c 100644 --- a/src/policy_manager/zipc/dummy_stm.c +++ b/src/policy_manager/zipc/dummy_stm.c @@ -94,7 +94,7 @@ int g_prv_apps_state_car_stop = 0; int stmTransitionState(int event, stm_state_t* state) { int event_no, category_no, area_no; - int apps_state, car_state, lamp_state; + int apps_state, parking_brake_state, car_state, lamp_state; event_no = event & STM_MSK_EVT_NO; category_no = event & STM_MSK_CTG_NO; @@ -105,6 +105,7 @@ int stmTransitionState(int event, stm_state_t* state) { // Get previous state apps_state = g_prv_state.layer.apps.state; + parking_brake_state = g_prv_state.parking_brake.state; car_state = g_prv_state.car.state; lamp_state = g_prv_state.lamp.state; @@ -254,6 +255,18 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; + case STM_EVT_NO_PARKING_BRAKE_OFF: + if (gStmParkingBrakeStateNoOff != parking_brake_state) { + g_crr_state.parking_brake.state = gStmParkingBrakeStateNoOff; + g_crr_state.parking_brake.is_changed = STM_TRUE; + } + break; + case STM_EVT_NO_PARKING_BRAKE_ON: + if (gStmParkingBrakeStateNoOn != parking_brake_state) { + g_crr_state.parking_brake.state = gStmParkingBrakeStateNoOn; + g_crr_state.parking_brake.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; -- cgit 1.2.3-korg