diff options
Diffstat (limited to 'src/policy_manager/zipc')
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.c | 539 | ||||
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.h | 286 |
2 files changed, 413 insertions, 412 deletions
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c index 6847e15..e90da3c 100644 --- a/src/policy_manager/zipc/dummy_stm.c +++ b/src/policy_manager/zipc/dummy_stm.c @@ -2,7 +2,7 @@ #include "dummy_stm.h" #include "hmi-debug.h" -const char* gStmEventName[] = { +const char* kStmEventName[] = { "none", "activate", "deactivate", @@ -12,7 +12,6 @@ const char* gStmEventName[] = { "parking_brake_on", "accel_pedal_off", "accel_pedal_on", - "timer_expired", "lamp_off", "lamp_on", "lightstatus_brake_off", @@ -21,7 +20,7 @@ const char* gStmEventName[] = { "restriction_mode_on", }; -const char* gStmCategoryName[] = { +const char* kStmCategoryName[] = { "none", "homescreen", "map", @@ -33,7 +32,7 @@ const char* gStmCategoryName[] = { "system", }; -const char* gStmAreaName[] = { +const char* kStmAreaName[] = { "none", "fullscreen", "normal", @@ -46,42 +45,42 @@ const char* gStmAreaName[] = { }; // String for state -const char* gStmTransGearStateName[] = { +const char* kStmTransGearStateName[] = { "neutral", "not_neutral" }; -const char* gStmParkingBrakeStateName[] = { +const char* kStmParkingBrakeStateName[] = { "off", "on" }; -const char* gStmAccelPedalStateName[] = { +const char* kStmAccelPedalStateName[] = { "off", "on" }; -const char* gStmRunningStateNo2Name[] = { +const char* kStmRunningSttNo2Name[] = { "stop", "run" }; -const char* gStmLampStateName[] = { +const char* kStmLampStateName[] = { "off", "on" }; -const char* gStmLightstatusBrakeStateName[] = { +const char* kStmLightstatusBrakeStateName[] = { "off", "on" }; -const char* gStmRestrictionModeStateName[] = { +const char* kStmRestrictionModeStateName[] = { "off", "on" }; -const char* gStmLayoutName[] = { +const char* kStmLayoutName[] = { "none", "pop_up", "system_alert", @@ -98,14 +97,14 @@ const char* gStmLayoutName[] = { "system.normal", }; -const char* gStmLayerName[] = { +const char* kStmLayerName[] = { "homescreen", "apps", "restriction", "on_screen", }; -const char* gStmCarElementName[] = { +const char* kStmCarElementName[] = { "trans_gear", "parking_brake", "accel_pedal", @@ -115,141 +114,141 @@ const char* gStmCarElementName[] = { "restriction_mode", }; -const char** gStmCarStateNameList[] = { - gStmTransGearStateName, - gStmParkingBrakeStateName, - gStmAccelPedalStateName, - gStmRunningStateNo2Name, - gStmLampStateName, - gStmLightstatusBrakeStateName, - gStmRestrictionModeStateName, +const char** kStmCarStateNameList[] = { + kStmTransGearStateName, + kStmParkingBrakeStateName, + kStmAccelPedalStateName, + kStmRunningSttNo2Name, + kStmLampStateName, + kStmLightstatusBrakeStateName, + kStmRestrictionModeStateName, }; -stm_state_t g_crr_state; -stm_state_t g_prv_state; -int g_prv_on_screen_state_car_stop = 0; -int g_prv_restriction_state_car_stop = 0; -int g_prv_apps_state_car_stop = 0; -int g_map_is_activated = STM_FALSE; +static StmState g_crr_state; +static StmState g_prv_state; +static int g_prv_on_screen_state_car_stop = 0; +static int g_prv_restriction_state_car_stop = 0; +static int g_prv_apps_state_car_stop = 0; +static int g_map_is_activated = STM_FALSE; void stmInitialize() { // Initialize previous state memset(&g_prv_state, 0, sizeof(g_prv_state)); - g_prv_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone; - g_prv_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone; - g_prv_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone; - g_prv_state.layer[gStmLayerNoHomescreen].state = gStmLayoutNoNone; - g_prv_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoN; - g_prv_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOn; - g_prv_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOff; - g_prv_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoStop; - g_prv_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOff; - g_prv_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOn; - g_prv_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOff; + g_prv_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone; + g_prv_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone; + g_prv_state.layer[StmLayerNoApps].state = StmLayoutNoNone; + g_prv_state.layer[StmLayerNoHomescreen].state = StmLayoutNoNone; + g_prv_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoN; + g_prv_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn; + g_prv_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff; + g_prv_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop; + g_prv_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOff; + g_prv_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOn; + g_prv_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff; // Initialize current state g_crr_state = g_prv_state; } -int stmTransitionState(int event, stm_state_t* state) { +int stmTransitionState(int event, StmState* state) { int event_no, category_no, area_no; int on_screen_state, restriction_state, apps_state; int trans_gear_state, parking_brake_state, lightstatus_brake_state, accel_pedal_state, car_state, lamp_state, restriction_mode_state; - event_no = GET_EVENT_FROM_ID(event); - category_no = GET_CATEGORY_FROM_ID(event); - area_no = GET_AREA_FROM_ID(event); + event_no = STM_GET_EVENT_FROM_ID(event); + category_no = STM_GET_CATEGORY_FROM_ID(event); + area_no = STM_GET_AREA_FROM_ID(event); // Backup previous state g_prv_state = g_crr_state; // Get previous state - on_screen_state = g_prv_state.layer[gStmLayerNoOnScreen].state; - restriction_state = g_prv_state.layer[gStmLayerNoRestriction].state; - apps_state = g_prv_state.layer[gStmLayerNoApps].state; - trans_gear_state = g_prv_state.car_element[gStmCarElementNoTransGear].state; - parking_brake_state = g_prv_state.car_element[gStmCarElementNoParkingBrake].state; - accel_pedal_state = g_prv_state.car_element[gStmCarElementNoAccelPedal].state; - car_state = g_prv_state.car_element[gStmCarElementNoRunning].state; - lamp_state = g_prv_state.car_element[gStmCarElementNoLamp].state; - lightstatus_brake_state = g_prv_state.car_element[gStmCarElementNoLightstatusBrake].state; - restriction_mode_state = g_prv_state.car_element[gStmCarElementNoRestrictionMode].state; + on_screen_state = g_prv_state.layer[StmLayerNoOnScreen].state; + restriction_state = g_prv_state.layer[StmLayerNoRestriction].state; + apps_state = g_prv_state.layer[StmLayerNoApps].state; + trans_gear_state = g_prv_state.car_element[StmCarElementNoTransGear].state; + parking_brake_state = g_prv_state.car_element[StmCarElementNoParkingBrake].state; + accel_pedal_state = g_prv_state.car_element[StmCarElementNoAccelPedal].state; + car_state = g_prv_state.car_element[StmCarElementNoRunning].state; + lamp_state = g_prv_state.car_element[StmCarElementNoLamp].state; + lightstatus_brake_state = g_prv_state.car_element[StmCarElementNoLightstatusBrake].state; + restriction_mode_state = g_prv_state.car_element[StmCarElementNoRestrictionMode].state; // Clear flags - g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_FALSE; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_FALSE; - g_crr_state.layer[gStmLayerNoApps].changed = STM_FALSE; - g_crr_state.layer[gStmLayerNoHomescreen].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_FALSE; - g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_FALSE; + g_crr_state.layer[StmLayerNoOnScreen].changed = STM_FALSE; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_FALSE; + g_crr_state.layer[StmLayerNoApps].changed = STM_FALSE; + g_crr_state.layer[StmLayerNoHomescreen].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoRunning].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoLamp].changed = STM_FALSE; + g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_FALSE; // Set car state switch (event_no) { - case STM_EVT_NO_TRANS_GEAR_N: - if (gStmTransGearStateNoN != trans_gear_state) { - g_crr_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoN; - g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_TRUE; + case StmEvtNoTransGearN: + if (StmTransGearSttNoN != trans_gear_state) { + g_crr_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoN; + g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_TRUE; } break; - case STM_EVT_NO_TRANS_GEAR_NOT_N: - if (gStmTransGearStateNoNotN != trans_gear_state) { - g_crr_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoNotN; - g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_TRUE; + case StmEvtNoTransGearNotN: + if (StmTransGearSttNoNotN != trans_gear_state) { + g_crr_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoNotN; + g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_TRUE; } break; - case STM_EVT_NO_PARKING_BRAKE_OFF: - if (gStmParkingBrakeStateNoOff != parking_brake_state) { - g_crr_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOff; - g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_TRUE; + case StmEvtNoParkingBrakeOff: + if (StmParkingBrakeSttNoOff != parking_brake_state) { + g_crr_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOff; + g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_TRUE; } break; - case STM_EVT_NO_PARKING_BRAKE_ON: - if (gStmParkingBrakeStateNoOn != parking_brake_state) { - g_crr_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOn; - g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_TRUE; + case StmEvtNoParkingBrakeOn: + if (StmParkingBrakeSttNoOn != parking_brake_state) { + g_crr_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOn; + g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_TRUE; } break; - case STM_EVT_NO_ACCEL_PEDAL_OFF: - if (gStmAccelPedalStateNoOff != accel_pedal_state) { - g_crr_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOff; - g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_TRUE; + case StmEvtNoAccelPedalOff: + if (StmAccelPedalSttNoOff != accel_pedal_state) { + g_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff; + g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE; } break; - case STM_EVT_NO_ACCEL_PEDAL_ON: - if (gStmAccelPedalStateNoOn != accel_pedal_state) { - g_crr_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOn; - g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_TRUE; + case StmEvtNoAccelPedalOn: + if (StmAccelPedalSttNoOn != accel_pedal_state) { + g_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOn; + g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE; } break; - case STM_EVT_NO_LAMP_OFF: - if (gStmLampStateNoOff != lamp_state) { - g_crr_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOff; - g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_TRUE; + case StmEvtNoLampOff: + if (StmLampSttNoOff != lamp_state) { + g_crr_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOff; + g_crr_state.car_element[StmCarElementNoLamp].changed = STM_TRUE; } break; - case STM_EVT_NO_LAMP_ON: - if (gStmLampStateNoOn != lamp_state) { - g_crr_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOn; - g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_TRUE; + case StmEvtNoLampOn: + if (StmLampSttNoOn != lamp_state) { + g_crr_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOn; + g_crr_state.car_element[StmCarElementNoLamp].changed = STM_TRUE; } break; - case STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF: - if (gStmLightstatusBrakeStateNoOff != lightstatus_brake_state) { - g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOff; - g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_TRUE; + case StmEvtNoLightstatusBrakeOff: + if (StmLightstatusBrakeSttNoOff != lightstatus_brake_state) { + g_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOff; + g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE; } break; - case STM_EVT_NO_LIGHTSTATUS_BRAKE_ON: - if (gStmLightstatusBrakeStateNoOn != lightstatus_brake_state) { - g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOn; - g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_TRUE; + case StmEvtNoLightstatusBrakeOn: + if (StmLightstatusBrakeSttNoOn != lightstatus_brake_state) { + g_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn; + g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE; } break; default: @@ -258,133 +257,133 @@ int stmTransitionState(int event, stm_state_t* state) { } #if 1 // FOR ALS - if (g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed - || g_crr_state.car_element[gStmCarElementNoAccelPedal].changed) { - if ((gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state) - && (gStmAccelPedalStateNoOn == g_crr_state.car_element[gStmCarElementNoAccelPedal].state)){ + if (g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed + || g_crr_state.car_element[StmCarElementNoAccelPedal].changed) { + if ((StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state) + && (StmAccelPedalSttNoOn == g_crr_state.car_element[StmCarElementNoAccelPedal].state)){ #else - if (g_crr_state.car_element[gStmCarElementNoParkingBrake].changed - || g_crr_state.car_element[gStmCarElementNoTransGear].changed) { - if ((gStmParkingBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoParkingBrake].state) - && (gStmTransGearStateNoNotN == g_crr_state.car_element[gStmCarElementNoTransGear].state)){ + if (g_crr_state.car_element[StmCarElementNoParkingBrake].changed + || g_crr_state.car_element[StmCarElementNoTransGear].changed) { + if ((StmParkingBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoParkingBrake].state) + && (StmTransGearSttNoNotN == g_crr_state.car_element[StmCarElementNoTransGear].state)){ #endif - if (gStmRunningNoRun != car_state) { + if (StmRunningNoRun != car_state) { // Car state is changed stop -> run - g_crr_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoRun; - g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_TRUE; + g_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoRun; + g_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE; } } else { - if (gStmRunningNoStop != car_state) { + if (StmRunningNoStop != car_state) { // Car state is changed run -> stop - g_crr_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoStop; - g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_TRUE; + g_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop; + g_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE; } } } // Set restriction mode - if ((STM_EVT_NO_RESTRICTION_MODE_ON == event_no) - && (gStmRestrictionModeStateNoOn != restriction_mode_state)) { + if ((StmEvtNoRestrictionModeOn == event_no) + && (StmRestrictionModeSttNoOn != restriction_mode_state)) { HMI_DEBUG("wm:pm:stm", "Restriction mode OFF -> ON"); // Restriction mode is changed OFF -> ON - g_crr_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOn; - g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_TRUE; + g_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOn; + g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE; // Update on screen layer g_prv_on_screen_state_car_stop = on_screen_state; - g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE; // Update restriction layer g_prv_restriction_state_car_stop = restriction_state; - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; // Update apps layer g_prv_apps_state_car_stop = apps_state; if ((STM_TRUE == g_map_is_activated) - && (gStmLayoutNoSysNml != apps_state)) { - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + && (StmLayoutNoSysNml != apps_state)) { + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; } } - else if ((STM_EVT_NO_RESTRICTION_MODE_OFF == event_no) - && (gStmRestrictionModeStateNoOff != restriction_mode_state)) { + else if ((StmEvtNoRestrictionModeOff == event_no) + && (StmRestrictionModeSttNoOff != restriction_mode_state)) { HMI_DEBUG("wm:pm:stm", "Restriction mode ON -> OFF"); // Restriction mode is changed ON -> OFF - g_crr_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOff; - g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_TRUE; + g_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff; + g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE; // Update on screen layer - g_crr_state.layer[gStmLayerNoOnScreen].state = g_prv_on_screen_state_car_stop; - g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoOnScreen].state = g_prv_on_screen_state_car_stop; + g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE; // Update restriction layer - g_crr_state.layer[gStmLayerNoRestriction].state = g_prv_restriction_state_car_stop; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoRestriction].state = g_prv_restriction_state_car_stop; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; // Update apps layer if (STM_TRUE == g_map_is_activated) { - g_crr_state.layer[gStmLayerNoApps].state = g_prv_apps_state_car_stop; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = g_prv_apps_state_car_stop; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; } } // Set apps/homescreen layer switch (event_no) { - case STM_EVT_NO_ACTIVATE: - if (gStmRestrictionModeStateNoOff == restriction_mode_state) { + case StmEvtNoActivate: + if (StmRestrictionModeSttNoOff == restriction_mode_state) { switch (category_no) { - case STM_CTG_NO_HOMESCREEN: + case StmCtgNoHomescreen: // Homescreen layer - g_crr_state.layer[gStmLayerNoHomescreen].state = gStmLayoutNoHms; - g_crr_state.layer[gStmLayerNoHomescreen].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoHomescreen].state = StmLayoutNoHms; + g_crr_state.layer[StmLayerNoHomescreen].changed = STM_TRUE; // Apps layer - if (gStmLayoutNoNone != apps_state) { - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + if (StmLayoutNoNone != apps_state) { + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; } break; - case STM_CTG_NO_MAP: + case StmCtgNoMap: switch (area_no) { - case STM_AREA_NO_FULL: + case StmAreaNoFullscreen: // Apps layer switch (apps_state) { - case gStmLayoutNoMapFll: + case StmLayoutNoMapFll: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapFll; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapFll; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; } break; - case STM_AREA_NO_NORMAL: + case StmAreaNoNormal: // Apps layer switch (apps_state) { - case gStmLayoutNoMapNml: + case StmLayoutNoMapNml: // nop break; - case gStmLayoutNoSplNml: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplNml: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; } break; - case STM_AREA_NO_SPLIT_MAIN: + case StmAreaNoSplitMain: // Apps layer switch (apps_state) { - case gStmLayoutNoSplNml: - case gStmLayoutNoSplSpl: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplNml: + case StmLayoutNoSplSpl: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; default: // nop @@ -393,17 +392,17 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; - case STM_CTG_NO_GENERAL: + case StmCtgNoGeneral: switch (area_no) { - case STM_AREA_NO_NORMAL: + case StmAreaNoNormal: // Apps layer switch (apps_state) { - case gStmLayoutNoMapFll: + case StmLayoutNoMapFll: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoGenNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoGenNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; } break; @@ -412,17 +411,17 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; - case STM_CTG_NO_SYSTEM: + case StmCtgNoSYSTEM: switch (area_no) { - case STM_AREA_NO_NORMAL: + case StmAreaNoNormal: // Apps layer switch (apps_state) { - case gStmLayoutNoMapFll: + case StmLayoutNoMapFll: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSysNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSysNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; } break; @@ -431,59 +430,59 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; - case STM_CTG_NO_SPLITABLE: + case StmCtgNoSplitable: switch (area_no) { - case STM_AREA_NO_NORMAL: + case StmAreaNoNormal: // Apps layer switch (apps_state) { - case gStmLayoutNoMapNml: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoMapNml: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; - case gStmLayoutNoMapFll: - case gStmLayoutNoSplNml: + case StmLayoutNoMapFll: + case StmLayoutNoSplNml: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; } break; - case STM_AREA_NO_SPLIT_MAIN: + case StmAreaNoSplitMain: // Apps layer switch (apps_state) { - case gStmLayoutNoSplNml: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplNml: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; - case gStmLayoutNoSplSpl: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplSpl: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; default: // nop break; } break; - case STM_AREA_NO_SPLIT_SUB: + case StmAreaNoSplitSub: // Apps layer switch (apps_state) { - case gStmLayoutNoMapNml: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoMapNml: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; - case gStmLayoutNoMapSpl: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoMapSpl: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; - case gStmLayoutNoSplNml: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplNml: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; - case gStmLayoutNoSplSpl: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + case StmLayoutNoSplSpl: + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; default: // nop @@ -501,36 +500,36 @@ int stmTransitionState(int event, stm_state_t* state) { } break; } - else { // (gStmRestrictionModeStateNoOn == restriction_mode_state) + else { // (StmRestrictionModeSttNoOn == restriction_mode_state) switch (category_no) { - case STM_CTG_NO_MAP: + case StmCtgNoMap: switch (area_no) { - case STM_AREA_NO_FULL: - case STM_AREA_NO_NORMAL: - case STM_AREA_NO_SPLIT_MAIN: + case StmAreaNoFullscreen: + case StmAreaNoNormal: + case StmAreaNoSplitMain: // Apps layer switch (apps_state) { - case gStmLayoutNoMapNml: + case StmLayoutNoMapNml: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; } break; } break; - case STM_CTG_NO_SYSTEM: + case StmCtgNoSYSTEM: switch (area_no) { - case STM_AREA_NO_NORMAL: + case StmAreaNoNormal: // Apps layer switch (apps_state) { - case gStmLayoutNoMapFll: + case StmLayoutNoMapFll: // nop break; default: - g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSysNml; - g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE; + g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSysNml; + g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE; break; } break; @@ -541,7 +540,7 @@ int stmTransitionState(int event, stm_state_t* state) { break; } } - case STM_EVT_NO_DEACTIVATE: + case StmEvtNoDeactivate: switch (category_no) { default: // nop @@ -555,20 +554,20 @@ int stmTransitionState(int event, stm_state_t* state) { // Set restriction layer - if (STM_CTG_NO_RESTRICTION == category_no) { - if (STM_EVT_NO_ACTIVATE == event_no) { - if (gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state) { + if (StmCtgNoRestriction == category_no) { + if (StmEvtNoActivate == event_no) { + if (StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state) { switch (area_no) { - case STM_AREA_NO_RESTRICTION_NORMAL: + case StmAreaNoRestrictionNormal: switch (restriction_state) { - case gStmLayoutNoNone: - if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoSplNml) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstNml; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + case StmLayoutNoNone: + if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstNml; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } - else if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoMapSpl) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + else if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } break; default: @@ -576,23 +575,23 @@ int stmTransitionState(int event, stm_state_t* state) { break; } break; - case STM_AREA_NO_RESTRICTION_SPLIT_MAIN: + case StmAreaNoRestrictionSplitMain: switch (restriction_state) { - case gStmLayoutNoNone: - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplMain; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + case StmLayoutNoNone: + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplMain; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; break; default: // nop break; } break; - case STM_AREA_NO_RESTRICTION_SPLIT_SUB: + case StmAreaNoRestrictionSplitSub: switch (restriction_state) { - case gStmLayoutNoNone: - if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoMapSpl) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + case StmLayoutNoNone: + if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } break; default: @@ -606,13 +605,13 @@ int stmTransitionState(int event, stm_state_t* state) { } } } - else if (STM_EVT_NO_DEACTIVATE == event_no) { + else if (StmEvtNoDeactivate == event_no) { switch (restriction_state) { - case gStmLayoutNoRstNml: - case gStmLayoutNoRstSplMain: - case gStmLayoutNoRstSplSub: - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + case StmLayoutNoRstNml: + case StmLayoutNoRstSplMain: + case StmLayoutNoRstSplSub: + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; break; default: // nop @@ -620,49 +619,49 @@ int stmTransitionState(int event, stm_state_t* state) { } } } - else if (g_crr_state.layer[gStmLayerNoApps].changed) { - if (gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state) { - if (gStmLayoutNoMapSpl == g_crr_state.layer[gStmLayerNoApps].state) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + else if (g_crr_state.layer[StmLayerNoApps].changed) { + if (StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state) { + if (StmLayoutNoMapSpl == g_crr_state.layer[StmLayerNoApps].state) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } - else if (gStmLayoutNoSplNml == g_crr_state.layer[gStmLayerNoApps].state) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstNml; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + else if (StmLayoutNoSplNml == g_crr_state.layer[StmLayerNoApps].state) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstNml; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } else { - if (gStmLayoutNoNone != g_crr_state.layer[gStmLayerNoRestriction].state) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + if (StmLayoutNoNone != g_crr_state.layer[StmLayerNoRestriction].state) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } } } else { - if (gStmLayoutNoNone != g_crr_state.layer[gStmLayerNoRestriction].state) { - g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE; + if (StmLayoutNoNone != g_crr_state.layer[StmLayerNoRestriction].state) { + g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE; } } } // Set on screen layer - if (STM_CTG_NO_POPUP == category_no) { - if (STM_EVT_NO_ACTIVATE == event_no) { + if (StmCtgNoPopUp == category_no) { + if (StmEvtNoActivate == event_no) { switch (on_screen_state) { - case gStmLayoutNoNone: - g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoPopUp; - g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE; + case StmLayoutNoNone: + g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoPopUp; + g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE; break; default: // nop break; } } - else if (STM_EVT_NO_DEACTIVATE == event_no) { + else if (StmEvtNoDeactivate == event_no) { switch (on_screen_state) { - case gStmLayoutNoPopUp: - g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone; - g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE; + case StmLayoutNoPopUp: + g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone; + g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE; break; default: // nop @@ -675,10 +674,10 @@ int stmTransitionState(int event, stm_state_t* state) { memcpy(state, &g_crr_state, sizeof(g_crr_state)); if ((STM_FALSE == g_map_is_activated) - && (STM_TRUE == g_crr_state.layer[gStmLayerNoApps].changed) - && ((gStmLayoutNoMapNml == g_crr_state.layer[gStmLayerNoApps].state) - || (gStmLayoutNoMapSpl == g_crr_state.layer[gStmLayerNoApps].state) - || (gStmLayoutNoMapFll == g_crr_state.layer[gStmLayerNoApps].state))) { + && (STM_TRUE == g_crr_state.layer[StmLayerNoApps].changed) + && ((StmLayoutNoMapNml == g_crr_state.layer[StmLayerNoApps].state) + || (StmLayoutNoMapSpl == g_crr_state.layer[StmLayerNoApps].state) + || (StmLayoutNoMapFll == g_crr_state.layer[StmLayerNoApps].state))) { g_map_is_activated = STM_TRUE; } diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h index a7f3032..97f6a5a 100644 --- a/src/policy_manager/zipc/dummy_stm.h +++ b/src/policy_manager/zipc/dummy_stm.h @@ -17,193 +17,195 @@ #ifndef TMCAGLWM_DUMMY_STM_HPP #define TMCAGLWM_DUMMY_STM_HPP -// TODO: This file should be existed in STM -// #define STM_TRUE 1 #define STM_FALSE 0 -// Event number -enum STM_EVT_NO { - STM_EVT_NO_NONE = 0, - 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, - STM_EVT_NO_ACCEL_PEDAL_ON, - STM_EVT_NO_TIMER_EXPIRED, - STM_EVT_NO_LAMP_OFF, - STM_EVT_NO_LAMP_ON, - STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF, - STM_EVT_NO_LIGHTSTATUS_BRAKE_ON, - STM_EVT_NO_RESTRICTION_MODE_OFF, - STM_EVT_NO_RESTRICTION_MODE_ON, - - STM_EVT_NO_NUM, - - STM_EVT_NO_MIN = STM_EVT_NO_NONE, - STM_EVT_NO_MAX = STM_EVT_NO_NUM - 1, -}; - -// Category number -enum STM_CTG_NO { - STM_CTG_NO_NONE = 0, - STM_CTG_NO_HOMESCREEN, - STM_CTG_NO_MAP, - STM_CTG_NO_GENERAL, - STM_CTG_NO_SPLITABLE, - STM_CTG_NO_POPUP, - STM_CTG_NO_SYSTEM_ALERT, - STM_CTG_NO_RESTRICTION, - STM_CTG_NO_SYSTEM, - - STM_CTG_NO_NUM, - - STM_CTG_NO_MIN = STM_CTG_NO_NONE, - STM_CTG_NO_MAX = STM_CTG_NO_NUM - 1, -}; - -// Area number -enum STM_AREA_NO { - STM_AREA_NO_NONE = 0, - STM_AREA_NO_FULL, - STM_AREA_NO_NORMAL, - STM_AREA_NO_SPLIT_MAIN, - STM_AREA_NO_SPLIT_SUB, - STM_AREA_NO_POP_UP, - STM_AREA_NO_RESTRICTION_NORMAL, - STM_AREA_NO_RESTRICTION_SPLIT_MAIN, - STM_AREA_NO_RESTRICTION_SPLIT_SUB, - - STM_AREA_NO_NUM, - - STM_AREA_NO_MIN = STM_AREA_NO_NONE, - STM_AREA_NO_MAX = STM_AREA_NO_NUM - 1, -}; - -#define CREATE_EVENT_ID(evt, ctg, area) \ +#define STM_CREATE_EVENT_ID(evt, ctg, area) \ ((evt) | ((ctg) << 8) | ((area) << 16)) -#define GET_EVENT_FROM_ID(id) \ +#define STM_GET_EVENT_FROM_ID(id) \ ((id) & 0xFF) -#define GET_CATEGORY_FROM_ID(id) \ +#define STM_GET_CATEGORY_FROM_ID(id) \ (((id) >> 8) & 0xFF) -#define GET_AREA_FROM_ID(id) \ +#define STM_GET_AREA_FROM_ID(id) \ (((id) >> 16) & 0xFF) -// Enum for state -enum stm_trans_gear_state_ { - gStmTransGearStateNoN = 0, - gStmTransGearStateNoNotN +// Event number +enum StmEvtNo { + StmEvtNoNone = 0, + StmEvtNoActivate, + StmEvtNoDeactivate, + StmEvtNoTransGearN, + StmEvtNoTransGearNotN, + StmEvtNoParkingBrakeOff, + StmEvtNoParkingBrakeOn, + StmEvtNoAccelPedalOff, + StmEvtNoAccelPedalOn, + StmEvtNoLampOff, + StmEvtNoLampOn, + StmEvtNoLightstatusBrakeOff, + StmEvtNoLightstatusBrakeOn, + StmEvtNoRestrictionModeOff, + StmEvtNoRestrictionModeOn, + + StmEvtNoNum, + + StmEvtNoMin = StmEvtNoNone, + StmEvtNoMax = StmEvtNoNum - 1, }; -enum stm_parking_brake_state_ { - gStmParkingBrakeStateNoOff = 0, - gStmParkingBrakeStateNoOn +// Category number +enum StmCtgNo { + StmCtgNoNone = 0, + StmCtgNoHomescreen, + StmCtgNoMap, + StmCtgNoGeneral, + StmCtgNoSplitable, + StmCtgNoPopUp, + StmCtgNoSystemAlert, + StmCtgNoRestriction, + StmCtgNoSYSTEM, + + StmCtgNoNum, + + StmCtgNoMin = StmCtgNoNone, + StmCtgNoMax = StmCtgNoNum - 1, }; -enum stm_accel_pedal_state_ { - gStmAccelPedalStateNoOff = 0, - gStmAccelPedalStateNoOn +// Area number +enum StmAreaNo { + StmAreaNoNone = 0, + StmAreaNoFullscreen, + StmAreaNoNormal, + StmAreaNoSplitMain, + StmAreaNoSplitSub, + StmAreaNoPopUp, + StmAreaNoRestrictionNormal, + StmAreaNoRestrictionSplitMain, + StmAreaNoRestrictionSplitSub, + + StmAreaNoNum, + + StmAreaNoMin = StmAreaNoNone, + StmAreaNoMax = StmAreaNoNum - 1, }; -enum stm_car_state_ { - gStmRunningNoStop = 0, - gStmRunningNoRun -}; +// Layer number +enum StmLayerNo { + StmLayerNoHomescreen = 0, + StmLayerNoApps, + StmLayerNoRestriction, + StmLayerNoOnScreen, + + StmLayerNoNum, -enum stm_lamp_state_ { - gStmLampStateNoOff = 0, - gStmLampStateNoOn + StmLayerNoMin = StmLayerNoHomescreen, + StmLayerNoMax = StmLayerNoNum - 1, }; -enum stm_lightstatus_brake_state_ { - gStmLightstatusBrakeStateNoOff = 0, - gStmLightstatusBrakeStateNoOn +// Layout number +enum StmLayoutNo { + StmLayoutNoNone = 0, + StmLayoutNoPopUp, + StmLayoutNoSysAlt, + StmLayoutNoMapNml, + StmLayoutNoMapSpl, + StmLayoutNoMapFll, + StmLayoutNoSplNml, + StmLayoutNoSplSpl, + StmLayoutNoGenNml, + StmLayoutNoHms, + StmLayoutNoRstNml, + StmLayoutNoRstSplMain, + StmLayoutNoRstSplSub, + StmLayoutNoSysNml, + + StmLayoutNoNum, + + StmLayoutNoMin = StmLayoutNoNone, + StmLayoutNoMax = StmLayoutNoNum - 1, }; -enum stm_restriction_mode_state_ { - gStmRestrictionModeStateNoOff = 0, - gStmRestrictionModeStateNoOn +// Car element number +enum StmCarElementNo { + StmCarElementNoTransGear = 0, + StmCarElementNoParkingBrake, + StmCarElementNoAccelPedal, + StmCarElementNoRunning, + StmCarElementNoLamp, + StmCarElementNoLightstatusBrake, + StmCarElementNoRestrictionMode, + + StmCarElementNoNum, + + StmCarElementNoMin = StmCarElementNoTransGear, + StmCarElementNoMax = StmCarElementNoNum - 1, }; -enum stm_layout_ { - gStmLayoutNoNone = 0, - gStmLayoutNoPopUp, - gStmLayoutNoSysAlt, - gStmLayoutNoMapNml, - gStmLayoutNoMapSpl, - gStmLayoutNoMapFll, - gStmLayoutNoSplNml, - gStmLayoutNoSplSpl, - gStmLayoutNoGenNml, - gStmLayoutNoHms, - gStmLayoutNoRstNml, - gStmLayoutNoRstSplMain, - gStmLayoutNoRstSplSub, - gStmLayoutNoSysNml, - - gStmLayoutNoNum, - - gStmLayoutNoMin = gStmLayoutNoNone, - gStmLayoutNoMax = gStmLayoutNoNum - 1, +// Enum for car element state +enum StmTransGearStt { + StmTransGearSttNoN = 0, + StmTransGearSttNoNotN }; -enum stm_layer_ { - gStmLayerNoHomescreen = 0, - gStmLayerNoApps, - gStmLayerNoRestriction, - gStmLayerNoOnScreen, +enum StmParkingBrakeStt { + StmParkingBrakeSttNoOff = 0, + StmParkingBrakeSttNoOn +}; - gStmLayerNoNum, +enum StmAccelPedalStt { + StmAccelPedalSttNoOff = 0, + StmAccelPedalSttNoOn +}; - gStmLayerNoMin = gStmLayerNoHomescreen, - gStmLayerNoMax = gStmLayerNoNum - 1, +enum StmCarStt { + StmRunningNoStop = 0, + StmRunningNoRun }; -enum stm_car_element_ { - gStmCarElementNoTransGear = 0, - gStmCarElementNoParkingBrake, - gStmCarElementNoAccelPedal, - gStmCarElementNoRunning, - gStmCarElementNoLamp, - gStmCarElementNoLightstatusBrake, - gStmCarElementNoRestrictionMode, +enum StmLampStt { + StmLampSttNoOff = 0, + StmLampSttNoOn +}; - gStmCarElementNoNum, +enum StmLightstatusBrakeStt { + StmLightstatusBrakeSttNoOff = 0, + StmLightstatusBrakeSttNoOn +}; - gStmCarElementNoMin = gStmCarElementNoTransGear, - gStmCarElementNoMax = gStmCarElementNoNum - 1, +enum StmRestrictionModeSttNo { + StmRestrictionModeSttNoOff = 0, + StmRestrictionModeSttNoOn }; // String for state -extern const char* gStmEventName[]; -extern const char* gStmCategoryName[]; -extern const char* gStmAreaName[]; -extern const char* gStmLayoutName[]; -extern const char* gStmLayerName[]; -extern const char* gStmCarElementName[]; -extern const char** gStmCarStateNameList[]; +extern const char* kStmEventName[]; +extern const char* kStmCategoryName[]; +extern const char* kStmAreaName[]; +extern const char* kStmLayoutName[]; +extern const char* kStmLayerName[]; +extern const char* kStmCarElementName[]; +extern const char** kStmCarStateNameList[]; // Struct for state -typedef struct stm_base_state_ { +typedef struct StmBaseState { int changed; int state; -} stm_base_state; +} StmBaseState; typedef struct { - stm_base_state car_element[gStmCarElementNoNum]; - stm_base_state layer[gStmLayerNoNum]; -} stm_state_t; + StmBaseState car_element[StmCarElementNoNum]; + StmBaseState layer[StmLayerNoNum]; +} StmState; +// API void stmInitialize(); -int stmTransitionState(int event_no, stm_state_t* state); +int stmTransitionState(int event_no, StmState* state); void stmUndoState(); + #endif // TMCAGLWM_DUMMY_STM_HPP |