Add boot sequence and multi ecu transfer
[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     "software_keyboard",
53     "tbt",
54     "meter",
55     "receiver",
56     "debug",
57 };
58
59 const char* kStmAreaName[] = {
60     "none",
61     "fullscreen",
62     "normal.full",
63     "split.main",
64     "split.sub",
65     "on_screen",
66     "restriction.normal",
67     "restriction.split.main",
68     "restriction.split.sub",
69     "software_keyboard",
70     "master.split.sub",
71     "upper.left",
72 };
73
74 const char* kStmLayoutName[] = {
75     "none",
76     "pop_up",
77     "system_alert",
78     "map.normal",
79     "map.split",
80     "map.fullscreen",
81     "splitable.normal",
82     "splitable.split",
83     "general.normal",
84     "homescreen",
85     "restriction.normal",
86     "restriction.split.main",
87     "restriction.split.sub",
88     "system.normal",
89     "software_keyboard",
90     "tbt",
91     "remote_tbt",
92     "remote_rse1",
93     "remote_rse2",
94     "remote_hud",
95     "remote_hud_upper_left",
96     "meter.normal",
97     "meter_receiver",
98     "meter_splitable",
99     "splitable_receiver",
100     "receiver.split",
101     "debug.normal",
102     "debug.split.main",
103     "debug.split.sub",
104     "debug.fullscreen",
105 };
106
107 const char* kStmLayerName[] = {
108     "homescreen",
109     "apps",
110     "near_homescreen",
111     "restriction",
112     "on_screen",
113     "remote",
114     "remote_hud",
115     "remote_hud_upper_left",
116     "remote_rse1",
117     "remote_rse2"
118 };
119
120 const char* kStmCarElementName[] = {
121     "trans_gear",
122     "parking_brake",
123     "accel_pedal",
124     "running",
125     "lamp",
126     "lightstatus_brake",
127     "restriction_mode",
128 };
129
130 const char* kStmTransGearStateName[] = {
131     "neutral",
132     "not_neutral"
133 };
134
135 const char* kStmParkingBrakeStateName[] = {
136     "off",
137     "on"
138 };
139
140 const char* kStmAccelPedalStateName[] = {
141     "off",
142     "on"
143 };
144
145 const char* kStmRunningSttNo2Name[] = {
146     "stop",
147     "run"
148 };
149
150 const char* kStmLampStateName[] = {
151     "off",
152     "on"
153 };
154
155 const char* kStmLightstatusBrakeStateName[] = {
156     "off",
157     "on"
158 };
159
160 const char* kStmRestrictionModeStateName[] = {
161     "off",
162     "on",
163 };
164
165 const char** kStmCarElementStateNameList[] = {
166     kStmTransGearStateName,
167     kStmParkingBrakeStateName,
168     kStmAccelPedalStateName,
169     kStmRunningSttNo2Name,
170     kStmLampStateName,
171     kStmLightstatusBrakeStateName,
172     kStmRestrictionModeStateName,
173 };
174
175 void stmInitialize(const char *ecu_name) {
176     stmInitializeInner(ecu_name);
177 }
178
179 int stmTransitionState(int event, StmState* state) {
180     return stmTransitionStateInner(event, state);
181 }
182
183 void stmUndoState() {
184     stmUndoStateInner();
185 }