Fix place of connection.json
[apps/agl-service-windowmanager.git] / policy_manager / stm / stm.c
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 #include <string.h>
18 #include "stm.h"
19 #include "stm_inner.h"
20
21 const char* kStmEventName[] = {
22     "none",
23     "activate",
24     "deactivate",
25     "trans_gear_neutral",
26     "trans_gear_not_neutral",
27     "parking_brake_off",
28     "parking_brake_on",
29     "accel_pedal_off",
30     "accel_pedal_on",
31     "lamp_off",
32     "lamp_on",
33     "lightstatus_brake_off",
34     "lightstatus_brake_on",
35     "restriction_mode_off",
36     "restriction_mode_on",
37     "undo",
38 };
39
40 const char* kStmCategoryName[] = {
41     "none",
42     "homescreen",
43     "map",
44     "general",
45     "splitable",
46     "splitable_main",
47     "splitable_sub",
48     "pop_up",
49     "system_alert",
50     "restriction",
51     "system",
52     "launcher",
53     "software_keyboard",
54     "tbt",
55     "meter",
56     "receiver",
57     "receiver2",
58     "speed",
59     "debug",
60 };
61
62 const char* kStmAreaName[] = {
63     "none",
64     "fullscreen",
65     "normal.full",
66     "split.main",
67     "split.sub",
68     "upper.left",
69     "on_screen",
70     "restriction.normal",
71     "restriction.split.main",
72     "restriction.split.sub",
73     "software_keyboard",
74     "master.split.sub",
75     "hud.upper.left",
76     "hud.normal.full",
77     "rse1.normal.full",
78     "rse2.normal.full",
79 };
80
81 const char* kStmLayoutName[] = {
82     "none",
83     "pop_up",
84     "system_alert",
85     "map.normal",
86     "map.split",
87     "map.fullscreen",
88     "splitable.normal",
89     "splitable.split",
90     "general.normal",
91     "homescreen",
92     "restriction.normal",
93     "restriction.split.main",
94     "restriction.split.sub",
95     "system.normal",
96     "launcher.normal",
97     "launcher.fullscreen",
98     "software_keyboard",
99     "tbt",
100     "upper.left",
101     "remote_tbt",
102     "remote_rse1",
103     "remote_rse2",
104     "remote_hud",
105     "remote_hud_upper_left",
106     "meter.normal",
107     "meter_receiver",
108     "meter_splitable",
109     "splitable_receiver",
110     "receiver.split",
111     "debug.normal",
112     "debug.split.main",
113     "debug.split.sub",
114     "debug.fullscreen",
115 };
116
117 const char* kStmLayerName[] = {
118     "homescreen",
119     "apps",
120     "near_apps",
121     "near_homescreen",
122     "restriction",
123     "on_screen",
124     "remote",
125     "remote_hud",
126     "remote_hud_upper_left",
127     "remote_rse1",
128     "remote_rse2"
129 };
130
131 const char* kStmCarElementName[] = {
132     "trans_gear",
133     "parking_brake",
134     "accel_pedal",
135     "running",
136     "lamp",
137     "lightstatus_brake",
138     "restriction_mode",
139 };
140
141 const char* kStmTransGearStateName[] = {
142     "neutral",
143     "not_neutral"
144 };
145
146 const char* kStmParkingBrakeStateName[] = {
147     "off",
148     "on"
149 };
150
151 const char* kStmAccelPedalStateName[] = {
152     "off",
153     "on"
154 };
155
156 const char* kStmRunningSttNo2Name[] = {
157     "stop",
158     "run"
159 };
160
161 const char* kStmLampStateName[] = {
162     "off",
163     "on"
164 };
165
166 const char* kStmLightstatusBrakeStateName[] = {
167     "off",
168     "on"
169 };
170
171 const char* kStmRestrictionModeStateName[] = {
172     "off",
173     "on",
174 };
175
176 const char** kStmCarElementStateNameList[] = {
177     kStmTransGearStateName,
178     kStmParkingBrakeStateName,
179     kStmAccelPedalStateName,
180     kStmRunningSttNo2Name,
181     kStmLampStateName,
182     kStmLightstatusBrakeStateName,
183     kStmRestrictionModeStateName,
184 };
185
186 void stmInitialize(const char *ecu_name) {
187     stmInitializeInner(ecu_name);
188 }
189
190 int stmTransitionState(int event, StmState* state) {
191     return stmTransitionStateInner(event, state);
192 }
193
194 void stmUndoState() {
195     stmUndoStateInner();
196 }