aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/policy_manager/policy_manager.cpp70
-rw-r--r--src/policy_manager/zipc/dummy_stm.c451
2 files changed, 281 insertions, 240 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index a40bb48..b790794 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -185,38 +185,25 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_out);
// "layers": [
- // {
- // "on_screen": {
- // "is_changed": <bool>,
- // "state": <const char*>
- // }
- // },
json_object* json_layer = json_object_new_array();
- json_object* json_tmp = json_object_new_object();
- HMI_DEBUG("wm", "on_screen state (is_changed:%d state:%d:%s)",
- crr_state.layer.on_screen.is_changed,
- crr_state.layer.on_screen.state,
- stm::gStmLayoutNo2Name[crr_state.layer.on_screen.state]);
- this->addStateToJson("on_screen",
- crr_state.layer.on_screen.is_changed,
- stm::gStmLayoutNo2Name[crr_state.layer.on_screen.state],
- &json_tmp);
- json_object_array_add(json_layer, json_tmp);
+ json_object* json_tmp;
// {
- // "restriction": {
+ // "homescreen": {
// "is_changed": <bool>,
// "state": <const char*>
// }
// },
- HMI_DEBUG("wm", "restriction state (is_changed:%d state:%d:%s)",
- crr_state.layer.restriction.is_changed,
- crr_state.layer.restriction.state,
- stm::gStmLayoutNo2Name[crr_state.layer.restriction.state]);
+ // ]
+ // }
+ HMI_DEBUG("wm", "homescreen state (is_changed:%d state:%d:%s)",
+ crr_state.layer.homescreen.is_changed,
+ crr_state.layer.homescreen.state,
+ stm::gStmLayoutNo2Name[crr_state.layer.homescreen.state]);
json_tmp = json_object_new_object();
- this->addStateToJson("restriction",
- crr_state.layer.restriction.is_changed,
- stm::gStmLayoutNo2Name[crr_state.layer.restriction.state],
+ this->addStateToJson("homescreen",
+ crr_state.layer.homescreen.is_changed,
+ stm::gStmLayoutNo2Name[crr_state.layer.homescreen.state],
&json_tmp);
json_object_array_add(json_layer, json_tmp);
@@ -238,21 +225,36 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_object_array_add(json_layer, json_tmp);
// {
- // "homescreen": {
+ // "restriction": {
// "is_changed": <bool>,
// "state": <const char*>
// }
// },
- // ]
- // }
- HMI_DEBUG("wm", "homescreen state (is_changed:%d state:%d:%s)",
- crr_state.layer.homescreen.is_changed,
- crr_state.layer.homescreen.state,
- stm::gStmLayoutNo2Name[crr_state.layer.homescreen.state]);
+ HMI_DEBUG("wm", "restriction state (is_changed:%d state:%d:%s)",
+ crr_state.layer.restriction.is_changed,
+ crr_state.layer.restriction.state,
+ stm::gStmLayoutNo2Name[crr_state.layer.restriction.state]);
json_tmp = json_object_new_object();
- this->addStateToJson("homescreen",
- crr_state.layer.homescreen.is_changed,
- stm::gStmLayoutNo2Name[crr_state.layer.homescreen.state],
+ this->addStateToJson("restriction",
+ crr_state.layer.restriction.is_changed,
+ stm::gStmLayoutNo2Name[crr_state.layer.restriction.state],
+ &json_tmp);
+ json_object_array_add(json_layer, json_tmp);
+
+ // {
+ // "on_screen": {
+ // "is_changed": <bool>,
+ // "state": <const char*>
+ // }
+ // },
+ HMI_DEBUG("wm", "on_screen state (is_changed:%d state:%d:%s)",
+ crr_state.layer.on_screen.is_changed,
+ crr_state.layer.on_screen.state,
+ stm::gStmLayoutNo2Name[crr_state.layer.on_screen.state]);
+ json_tmp = json_object_new_object();
+ this->addStateToJson("on_screen",
+ crr_state.layer.on_screen.is_changed,
+ stm::gStmLayoutNo2Name[crr_state.layer.on_screen.state],
&json_tmp);
json_object_array_add(json_layer, json_tmp);
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 095e5b0..a7d7b67 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -168,212 +168,9 @@ int stmTransitionState(int event, stm_state_t* state) {
g_crr_state.car.is_changed = STM_FALSE;
g_crr_state.lamp.is_changed = STM_FALSE;
+
+ // Set car state
switch (event_no) {
- case STM_EVT_NO_ACTIVATE:
- switch (category_no) {
- case STM_CTG_NO_HOMESCREEN:
- // Apps layer
- g_crr_state.layer.apps.state = gStmLayoutNoNone;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
-
- // Homescreen layer
- g_crr_state.layer.homescreen.state = gStmLayoutNoHs;
- g_crr_state.layer.homescreen.is_changed = STM_TRUE;
- break;
- case STM_CTG_NO_MAP:
- switch (area_no) {
- case STM_ARA_NO_FULL:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoMf:
- // nop
- break;
- default:
- g_crr_state.layer.apps.state = gStmLayoutNoMf;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- }
- break;
- case STM_ARA_NO_NORMAL:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoM1:
- // nop
- break;
- case gStmLayoutNoS1:
- g_crr_state.layer.apps.state = gStmLayoutNoM2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- default:
- g_crr_state.layer.apps.state = gStmLayoutNoM1;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- }
- break;
- case STM_ARA_NO_SPLIT_MAIN:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoS1:
- case gStmLayoutNoS2:
- g_crr_state.layer.apps.state = gStmLayoutNoS2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- }
- break;
- case STM_CTG_NO_GENERAL:
- switch (area_no) {
- case STM_ARA_NO_NORMAL:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoMf:
- // nop
- break;
- default:
- g_crr_state.layer.apps.state = gStmLayoutNoG;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- }
- break;
- default:
- // nop
- break;
- }
- break;
- case STM_CTG_NO_SPLITABLE:
- switch (area_no) {
- case STM_ARA_NO_NORMAL:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoM1:
- g_crr_state.layer.apps.state = gStmLayoutNoM2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- case gStmLayoutNoMf:
- case gStmLayoutNoS1:
- // nop
- break;
- default:
- g_crr_state.layer.apps.state = gStmLayoutNoS1;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- }
- break;
- case STM_ARA_NO_SPLIT_MAIN:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoS1:
- g_crr_state.layer.apps.state = gStmLayoutNoS2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- case gStmLayoutNoS2:
- g_crr_state.layer.apps.state = gStmLayoutNoS2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- case STM_ARA_NO_SPLIT_SUB:
- // Apps layer
- switch (apps_state) {
- case gStmLayoutNoM1:
- g_crr_state.layer.apps.state = gStmLayoutNoM2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- case gStmLayoutNoM2:
- g_crr_state.layer.apps.state = gStmLayoutNoM2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- case gStmLayoutNoS1:
- g_crr_state.layer.apps.state = gStmLayoutNoS2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- case gStmLayoutNoS2:
- g_crr_state.layer.apps.state = gStmLayoutNoS2;
- g_crr_state.layer.apps.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- default:
- // nop
- break;
- }
- break;
- case STM_CTG_NO_RESTRICTION:
- switch (area_no) {
- case STM_ARA_NO_RESTRICTION_NORMAL:
- // restriction Layer
- switch (restriction_state) {
- case gStmLayoutNoNone:
- g_crr_state.layer.restriction.state = gStmLayoutNoRestriction;
- g_crr_state.layer.restriction.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- case STM_ARA_NO_RESTRICTION_SPLIT_MAIN:
- // restriction Layer
- switch (restriction_state) {
- case gStmLayoutNoNone:
- g_crr_state.layer.restriction.state = gStmLayoutNoRestrictionSplitMain;
- g_crr_state.layer.restriction.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- case STM_ARA_NO_RESTRICTION_SPLIT_SUB:
- // restriction Layer
- switch (restriction_state) {
- case gStmLayoutNoNone:
- g_crr_state.layer.restriction.state = gStmLayoutNoRestrictionSplitSub;
- g_crr_state.layer.restriction.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- break;
- default:
- // nop
- break;
- }
- break;
- default:
- // nop
- break;
- }
- case STM_EVT_NO_DEACTIVATE:
- switch (category_no) {
- case STM_CTG_NO_RESTRICTION:
- // restriction Layer
- switch (restriction_state) {
- case gStmLayoutNoRestriction:
- case gStmLayoutNoRestrictionSplitMain:
- case gStmLayoutNoRestrictionSplitSub:
- g_crr_state.layer.restriction.state = gStmLayoutNoNone;
- g_crr_state.layer.restriction.is_changed = STM_TRUE;
- break;
- default:
- // nop
- break;
- }
- default:
- // nop
- break;
- }
- break;
case STM_EVT_NO_TRANS_GEAR_N:
if (gStmTransGearStateNoN != trans_gear_state) {
g_crr_state.trans_gear.state = gStmTransGearStateNoN;
@@ -427,7 +224,6 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
- // Set car state
#if 1 // FOR ALS
if (g_crr_state.parking_brake.is_changed
|| g_crr_state.accel_pedal.is_changed) {
@@ -472,6 +268,249 @@ int stmTransitionState(int event, stm_state_t* state) {
}
}
+ // Set apps/homescreen layer
+ switch (event_no) {
+ case STM_EVT_NO_ACTIVATE:
+ if (gStmCarStateNoStop == car_state) {
+ switch (category_no) {
+ case STM_CTG_NO_HOMESCREEN:
+ // Apps layer
+ g_crr_state.layer.apps.state = gStmLayoutNoNone;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+
+ // Homescreen layer
+ g_crr_state.layer.homescreen.state = gStmLayoutNoHs;
+ g_crr_state.layer.homescreen.is_changed = STM_TRUE;
+ break;
+ case STM_CTG_NO_MAP:
+ switch (area_no) {
+ case STM_ARA_NO_FULL:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoMf:
+ // nop
+ break;
+ default:
+ g_crr_state.layer.apps.state = gStmLayoutNoMf;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ }
+ break;
+ case STM_ARA_NO_NORMAL:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoM1:
+ // nop
+ break;
+ case gStmLayoutNoS1:
+ g_crr_state.layer.apps.state = gStmLayoutNoM2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ default:
+ g_crr_state.layer.apps.state = gStmLayoutNoM1;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ }
+ break;
+ case STM_ARA_NO_SPLIT_MAIN:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoS1:
+ case gStmLayoutNoS2:
+ g_crr_state.layer.apps.state = gStmLayoutNoS2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ }
+ break;
+ case STM_CTG_NO_GENERAL:
+ switch (area_no) {
+ case STM_ARA_NO_NORMAL:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoMf:
+ // nop
+ break;
+ default:
+ g_crr_state.layer.apps.state = gStmLayoutNoG;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ }
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ case STM_CTG_NO_SPLITABLE:
+ switch (area_no) {
+ case STM_ARA_NO_NORMAL:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoM1:
+ g_crr_state.layer.apps.state = gStmLayoutNoM2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ case gStmLayoutNoMf:
+ case gStmLayoutNoS1:
+ // nop
+ break;
+ default:
+ g_crr_state.layer.apps.state = gStmLayoutNoS1;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ }
+ break;
+ case STM_ARA_NO_SPLIT_MAIN:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoS1:
+ g_crr_state.layer.apps.state = gStmLayoutNoS2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ case gStmLayoutNoS2:
+ g_crr_state.layer.apps.state = gStmLayoutNoS2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ case STM_ARA_NO_SPLIT_SUB:
+ // Apps layer
+ switch (apps_state) {
+ case gStmLayoutNoM1:
+ g_crr_state.layer.apps.state = gStmLayoutNoM2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ case gStmLayoutNoM2:
+ g_crr_state.layer.apps.state = gStmLayoutNoM2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ case gStmLayoutNoS1:
+ g_crr_state.layer.apps.state = gStmLayoutNoS2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ case gStmLayoutNoS2:
+ g_crr_state.layer.apps.state = gStmLayoutNoS2;
+ g_crr_state.layer.apps.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ }
+ case STM_EVT_NO_DEACTIVATE:
+ switch (category_no) {
+ default:
+ // nop
+ break;
+ }
+ break;
+ default:
+ // nop
+ break;
+ }
+
+
+ // Set restriction layer
+ if (STM_CTG_NO_RESTRICTION == category_no) {
+ if (STM_EVT_NO_ACTIVATE == event_no) {
+ if (gStmParkingBrakeStateNoOff == g_crr_state.parking_brake.state) {
+ switch (area_no) {
+ case STM_ARA_NO_RESTRICTION_NORMAL:
+ switch (restriction_state) {
+ case gStmLayoutNoNone:
+ g_crr_state.layer.restriction.state = gStmLayoutNoRestriction;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ case STM_ARA_NO_RESTRICTION_SPLIT_MAIN:
+ switch (restriction_state) {
+ case gStmLayoutNoNone:
+ g_crr_state.layer.restriction.state = gStmLayoutNoRestrictionSplitMain;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ case STM_ARA_NO_RESTRICTION_SPLIT_SUB:
+ switch (restriction_state) {
+ case gStmLayoutNoNone:
+ g_crr_state.layer.restriction.state = gStmLayoutNoRestrictionSplitSub;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ break;
+ default:
+ // nop
+ break;
+ }
+ }
+ }
+ else if (STM_EVT_NO_DEACTIVATE == event_no) {
+ switch (restriction_state) {
+ case gStmLayoutNoRestriction:
+ case gStmLayoutNoRestrictionSplitMain:
+ case gStmLayoutNoRestrictionSplitSub:
+ g_crr_state.layer.restriction.state = gStmLayoutNoNone;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ break;
+ default:
+ // nop
+ break;
+ }
+ }
+ }
+ else if (g_crr_state.layer.apps.is_changed) {
+ if (gStmParkingBrakeStateNoOff == g_crr_state.parking_brake.state) {
+ if (gStmLayoutNoM2 == g_crr_state.layer.apps.state) {
+ g_crr_state.layer.restriction.state = gStmLayoutNoRestrictionSplitSub;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ }
+ else if (gStmLayoutNoS1 == g_crr_state.layer.apps.state) {
+ g_crr_state.layer.restriction.state = gStmLayoutNoRestriction;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ }
+ else {
+ if (gStmLayoutNoNone != g_crr_state.layer.restriction.state) {
+ g_crr_state.layer.restriction.state = gStmLayoutNoNone;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ }
+ }
+ }
+ else {
+ if (gStmLayoutNoNone != g_crr_state.layer.restriction.state) {
+ g_crr_state.layer.restriction.state = gStmLayoutNoNone;
+ g_crr_state.layer.restriction.is_changed = STM_TRUE;
+ }
+ }
+ }
+
// Copy current state for return
memcpy(state, &g_crr_state, sizeof(g_crr_state));