add source for ces2019
[apps/agl-service-windowmanager-2017.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 };
72
73 const char* kStmLayoutName[] = {
74     "none",
75     "pop_up",
76     "system_alert",
77     "map.normal",
78     "map.split",
79     "map.fullscreen",
80     "splitable.normal",
81     "splitable.split",
82     "general.normal",
83     "homescreen",
84     "restriction.normal",
85     "restriction.split.main",
86     "restriction.split.sub",
87     "system.normal",
88     "software_keyboard",
89     "tbt",
90     "remote_tbt",
91     "meter.normal",
92     "meter_receiver",
93     "meter_splitable",
94     "splitable_receiver",
95     "receiver.split",
96     "debug.normal",
97     "debug.split.main",
98     "debug.split.sub",
99     "debug.fullscreen",
100 };
101
102 const char* kStmLayerName[] = {
103     "homescreen",
104     "apps",
105     "near_homescreen",
106     "restriction",
107     "on_screen",
108     "remote",
109 };
110
111 const char* kStmCarElementName[] = {
112     "trans_gear",
113     "parking_brake",
114     "accel_pedal",
115     "running",
116     "lamp",
117     "lightstatus_brake",
118     "restriction_mode",
119 };
120
121 const char* kStmTransGearStateName[] = {
122     "neutral",
123     "not_neutral"
124 };
125
126 const char* kStmParkingBrakeStateName[] = {
127     "off",
128     "on"
129 };
130
131 const char* kStmAccelPedalStateName[] = {
132     "off",
133     "on"
134 };
135
136 const char* kStmRunningSttNo2Name[] = {
137     "stop",
138     "run"
139 };
140
141 const char* kStmLampStateName[] = {
142     "off",
143     "on"
144 };
145
146 const char* kStmLightstatusBrakeStateName[] = {
147     "off",
148     "on"
149 };
150
151 const char* kStmRestrictionModeStateName[] = {
152     "off",
153     "on",
154 };
155
156 const char** kStmCarElementStateNameList[] = {
157     kStmTransGearStateName,
158     kStmParkingBrakeStateName,
159     kStmAccelPedalStateName,
160     kStmRunningSttNo2Name,
161     kStmLampStateName,
162     kStmLightstatusBrakeStateName,
163     kStmRestrictionModeStateName,
164 };
165
166 void stmInitialize(const char *ecu_name) {
167     stmInitializeInner(ecu_name);
168 }
169
170 int stmTransitionState(int event, StmState* state) {
171     return stmTransitionStateInner(event, state);
172 }
173
174 void stmUndoState() {
175     stmUndoStateInner();
176 }