2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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.
22 ///////////////////////////////////////////////////////////////////////////////
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>
29 #include "ss_power_powerservicelog.h"
33 * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app)
34 * @brief Handles setup for SS_Power subsystem, registers with
35 * NP_Service and indicates that its ready.
37 * @param h_app Handle to the SS_Power Framework Obj.
39 * @return method status of completion or failure.
41 EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE h_app) {
42 EFrameworkunifiedStatus eStatus;
43 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
45 eStatus = Power::GetInstance().Initialize(h_app);
47 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
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.
56 * @param h_app Handle to the SS_Power Framework Obj.
58 * @return method status of completion or failure.
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;
65 // LCOV_EXCL_STOP 200: not called by NSFW
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.
72 * @param h_app Handle to the SS_Power Framework Obj.
74 * @return method status of completion or failure.
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;
81 // LCOV_EXCL_STOP 200: not called by NSFW
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.
88 * @param h_app Handle to the SS_Power Framework Obj.
90 * @return method status of completion or failure.
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;
97 // LCOV_EXCL_STOP 200: not called by NSFW
100 * EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE h_app)
101 * @brief SS_Power will exit when this method is invoked,
102 * return value will always be invalid.
104 * @param h_app Handle to the SS_Power Framework Obj.
106 * @return method status of completion or failure.
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",
114 return eFrameworkunifiedStatusNotImplemented;
116 // LCOV_EXCL_STOP 200: not called by NSFW
119 * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE h_app)
120 * @brief Used to ask SS_Power to dump its vital information about the subsystem.
122 * @param h_app Handle to the SS_Power Framework Obj.
124 * @return method status of completion or failure.
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;
130 Power* l_instance = &Power::GetInstance();
132 if (l_instance != NULL) {
133 l_instance->SSPowerDebugDump(h_app);
136 eStatus = eFrameworkunifiedStatusInvldHandle;
140 // LCOV_EXCL_STOP 7: debug code
143 * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app)
146 * @param h_app Handle to the SS_Power Framework Obj.
148 * @return method status of completion or failure.
150 EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE h_app) {
151 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
152 return eFrameworkunifiedStatusOK;
156 * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app)
159 * @param h_app Handle to the SS_Power Framework Obj.
161 * @return method status of completion or failure.
164 EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE h_app) {
165 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
166 return eFrameworkunifiedStatusOK;
170 * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE h_app)
172 * @param h_app Handle to the SS_Power Framework Obj.
174 * @return method status of completion or failure.
177 EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
178 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
179 return eFrameworkunifiedStatusOK;
183 * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE h_app)
185 * @param h_app Handle to the SS_Power Framework Obj.
187 * @return method status of completion or failure.
190 EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
191 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
192 return eFrameworkunifiedStatusOK;
196 * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE h_app)
198 * @param h_app Handle to the SS_Power Framework Obj.
200 * @return method status of completion or failure.
203 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
204 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
205 return eFrameworkunifiedStatusOK;
209 * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE h_app)
211 * @param h_app Handle to the SS_Power Framework Obj.
213 * @return method status of completion or failure.
216 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
217 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "N/A; returning eFrameworkunifiedStatusOK");
218 return eFrameworkunifiedStatusOK;
222 * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE h_app)
225 * @param h_app Handle to the SS_Power Framework Obj.
227 * @return method status of completion or failure.
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;
234 // LCOV_EXCL_STOP 200: not called by NSFW