Add lightstatus brake ON/OFF event
[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
41 // Category number
42 #define STM_CTG_NO_HOMESCREEN   0x0100
43 #define STM_CTG_NO_MAP          0x0200
44 #define STM_CTG_NO_GENERAL      0x0300
45 #define STM_CTG_NO_SPLITABLE    0x0400
46 #define STM_CTG_NO_POPUP        0x0500
47 #define STM_CTG_NO_SYSTEM_ALERT 0x0600
48 #define STM_CTG_NO_RESTRICTION  0x0700
49
50 // Area number
51 #define STM_ARA_NO_FULL                   0x010000
52 #define STM_ARA_NO_NORMAL                 0x020000
53 #define STM_ARA_NO_SPLIT_MAIN             0x030000
54 #define STM_ARA_NO_SPLIT_SUB              0x040000
55 #define STM_ARA_NO_ON_SCREEN              0x050000
56 #define STM_ARA_NO_RESTRICTION_NORMAL     0x060000
57 #define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x070000
58 #define STM_ARA_NO_RESTRICTION_SPLIT_SUB  0x080000
59
60 // Mask
61 #define STM_MSK_EVT_NO 0x0000FF
62 #define STM_MSK_CTG_NO 0x00FF00
63 #define STM_MSK_ARA_NO 0xFF0000
64
65 // Number of events, categories and areas
66 #define STM_NUM_EVT 13
67 #define STM_NUM_CTG  7
68 #define STM_NUM_ARA  8
69
70 // Enum for state
71 enum stm_trans_gear_state_ {
72     gStmTransGearStateNoN = 0,
73     gStmTransGearStateNoNotN
74 };
75
76 enum stm_parking_brake_state_ {
77     gStmParkingBrakeStateNoOff = 0,
78     gStmParkingBrakeStateNoOn
79 };
80
81 enum stm_accel_pedal_state_ {
82     gStmAccelPedalStateNoOff = 0,
83     gStmAccelPedalStateNoOn
84 };
85
86 enum stm_car_state_ {
87     gStmCarStateNoStop = 0,
88     gStmCarStateNoRun
89 };
90
91 enum stm_lamp_state_ {
92     gStmLampStateNoOff = 0,
93     gStmLampStateNoOn
94 };
95
96 enum stm_lightstatus_brake_state_ {
97     gStmLightstatusBrakeStateNoOff = 0,
98     gStmLightstatusBrakeStateNoOn
99 };
100
101 enum stm_layout_ {
102     gStmLayoutNoNone = 0,
103     gStmLayoutNoPu,
104     gStmLayoutNoSa,
105     gStmLayoutNoM1,
106     gStmLayoutNoM2,
107     gStmLayoutNoMf,
108     gStmLayoutNoS1,
109     gStmLayoutNoS2,
110     gStmLayoutNoG,
111     gStmLayoutNoHs,
112     gStmLayoutNoRestriction,
113     gStmLayoutNoRestrictionSplitMain,
114     gStmLayoutNoRestrictionSplitSub,
115 };
116
117
118 extern const char* gStmEventName[];
119 extern const int gStmEventNo[];
120 extern const char* gStmCategoryName[];
121 extern const int gStmCategoryNo[];
122 extern const char* gStmAreaName[];
123 extern const int gStmAreaNo[];
124
125 // String for state
126 extern const char* gStmParkingBrakeStateNo2Name[];
127 extern const char* gStmAccelPedalStateNo2Name[];
128 extern const char* gStmCarStateNo2Name[];
129 extern const char* gStmLampStateNo2Name[];
130 extern const char* gStmLayoutNo2Name[];
131 extern const char* gStmLightstatusBrakeStateNo2Name[];
132
133 // Struct for state
134 typedef struct stm_base_state_ {
135     int is_changed;
136     int state;
137 } stm_base_state;
138
139 typedef struct stm_layer_state_ {
140     stm_base_state on_screen;
141     stm_base_state restriction;
142     stm_base_state apps;
143     stm_base_state homescreen;
144 } stm_layer_state;
145
146 typedef struct {
147     stm_base_state trans_gear;
148     stm_base_state parking_brake;
149     stm_base_state accel_pedal;
150     stm_base_state car;
151     stm_base_state lamp;
152     stm_base_state lightstatus_brake;
153     stm_layer_state layer;
154 } stm_state_t;
155
156
157 void stmInitialize();
158 int stmTransitionState(int event_no, stm_state_t* state);
159
160
161 #endif  // TMCAGLWM_DUMMY_STM_HPP