Add category "system" for showing specific app on restriction mode ON
[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_ACTIVATE              0x01
28 #define STM_EVT_NO_DEACTIVATE            0x02
29 #define STM_EVT_NO_TRANS_GEAR_N          0x03
30 #define STM_EVT_NO_TRANS_GEAR_NOT_N      0x04
31 #define STM_EVT_NO_PARKING_BRAKE_OFF     0x05
32 #define STM_EVT_NO_PARKING_BRAKE_ON      0x06
33 #define STM_EVT_NO_ACCEL_PEDAL_OFF       0x07
34 #define STM_EVT_NO_ACCEL_PEDAL_ON        0x08
35 #define STM_EVT_NO_TIMER_EXPIRED         0x09
36 #define STM_EVT_NO_LAMP_OFF              0x0A
37 #define STM_EVT_NO_LAMP_ON               0x0B
38 #define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0C
39 #define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON  0x0D
40 #define STM_EVT_NO_RESTRICTION_MODE_OFF  0x0E
41 #define STM_EVT_NO_RESTRICTION_MODE_ON   0x0F
42
43 // Category number
44 #define STM_CTG_NO_NONE         0x0100
45 #define STM_CTG_NO_HOMESCREEN   0x0200
46 #define STM_CTG_NO_MAP          0x0300
47 #define STM_CTG_NO_GENERAL      0x0400
48 #define STM_CTG_NO_SPLITABLE    0x0500
49 #define STM_CTG_NO_POPUP        0x0600
50 #define STM_CTG_NO_SYSTEM_ALERT 0x0700
51 #define STM_CTG_NO_RESTRICTION  0x0800
52 #define STM_CTG_NO_SYSTEM       0x0900
53
54 // Area number
55 #define STM_ARA_NO_FULL                   0x010000
56 #define STM_ARA_NO_NORMAL                 0x020000
57 #define STM_ARA_NO_SPLIT_MAIN             0x030000
58 #define STM_ARA_NO_SPLIT_SUB              0x040000
59 #define STM_ARA_NO_ON_SCREEN              0x050000
60 #define STM_ARA_NO_RESTRICTION_NORMAL     0x060000
61 #define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x070000
62 #define STM_ARA_NO_RESTRICTION_SPLIT_SUB  0x080000
63
64 // Mask
65 #define STM_MSK_EVT_NO 0x0000FF
66 #define STM_MSK_CTG_NO 0x00FF00
67 #define STM_MSK_ARA_NO 0xFF0000
68
69 // Number of events, categories and areas
70 #define STM_NUM_EVT 15
71 //#define STM_NUM_CTG  9
72 #define STM_NUM_ARA  8
73
74 // Enum for state
75 enum stm_trans_gear_state_ {
76     gStmTransGearStateNoN = 0,
77     gStmTransGearStateNoNotN
78 };
79
80 enum stm_parking_brake_state_ {
81     gStmParkingBrakeStateNoOff = 0,
82     gStmParkingBrakeStateNoOn
83 };
84
85 enum stm_accel_pedal_state_ {
86     gStmAccelPedalStateNoOff = 0,
87     gStmAccelPedalStateNoOn
88 };
89
90 enum stm_car_state_ {
91     gStmCarStateNoStop = 0,
92     gStmCarStateNoRun
93 };
94
95 enum stm_lamp_state_ {
96     gStmLampStateNoOff = 0,
97     gStmLampStateNoOn
98 };
99
100 enum stm_lightstatus_brake_state_ {
101     gStmLightstatusBrakeStateNoOff = 0,
102     gStmLightstatusBrakeStateNoOn
103 };
104
105 enum stm_restriction_mode_state_ {
106     gStmRestrictionModeStateNoOff = 0,
107     gStmRestrictionModeStateNoOn
108 };
109
110 enum stm_layout_ {
111     gStmLayoutNoNone = 0,
112     gStmLayoutNoPu,
113     gStmLayoutNoSa,
114     gStmLayoutNoM1,
115     gStmLayoutNoM2,
116     gStmLayoutNoMf,
117     gStmLayoutNoS1,
118     gStmLayoutNoS2,
119     gStmLayoutNoG,
120     gStmLayoutNoHs,
121     gStmLayoutNoRestriction,
122     gStmLayoutNoRestrictionSplitMain,
123     gStmLayoutNoRestrictionSplitSub,
124     gStmLayoutNoSystem,
125 };
126
127 enum stm_category_ {
128     gStmCategoryNoNone = 0,
129     gStmCategoryNoHomescreen,
130     gStmCategoryNoMap,
131     gStmCategoryNoGeneral,
132     gStmCategoryNoSplitable,
133     gStmCategoryNoPopup,
134     gStmCategoryNoSystemAlert,
135     gStmCategoryNoRestriction,
136
137     gStmCategoryNoNum,
138
139     gStmCategoryNoMin = gStmCategoryNoNone,
140     gStmCategoryNoMax = gStmCategoryNoNum - 1,
141 };
142
143 enum stm_layer_ {
144     gStmLayerNoNone = 0,
145     gStmLayerNoHomescreen,
146     gStmLayerNoApps,
147     gStmLayerNoRestriction,
148     gStmLayerNoOnScreen,
149
150     gStmLayerNoNum,
151
152     gStmLayerNoMin = gStmLayerNoNone,
153     gStmLayerNoMax = gStmLayerNoNum - 1,
154 };
155
156 extern const char* gStmEventName[];
157 extern const int gStmEventNo[];
158 extern const char* gStmCategoryName[];
159 extern const int gStmCategoryNo[];
160 extern const char* gStmAreaName[];
161 extern const int gStmAreaNo[];
162 extern const char* gStmLayerName[];
163
164 // String for state
165 extern const char* gStmParkingBrakeStateNo2Name[];
166 extern const char* gStmAccelPedalStateNo2Name[];
167 extern const char* gStmCarStateNo2Name[];
168 extern const char* gStmLampStateNo2Name[];
169 extern const char* gStmLayoutNo2Name[];
170 extern const char* gStmLightstatusBrakeStateNo2Name[];
171 extern const char* gStmRestrictionModeStateNo2Name[];
172
173 // Struct for state
174 typedef struct stm_base_state_ {
175     int is_changed;
176     int state;
177 } stm_base_state;
178
179 typedef struct stm_layer_state_ {
180     stm_base_state on_screen;
181     stm_base_state restriction;
182     stm_base_state apps;
183     stm_base_state homescreen;
184 } stm_layer_state;
185
186 typedef struct {
187     stm_base_state trans_gear;
188     stm_base_state parking_brake;
189     stm_base_state accel_pedal;
190     stm_base_state car;
191     stm_base_state lamp;
192     stm_base_state lightstatus_brake;
193     stm_base_state restriction_mode;
194     stm_base_state layer[gStmLayerNoNum];
195 //    stm_layer_state layer;
196 } stm_state_t;
197
198
199 void stmInitialize();
200 int stmTransitionState(int event_no, stm_state_t* state);
201 void stmUndoState();
202
203
204 #endif  // TMCAGLWM_DUMMY_STM_HPP