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 supports the power service state machine.
21 ///////////////////////////////////////////////////////////////////////////////
23 #include "ss_power_state_machine.h"
24 #include <system_service/ss_power_service_protocol.h>
25 #include <system_service/ss_power_service.h>
26 #include <system_service/ss_power_service_notifications.h>
27 #include <system_service/ss_power_service_local.h>
28 #include <system_service/ss_power_service_notifications_local.h>
29 #include <system_service/ss_services.h>
30 #include <native_service/ns_timer_if.h>
31 #include <native_service/frameworkunified_framework_if.h>
34 #include "ss_power_session.h"
35 #include "ss_power_powerservicelog.h"
37 /// Define static members of the class.
38 PowerStateMachine::Wakeup PowerStateMachine::WakeupState;
39 PowerStateMachine::WakeupActive PowerStateMachine::WakeupActiveState;
40 PowerStateMachine::WakeupPending PowerStateMachine::WakeupPendingState;
41 PowerStateMachine::LowVoltage1 PowerStateMachine::LowVoltage1State;
42 PowerStateMachine::LowVoltage1Active PowerStateMachine::LowVoltage1ActiveState;
43 PowerStateMachine::LowVoltage2 PowerStateMachine::LowVoltage2State;
44 PowerStateMachine::LowVoltage2Active PowerStateMachine::LowVoltage2ActiveState;
45 PowerStateMachine::Shutdown PowerStateMachine::ShutdownState;
46 PowerStateMachine::ShutdownActive PowerStateMachine::ShutdownActiveState;
47 PowerStateMachine::NormalVoltage PowerStateMachine::NormalVoltageState;
48 PowerStateMachine::SoftwareUpdate PowerStateMachine::SoftwareUpdateState;
51 PowerStateMachine::PowerStateMachine()
52 : m_pCurrentState(&WakeupState),
53 m_pPreviousState(NULL),
54 m_pOnHysteresisTimeoutState(NULL),
55 m_oShutdownHysteresis(),
56 m_oLowVoltage1Hysteresis(),
57 m_oLowVoltage2Hysteresis(),
58 m_hHysteresisTimer(NULL),
63 PowerStateMachine::~PowerStateMachine() { // LCOV_EXCL_START 14 Resident process, not called by NSFW
64 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
66 // LCOV_EXCL_STOP 14 Resident process, not called by NSFW
68 void PowerStateMachine::onEvent(HANDLE h_app, PowerSessionHandler & oSession,
69 ePowerStateMachineEvents evt) {
70 FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
71 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
72 "(ENTRY) Power StateMachine Current State: %s, Previous State: %s",
73 m_pCurrentState->name(),
74 (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
76 switch (evt) { // LCOV_EXCL_BR_LINE 8: dead code
77 case PowerStateMachine::epsmeWAKEUP:
78 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeWAKEUP");
79 m_pCurrentState->onWakeup(*this, h_app, oSession);
81 case PowerStateMachine::epsmeSTART_COMPLETE: // LCOV_EXCL_START 8: no one send the event
82 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
83 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTART_COMPLETE");
84 m_pCurrentState->onStartComplete(*this, h_app, oSession);
86 // LCOV_EXCL_STOP 8: no one send the event
87 case PowerStateMachine::epsmeSHUTDOWN:
88 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSHUTDOWN");
89 m_pCurrentState->onShutdown(*this, h_app, oSession);
91 case PowerStateMachine::epsmeSTOP_COMPLETE: // LCOV_EXCL_START 8: no one send the event
92 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
93 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTOP_COMPLETE");
94 m_pCurrentState->onStopComplete(*this, h_app, oSession);
96 case PowerStateMachine::epsmeLVI1_ENCOUNTERED:
97 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_ENCOUNTERED");
98 m_pCurrentState->onLowVoltage1Encountered(*this, h_app, oSession);
100 case PowerStateMachine::epsmeLVI2_ENCOUNTERED:
101 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_ENCOUNTERED");
102 m_pCurrentState->onLowVoltage2Encountered(*this, h_app, oSession);
104 case PowerStateMachine::epsmeNORMAL_VOLTAGE_ENCOUNTERED:
105 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
106 "Power StateMachine Event Received: epsmeNORMAL_VOLTAGE_ENCOUNTERED");
107 m_pCurrentState->onNormalVoltageEncountered(*this, h_app, oSession);
109 case PowerStateMachine::epsmeSOFTWARE_UPDATE:
110 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSOFTWARE_UPDATE");
111 m_pCurrentState->onSoftwareUpdate(*this, h_app, oSession);
113 case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_ABORTED:
114 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
115 "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_ABORTED");
116 case PowerStateMachine::epsmeLVI1_HYSTERESIS_ABORTED:
117 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_ABORTED");
118 case PowerStateMachine::epsmeLVI2_HYSTERESIS_ABORTED:
119 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_ABORTED");
120 m_pCurrentState->onHysteresisAborted(*this, h_app, oSession);
122 // LCOV_EXCL_STOP 8: no one send the event
123 case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_TM_OUT:
124 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
125 "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
126 case PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT:
127 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
128 case PowerStateMachine::epsmeLVI2_HYSTERESIS_TM_OUT:
129 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_TM_OUT"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
130 m_pCurrentState->onHysteresisTimeout(*this, h_app, oSession);
133 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: WAS INVALID"); // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h" // NOLINT[whitespace/line_length]
135 } // ZONE_POWER_STATEMACHINE
137 FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
138 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
139 "(EXIT) Power StateMachine Current State: %s, Previous State: %s",
140 m_pCurrentState->name(),
141 (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
144 PCSTR PowerStateMachine::name() { // LCOV_EXCL_START 8: do not be called
145 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
146 if (NULL != m_pCurrentState) {
147 return m_pCurrentState->name();
150 return "Invalid Current State is NULL...";
152 // LCOV_EXCL_STOP 8: do not be called
154 /// Switch to the next State and save the previous state.
155 void PowerStateMachine::NextState(Base_State & refState, HANDLE h_app,
156 PowerSessionHandler & oSession) {
157 m_pPreviousState = m_pCurrentState;
158 m_pPreviousState->onExit(*this, h_app, oSession);
159 m_pCurrentState = &refState;
160 m_pCurrentState->onEntry(*this, h_app, oSession);
163 // LCOV_EXCL_START 8: do not be called
164 void PowerStateMachine::OnVoltage(Base_State * pState, HANDLE h_app,
165 PowerSessionHandler & oSession) {
166 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
167 if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
168 Pwr_ServiceSetInterface tServiceIf;
170 if (eFrameworkunifiedStatusOK
171 == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
172 sizeof(Pwr_ServiceSetInterface))) {
173 /// Need to store the voltage information
174 m_tStateInfo.voltage = tServiceIf.data.voltage.state;
176 if (NULL != pState) {
177 NextState(*pState, h_app, oSession);
182 // LCOV_EXCL_STOP 8: do not be called
183 void PowerStateMachine::GotoStateOnHysteresisTimeout(Base_State & refState) {
184 m_pOnHysteresisTimeoutState = &refState;
187 void PowerStateMachine::startHysteresisTimer(PowerStateHysteresis & hys_info) {
188 /// clear the try counter.
189 hys_info.clearTryCounter();
191 /// bump the hysteresis try counter (prime the counter).
192 hys_info.bumbTryCounter();
194 /// setup the hysteresis timer
195 NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
196 MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
198 /// start the hysteresis timer
199 NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
202 void PowerStateMachine::reStartHysteresisTimer(
203 PowerStateHysteresis & hys_info) {
204 /// bump the hysteresis try counter.
205 hys_info.bumbTryCounter();
207 /// setup the hysteresis timer (one shot)
208 NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
209 MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
210 /// start the hysteresis timer
211 NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
214 void PowerStateMachine::stopHysteresisTimer(PowerStateHysteresis & hys_info) {
215 NSTimerInfo turn_off_hysteresis = { 0, 0, 0, 0, 0 };
216 NS_TimerSetTime(m_hHysteresisTimer, turn_off_hysteresis);
217 /// clear the try counter.
218 hys_info.clearTryCounter();
221 // LCOV_EXCL_START 8: can not be called
222 void PowerStateMachine::publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm,
224 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
225 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
226 PowerSrvLVIStatus eLviStatus = static_cast<PowerSrvLVIStatus>(value);
227 if (eFrameworkunifiedStatusOK
228 != (eStatus = FrameworkunifiedNPPublishNotification(h_app, nNotifNm, &eLviStatus,
229 sizeof(eLviStatus)))) {
230 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
231 " Error: FrameworkunifiedNPPublishNotification( %s ) errored: 0x%X", nNotifNm,
235 // LCOV_EXCL_STOP 8: can not be called
236 void PowerStateMachine::publishPowerLevelType(HANDLE h_app, UI_32 value) {
237 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
238 PowerSrvLevelType eLevelType = static_cast<PowerSrvLevelType>(value);
239 if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification (h_app, szNTFY_PowerLevel, &eLevelType, sizeof (eLevelType)))) { // LCOV_EXCL_BR_LINE 4: NSFW error case. // NOLINT[whitespace/line_length]
240 // LCOV_EXCL_START 4: NSFW error case.
241 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
242 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
243 " Error: FrameworkunifiedNPPublishNotification %s Failed Status:0x%x ",
244 szNTFY_PowerLevel, eStatus);
245 // LCOV_EXCL_STOP 4: NSFW error case.
249 // LCOV_EXCL_START 8: no one send the event
250 void PowerStateMachine::Base_State::onStartComplete(
251 PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
252 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
253 oSession.StartComplete(h_app);
255 // LCOV_EXCL_STOP 8: do not be called
257 // LCOV_EXCL_START 8: no one send the event
258 void PowerStateMachine::Base_State::onStopComplete(
259 PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
260 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
261 oSession.StopComplete(h_app);
263 // LCOV_EXCL_STOP 8: no one send the event
265 // LCOV_EXCL_START 8: no one call this function
266 void PowerStateMachine::Base_State::onLaunchComplete(
267 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
268 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
269 FrameworkunifiedDeferMessage(h_app);
271 // LCOV_EXCL_STOP 8: do not be called
273 // LCOV_EXCL_START 8: no one send the event
274 void PowerStateMachine::Base_State::onShutdownComplete(
275 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
276 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
277 FrameworkunifiedDeferMessage(h_app);
279 // LCOV_EXCL_STOP 8: no one call this function
280 PCSTR PowerStateMachine::Wakeup::name() {
284 // LCOV_EXCL_START 8: no one send the event
285 void PowerStateMachine::Wakeup::onLowVoltage1Encountered(
286 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
287 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
288 u.OnVoltage(&LowVoltage1State, h_app, oSession);
289 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
290 FrameworkunifiedGetMsgSrc(h_app));
292 // LCOV_EXCL_STOP 8: do not be called
294 // LCOV_EXCL_START 8: no one send the event
295 void PowerStateMachine::Wakeup::onLowVoltage2Encountered(
296 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
297 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
298 u.OnVoltage(&LowVoltage2State, h_app, oSession);
299 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
300 FrameworkunifiedGetMsgSrc(h_app));
302 // LCOV_EXCL_STOP 8: no one send the event to call this function
304 // LCOV_EXCL_START 8: no one send the event to call this function
305 void PowerStateMachine::Wakeup::onNormalVoltageEncountered(
306 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
307 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
308 u.OnVoltage(NULL, h_app, oSession);
309 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
310 "NORMAL ENCOUNTERED %s (no switch)", FrameworkunifiedGetMsgSrc(h_app));
312 // LCOV_EXCL_STOP 8: no one send the event
313 void PowerStateMachine::Wakeup::onShutdown(PowerStateMachine &u, HANDLE h_app,
314 PowerSessionHandler & oSession) {
315 u.NextState(ShutdownState, h_app, oSession);
318 // LCOV_EXCL_START 8: no one send the event
319 void PowerStateMachine::Wakeup::onSoftwareUpdate(
320 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
321 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
322 u.NextState(SoftwareUpdateState, h_app, oSession);
324 // LCOV_EXCL_STOP 8: no one send the event
326 // LCOV_EXCL_START 8: no one send the event
327 void PowerStateMachine::Wakeup::onWakeup(PowerStateMachine &u, HANDLE h_app,
328 PowerSessionHandler & oSession) {
329 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
330 Pwr_ServiceSetInterface tServiceIf;
331 if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
332 if (eFrameworkunifiedStatusOK
333 == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
334 sizeof(Pwr_ServiceSetInterface))) {
335 if (epswsPWRON == tServiceIf.data.wake.powerupType) {
336 /// Need to store the wakeup \ shutdown information
337 u.m_tStateInfo.wake = tServiceIf.data.wake.powerupType;
338 u.m_tStateInfo.level = tServiceIf.data.wake.up.level;
339 u.m_tStateInfo.factor = tServiceIf.data.wake.up.factor;
341 u.NextState(WakeupPendingState, h_app, oSession);
346 // LCOV_EXCL_STOP 8: no one send the event
348 PCSTR PowerStateMachine::WakeupActive::name() {
349 return "Wakeup Active";
352 // LCOV_EXCL_START 8: no one send the event
353 void PowerStateMachine::WakeupActive::onLowVoltage1Encountered(
354 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
355 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
356 u.OnVoltage(&LowVoltage1State, h_app, oSession);
357 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
358 FrameworkunifiedGetMsgSrc(h_app));
360 // LCOV_EXCL_STOP 8: no one send the event to call this function
362 // LCOV_EXCL_START 8: no one send the event to call this function
363 void PowerStateMachine::WakeupActive::onLowVoltage2Encountered(
364 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
365 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
366 u.OnVoltage(&LowVoltage2State, h_app, oSession);
367 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
368 FrameworkunifiedGetMsgSrc(h_app));
370 // LCOV_EXCL_STOP 8: no one send the event
371 void PowerStateMachine::WakeupActive::onShutdown(
372 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
373 u.NextState(ShutdownState, h_app, oSession);
376 PCSTR PowerStateMachine::WakeupPending::name() {
377 return "Wakeup Pending";
380 // LCOV_EXCL_START 8: no one send the event
381 void PowerStateMachine::WakeupPending::onNormalVoltageEncountered(
382 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
383 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
384 u.OnVoltage(&NormalVoltageState, h_app, oSession);
385 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL ENCOUNTERED %s",
386 FrameworkunifiedGetMsgSrc(h_app));
388 // LCOV_EXCL_STOP 8: no one send the event to call this function
390 // LCOV_EXCL_START 8: no one send the event to call this function
391 void PowerStateMachine::WakeupPending::onStartComplete(
392 PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
393 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
394 oSession.StartComplete(h_app);
396 // LCOV_EXCL_STOP 8: no one send the event
398 // LCOV_EXCL_START 8: no one call this function
399 void PowerStateMachine::WakeupPending::onLaunchComplete(
400 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
401 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
402 oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
403 if (epsvsNORMAL == u.m_tStateInfo.voltage) {
404 u.NextState(NormalVoltageState, h_app, oSession);
407 // LCOV_EXCL_STOP 8: no one call this function
409 // LCOV_EXCL_START 8: no one send the event
410 void PowerStateMachine::WakeupPending::onWakeup(
411 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
412 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
413 if (oSession.WakeupComplete(u.m_lstWakeupModules)) {
414 oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
417 // LCOV_EXCL_STOP 8: no one send the event
419 void PowerStateMachine::WakeupPending::onEntry(PowerStateMachine &u,
421 PowerSessionHandler & oSession) {
422 if (!FrameworkunifiedIsDeferQueueEmpty(h_app)) {
423 FrameworkunifiedRetrieveDeferMessage(h_app);
427 PCSTR PowerStateMachine::Shutdown::name() {
431 // LCOV_EXCL_START 8: no one send the event
432 void PowerStateMachine::Shutdown::onLowVoltage1Encountered(
433 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
434 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
435 u.GotoStateOnHysteresisTimeout(LowVoltage1State);
436 u.OnVoltage(NULL, h_app, oSession);
437 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
438 "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
439 FrameworkunifiedGetMsgSrc(h_app));
441 // LCOV_EXCL_STOP 8: no one send the event to call this function
443 // LCOV_EXCL_START 8: no one send the event to call this function
444 void PowerStateMachine::Shutdown::onLowVoltage2Encountered(
445 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
446 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
447 u.GotoStateOnHysteresisTimeout(LowVoltage2State);
448 u.OnVoltage(NULL, h_app, oSession);
449 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
450 "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
451 FrameworkunifiedGetMsgSrc(h_app));
453 // LCOV_EXCL_STOP 8: no one send the event to call this function
455 // LCOV_EXCL_START 8: no one send the event to call this function
456 void PowerStateMachine::Shutdown::onHysteresisAborted(
457 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
458 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
459 u.NextState(*(u.m_pPreviousState), h_app, oSession);
461 // LCOV_EXCL_STOP 8: no one send the event
462 void PowerStateMachine::Shutdown::onHysteresisTimeout(
463 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
464 if (!u.m_oShutdownHysteresis.maxTries()) {
465 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
466 "epsmeSHUTDOWN_TM_OUT tries: %d", u.m_oShutdownHysteresis.getTries());
468 u.reStartHysteresisTimer(u.m_oShutdownHysteresis);
470 // Move directorly to next state.
471 u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
475 void PowerStateMachine::Shutdown::onEntry(PowerStateMachine &u, HANDLE h_app,
476 PowerSessionHandler & oSession) {
477 if (u.m_oShutdownHysteresis.getEnabled()) {
478 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
479 "Starting epsmeSHUTDOWN_HYSTERESIS_TM_OUT timeout: %d tries: %d",
480 u.m_oShutdownHysteresis.getTimeout(),
481 u.m_oShutdownHysteresis.getTries());
482 // Set the goto state state.
483 u.GotoStateOnHysteresisTimeout(ShutdownActiveState);
484 // Start the hysteresis timer for low voltage 2
485 u.startHysteresisTimer(u.m_oShutdownHysteresis);
487 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
488 "SHUTDOWN_HYSTERESIS is not enabled. Going directly to ShutdownActiveState");
489 // Move directly to next state.
490 u.NextState(ShutdownActiveState, h_app, oSession);
494 void PowerStateMachine::Shutdown::onExit(PowerStateMachine &u, HANDLE h_app,
495 PowerSessionHandler & oSession) {
496 u.stopHysteresisTimer(u.m_oShutdownHysteresis);
497 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) Shutdown State");
500 // LCOV_EXCL_START 8: no one send the event
501 void PowerStateMachine::Shutdown::onWakeup(PowerStateMachine &u, HANDLE h_app,
502 PowerSessionHandler & oSession) {
503 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
504 u.GotoStateOnHysteresisTimeout(WakeupPendingState);
506 // LCOV_EXCL_STOP 8: no one send the event
508 PCSTR PowerStateMachine::ShutdownActive::name() {
509 return "Shutdown Active";
512 // LCOV_EXCL_START 8: no one send the event
513 void PowerStateMachine::ShutdownActive::onLowVoltage1Encountered(
514 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
515 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
516 u.OnVoltage(&LowVoltage1State, h_app, oSession);
517 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
518 FrameworkunifiedGetMsgSrc(h_app));
520 // LCOV_EXCL_STOP 8: no one send the event to call this function
522 // LCOV_EXCL_START 8: no one send the event to call this function
523 void PowerStateMachine::ShutdownActive::onLowVoltage2Encountered(
524 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
525 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
526 u.OnVoltage(&LowVoltage2State, h_app, oSession);
527 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
528 FrameworkunifiedGetMsgSrc(h_app));
530 // LCOV_EXCL_STOP 8: no one send the event
531 void PowerStateMachine::ShutdownActive::onEntry(
532 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
533 u.publishPowerLevelType(h_app, epspltSHUTDOWN);
535 if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
536 oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
540 void PowerStateMachine::ShutdownActive::onShutdown(
541 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
542 if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
543 oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
547 PCSTR PowerStateMachine::LowVoltage1::name() { // LCOV_EXCL_START 8: can not be LowVoltage1status
548 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
549 return "Low Voltage I";
551 // LCOV_EXCL_STOP 8: can not be LowVoltage1status
553 // LCOV_EXCL_START 8: no one send the event
554 void PowerStateMachine::LowVoltage1::onHysteresisAborted(
555 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
556 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
557 u.NextState(*(u.m_pPreviousState), h_app, oSession);
559 // LCOV_EXCL_STOP 8: no one send the event
561 // LCOV_EXCL_START 8: can not be LowVoltage1status
562 void PowerStateMachine::LowVoltage1::onHysteresisTimeout(
563 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
564 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
565 if (!u.m_oLowVoltage1Hysteresis.maxTries()) {
566 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
567 "epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT tries: %d",
568 u.m_oLowVoltage1Hysteresis.getTries());
570 u.reStartHysteresisTimer(u.m_oLowVoltage1Hysteresis);
572 // Move directorly to next state.
573 u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
576 // LCOV_EXCL_STOP 8: no one send the event to call this function
578 // LCOV_EXCL_START 8: no one send the event to call this function
579 void PowerStateMachine::LowVoltage1::onWakeup(PowerStateMachine &u, HANDLE h_app,
580 PowerSessionHandler & oSession) {
581 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
582 u.GotoStateOnHysteresisTimeout(NormalVoltageState);
583 u.OnVoltage(NULL, h_app, oSession);
584 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
585 "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
586 FrameworkunifiedGetMsgSrc(h_app));
588 // LCOV_EXCL_STOP 8: can not be LowVoltage1status
590 // LCOV_EXCL_START 8: no one send the event
591 void PowerStateMachine::LowVoltage1::onLowVoltage2Encountered(
592 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
593 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
594 u.GotoStateOnHysteresisTimeout(LowVoltage2State);
595 u.OnVoltage(NULL, h_app, oSession);
596 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
597 "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
598 FrameworkunifiedGetMsgSrc(h_app));
600 // LCOV_EXCL_STOP 8: no one send the event to call this function
602 // LCOV_EXCL_START 8: no one send the event to call this function
603 void PowerStateMachine::LowVoltage1::onNormalVoltageEncountered(
604 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
605 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
606 u.GotoStateOnHysteresisTimeout(NormalVoltageState);
607 u.OnVoltage(NULL, h_app, oSession);
608 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
609 "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
610 FrameworkunifiedGetMsgSrc(h_app));
612 // LCOV_EXCL_STOP 8: no one send the event
614 // LCOV_EXCL_START 8: can not be LowVoltage1status
615 void PowerStateMachine::LowVoltage1::onEntry(PowerStateMachine &u, HANDLE h_app,
616 PowerSessionHandler & oSession) {
617 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
618 if (u.m_oLowVoltage1Hysteresis.getEnabled()) {
619 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
620 "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
621 u.m_oLowVoltage1Hysteresis.getTimeout(),
622 u.m_oLowVoltage1Hysteresis.getTries());
623 // Set the goto state state.
624 u.GotoStateOnHysteresisTimeout(LowVoltage1ActiveState);
625 // Start the hysteresis timer for low voltage 1
626 u.startHysteresisTimer(u.m_oLowVoltage1Hysteresis);
628 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
629 "LOW_VOLTAGE_HYSTERESIS is not enabled. Going directly to LowVoltage1ActiveState");
630 // Move directly to next state.
631 u.NextState(LowVoltage1ActiveState, h_app, oSession);
634 // LCOV_EXCL_STOP 8: no one send the event to call this function
636 // LCOV_EXCL_START 8: no one send the event to call this function
637 void PowerStateMachine::LowVoltage1::onExit(PowerStateMachine &u, HANDLE h_app,
638 PowerSessionHandler & oSession) {
639 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
640 u.stopHysteresisTimer(u.m_oLowVoltage1Hysteresis);
641 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage1 State");
643 // LCOV_EXCL_STOP 8: no one send the event to call this function
645 // LCOV_EXCL_START 8: no one send the event to call this function
646 PCSTR PowerStateMachine::LowVoltage1Active::name() {
647 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
648 return "Low Voltage I Active";
650 // LCOV_EXCL_STOP 8: can not be LowVoltage1status
652 // LCOV_EXCL_START 8: no one send the event
653 void PowerStateMachine::LowVoltage1Active::onLowVoltage2Encountered(
654 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
655 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
656 u.OnVoltage(&LowVoltage2State, h_app, oSession);
657 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
658 FrameworkunifiedGetMsgSrc(h_app));
660 // LCOV_EXCL_STOP 8: no one send the event to call this function
662 // LCOV_EXCL_START 8: no one send the event to call this function
663 void PowerStateMachine::LowVoltage1Active::onNormalVoltageEncountered(
664 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
665 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
666 u.OnVoltage(&NormalVoltageState, h_app, oSession);
667 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
668 FrameworkunifiedGetMsgSrc(h_app));
670 // LCOV_EXCL_STOP 8: no one send the event
672 // LCOV_EXCL_START 8: can not be LowVoltage1Activestatus
673 void PowerStateMachine::LowVoltage1Active::onEntry(
674 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
675 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
676 u.publishPowerLevelType(h_app, epspltEMERGENCY);
677 u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_Active);
679 // LCOV_EXCL_STOP 8: no one send the event to call this function
681 // LCOV_EXCL_START 8: no one send the event to call this function
682 void PowerStateMachine::LowVoltage1Active::onExit(
683 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
684 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
685 u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_InActive);
687 // LCOV_EXCL_STOP 8: can not be LowVoltage1Activestatus
689 PCSTR PowerStateMachine::LowVoltage2::name() { // LCOV_EXCL_START 8: can not be LowVoltage2status
690 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
691 return "Low Voltage II";
693 // LCOV_EXCL_STOP 8: can not be LowVoltage2status
695 // LCOV_EXCL_START 8: no one send the event
696 void PowerStateMachine::LowVoltage2::onHysteresisAborted(
697 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
698 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
699 u.NextState(*(u.m_pPreviousState), h_app, oSession);
701 // LCOV_EXCL_STOP 8: no one send the event
703 // LCOV_EXCL_START 8: can not be LowVoltage2status
704 void PowerStateMachine::LowVoltage2::onHysteresisTimeout(
705 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
706 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
707 if (!u.m_oLowVoltage2Hysteresis.maxTries()) {
708 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
709 "epsmeLOW_VOLTAGE2_HYSTERESIS_TM_OUT tries: %d",
710 u.m_oLowVoltage2Hysteresis.getTries());
712 u.reStartHysteresisTimer(u.m_oLowVoltage2Hysteresis);
714 // Move directorly to next state.
715 u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
718 // LCOV_EXCL_STOP 8: no one send the event to call this function
720 // LCOV_EXCL_START 8: no one send the event to call this function
721 void PowerStateMachine::LowVoltage2::onEntry(PowerStateMachine &u, HANDLE h_app,
722 PowerSessionHandler & oSession) {
723 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
724 if (u.m_oLowVoltage2Hysteresis.getEnabled()) {
725 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
726 "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
727 u.m_oLowVoltage2Hysteresis.getTimeout(),
728 u.m_oLowVoltage2Hysteresis.getTries());
729 // Set the goto state state.
730 u.GotoStateOnHysteresisTimeout(LowVoltage2ActiveState);
731 // Start the hysteresis timer for low voltage 2
732 u.startHysteresisTimer(u.m_oLowVoltage2Hysteresis);
734 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
735 "LOW_VOLTAGE2_HYSTERESIS is not enabled. Going directly to LowVoltage2ActiveState");
736 // Move directly to next state.
737 u.NextState(LowVoltage2ActiveState, h_app, oSession);
740 // LCOV_EXCL_STOP 8: no one send the event to call this function
742 // LCOV_EXCL_START 8: no one send the event to call this function
743 void PowerStateMachine::LowVoltage2::onExit(PowerStateMachine &u, HANDLE h_app,
744 PowerSessionHandler & oSession) {
745 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
746 u.stopHysteresisTimer(u.m_oLowVoltage2Hysteresis);
747 FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage2 State");
749 // LCOV_EXCL_STOP 8: no one send the event to call this function
751 // LCOV_EXCL_START 8: no one send the event to call this function
752 void PowerStateMachine::LowVoltage2::onWakeup(PowerStateMachine &u, HANDLE h_app,
753 PowerSessionHandler & oSession) {
754 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
755 u.GotoStateOnHysteresisTimeout(WakeupPendingState);
757 // LCOV_EXCL_STOP 8: can not be LowVoltage2status
759 // LCOV_EXCL_START 8: no one send the event
760 void PowerStateMachine::LowVoltage2::onLowVoltage1Encountered(
761 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
762 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
763 u.GotoStateOnHysteresisTimeout(LowVoltage1State);
764 u.OnVoltage(NULL, h_app, oSession);
765 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
766 "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
767 FrameworkunifiedGetMsgSrc(h_app));
769 // LCOV_EXCL_STOP 8: no one send the event to call this function
771 // LCOV_EXCL_START 8: no one send the event to call this function
772 void PowerStateMachine::LowVoltage2::onNormalVoltageEncountered(
773 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
774 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
775 u.GotoStateOnHysteresisTimeout(NormalVoltageState);
776 u.OnVoltage(NULL, h_app, oSession);
777 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
778 "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
779 FrameworkunifiedGetMsgSrc(h_app));
781 // LCOV_EXCL_STOP 8: no one send the event
783 PCSTR PowerStateMachine::LowVoltage2Active::name() { // LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
784 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
785 return "Low Voltage II Active";
787 // LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
789 // LCOV_EXCL_START 8: no one send the event
790 void PowerStateMachine::LowVoltage2Active::onLowVoltage1Encountered(
791 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
792 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
793 u.OnVoltage(&LowVoltage1State, h_app, oSession);
794 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
795 FrameworkunifiedGetMsgSrc(h_app));
797 // LCOV_EXCL_STOP 8: no one send the event to call this function
799 // LCOV_EXCL_START 8: no one send the event to call this function
800 void PowerStateMachine::LowVoltage2Active::onNormalVoltageEncountered(
801 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
802 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
803 u.OnVoltage(&NormalVoltageState, h_app, oSession);
804 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
805 FrameworkunifiedGetMsgSrc(h_app));
807 // LCOV_EXCL_STOP 8: no one send the event
809 // LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
810 void PowerStateMachine::LowVoltage2Active::onEntry(
811 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
812 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
813 u.publishPowerLevelType(h_app, epspltEMERGENCY);
814 u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_Active);
816 // LCOV_EXCL_STOP 8: no one send the event to call this function
818 // LCOV_EXCL_START 8: no one send the event to call this function
819 void PowerStateMachine::LowVoltage2Active::onExit(
820 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
821 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
822 u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_InActive);
823 oSession.SendToSupervisor(SS_POWER_LVI2_SHUTDOWN_COMPLETE, 0, NULL);
825 // LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus
827 PCSTR PowerStateMachine::NormalVoltage::name() { // LCOV_EXCL_START 8: can not be NormalVoltageState
828 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
829 return "Normal Voltage";
831 // LCOV_EXCL_STOP 8: can not be NormalVoltageState
833 // LCOV_EXCL_START 8: no one send the event
834 void PowerStateMachine::NormalVoltage::onLowVoltage1Encountered(
835 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
836 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
837 u.OnVoltage(&LowVoltage1State, h_app, oSession);
838 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
839 FrameworkunifiedGetMsgSrc(h_app));
841 // LCOV_EXCL_STOP 8: no one send the event to call this function
843 // LCOV_EXCL_START 8: no one send the event to call this function
844 void PowerStateMachine::NormalVoltage::onLowVoltage2Encountered(
845 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
846 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
847 u.OnVoltage(&LowVoltage2State, h_app, oSession);
848 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
849 FrameworkunifiedGetMsgSrc(h_app));
851 // LCOV_EXCL_STOP 8: no one send the event
853 // LCOV_EXCL_START 8: can not be NormalVoltageState
854 void PowerStateMachine::NormalVoltage::onShutdown(
855 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
856 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
857 u.NextState(ShutdownState, h_app, oSession);
859 // LCOV_EXCL_STOP 8: can not be NormalVoltageState
861 // LCOV_EXCL_START 8: no one send the event
862 void PowerStateMachine::NormalVoltage::onSoftwareUpdate(
863 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
864 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
865 u.NextState(SoftwareUpdateState, h_app, oSession);
867 // LCOV_EXCL_STOP 8: no one send the event
869 // LCOV_EXCL_START 8: can not be NormalVoltageState
870 void PowerStateMachine::NormalVoltage::onEntry(PowerStateMachine &u,
872 PowerSessionHandler & oSession) {
873 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
874 u.publishPowerLevelType(h_app, epspltNORMAL);
876 // LCOV_EXCL_STOP 8: can not be NormalVoltageState
878 PCSTR PowerStateMachine::SoftwareUpdate::name() { // LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
879 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
880 return "Software Update";
882 // LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus
884 // LCOV_EXCL_START 8: no one send the event
885 void PowerStateMachine::SoftwareUpdate::onLowVoltage1Encountered(
886 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
887 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
888 u.OnVoltage(&LowVoltage1State, h_app, oSession);
889 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
890 FrameworkunifiedGetMsgSrc(h_app));
892 // LCOV_EXCL_STOP 8: no one send the event to call this function
894 // LCOV_EXCL_START 8: no one send the event to call this function
895 void PowerStateMachine::SoftwareUpdate::onLowVoltage2Encountered(
896 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
897 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
898 u.OnVoltage(&LowVoltage2State, h_app, oSession);
899 FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
900 FrameworkunifiedGetMsgSrc(h_app));
902 // LCOV_EXCL_STOP 8: no one send the event
904 // LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
905 void PowerStateMachine::SoftwareUpdate::onShutdown(
906 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
907 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
909 // LCOV_EXCL_STOP 8: no one send the event to call this function
911 // LCOV_EXCL_START 8: no one send the event to call this function
912 void PowerStateMachine::SoftwareUpdate::onEntry(
913 PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
914 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
916 // LCOV_EXCL_STOP 8: no one send the event to call this function
918 // LCOV_EXCL_START 8: no one send the event to call this function
919 void PowerStateMachine::SoftwareUpdate::onExit(PowerStateMachine &u,
921 PowerSessionHandler & oSession) {
922 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
924 // LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus