Add policy table generated by ZIPC for EXAMPLE
[apps/agl-service-windowmanager-2017.git] / src / policy_manager / stm / zipc / src / StateTransitionor / RestrictionMode / ZREM_RestrictionMode.c
1 /************************************************************/
2 /*     ZREM_RestrictionMode.c                               */
3 /*     RestrictionMode State transition model source file   */
4 /*     ZIPC Designer Version 1.2.0                          */
5 /************************************************************/
6 #include "../ZST_include.h"
7
8 /* State management variable */
9 static uint8_t ZREM_RestrictionModeState[ZREM_RESTRICTIONMODESTATENOMAX];
10
11 static void ZREM_RestrictionModes0e1( void );
12 static void ZREM_RestrictionModes0e2( void );
13 static void ZREM_RestrictionModes1e0( void );
14 static void ZREM_RestrictionModes0Event( void );
15 static void ZREM_RestrictionModes1Event( void );
16 static void ZREM_RestrictionModes2Event( void );
17
18 /****************************************/
19 /* Action function                      */
20 /*   STM : RestrictionMode              */
21 /*   State : restriction_mode_off( No 0 ) */
22 /*   Event : evt_restriction_mode_1_on( No 1 ) */
23 /****************************************/
24 static void ZREM_RestrictionModes0e1( void )
25 {
26     ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES1;
27     stm_rem_start_activity_restriction_mode_1_on();
28 }
29
30 /****************************************/
31 /* Action function                      */
32 /*   STM : RestrictionMode              */
33 /*   State : restriction_mode_off( No 0 ) */
34 /*   Event : evt_restriction_mode_2_on( No 2 ) */
35 /****************************************/
36 static void ZREM_RestrictionModes0e2( void )
37 {
38     ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES2;
39     stm_rem_start_activity_restriction_mode_2_on();
40 }
41
42 /****************************************/
43 /* Action function                      */
44 /*   STM : RestrictionMode              */
45 /*   State : restriction_mode_1_on( No 1 ) */
46 /*   Event : evt_restriction_mode_off( No 0 ) */
47 /****************************************/
48 static void ZREM_RestrictionModes1e0( void )
49 {
50     ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
51     stm_rem_start_activity_restriction_mode_off();
52 }
53
54 /****************************************/
55 /* Event appraisal function             */
56 /*   STM : RestrictionMode              */
57 /*   State : restriction_mode_off( No 0 ) */
58 /****************************************/
59 static void ZREM_RestrictionModes0Event( void )
60 {
61     /*evt_restriction_mode_1_on*/
62     if( g_stm_event == StmEvtNoRestrictionMode1On )
63     {
64         ZREM_RestrictionModes0e1();
65     }
66     /*evt_restriction_mode_2_on*/
67     else if( g_stm_event == StmEvtNoRestrictionMode2On )
68     {
69         ZREM_RestrictionModes0e2();
70     }
71     else
72     {
73         /*Else and default design have not done.*/
74         /*Please confirm the STM and design else and default.*/
75     }
76 }
77
78 /****************************************/
79 /* Event appraisal function             */
80 /*   STM : RestrictionMode              */
81 /*   State : restriction_mode_1_on( No 1 ) */
82 /****************************************/
83 static void ZREM_RestrictionModes1Event( void )
84 {
85     /*evt_restriction_mode_off*/
86     if( g_stm_event == StmEvtNoRestrictionModeOff )
87     {
88         ZREM_RestrictionModes1e0();
89     }
90     /*evt_restriction_mode_2_on*/
91     else if( g_stm_event == StmEvtNoRestrictionMode2On )
92     {
93         ZREM_RestrictionModes0e2();
94     }
95     else
96     {
97         /*Else and default design have not done.*/
98         /*Please confirm the STM and design else and default.*/
99     }
100 }
101
102 /****************************************/
103 /* Event appraisal function             */
104 /*   STM : RestrictionMode              */
105 /*   State : restriction_mode_2_on( No 2 ) */
106 /****************************************/
107 static void ZREM_RestrictionModes2Event( void )
108 {
109     /*evt_restriction_mode_off*/
110     if( g_stm_event == StmEvtNoRestrictionModeOff )
111     {
112         ZREM_RestrictionModes1e0();
113     }
114     /*evt_restriction_mode_1_on*/
115     else if( g_stm_event == StmEvtNoRestrictionMode1On )
116     {
117         ZREM_RestrictionModes0e1();
118     }
119     else
120     {
121         /*Else and default design have not done.*/
122         /*Please confirm the STM and design else and default.*/
123     }
124 }
125
126 /****************************************/
127 /* Event call function                  */
128 /*   STM : RestrictionMode              */
129 /****************************************/
130 void stm_rem_event_call( void )
131 {
132     stm_rem_start_stm();
133     switch( ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] )
134     {
135     case ZREM_RESTRICTIONMODES0:
136         ZREM_RestrictionModes0Event();
137         break;
138     case ZREM_RESTRICTIONMODES1:
139         ZREM_RestrictionModes1Event();
140         break;
141     case ZREM_RESTRICTIONMODES2:
142         ZREM_RestrictionModes2Event();
143         break;
144     default:
145         /*Not accessible to this else (default).*/
146         break;
147     }
148 }
149
150 /****************************************/
151 /* Initial function                     */
152 /*   STM : RestrictionMode              */
153 /****************************************/
154 void stm_rem_initialize( void )
155 {
156     ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
157     stm_rem_start_activity_restriction_mode_off();
158 }
159
160 /****************************************/
161 /* Terminate function                   */
162 /*   STM : RestrictionMode              */
163 /****************************************/
164 void ZREM_RestrictionModeTerminate( void )
165 {
166     ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODETERMINATE;
167 }
168