Use enum instead of constant macro
[apps/agl-service-windowmanager.git] / src / policy_manager / zipc / dummy_stm.h
1 /*
2  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef TMCAGLWM_DUMMY_STM_HPP
18 #define TMCAGLWM_DUMMY_STM_HPP
19
20 // TODO: This file should be existed in STM
21
22 //
23 #define STM_TRUE 1
24 #define STM_FALSE 0
25
26 // Event number
27 #define STM_EVT_NO_NONE                  0x01
28 #define STM_EVT_NO_ACTIVATE              0x02
29 #define STM_EVT_NO_DEACTIVATE            0x03
30 #define STM_EVT_NO_TRANS_GEAR_N          0x04
31 #define STM_EVT_NO_TRANS_GEAR_NOT_N      0x05
32 #define STM_EVT_NO_PARKING_BRAKE_OFF     0x06
33 #define STM_EVT_NO_PARKING_BRAKE_ON      0x07
34 #define STM_EVT_NO_ACCEL_PEDAL_OFF       0x08
35 #define STM_EVT_NO_ACCEL_PEDAL_ON        0x09
36 #define STM_EVT_NO_TIMER_EXPIRED         0x0A
37 #define STM_EVT_NO_LAMP_OFF              0x0B
38 #define STM_EVT_NO_LAMP_ON               0x0C
39 #define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0D
40 #define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON  0x0E
41 #define STM_EVT_NO_RESTRICTION_MODE_OFF  0x0F
42 #define STM_EVT_NO_RESTRICTION_MODE_ON   0x10
43
44 // Category number
45 #define STM_CTG_NO_NONE         0x0100
46 #define STM_CTG_NO_HOMESCREEN   0x0200
47 #define STM_CTG_NO_MAP          0x0300
48 #define STM_CTG_NO_GENERAL      0x0400
49 #define STM_CTG_NO_SPLITABLE    0x0500
50 #define STM_CTG_NO_POPUP        0x0600
51 #define STM_CTG_NO_SYSTEM_ALERT 0x0700
52 #define STM_CTG_NO_RESTRICTION  0x0800
53 #define STM_CTG_NO_SYSTEM       0x0900
54
55 // Area number
56 #define STM_ARA_NO_NONE                   0x010000
57 #define STM_ARA_NO_FULL                   0x020000
58 #define STM_ARA_NO_NORMAL                 0x030000
59 #define STM_ARA_NO_SPLIT_MAIN             0x040000
60 #define STM_ARA_NO_SPLIT_SUB              0x050000
61 #define STM_ARA_NO_ON_SCREEN              0x060000
62 #define STM_ARA_NO_RESTRICTION_NORMAL     0x070000
63 #define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x080000
64 #define STM_ARA_NO_RESTRICTION_SPLIT_SUB  0x090000
65
66 // Mask
67 #define STM_MSK_EVT_NO 0x0000FF
68 #define STM_MSK_CTG_NO 0x00FF00
69 #define STM_MSK_ARA_NO 0xFF0000
70
71 // Enum for state
72 enum stm_trans_gear_state_ {
73     gStmTransGearStateNoN = 0,
74     gStmTransGearStateNoNotN
75 };
76
77 enum stm_parking_brake_state_ {
78     gStmParkingBrakeStateNoOff = 0,
79     gStmParkingBrakeStateNoOn
80 };
81
82 enum stm_accel_pedal_state_ {
83     gStmAccelPedalStateNoOff = 0,
84     gStmAccelPedalStateNoOn
85 };
86
87 enum stm_car_state_ {
88     gStmCarStateNoStop = 0,
89     gStmCarStateNoRun
90 };
91
92 enum stm_lamp_state_ {
93     gStmLampStateNoOff = 0,
94     gStmLampStateNoOn
95 };
96
97 enum stm_lightstatus_brake_state_ {
98     gStmLightstatusBrakeStateNoOff = 0,
99     gStmLightstatusBrakeStateNoOn
100 };
101
102 enum stm_restriction_mode_state_ {
103     gStmRestrictionModeStateNoOff = 0,
104     gStmRestrictionModeStateNoOn
105 };
106
107 enum stm_layout_ {
108     gStmLayoutNoNone = 0,
109     gStmLayoutNoPu,
110     gStmLayoutNoSa,
111     gStmLayoutNoM1,
112     gStmLayoutNoM2,
113     gStmLayoutNoMf,
114     gStmLayoutNoS1,
115     gStmLayoutNoS2,
116     gStmLayoutNoG,
117     gStmLayoutNoHs,
118     gStmLayoutNoRestriction,
119     gStmLayoutNoRestrictionSplitMain,
120     gStmLayoutNoRestrictionSplitSub,
121     gStmLayoutNoSystem,
122 };
123
124 enum stm_event_ {
125     gStmEventNoNone = 0,
126     gStmEventNoActive,
127     gStmEventNoDeactive,
128     gStmEventNoTransGearN,
129     gStmEventNoTransGearNotN,
130     gStmEventNoParkingBrakeOff,
131     gStmEventNoParkingBrakeOn,
132     gStmEventNoAccelPedalOff,
133     gStmEventNoAccelPedalOn,
134     gStmEventNoTimerExpired,
135     gStmEventNoLampOff,
136     gStmEventNoLampOn,
137     gStmEventNoLightstatusBrakeOff,
138     gStmEventNoLightstatusBrakeOn,
139     gStmEventNoRestrictionModeOff,
140     gStmEventNoRestrictionModeOn,
141
142     gStmEventNoNum,
143
144     gStmEventNoMin = gStmEventNoNone,
145     gStmEventNoMax = gStmEventNoNum - 1,
146 };
147
148 enum stm_category_ {
149     gStmCategoryNoNone = 0,
150     gStmCategoryNoHomescreen,
151     gStmCategoryNoMap,
152     gStmCategoryNoGeneral,
153     gStmCategoryNoSplitable,
154     gStmCategoryNoPopup,
155     gStmCategoryNoSystemAlert,
156     gStmCategoryNoRestriction,
157
158     gStmCategoryNoNum,
159
160     gStmCategoryNoMin = gStmCategoryNoNone,
161     gStmCategoryNoMax = gStmCategoryNoNum - 1,
162 };
163
164 enum stm_area_ {
165     gStmAreaNoNone = 0,
166     gStmAreaNoFullscreen,
167     gStmAreaNoNormal,
168     gStmAreaNoSplitMain,
169     gStmAreaNoSplitSub,
170     gStmAreaNoOnScreen,
171     gStmAreaNoRestrictionNormal,
172     gStmAreaNoRestrictionSplitMain,
173     gStmAreaNoRestrictionSplitSub,
174
175     gStmAreaNoNum,
176
177     gStmAreaNoMin = gStmAreaNoNone,
178     gStmAreaNoMax = gStmAreaNoNum - 1,
179 };
180
181 enum stm_layer_ {
182     gStmLayerNoNone = 0,
183     gStmLayerNoHomescreen,
184     gStmLayerNoApps,
185     gStmLayerNoRestriction,
186     gStmLayerNoOnScreen,
187
188     gStmLayerNoNum,
189
190     gStmLayerNoMin = gStmLayerNoNone,
191     gStmLayerNoMax = gStmLayerNoNum - 1,
192 };
193
194 extern const char* gStmEventName[];
195 extern const int gStmEventNo[];
196 extern const char* gStmCategoryName[];
197 extern const int gStmCategoryNo[];
198 extern const char* gStmAreaName[];
199 extern const int gStmAreaNo[];
200 extern const char* gStmLayerName[];
201
202 // String for state
203 extern const char* gStmParkingBrakeStateNo2Name[];
204 extern const char* gStmAccelPedalStateNo2Name[];
205 extern const char* gStmCarStateNo2Name[];
206 extern const char* gStmLampStateNo2Name[];
207 extern const char* gStmLayoutNo2Name[];
208 extern const char* gStmLightstatusBrakeStateNo2Name[];
209 extern const char* gStmRestrictionModeStateNo2Name[];
210
211 // Struct for state
212 typedef struct stm_base_state_ {
213     int is_changed;
214     int state;
215 } stm_base_state;
216
217 typedef struct stm_layer_state_ {
218     stm_base_state on_screen;
219     stm_base_state restriction;
220     stm_base_state apps;
221     stm_base_state homescreen;
222 } stm_layer_state;
223
224 typedef struct {
225     stm_base_state trans_gear;
226     stm_base_state parking_brake;
227     stm_base_state accel_pedal;
228     stm_base_state car;
229     stm_base_state lamp;
230     stm_base_state lightstatus_brake;
231     stm_base_state restriction_mode;
232     stm_base_state layer[gStmLayerNoNum];
233 //    stm_layer_state layer;
234 } stm_state_t;
235
236
237 void stmInitialize();
238 int stmTransitionState(int event_no, stm_state_t* state);
239 void stmUndoState();
240
241
242 #endif  // TMCAGLWM_DUMMY_STM_HPP