PolicyManager can judge the current car state
[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_PARKING_BRAKE_OFF 0x03
30 #define STM_EVT_NO_PARKING_BRAKE_ON  0x04
31 #define STM_EVT_NO_ACCEL_PEDAL_OFF   0x05
32 #define STM_EVT_NO_ACCEL_PEDAL_ON    0x06
33 #define STM_EVT_NO_TIMER_EXPIRED     0x07
34 #define STM_EVT_NO_LAMP_OFF          0x08
35 #define STM_EVT_NO_LAMP_ON           0x09
36
37 // Category number
38 #define STM_CTG_NO_HOMESCREEN   0x0100
39 #define STM_CTG_NO_MAP          0x0200
40 #define STM_CTG_NO_GENERAL      0x0300
41 #define STM_CTG_NO_SPLITABLE    0x0400
42 #define STM_CTG_NO_POPUP        0x0500
43 #define STM_CTG_NO_SYSTEM_ALERT 0x0600
44 #define STM_CTG_NO_RESTRICTION  0x0700
45
46 // Area number
47 #define STM_ARA_NO_FULL                   0x010000
48 #define STM_ARA_NO_NORMAL                 0x020000
49 #define STM_ARA_NO_SPLIT_MAIN             0x030000
50 #define STM_ARA_NO_SPLIT_SUB              0x040000
51 #define STM_ARA_NO_ON_SCREEN              0x050000
52 #define STM_ARA_NO_RESTRICTION_NORMAL     0x060000
53 #define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x070000
54 #define STM_ARA_NO_RESTRICTION_SPLIT_SUB  0x080000
55
56 // Mask
57 #define STM_MSK_EVT_NO 0x0000FF
58 #define STM_MSK_CTG_NO 0x00FF00
59 #define STM_MSK_ARA_NO 0xFF0000
60
61 // Number of events, categories and areas
62 #define STM_NUM_EVT  9
63 #define STM_NUM_CTG  7
64 #define STM_NUM_ARA  8
65
66 // Enum for state
67 enum stm_parking_brake_state_ {
68     gStmParkingBrakeStateNoOff = 0,
69     gStmParkingBrakeStateNoOn
70 };
71
72 enum stm_accel_pedal_state_ {
73     gStmAccelPedalStateNoOff = 0,
74     gStmAccelPedalStateNoOn
75 };
76
77 enum stm_car_state_ {
78     gStmCarStateNoStop = 0,
79     gStmCarStateNoRun
80 };
81
82 enum stm_lamp_state_ {
83     gStmLampStateNoOff = 0,
84     gStmLampStateNoOn
85 };
86
87 enum stm_layout_ {
88     gStmLayoutNoNone = 0,
89     gStmLayoutNoPu,
90     gStmLayoutNoSa,
91     gStmLayoutNoM1,
92     gStmLayoutNoM2,
93     gStmLayoutNoMf,
94     gStmLayoutNoS1,
95     gStmLayoutNoS2,
96     gStmLayoutNoG,
97     gStmLayoutNoHs,
98     gStmLayoutNoRestriction,
99     gStmLayoutNoRestrictionSplitMain,
100     gStmLayoutNoRestrictionSplitSub,
101 };
102
103
104 extern const char* gStmEventName[];
105 extern const int gStmEventNo[];
106 extern const char* gStmCategoryName[];
107 extern const int gStmCategoryNo[];
108 extern const char* gStmAreaName[];
109 extern const int gStmAreaNo[];
110
111 // String for state
112 extern const char* gStmParkingBrakeStateNo2Name[];
113 extern const char* gStmAccelPedalStateNo2Name[];
114 extern const char* gStmCarStateNo2Name[];
115 extern const char* gStmLampStateNo2Name[];
116 extern const char* gStmLayoutNo2Name[];
117
118 // Struct for state
119 typedef struct stm_base_state_ {
120     int is_changed;
121     int state;
122 } stm_base_state;
123
124 typedef struct stm_layer_state_ {
125     stm_base_state on_screen;
126     stm_base_state restriction;
127     stm_base_state apps;
128     stm_base_state homescreen;
129 } stm_layer_state;
130
131 typedef struct {
132     stm_base_state parking_brake;
133     stm_base_state accel_pedal;
134     stm_base_state car;
135     stm_base_state lamp;
136     stm_layer_state layer;
137 } stm_state_t;
138
139
140 void stmInitialize();
141 int stmTransitionState(int event_no, stm_state_t* state);
142
143
144 #endif  // TMCAGLWM_DUMMY_STM_HPP