Init basesystem source codes.
[staging/basesystem.git] / systemservice / power_service / server / src / powerservice_application.cpp
1 /*
2  * @copyright Copyright (c) 2016-2020 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 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup  tag_PowerService
19 /// \brief    This file contains the standard set functions called by the NS
20 //            dispatcher on application initialization, cleanup and wakeup.
21 ///
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include <system_service/ss_services.h>
25 #include <native_service/frameworkunified_application.h>
26 #include <native_service/frameworkunified_framework_if.h>
27 #include <native_service/frameworkunified_service_protocol.h>
28
29 #include "ss_power_powerservicelog.h"
30 #include "ss_power.h"
31
32 /**
33  * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app)
34  * @brief Handles setup for SS_Power subsystem, registers with
35  * NP_Service and indicates that its ready.
36  *
37  * @param h_app Handle to the SS_Power Framework Obj.
38  *
39  * @return method status of completion or failure.
40  */
41 EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
42   EFrameworkunifiedStatus eStatus;
43   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
44
45   eStatus = Power::GetInstance().Initialize(h_app);
46
47   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
48   return eStatus;
49 }
50
51 /**
52  * EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app)
53  * @brief This is not handled by the Power Subsystem since send out the
54  * notifications that indicated Wakeup.
55  *
56  * @param h_app Handle to the SS_Power Framework Obj.
57  *
58  * @return method status of completion or failure.
59  */
60 EFrameworkunifiedStatus PowerserviceOnWakepup(HANDLE h_app) {  // LCOV_EXCL_START 200: not called by NSFW
61   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
62   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
63   return eFrameworkunifiedStatusOK;
64 }
65 // LCOV_EXCL_STOP 200: not called by NSFW
66
67 /**
68  * EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app)
69  * @brief This is not handled by the Power Subsystem since send out the
70  * notifications that indicated Shutdown.
71  *
72  * @param h_app Handle to the SS_Power Framework Obj.
73  *
74  * @return method status of completion or failure.
75  */
76 EFrameworkunifiedStatus FrameworkunifiedOnShutdown(HANDLE h_app) {  // LCOV_EXCL_START 200: not called by NSFW
77   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
78   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
79   return eFrameworkunifiedStatusOK;
80 }
81 // LCOV_EXCL_STOP 200: not called by NSFW
82
83 /**
84  * EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app)
85  * @brief This is not handled by the Power Subsystem since send out the
86  * notifications that indicated Emergency Shutdown.
87  *
88  * @param h_app Handle to the SS_Power Framework Obj.
89  *
90  * @return method status of completion or failure.
91  */
92 EFrameworkunifiedStatus FrameworkunifiedOnEShutdown(HANDLE h_app) {  // LCOV_EXCL_START 200: not called by NSFW
93   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
94   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
95   return eFrameworkunifiedStatusOK;
96 }
97 // LCOV_EXCL_STOP 200: not called by NSFW
98
99 /**
100  * EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app)
101  * @brief SS_Power will exit when this method is invoked,
102  * return value will always be invalid.
103  *
104  * @param h_app Handle to the SS_Power Framework Obj.
105  *
106  * @return method status of completion or failure.
107  */
108 EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app) {  // LCOV_EXCL_START 200: not called by NSFW
109   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
110   FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__,
111           " This method is not valid for %s, returning "
112           "eFrameworkunifiedStatusNotImplemented",
113           SERVICE_POWER);
114   return eFrameworkunifiedStatusNotImplemented;
115 }
116 // LCOV_EXCL_STOP 200: not called by NSFW
117
118 /**
119  * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app)
120  * @brief Used to ask SS_Power to dump its vital information about the subsystem.
121  *
122  * @param h_app Handle to the SS_Power Framework Obj.
123  *
124  * @return method status of completion or failure.
125  */
126 EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app) {  // LCOV_EXCL_START 7: debug code
127   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
128   EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
129
130   Power* l_instance = &Power::GetInstance();
131
132   if (l_instance != NULL) {
133     l_instance->SSPowerDebugDump(h_app);
134
135   } else {
136     eStatus = eFrameworkunifiedStatusInvldHandle;
137   }
138   return eStatus;
139 }
140 // LCOV_EXCL_STOP 7: debug code
141
142 /**
143  * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app)
144  * @brief Used to .
145  *
146  * @param h_app Handle to the SS_Power Framework Obj.
147  *
148  * @return method status of completion or failure.
149  */
150 EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
151   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
152   return eFrameworkunifiedStatusOK;
153 }
154
155 /**
156  * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app)
157  * @brief Used to .
158  *
159  * @param h_app Handle to the SS_Power Framework Obj.
160  *
161  * @return method status of completion or failure.
162  */
163
164 EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
165   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
166   return eFrameworkunifiedStatusOK;
167 }
168
169 /**
170  * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
171  *
172  * @param h_app Handle to the SS_Power Framework Obj.
173  *
174  * @return method status of completion or failure.
175  */
176
177 EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
178   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
179   return eFrameworkunifiedStatusOK;
180 }
181
182 /**
183  * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
184  *
185  * @param h_app Handle to the SS_Power Framework Obj.
186  *
187  * @return method status of completion or failure.
188  */
189
190 EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
191   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
192   return eFrameworkunifiedStatusOK;
193 }
194
195 /**
196  * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
197  *
198  * @param h_app Handle to the SS_Power Framework Obj.
199  *
200  * @return method status of completion or failure.
201  */
202
203 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
204   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
205   return eFrameworkunifiedStatusOK;
206 }
207
208 /**
209  * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
210  *
211  * @param h_app Handle to the SS_Power Framework Obj.
212  *
213  * @return method status of completion or failure.
214  */
215
216 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
217   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
218   return eFrameworkunifiedStatusOK;
219 }
220
221 /**
222  * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app)
223  * @brief Used to .
224  *
225  * @param h_app Handle to the SS_Power Framework Obj.
226  *
227  * @return method status of completion or failure.
228  */
229 EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app) {  // LCOV_EXCL_START 200: not called by NSFW
230   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
231   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
232   return eFrameworkunifiedStatusOK;
233 }
234 // LCOV_EXCL_STOP 200: not called by NSFW
235 // EOF
236