aboutsummaryrefslogtreecommitdiffstats
path: root/src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-07-11 16:21:37 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-07-12 00:27:30 +0000
commit67f414f67ee22ddf40003d1be3fa1d0cb13deb8f (patch)
tree407f01c2af124c97f38d79403b808828b6ea527f /src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c
parent99b6f4d2fcd421d3a760a88a67e511fb6fc98068 (diff)
Add policy table generated by ZIPC for EXAMPLE
To PolicyManager, add the source code of policy table which is generated by ZIPC for EXAMPLE. If use this example, please comment out line 84 and uncomment line 85 in CMakeLists.txt as follows: #set(USE_STM_NAME stub) set(USE_STM_NAME zipc) If try to show split layout, please rename from roles.db.split to roles.db in src/policy_manager/db/. Bug-AGL: SPEC-1537 Change-Id: I4b35f148313e0c5a12c59ed1c2f8eb6fbcf3ea6b Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c')
-rw-r--r--src/policy_manager/stm/zipc/src/StateTransitionor/ZST_StateTransitionor_func.c187
1 files changed, 187 insertions, 0 deletions
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 <string.h>
+
+
+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;
+}
+
+