X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=apps%2Fagl-service-windowmanager-2017.git;a=blobdiff_plain;f=src%2Fpolicy_manager%2Fstm%2Fzipc%2Fsrc%2FStateTransitionor%2FZST_StateTransitionor_func.c;fp=src%2Fpolicy_manager%2Fstm%2Fzipc%2Fsrc%2FStateTransitionor%2FZST_StateTransitionor_func.c;h=77db170384e5722dbf350db145c88be6943244ea;hp=0000000000000000000000000000000000000000;hb=67f414f67ee22ddf40003d1be3fa1d0cb13deb8f;hpb=99b6f4d2fcd421d3a760a88a67e511fb6fc98068 diff --git a/src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c b/src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c new file mode 100644 index 0000000..77db170 --- /dev/null +++ b/src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c @@ -0,0 +1,187 @@ +/************************************************************/ +/* ZST_StateTransitionor_func.c */ +/* Function and variable source file */ +/* ZIPC Designer Version 1.2.0 */ +/************************************************************/ +#include "ZST_include.h" + +/************************************************************* + Function definition +*************************************************************/ + +#include + + +const char* kStmEventName[] = { + "none", + "activate", + "deactivate", + "restriction_mode_off", + "restriction_mode_1_on", + "restriction_mode_2_on", + "undo", +}; + +const char* kStmCategoryName[] = { + "none", + "homescreen", + "map", + "general", + "splitable", + "pop_up", + "system_alert", + "restriction", + "system", + "software_keyboard", +}; + +const char* kStmAreaName[] = { + "none", + "fullscreen", + "normal.full", + "split.main", + "split.sub", + "on_screen", + "restriction.normal", + "restriction.split.main", + "restriction.split.sub", + "software_keyboard", +}; + +const char* kStmLayoutName[] = { + "none", + "pop_up", + "system_alert", + "map.normal", + "map.split", + "map.fullscreen", + "splitable.normal", + "splitable.split", + "general.normal", + "homescreen", + "restriction.normal", + "restriction.split.main", + "restriction.split.sub", + "system.normal", + "software_keyboard", +}; + +const char* kStmLayerName[] = { + "homescreen", + "apps", + "near_homescreen", + "restriction", + "on_screen", +}; + +const char* kStmModeName[] = { + "trans_gear", + "parking_brake", + "accel_pedal", + "running", + "lamp", + "lightstatus_brake", + "restriction_mode", +}; + +const char* kStmRestrictionModeStateName[] = { + "off", + "1on", + "2on", +}; + +const char** kStmModeStateNameList[] = { + kStmRestrictionModeStateName, +}; + + +//================================= +// API +//================================= +/** + * Initialize STM + */ +void stmInitialize() { + // Initialize previous state + memset(&g_stm_prv_state, 0, sizeof(g_stm_prv_state)); + + // Initialize current state + g_stm_crr_state = g_stm_prv_state; + + /* Initialize restriction mode state */ + stm_rem_initialize(); + stm_rem_initialize_variable(); + + // Initialize homecsreen layer + stm_hsl_initialize(); + stm_hsl_initialize_variable(); + + // Initialize apps layer + stm_apl_initialize(); + stm_apl_initialize_variable(); + + // Initialize near_homecsreen layer + stm_nhl_initialize(); + stm_nhl_initialize_variable(); + + /* Initialize restriction layer */ + stm_rel_initialize(); + stm_rel_initialize_variable(); + + g_stm_map_is_activated = STM_FALSE; +} + +/** + * Transition State + */ +int stmTransitionState(int event_id, StmState* state) { + g_stm_event = STM_GET_EVENT_FROM_ID(event_id); + g_stm_category = STM_GET_CATEGORY_FROM_ID(event_id); + g_stm_area = STM_GET_AREA_FROM_ID(event_id); + + // restriction mode + stm_rem_event_call(); + + // homescreen layer + stm_hsl_event_call(); + + // apps layer + stm_apl_event_call(); + + // near_homecsreen layer + stm_nhl_event_call(); + + // restriction layer + stm_rel_event_call(); + + // on_screen layer + stm_osl_event_call(); + + // Copy current state for return + memcpy(state, &g_stm_crr_state, sizeof(g_stm_crr_state)); + + return 0; +} + +/** + * Undo State + */ +void stmUndoState() { + g_stm_event = StmEvtNoUndo; + + // apps layer + stm_apl_event_call(); + + // near_homecsreen layer + stm_nhl_event_call(); + + // restriction layer + stm_rel_event_call(); + + // on_screen layer + stm_osl_event_call(); + + g_stm_crr_state = g_stm_prv_state; +} + +