Fix the path to the host specific system configurations
[staging/basesystem.git] / service / system / power_service / server / src / ss_power.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    Handles Power Service Business logic
20 ///
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #include "ss_power.h"
24 #include <inttypes.h>
25 #include <system_service/ss_system_manager_notifications.h>
26 #include <system_service/ss_templates.h>
27 #include <system_service/ss_services.h>
28 #include <system_service/ss_sm_client_if.h>
29 #include <system_service/ss_system_manager_if.h>
30 #include <system_service/ss_system_manager_protocol.h>
31 #include <system_service/ss_power_service_protocol.h>
32 #include <system_service/ss_power_service_notifications.h>
33 #include <system_service/ss_power_service.h>
34 #include <system_service/ss_power_service_notifications_local.h>
35 #include <system_service/ss_power_service_local.h>
36 #include <native_service/frameworkunified_timer.h>
37 #include <native_service/frameworkunified_application.h>
38 #include <native_service/frameworkunified_framework_if.h>
39 #include <native_service/ns_np_service_protocol.h>
40 #include <other_service/PosixBasedOS001ClockCycleApi.h>
41 #include <utility>
42 #include <string>
43
44 #include "ss_power_powerservicelog.h"
45
46 using namespace std;  // NOLINT (build/namespaces)
47
48 static Power g_PowerSubsystem;
49
50 /**
51  * @brief
52  *
53  * @param
54  * @param
55  *
56  * @return
57  */
58 template<typename C, eFrameworkunifiedStatus (C::*M)(HANDLE)> EFrameworkunifiedStatus PowerCallback(
59     HANDLE h_app) {
60
61   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
62
63   C * pObj = static_cast<C *>(&g_PowerSubsystem);
64
65   if (pObj) {
66     l_eStatus = (pObj->*M)(h_app);
67   }
68
69   return l_eStatus;
70 }
71
72 ///////////////////////////////////////////////////////////////////////
73 /// GetInstance
74 /// Return global instance of Power object. Power is singleton class
75 ///
76 //////////////////////////////////////////////////////////////////////
77 Power & Power::GetInstance() {
78   return g_PowerSubsystem;
79 }
80
81 ///////////////////////////////////////////////////////////////////////
82 /// Power
83 /// Constructor of Power class
84 ///
85 //////////////////////////////////////////////////////////////////////
86 Power::Power()
87     : m__CWORD56_RepHist(SS_PWR__CWORD56__REP_HIST_SIZE),
88       m_PubCmdHist(SS_PWR_PUB_CMD_HIST_SIZE),
89       m_ErrHist(SS_PWR_ERR_HIST_SIZE),
90       m_VCmdHist(SS_PWR_V_HIST_SIZE),
91       m_PowerState(SS_PS_READY_TO_WAKEUP),
92       m_VoltageState(epsvsINVALID),
93       m_CrankState(epscsINVALID),
94       m_MaxShutdownTimeout(0) {
95   m_PPStateStrMap[SS_PS_READY_TO_WAKEUP] = "SS_PS_READY_TO_WAKEUP";
96   m_PPStateStrMap[SS_PS_WAKEUP_INITIATED] = "SS_PS_WAKEUP_INITIATED";
97   m_PPStateStrMap[SS_PS_WAKEUP_COMPLETE] = "SS_PS_WAKEUP_COMPLETE";
98   m_PPStateStrMap[SS_PS_POWER_ON_COMPLETE] = "SS_PS_POWER_ON_COMPLETE";
99   m_PPStateStrMap[SS_PS_POWER_OFF_INITIATED] = "SS_PS_POWER_OFF_INITIATED";
100   m_PPStateStrMap[SS_PS_POWER_OFF_COMPLETE] = "SS_PS_POWER_OFF_COMPLETE";
101   m_PPStateStrMap[SS_PS_SHUTDOWN_INITIATED] = "SS_PS_SHUTDOWN_INITIATED";
102   m_PPStateStrMap[SS_PS_SHUTDOWN_COMPLETE] = "SS_PS_SHUTDOWN_COMPLETE";
103   m_PPStateStrMap[SS_PS_STATE_MAX] = "SS_PS_STATE_MAX";
104
105   m__CWORD56_RepIter = m__CWORD56_RepHist.begin();
106   m_PubHistIter = m_PubCmdHist.begin();
107   m_ErrHistIter = m_ErrHist.begin();
108   m_VHistIter = m_VCmdHist.begin();
109   bzero(&m_WakeUpData, sizeof(m_WakeUpData));
110 }
111
112 ///////////////////////////////////////////////////////////////////////
113 /// ~Power
114 /// Destructor of Power class
115 ///
116 //////////////////////////////////////////////////////////////////////
117 Power::~Power() {  // LCOV_EXCL_START 14 Resident process, not called by NSFW
118   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
119 }
120 // LCOV_EXCL_STOP 14 Resident process, not called by NSFW
121
122 ///////////////////////////////////////////////////////////////////////
123 /// Initialize
124 ///
125 ///
126 //////////////////////////////////////////////////////////////////////
127 EFrameworkunifiedStatus Power::Initialize(HANDLE h_app) {
128   EFrameworkunifiedStatus l_eStatus;
129   BOOL l_SpecifiedCfgLoaded;
130
131   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
132
133   SetPowerServiceState(SS_PS_READY_TO_WAKEUP);
134
135   pthread_mutex_init(&pwr_hist_mutex, NULL);
136
137   /// Open and parse the configuration data for Power
138   const CHAR configFileName[] = "/etc/basesystem/BS/ss/power_service/rodata/gpf_ss_ps_config.cfg";
139
140   PowerConfiguration config(configFileName);
141   l_SpecifiedCfgLoaded = config.LoadParameters(m_tConfigData);
142   if (FALSE == l_SpecifiedCfgLoaded) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
143     FRAMEWORKUNIFIEDLOG(
144         ZONE_ERR, __FUNCTION__,
145         "Reading configuration from file: %s failed. Using default parameters.",
146         configFileName);
147     config.LoadDefaultParameters(m_tConfigData);
148   }
149
150   config.PrintConfigInfo(m_tConfigData);
151
152   /// init PowerStateMachine
153   m_oStateMachine.initialize(h_app, m_tConfigData);
154
155   // Register all callbacks to dispatcher and notifications
156   l_eStatus = RegisterAllCallbacksAndNofitications(h_app);
157   LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
158       l_eStatus, "RegisterAllCallbacksAndNofitications()");
159
160   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
161   return l_eStatus;
162 }
163
164 ///////////////////////////////////////////////////////////////////////
165 /// RegisterAllCallbacksAndNofitications
166 ///
167 ///
168 //////////////////////////////////////////////////////////////////////
169 EFrameworkunifiedStatus Power::RegisterAllCallbacksAndNofitications(HANDLE h_app) {
170   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
171   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
172
173   if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(h_app, szNTFY_PowerAvailability))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
174     // LCOV_EXCL_START 4: NSFW error case.
175     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
176     LOG_ERROR(
177         "FrameworkunifiedRegisterServiceAvailabilityNotification( "szNTFY_PowerAvailability" )");
178     FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
179     return l_eStatus;
180     // LCOV_EXCL_STOP 4: NSFW error case.
181   } else {
182     l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, FALSE);
183     if (eFrameworkunifiedStatusOK != l_eStatus) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
184       // LCOV_EXCL_START 4: NSFW error case.
185       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
186       LOG_ERROR("FrameworkunifiedPublishServiceAvailability()");
187     }
188     // LCOV_EXCL_STOP 4: NSFW error case.
189
190     SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
191                     m_PubHistIter, "", l_eStatus);
192   }
193
194   // Attach Notification callbacks to dispatcher
195   FrameworkunifiedNotificationsList
196   ss_power_notifications[] = {
197     { szNTFY_PowerLVI1, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
198     , {szNTFY_PowerLVI2, sizeof(PowerSrvLVIStatus), eFrameworkunifiedStateVar}
199     , {szNTFY_PowerLevel, sizeof(PowerSrvLevelType), eFrameworkunifiedStateVar}
200     , {szNTFY_ShutdownPopup, sizeof(EPWR_SHUTDOWN_POPUP_TYPE), eFrameworkunifiedStateVar}
201     , {szNTFY_PowerPopup, sizeof(EPWR_POWER_POPUP_TYPE), eFrameworkunifiedStateVar}
202   };
203   //   Register Notifications
204   if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedNPRegisterNotifications(h_app, ss_power_notifications, _countof(ss_power_notifications)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
205     // LCOV_EXCL_START 4: NSFW error case.
206     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
207     LOG_ERROR("FrameworkunifiedNPRegisterNotifications(ss_power_notifications)");
208     FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
209     return l_eStatus;
210   }
211   // LCOV_EXCL_STOP 4: NSFW error case.
212   // Subscribe and attach call back for notification
213   if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSubscribeNotificationWithCallback(h_app, NTFY_SSSystemMgrPowerOnOff, PowerCallback<Power, &Power::OnPowerOnOffNotification>))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
214     // LCOV_EXCL_START 4: NSFW error case.
215     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
216     LOG_ERROR("FrameworkunifiedSubscribeNotificationWithCallback()");
217     FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
218     return l_eStatus;
219   }
220   // LCOV_EXCL_STOP 4: NSFW error case.
221
222 //*************************
223
224 /// < Attach to the following session handles.
225   FrameworkunifiedProtocolCallbackHandler ss_power_session_req_handlers[] = {
226       /// session handles.
227           { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
228               &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
229               PowerCallback<Power, &Power::OnCloseSession> }, {
230               SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
231                   &Power::OnSetPowerState> }, { SS_POWER_POWER_REQUEST_MSG,
232               PowerCallback<Power, &Power::OnPowerRequestMsg> }, {
233               SS_POWER_COMM_WAKEUP,
234               PowerCallback<Power, &Power::OnSetCommWakeUp> }, {
235               SS_POWER_SHUTDOWN_REQ,
236               PowerCallback<Power, &Power::OnSetCommSleep> }, {
237               SS_POWER_SHUTDOWN_REQUEST_MSG, PowerCallback<Power,
238                   &Power::OnShutdownRequestMsg> }
239
240           /// Wake-up / Shutdown Protocol commands for System Manager.
241           , { SS_SM_WAKEUP_MODULES_CMPL_RSPN, PowerCallback<Power,
242               &Power::OnWakeUpComplete> }, { SS_SM_SHUTDOWN_MODULES_CMPL_RSPN,
243               PowerCallback<Power, &Power::OnShutdownComplete> }
244           //
245           , { SS_POWER_PRINT_CONNECTIONS, PowerCallback<Power,
246               &Power::OnPrintConnections> }, { SS_POWER_PRINT_STACK,
247               PowerCallback<Power, &Power::OnPrintStack> }
248           /// Set Voltage & Crank states from shadow?
249           , { SS_POWER_VOLTAGE_STATE, PowerCallback<Power,
250               &Power::OnSetVoltageState> }, { SS_POWER_CRANK_STATE,
251               PowerCallback<Power, &Power::OnSetCrankState> }
252           /// Current Power Service State inquiry from Test Client
253           , { SS_POWER_CRNT_STATE_QUERY, PowerCallback<Power,
254               &Power::OnCurrentPowerStateQuery> }, {
255               SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
256                   &Power::OnSystemModeInfoRequest> }, {
257               SS_SM_SYSTEM_MODE_INFO_RSPN, PowerCallback<Power,
258                   &Power::OnSystemModeInfoResponse> }
259           /// InitComp report to SystemManager
260           , { SS_POWER_INITCOMP_REP, PowerCallback<Power,
261               &Power::OnInitCompReport> }
262           //
263           // Startup Confirmation Request ( from Power Shadow ) and
264           // Startup Confirmation Response ( from System Manager )
265           , { SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
266               &Power::OnSendStartupConfirmationRequest> }, {
267               SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, PowerCallback<Power,
268                   &Power::OnSendStartupConfirmationResponse> }
269           //
270           // User Mode Request ( from Power Shadow ) and
271           // User Mode Response ( from System Manager )
272           , { SS_SM_USER_MODE_SET_RESP, PowerCallback<Power,
273               &Power::OnUserModeResponse> }
274
275           //
276           // Heartbeat Request ( from Power Shadow )
277           , { SS_POWER_HEARTBEAT_REQ, PowerCallback<Power,
278               &Power::On_CWORD56_HeartBeatRequest> }, { SS_SM__CWORD56__HEARTBEAT_RSPN,
279               PowerCallback<Power, &Power::OnSM_CWORD56_HeartBeatResponse> }
280
281           // System Manager to Power Services
282           , { SS_SM_CPU_RESET_REQ, PowerCallback<Power,
283               &Power::OnCpuResetRequest> }, { SS_SM_REMOTE_DATA_RESET_REQ,
284               PowerCallback<Power, &Power::OnRemoteDataResetRequest> } };
285
286   // Attach callback
287   if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, FRAMEWORKUNIFIED_ANY_SOURCE, ss_power_session_req_handlers, _countof(ss_power_session_req_handlers)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
288     // LCOV_EXCL_START 4: NSFW error case.
289     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
290     LOG_ERROR("FrameworkunifiedAttachCallbacksToDispatcher( ss_power_session_req_handlers )");
291     FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
292     return l_eStatus;
293   }
294   // LCOV_EXCL_STOP 4: NSFW error case.
295
296   //*************************
297
298   // Publish szNTFY_PowerAvailable so that other services can start connecting via sessions.
299
300   l_eStatus = RegisterSMSessionAckCallback(
301       PowerCallback<Power, &Power::OnSystemMgrConnectionEstablished>);
302   LOG_STATUS(l_eStatus, "RegisterSMSessionAckCallback()");
303
304   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
305   return l_eStatus;
306 }
307
308 ///////////////////////////////////////////////////////////////////////
309 /// OnSetCommWakeUp
310 ///
311 ///
312 //////////////////////////////////////////////////////////////////////
313 EFrameworkunifiedStatus Power::OnSetCommWakeUp(HANDLE h_app) {
314   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
315   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
316   Pwr_ServiceSetInterface l_CanStatesData;
317
318   // ReadMsg():                                                        *
319   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
320   //     Report any errors found.                                      *
321   //                                                                   *
322   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
323     // LCOV_EXCL_START 4: NSFW error case.
324     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
325     LOG_ERROR("ReadMsg()");
326     // LCOV_EXCL_STOP 4: NSFW error case.
327   } else if (l_CanStatesData.data.commwake.state == epscnCANWAKEUP) {
328     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
329            "Received WakeUp from %s, Processing Ignored !!",
330            FrameworkunifiedGetMsgSrc(h_app));
331   }
332
333   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
334   return l_eStatus;
335 }
336
337 ///////////////////////////////////////////////////////////////////////
338 /// OnSetCommSleep
339 ///
340 ///
341 //////////////////////////////////////////////////////////////////////
342 // LCOV_EXCL_START 200: can not be called from power class
343 EFrameworkunifiedStatus Power::OnSetCommSleep(HANDLE h_app) {
344   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
345   EFrameworkunifiedStatus l_eStatus;
346   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
347   Pwr_ServiceSetInterface l_CanStatesData;
348
349   // ReadMsg():                                                        *
350   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
351   //     Report any errors found.                                      *
352   //                                                                   *
353   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CanStatesData))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
354     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
355     LOG_ERROR("ReadMsg()");  // LCOV_EXCL_LINE 4: NSFW error case.
356   } else if (l_CanStatesData.data.commwake.state != epscnCANSLEEP) {
357     FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
358            "Error: %s: l_CanStatesData.data.commwake.state != epscnCANSLEEP",
359            FrameworkunifiedGetMsgSrc(h_app));
360     l_eStatus = eFrameworkunifiedStatusInvldParam;
361   } else {
362     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Received Sleep from %s",
363            FrameworkunifiedGetMsgSrc(h_app));
364
365     // Send to System Manager to WakeUp Modules
366     l_eStatus = SendShutdownToSystemManager(&l_CanStatesData);
367     if (l_eStatus != eFrameworkunifiedStatusOK) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
368       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
369       LOG_ERROR("SendShutdownToSystemManager()");  // LCOV_EXCL_LINE 4: NSFW error case.
370     } else {
371       SetPowerServiceState(SS_PS_SHUTDOWN_INITIATED);
372       LOG_SUCCESS("SendShutdownToSystemManager()");
373     }
374   }
375
376   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
377   return l_eStatus;
378 }
379 // LCOV_EXCL_STOP 200: can not be called from power class
380
381 ///////////////////////////////////////////////////////////////////////
382 /// SetPowerServiceState
383 ///
384 ///
385 //////////////////////////////////////////////////////////////////////
386 VOID Power::SetPowerServiceState(SS_PSState f_NewState) {
387   FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Changing State from '%s' to '%s'",
388          m_PPStateStrMap[m_PowerState].c_str(),
389          m_PPStateStrMap[f_NewState].c_str());
390
391   m_PowerState = f_NewState;
392 }
393
394 ///////////////////////////////////////////////////////////////////////
395 /// OnPowerOnOffNotification
396 ///
397 ///
398 //////////////////////////////////////////////////////////////////////
399 EFrameworkunifiedStatus Power::OnPowerOnOffNotification(HANDLE h_app) {
400   EFrameworkunifiedStatus l_eStatus;
401   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
402   T_SS_SM_UserModeOnOffNotification_StructType l_userModeOnOffStruct;
403   INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
404
405   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<T_SS_SM_UserModeOnOffNotification_StructType>(h_app, l_userModeOnOffStruct))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
406     // LCOV_EXCL_START 4: NSFW error case.
407     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
408     LOG_ERROR("ReadMsg()");
409     // LCOV_EXCL_STOP 4: NSFW error case.
410   } else {
411     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
412            " User Mode is '%s', User Mode Change Reason is '%s'",
413            GetStr(l_userModeOnOffStruct.isUserModeOn).c_str(),
414            GetStr(l_userModeOnOffStruct.userModeChangeReason).c_str());
415     SetPowerServiceState(
416         l_userModeOnOffStruct.isUserModeOn ?
417             SS_PS_POWER_ON_COMPLETE : SS_PS_POWER_OFF_COMPLETE);
418   }
419   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
420   return l_eStatus;
421 }
422
423 ///////////////////////////////////////////////////////////////////////
424 /// ProcessSystemWakeUp
425 /// On receipt of this notification send wake up notification to
426 /// System Manager to wake up (START) all modules
427 ///
428 //////////////////////////////////////////////////////////////////////
429 EFrameworkunifiedStatus Power::OnSetPowerState(HANDLE h_app) {
430   EFrameworkunifiedStatus l_eStatus;
431   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
432   Pwr_ServiceSetInterface l_serviceSetIf;
433
434   // ReadMsg():                                                        *
435   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
436   //     Report any errors found.                                      *
437   //                                                                   *
438   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_serviceSetIf))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
439     // LCOV_EXCL_START 4: NSFW error case.
440     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
441     LOG_ERROR("ReadMsg()");
442     // LCOV_EXCL_STOP 4: NSFW error case.
443   } else {
444     switch (l_serviceSetIf.data.wake.powerupType) {
445       case epswsPWRON:
446       case epswsPWROFF:
447         m_WakeUpData = l_serviceSetIf.data.wake;
448
449         FRAMEWORKUNIFIEDLOG(
450             ZONE_INFO, __FUNCTION__, " Received Power %s from %s, level 0x%X",
451             l_serviceSetIf.data.wake.powerupType == epswsPWRON ? "On" : "Off",
452             FrameworkunifiedGetMsgSrc(h_app), m_WakeUpData.up.level);
453         // Send to System Manager to WakeUp Modules
454         l_eStatus = SendWakeUpToSystemManager(&m_WakeUpData);
455         if (l_eStatus == eFrameworkunifiedStatusOK) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
456           SetPowerServiceState(SS_PS_WAKEUP_INITIATED);
457           LOG_SUCCESS("SendWakeUpToSystemManager()");
458         } else {
459           // LCOV_EXCL_START 4: NSFW error case.
460           AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
461           LOG_ERROR("SendWakeUpToSystemManager()");
462           // LCOV_EXCL_STOP 4: NSFW error case.
463         }
464         break;
465       default:
466         l_eStatus = eFrameworkunifiedStatusInvldParam;
467         FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
468                " Error: Invalid PowerOnOff State received: 0x%X",
469                l_serviceSetIf.data.wake.powerupType);
470         break;
471     }
472   }
473
474   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
475   return l_eStatus;
476 }
477
478 ///////////////////////////////////////////////////////////////////////
479 ///
480 /// Session Request Handlers
481 ///
482 //////////////////////////////////////////////////////////////////////
483
484 EFrameworkunifiedStatus Power::OnOpenSession(HANDLE h_app) {
485   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
486   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
487   INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
488   l_eStatus = m_oSessionHandler.OpenSesion(h_app);
489
490   /// < Test Code TODO: Remove ME!!!
491   // m_oSessionHandler.Print();
492
493   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
494   return l_eStatus;
495 }
496
497 ///////////////////////////////////////////////////////////////////////
498 ///
499 ///
500 ///
501 //////////////////////////////////////////////////////////////////////
502 EFrameworkunifiedStatus Power::OnCloseSession(HANDLE h_app) {
503   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
504   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
505   INTERFACEUNIFIEDLOG_RECEIVED_FROM(h_app);
506   l_eStatus = m_oSessionHandler.CloseSession(h_app);
507   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
508   return l_eStatus;
509 }
510
511 ///////////////////////////////////////////////////////////////////////
512 ///
513 ///
514 ///
515 //////////////////////////////////////////////////////////////////////
516 EFrameworkunifiedStatus Power::OnWakeUpComplete(HANDLE h_app) {
517   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
518   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
519   wakeInfo l_Wake;
520
521   // ReadMsg():                                                        *
522   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
523   //     Report any errors found.                                      *
524   //                                                                   *
525   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<wakeInfo>(h_app, l_Wake))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
526     // LCOV_EXCL_START 4: NSFW error case.
527     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
528     LOG_ERROR("ReadMsg()");
529     // LCOV_EXCL_STOP 4: NSFW error case.
530   } else if (l_Wake.up.level == m_WakeUpData.up.level) {
531     SetPowerServiceState(SS_PS_WAKEUP_COMPLETE);
532
533     /// < send the state machine a wakeup event.
534     m_oStateMachine.onEvent(h_app, m_oSessionHandler,
535                             PowerStateMachine::epsmeWAKEUP);
536
537     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
538            " Sending SS_POWER_STATE_CHANGE_RESP(%s) to PSM",
539            l_Wake.powerupType == epswsPWRON ? "User_On" : "User_Off");
540
541     // send Wake-up complete response to Supervisor
542     m_oSessionHandler.SendToSupervisor(SS_POWER_STATE_CHANGE_RESP,
543                                        sizeof(l_Wake), (PVOID) &l_Wake);
544     SS_PWR_LOG_HIST("SS_POWER_STATE_CHANGE_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
545                     "SS_PS_WAKEUP_COMPLETE", l_eStatus);
546
547     /// < Test Code TODO: Remove ME!!!
548     // m_oSessionHandler.Print();
549   } else {
550     l_eStatus = eFrameworkunifiedStatusInvldParam;
551     FRAMEWORKUNIFIEDLOG(
552         ZONE_ERR,
553         __FUNCTION__,
554         "Error: Power WakeUp Threshold (%d) and SM WakeUp Threshold (%d) Mismatch",
555         m_WakeUpData.up.level, l_Wake.up.level);
556   }
557
558   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
559   return l_eStatus;
560 }
561
562 ///////////////////////////////////////////////////////////////////////
563 ///
564 ///
565 ///
566 //////////////////////////////////////////////////////////////////////
567 EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app) {
568   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
569   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
570
571   SetPowerServiceState(SS_PS_SHUTDOWN_COMPLETE);
572
573   m_oStateMachine.onEvent(h_app, m_oSessionHandler,
574                           PowerStateMachine::epsmeSHUTDOWN);
575
576   FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Sending SS_POWER_SHUTDOWN_RESP to PSM");
577   // send Shutdown complete response to Power Shadow / Supervisor
578   m_oSessionHandler.SendToSupervisor(SS_POWER_SHUTDOWN_RESP, 0, (PVOID) NULL);
579
580   SS_PWR_LOG_HIST("SS_POWER_SHUTDOWN_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter,
581                   "SS_PS_SHUTDOWN_COMPLETE", l_eStatus);
582
583   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
584   return l_eStatus;
585 }  // End of EFrameworkunifiedStatus Power::OnShutdownComplete(HANDLE h_app)
586
587 ///////////////////////////////////////////////////////////////////////
588 ///
589 ///
590 ///
591 //////////////////////////////////////////////////////////////////////
592 EFrameworkunifiedStatus Power::OnPrintConnections(HANDLE h_app) {
593   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
594   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
595   m_oSessionHandler.Print();
596   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
597   return l_eStatus;
598 }
599
600 ///////////////////////////////////////////////////////////////////////
601 ///
602 ///
603 ///
604 //////////////////////////////////////////////////////////////////////
605 EFrameworkunifiedStatus Power::OnPrintStack(HANDLE h_app) {
606   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
607   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
608   m_oSessionHandler.Print();
609   // m_oStateMachine.Print();
610   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
611   return l_eStatus;
612 }
613
614 ///////////////////////////////////////////////////////////////////////
615 ///
616 ///
617 ///
618 //////////////////////////////////////////////////////////////////////
619 EFrameworkunifiedStatus Power::OnHysteresisTimeout(HANDLE h_app) {
620   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
621   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
622   m_oStateMachine.onEvent(h_app, m_oSessionHandler,
623                           PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT);
624   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
625   return l_eStatus;
626 }
627 ///////////////////////////////////////////////////////////////////////
628 ///
629 ///
630 ///
631 //////////////////////////////////////////////////////////////////////
632
633 EFrameworkunifiedStatus PowerStateMachine::initialize(HANDLE h_app,
634                                          PowerConfigParams & refConfigParms) {
635   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
636   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
637   /// Set all hysteresis objects with the configuration data obtained from PowerService.xml
638   m_oShutdownHysteresis.set(refConfigParms.shutdown);
639   m_oLowVoltage1Hysteresis.set(refConfigParms.lvi1);
640   m_oLowVoltage2Hysteresis.set(refConfigParms.lvi2);
641
642   /// Copy the list of required modules.
643   m_lstWakeupModules = refConfigParms.wakeup_modules;
644   m_lstShutdownModules = refConfigParms.shutdown_modules;
645   m_lstLvi2Modules = refConfigParms.lvi2_modules;
646
647   m_hHysteresisTimer = FrameworkunifiedAttachTimerCallback(
648       h_app, 0, 0, PowerCallback<Power, &Power::OnHysteresisTimeout>);
649   if (NULL == m_hHysteresisTimer) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
650     // LCOV_EXCL_START 4: NSFW error case.
651     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
652     FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
653            "Error: FrameworkunifiedAttachTimerCallback() returned NULL");
654     l_eStatus = eFrameworkunifiedStatusInvldHandle;
655   }
656   // LCOV_EXCL_STOP 4: NSFW error case.
657
658   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
659   return l_eStatus;
660 }
661
662 ///////////////////////////////////////////////////////////////////////
663 ///
664 ///
665 ///
666 //////////////////////////////////////////////////////////////////////
667 EFrameworkunifiedStatus PowerSessionHandler::OpenSesion(HANDLE h_app) {
668   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
669   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
670
671   // check if the subscriber is already in map
672   PwSessionIter iter = m_mapSessions.find(FrameworkunifiedGetMsgSrc(h_app));
673
674   // the iter is set to the end then the subscriber is not in the map
675   if (m_mapSessions.end() == iter) {
676     string subscriber(FrameworkunifiedGetMsgSrc(h_app));
677     PwSessionInfo newEntry;
678     newEntry.frunning = FALSE;
679     newEntry.hsession = FrameworkunifiedMcOpenSender(h_app, subscriber.c_str());
680     newEntry.sz_name = subscriber;
681     newEntry.sz_servicename = "";  // we will get this on the start complete.
682     newEntry.esessiontype = epsstBASIC;
683     newEntry.ui_groupid = 0;
684
685     if (NULL != newEntry.hsession) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
686       //
687       // Set the Session Handle for Framework so FrameworkunifiedSendResponse won't error due to a null
688       // session handle.
689       //
690       // LCOV_EXCL_BR_START 4: NSFW error case.
691       if (eFrameworkunifiedStatusOK
692           // [in] PCSTR - Name of the associated service name
693           // [in] HANDLE - Session handle
694           != (l_eStatus = FrameworkunifiedSetSessionHandle(h_app, subscriber.c_str(), newEntry.hsession))) {  // NOLINT[whitespace/line_length]
695       // LCOV_EXCL_BR_STOP
696         // LCOV_EXCL_START 4: NSFW error case.
697         LOG_ERROR("FrameworkunifiedSetSessionHandle()");
698         AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
699         FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
700         return l_eStatus;
701         // LCOV_EXCL_STOP 4: NSFW error case.
702       }
703
704       OpenSessionAck openSessionAck;
705       memset(&openSessionAck, 0, sizeof(openSessionAck));
706       strcpy(openSessionAck.cSessionName, SERVICE_POWER);  // NOLINT (runtime/printf)
707       openSessionAck.eStatus = eFrameworkunifiedStatusOK;
708       openSessionAck.sessionId = 0;  /// Only one session handles all the heartbeat clients
709
710       // Send Ack to subscriber
711       l_eStatus = FrameworkunifiedSendMsg(newEntry.hsession, PROTOCOL_OPEN_SESSION_ACK,
712                              sizeof(OpenSessionAck), (PVOID) &openSessionAck);
713       char l_cBuf[100];
714       snprintf(l_cBuf, sizeof(l_cBuf),
715                "FrameworkunifiedSendMsg(%s, PROTOCOL_OPEN_SESSION_ACK)", subscriber.c_str());
716       LOG_STATUS(l_eStatus, l_cBuf);
717     }
718
719     // If this is not a basic module then we will need to register some other protocols
720     if (0 != FrameworkunifiedGetMsgLength(h_app)) {
721       EPWR_SESSION_TYPE tOpenSessionReq;
722       if (sizeof(EPWR_SESSION_TYPE) == FrameworkunifiedGetMsgLength(h_app)) {
723         if (eFrameworkunifiedStatusOK
724             == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tOpenSessionReq,
725                                                 sizeof(EPWR_SESSION_TYPE)))) {
726           switch (tOpenSessionReq) {
727             case epsstBASIC: {
728               FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
729                      "Subscriber : %s , open a session using type: BASIC",
730                      subscriber.c_str());
731               FrameworkunifiedProtocolCallbackHandler ss_power_session_basic_handlers[] = { {
732                   PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
733                       &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
734                   PowerCallback<Power, &Power::OnCloseSession> } };
735
736               // Attach callback : Power Session Requests
737               if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_session_basic_handlers, _countof(ss_power_session_basic_handlers)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
738                 // LCOV_EXCL_START 4: NSFW error case.
739                 AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
740                 LOG_ERROR(
741                     "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_basic_handlers)");
742                 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
743                 return l_eStatus;
744               }
745               // LCOV_EXCL_STOP 4: NSFW error case.
746
747               FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
748                      "Subscriber '%s' opened a type 'BASIC' session",
749                      subscriber.c_str());
750             }
751               break;
752             case epsstSUPERVISOR: {
753               FrameworkunifiedProtocolCallbackHandler ss_power_sprv_session_handlers[] = { {
754                   PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
755                       &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
756                   PowerCallback<Power, &Power::OnCloseSession> }, {
757                   SS_POWER_FWD_START_CONFIRMATION_MSG_REQ, PowerCallback<Power,
758                       &Power::OnSendStartupConfirmationRequest> }, {
759                   SS_POWER_STATE_CHANGE_REQ, PowerCallback<Power,
760                       &Power::OnSetPowerState> }, { SS_POWER_SHUTDOWN_REQ,
761                   PowerCallback<Power, &Power::OnShutdownRequestMsg> }
762                   , { SS_POWER_SYSTEM_MODE_INFO_REQ, PowerCallback<Power,
763                       &Power::OnSystemModeInfoRequest> }, {
764                       SS_POWER_PUBLISH_SHUTDOWN_CONDITION_REQ, PowerCallback<
765                           Power, &Power::OnPublishShutdownPopupRequest> }, {
766                       SS_POWER_PUBLISH_POWER_POPUP_REQ, PowerCallback<Power,
767                           &Power::OnPublishPowerPopupRequest> }, {
768                       SS_POWER_POWER_REQUEST_MSG, PowerCallback<Power,
769                           &Power::OnPowerRequestMsg> } };
770
771               // Attach callback : Power Supervisor Session Requests
772               if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_sprv_session_handlers, _countof(ss_power_sprv_session_handlers)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
773                 // LCOV_EXCL_START 4: NSFW error case.
774                 AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
775                 LOG_ERROR(
776                     "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_sprv_session_handlers)");
777                 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
778                 return l_eStatus;
779               }
780               // LCOV_EXCL_STOP 4: NSFW error case.
781
782               FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
783                      "Subscriber '%s' opened a 'SUPERVISOR' session",
784                      subscriber.c_str());
785               newEntry.esessiontype = tOpenSessionReq;
786
787               static BOOL first_supervisor = TRUE;
788               if (first_supervisor) {
789                 AttachCallbackToSystemManager(  // LCOV_EXCL_BR_LINE 4: NSFW error case.
790                     h_app, SS_SM_SYSTEM_MODE_INFO_RSPN,
791                     PowerCallback<Power, &Power::OnSystemModeInfoResponse>);
792                 first_supervisor = FALSE;
793               }
794             }
795               break;
796             case epsstSYSTEM: {
797               FrameworkunifiedProtocolCallbackHandler ss_power_system_session_handlers[] = {
798                   { PROTOCOL_OPEN_SESSION_REQ, PowerCallback<Power,
799                       &Power::OnOpenSession> }, { PROTOCOL_CLOSE_SESSION_REQ,
800                       PowerCallback<Power, &Power::OnCloseSession> }, {
801                       SS_POWER_SYSTEM_LAUNCH_COMPLETE, PowerCallback<Power,
802                           &Power::OnSystemLaunchComplete> }, {
803                       SS_POWER_SHUTDOWN_RESP, PowerCallback<Power,
804                           &Power::OnSystemShutdownComplete> } };
805
806               // Attach callback : Power System Session Requests
807               if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher(h_app, subscriber.c_str(), ss_power_system_session_handlers, _countof(ss_power_system_session_handlers)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
808                 // LCOV_EXCL_START 4: NSFW error case.
809                 AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
810                 LOG_ERROR(
811                     "FrameworkunifiedAttachCallbacksToDispatcher(ss_power_session_handlers)");
812                 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
813                 return l_eStatus;
814               }
815               // LCOV_EXCL_STOP 4: NSFW error case.
816
817               FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
818                      "Subscriber '%s' opened a 'SYSTEM' session",
819                      subscriber.c_str());
820               newEntry.esessiontype = tOpenSessionReq;
821             }
822               break;
823             case epsstUNKNOWN: {
824               FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
825                      "Subscriber '%s' tried to open a type 'UNKNOWN' session",
826                      subscriber.c_str());
827               FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
828               return eFrameworkunifiedStatusInvldParam;
829             }
830               break;
831           }
832         }
833       }
834     }
835
836     // insert this newEntry into the map
837     m_mapSessions.insert(make_pair(subscriber, newEntry));
838   } else {
839     // This Subscriber is already in our map, just send and ack to keep them quote.
840     FRAMEWORKUNIFIEDLOG(
841         ZONE_INFO, __FUNCTION__,
842         "Subscriber : %s , is already in the map, will Just send back an ACK",
843         iter->second.sz_name.c_str());
844     if (NULL != iter->second.hsession) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
845       OpenSessionAck openSessionAck;
846       memset(&openSessionAck, 0, sizeof(openSessionAck));
847       strcpy(openSessionAck.cSessionName, SERVICE_POWER);  // NOLINT (runtime/printf)
848       openSessionAck.eStatus = eFrameworkunifiedStatusOK;
849       // I can't think of a reason why we would need more that one session per subscriber.
850       openSessionAck.sessionId = 0;
851
852       // Send Ack to subscriber
853       l_eStatus = FrameworkunifiedSendMsg(iter->second.hsession, PROTOCOL_OPEN_SESSION_ACK,
854                              sizeof(OpenSessionAck), (PVOID) &openSessionAck);
855       FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
856              "FrameworkunifiedSendMsg Success to : %s , status: 0x%x",
857              iter->second.sz_name.c_str(), l_eStatus);
858     } else {
859       FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__,
860              "What!  NULL == iter->second.hsession TODO: Need to handle this!");
861     }
862   }
863
864   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
865   return l_eStatus;
866 }
867
868 ///////////////////////////////////////////////////////////////////////
869 ///
870 ///
871 ///
872 //////////////////////////////////////////////////////////////////////
873 EFrameworkunifiedStatus PowerSessionHandler::StopComplete(HANDLE h_app) {  // LCOV_EXCL_START 8: can not be called
874   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
875   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
876   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
877
878   // ToDo Jay 2012 November 02 Can this be deleted ?
879   FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
880          " No-op function - It's here, but it doesn't do anything");
881
882   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
883   return l_eStatus;
884 }
885 // LCOV_EXCL_STOP 8: can not be called
886
887 ///////////////////////////////////////////////////////////////////////
888 /// ProcessVoltageNotifyRequest
889 ///
890 ///
891 //////////////////////////////////////////////////////////////////////
892 EFrameworkunifiedStatus Power::PublishVoltageStateChange(HANDLE h_app) {
893   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
894   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
895   PowerSrvLVIStatus l_LVIStatus;
896   PowerSrvLevelType l_PowerLevel;
897
898   switch (m_VoltageState) {  // LCOV_EXCL_BR_LINE 6: double check
899     case epsvsNORMAL:
900       l_PowerLevel = epspltNORMAL;
901 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
902                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
903           l_eStatus,
904           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltNORMAL)");
905
906       l_LVIStatus = ePwSrvLVI_Status_InActive;
907 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
908                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
909           l_eStatus,
910           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
911
912 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
913                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
914           l_eStatus,
915           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
916       break;
917
918     case epsvsLVI1:
919       l_PowerLevel = epspltEMERGENCY;
920 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
921                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
922           l_eStatus,
923           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
924
925       l_LVIStatus = ePwSrvLVI_Status_Active;
926 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
927                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
928           l_eStatus,
929           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_Active)");
930
931       l_LVIStatus = ePwSrvLVI_Status_InActive;
932 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
933                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
934           l_eStatus,
935           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_InActive)");
936       break;
937
938     case epsvsLVI2:
939       l_PowerLevel = epspltEMERGENCY;
940 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLevel, &l_PowerLevel, sizeof(PowerSrvLevelType));
941                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
942           l_eStatus,
943           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLevel ", epspltEMERGENCY)");
944
945       l_LVIStatus = ePwSrvLVI_Status_InActive;
946 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI1, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
947                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
948           l_eStatus,
949           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI1 ", ePwSrvLVI_Status_InActive)");
950
951       l_LVIStatus = ePwSrvLVI_Status_Active;
952 l_eStatus = FrameworkunifiedNPPublishNotification(h_app, szNTFY_PowerLVI2, &l_LVIStatus, sizeof(PowerSrvLVIStatus));
953                         LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
954           l_eStatus,
955           "FrameworkunifiedNPPublishNotification(" szNTFY_PowerLVI2 ", ePwSrvLVI_Status_Active)");
956       break;
957
958     case epsvsINVALID:
959       // LCOV_EXCL_START 6: double check
960       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
961       l_eStatus = eFrameworkunifiedStatusInvldParam;
962       LOG_ERROR(" epsvsINVALID == m_VoltageState");
963       break;
964       // LCOV_EXCL_STOP 6: double check
965
966     default:
967       // LCOV_EXCL_START 6: double check
968       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
969       l_eStatus = eFrameworkunifiedStatusInvldParam;
970       FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
971              "Error: Invalid 'm_VoltageState' value detected: 0x%X/%d",
972              m_VoltageState, m_VoltageState);
973       break;
974       // LCOV_EXCL_STOP 6: double check
975   }
976
977   SS_PWR_LOG_HIST("PublishVoltageStateChange()", m_PubCmdHist, m_PubHistIter,
978                   "", l_eStatus);
979
980   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
981   return l_eStatus;
982 }
983 ///////////////////////////////////////////////////////////////////////
984 /// OnSystemModeInfoResponse
985 ///
986 //////////////////////////////////////////////////////////////////////
987 EFrameworkunifiedStatus Power::OnSystemModeInfoResponse(HANDLE h_app) {
988   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
989   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
990   SystemModeInfo l_SystemModeInfo;
991
992   std::memset(&l_SystemModeInfo, 0, sizeof(SystemModeInfo));
993
994   // ReadMsg():                                                        *
995   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
996   //     Report any errors found.                                      *
997   //                                                                   *
998   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SystemModeInfo>(h_app, l_SystemModeInfo))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
999     // LCOV_EXCL_START 4: NSFW error case.
1000     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1001     LOG_ERROR("ReadMsg()");  // LCOV_EXCL_LINE 4: NSFW error case.
1002     // LCOV_EXCL_STOP 4: NSFW error case.
1003   } else {
1004     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1005            "Sending SS_POWER_SYSTEM_MODE_INFO_RESP to PSM");
1006     // send Wake-up complete response to System Power Manager
1007     l_eStatus = m_oSessionHandler.SendToSupervisor(
1008         SS_POWER_SYSTEM_MODE_INFO_RESP, sizeof(SystemModeInfo),
1009         (PVOID) &l_SystemModeInfo);
1010
1011     SS_PWR_LOG_HIST("SS_POWER_SYSTEM_MODE_INFO_RESP", m__CWORD56_RepHist,
1012                     m__CWORD56_RepIter, "", l_eStatus);
1013
1014     LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
1015         l_eStatus, "m_oSessionHandler.SendToSupervisor( "
1016         "SS_POWER_SYSTEM_MODE_INFO_RESP)");
1017   }
1018   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1019   return l_eStatus;
1020 }
1021
1022 ///////////////////////////////////////////////////////////////////////
1023 /// OnSystemModeInfoRequest
1024 ///
1025 //////////////////////////////////////////////////////////////////////
1026 EFrameworkunifiedStatus Power::OnSystemModeInfoRequest(HANDLE h_app) {
1027   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1028   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1029
1030   if (eFrameworkunifiedStatusOK != (l_eStatus = SendSystemModeRequestToSystemManager())) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
1031     // LCOV_EXCL_START 4: NSFW error case.
1032     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1033     LOG_ERROR("SendSystemModeRequestToSystemManager()");
1034     // LCOV_EXCL_STOP 4: NSFW error case.
1035   }
1036   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1037   return l_eStatus;
1038 }
1039
1040 ///////////////////////////////////////////////////////////////////////
1041 /// OnInitCompReport
1042 ///
1043 //////////////////////////////////////////////////////////////////////
1044 EFrameworkunifiedStatus Power::OnInitCompReport(HANDLE h_app) {
1045   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1046   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1047
1048   if (eFrameworkunifiedStatusOK != (l_eStatus = SendInitCompReportToSystemManager())) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
1049     // LCOV_EXCL_START 4: NSFW error case.
1050     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1051     LOG_ERROR("SendInitCompReportToSystemManager()");
1052     // LCOV_EXCL_STOP 4: NSFW error case.
1053   }
1054
1055   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1056   return l_eStatus;
1057 }
1058
1059 ///////////////////////////////////////////////////////////////////////
1060 /// OnCurrentPowerStateQuery
1061 ///
1062 //////////////////////////////////////////////////////////////////////
1063 EFrameworkunifiedStatus Power::OnCurrentPowerStateQuery(HANDLE h_app) {
1064   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1065   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1066   SS_PSCurrentState l_CurrentState;
1067   std::memset(&l_CurrentState, 0, sizeof(SS_PSCurrentState));
1068
1069   // ReadMsg():                                                        *
1070   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1071   //     Report any errors found.                                      *
1072   //                                                                   *
1073   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<SS_PSCurrentState>(h_app, l_CurrentState))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1074     // LCOV_EXCL_START 4: NSFW error case.
1075     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1076     LOG_ERROR("ReadMsg()");
1077     // LCOV_EXCL_STOP 4: NSFW error case.
1078   } else if (eFrameworkunifiedStatusOK != (l_eStatus = ConstructPwrStateResponse(l_CurrentState.printRespmsg))) {  // LCOV_EXCL_BR_LINE 8: dead code  // NOLINT[whitespace/line_length]
1079     // LCOV_EXCL_START 8: dead code.
1080     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1081     LOG_ERROR("ConstructPwrStateResponse(l_CurrentState.printRespmsg)");
1082     // LCOV_EXCL_STOP
1083   } else {
1084     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Response is %s",
1085            l_CurrentState.printRespmsg);
1086     // Send Power State to client
1087
1088     HANDLE l_handle = FrameworkunifiedOpenService(h_app, FrameworkunifiedGetMsgSrc(h_app));
1089     if (NULL != l_handle) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
1090       l_eStatus = FrameworkunifiedSendMsg(l_handle, SS_POWER_CRNT_STATE_QUERY_RSPN,
1091                              sizeof(SS_PSCurrentState),
1092                              (PVOID) &l_CurrentState);
1093
1094       LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
1095           l_eStatus, "FrameworkunifiedSendMsg(SS_POWER_CRNT_STATE_QUERY_RSPN)");
1096
1097       l_eStatus = FrameworkunifiedCloseService(h_app, l_handle);
1098       LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(l_eStatus,
1099                                                      "FrameworkunifiedCloseService()");
1100     } else {
1101       // LCOV_EXCL_START 4: NSFW error case.
1102       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1103       l_eStatus = eFrameworkunifiedStatusNullPointer;
1104       FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error. FrameworkunifiedOpenService(%s) returned NULL",
1105              FrameworkunifiedGetMsgSrc(h_app));
1106       // LCOV_EXCL_STOP 4: NSFW error case.
1107     }
1108   }
1109
1110   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1111   return l_eStatus;
1112 }
1113
1114 ///////////////////////////////////////////////////////////////////////
1115 /// OnSetVoltageState
1116 ///
1117 //////////////////////////////////////////////////////////////////////
1118 EFrameworkunifiedStatus Power::OnSetVoltageState(HANDLE h_app) {
1119   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1120   std::string stLvl = "INVALID";
1121   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1122
1123   Pwr_ServiceSetInterface l_VoltageState;
1124   // ReadMsg():                                                        *
1125   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1126   //     Report any errors found.                                      *
1127   //                                                                   *
1128   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_VoltageState))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1129     // LCOV_EXCL_START 4: NSFW error case.
1130     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1131     LOG_ERROR("ReadMsg()");
1132     // LCOV_EXCL_STOP 4: NSFW error case.
1133   } else {
1134     m_VoltageState = static_cast<ePowerSrvVoltageStates>(l_VoltageState.data
1135         .voltage.state);
1136     if (eFrameworkunifiedStatusOK != (l_eStatus = PublishVoltageStateChange(h_app))) {  // LCOV_EXCL_BR_LINE 4:NSFW error case.
1137       // LCOV_EXCL_START 4: NSFW error case.
1138       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1139       LOG_ERROR("PublishVoltageStateChange()");
1140       // LCOV_EXCL_STOP 4: NSFW error case.
1141     }
1142
1143     SS_PWR_LOG_HIST("OnSetVoltageState", m_PubCmdHist, m_PubHistIter,
1144                     "PublishVoltageStateChange()", l_eStatus);
1145
1146     switch (l_VoltageState.data.voltage.state) {
1147       case epsvsINVALID: {
1148         stLvl = "INVALID";
1149       }
1150         break;
1151
1152       case epsvsNORMAL: {
1153         stLvl = "NORMAL";
1154       }
1155         break;
1156
1157       case epsvsLVI1: {
1158         stLvl = "LVI1";
1159       }
1160         break;
1161
1162       case epsvsLVI2: {
1163         stLvl = "LVI2";
1164       }
1165         break;
1166
1167       default:
1168         break;
1169     }
1170
1171     SS_PWR_LOG_HIST("OnSetVoltageState()", m_VCmdHist, m_VHistIter, stLvl,
1172                     l_eStatus);
1173   }
1174
1175   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1176   return l_eStatus;
1177 }
1178
1179 ///////////////////////////////////////////////////////////////////////
1180 /// OnSetCrankState
1181 ///
1182 //////////////////////////////////////////////////////////////////////
1183 EFrameworkunifiedStatus Power::OnSetCrankState(HANDLE h_app) {
1184   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1185   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1186   Pwr_ServiceSetInterface l_CrankState;
1187
1188   // ReadMsg():                                                        *
1189   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1190   //     Report any errors found.                                      *
1191   //                                                                   *
1192   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, l_CrankState))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1193     // LCOV_EXCL_START 4: NSFW error case.
1194     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1195     LOG_ERROR("ReadMsg()");
1196     // LCOV_EXCL_STOP 4: NSFW error case.
1197   } else {
1198     m_CrankState = static_cast<ePowerSrvCrankStates>(l_CrankState.data.crank
1199         .state);
1200   }
1201
1202   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1203   return l_eStatus;
1204 }
1205
1206 EFrameworkunifiedStatus Power::OnSystemMgrConnectionEstablished(HANDLE h_app) {
1207   EFrameworkunifiedStatus l_eStatus;
1208   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1209
1210   l_eStatus = FrameworkunifiedPublishServiceAvailability(h_app, TRUE);
1211
1212   SS_PWR_LOG_HIST("FrameworkunifiedPublishServiceAvailability()", m_PubCmdHist,
1213                   m_PubHistIter, "", l_eStatus);
1214
1215   LOG_STATUS(l_eStatus,
1216              "FrameworkunifiedPublishServiceAvailability(" szNTFY_PowerAvailability ",TRUE)");
1217   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1218   return l_eStatus;
1219 }
1220
1221 EFrameworkunifiedStatus Power::OnUserModeResponse(HANDLE h_app) {
1222   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1223   EFrameworkunifiedStatus l_eStatus;
1224   EPWR_USER_MODE_TYPE l_eUserModeState = epsumINVALID;
1225   Pwr_ServiceSetInterface tServiceSetIf;
1226
1227   l_eStatus = ValidateUserModeMessage(h_app, l_eUserModeState);
1228   if (eFrameworkunifiedStatusOK != l_eStatus) {
1229     LOG_ERROR("ValidateUserModeMessage(&l_eUserModeState)");
1230   } else {
1231     PCSTR p_sStateName = l_eUserModeState == epsumON ? "epsumON" : "epsumOFF";
1232     tServiceSetIf.data.user_mode.mode = l_eUserModeState;
1233
1234     l_eStatus = m_oSessionHandler.SendToSupervisor(
1235         SS_POWER_USER_MODE_SET_RESP, sizeof(Pwr_ServiceSetInterface),
1236         (PVOID) &tServiceSetIf);
1237
1238     if (eFrameworkunifiedStatusOK != l_eStatus) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
1239       // LCOV_EXCL_START 4: NSFW error case.
1240       AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1241       FRAMEWORKUNIFIEDLOG(
1242           ZONE_ERR,
1243           __FUNCTION__,
1244           "Error: m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) errored: %d/'%s'",
1245           p_sStateName, l_eStatus, GetStr(l_eStatus).c_str());
1246       // LCOV_EXCL_STOP
1247     } else {
1248       SS_PWR_LOG_HIST("SS_POWER_USER_MODE_SET_RESP", m__CWORD56_RepHist,
1249                       m__CWORD56_RepIter, p_sStateName, l_eStatus);
1250       FRAMEWORKUNIFIEDLOG(
1251           ZONE_INFO,
1252           __FUNCTION__,
1253           "  m_oSessionHandler.SendToSupervisor(" " SS_POWER_USER_MODE_SET_RESP, %s) successful ",
1254           p_sStateName);
1255     }
1256   }
1257   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1258   return l_eStatus;
1259 }  // End of EFrameworkunifiedStatus Power::OnUserModeResponse( HANDLE h_app )
1260
1261 EFrameworkunifiedStatus Power::ValidateUserModeMessage(
1262     HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState) {
1263   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1264   EFrameworkunifiedStatus l_eStatus;
1265   Pwr_ServiceSetInterface tServiceSetIf;
1266   EPWR_USER_MODE_TYPE l_my_eUserModeState;
1267
1268   // ReadMsg():                                                        *
1269   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1270   //     Report any errors found.                                      *
1271   //                                                                   *
1272   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1273     // LCOV_EXCL_START 4: NSFW error case.
1274     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1275     LOG_ERROR("ReadMsg()");
1276     // LCOV_EXCL_STOP 4: NSFW error case.
1277   } else {
1278     l_my_eUserModeState = tServiceSetIf.data.user_mode.mode;
1279     switch (l_my_eUserModeState) {
1280       case epsumINVALID:
1281         l_eStatus = eFrameworkunifiedStatusInvldParam;
1282         LOG_ERROR("l_eUserModeState == epsumINVALID");
1283         break;
1284
1285       case epsumOFF:
1286       case epsumON:
1287         FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Validated '%s'",
1288                l_my_eUserModeState == epsumON ? "epsumON" : "epsumOFF");
1289         l_eUserModeState = l_my_eUserModeState;
1290         l_eStatus = eFrameworkunifiedStatusOK;
1291         break;
1292
1293       default:
1294         FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1295                "Error: Unknown 'l_my_eUserModeState' value: 0x%x",
1296                l_my_eUserModeState);
1297         l_eStatus = eFrameworkunifiedStatusInvldParam;
1298         break;
1299     }  // End switch
1300   }
1301   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1302   return l_eStatus;
1303 }  // End of EFrameworkunifiedStatus Power::ValidateUserModeMessage( HANDLE h_app, EPWR_USER_MODE_TYPE &l_eUserModeState )
1304
1305 //*****************************************************************************
1306 // Start Confirmation Protocol callback functions
1307 //
1308 EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest(HANDLE h_app) {
1309   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1310   EFrameworkunifiedStatus l_eStatus;
1311   EFrameworkunifiedStatus l_responseStatus = eFrameworkunifiedStatusOK;
1312   Pwr_ServiceSetInterface tServiceSetIf;
1313
1314   // ReadMsg():                                                        *
1315   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1316   //     Report any errors found.                                      *
1317   //                                                                   *
1318   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<Pwr_ServiceSetInterface>(h_app, tServiceSetIf))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1319     // LCOV_EXCL_START 4: NSFW error case.
1320     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1321     LOG_ERROR("ReadMsg()");
1322     // LCOV_EXCL_STOP 4: NSFW error case.
1323   } else {
1324     StartupConfirmationMsgStrut l_startupConfirmationMsg = tServiceSetIf.data
1325         .startupConfirmationMsg;
1326     l_eStatus = SendStartupConfirmationToSystemManager(
1327         l_startupConfirmationMsg);
1328     LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
1329         l_eStatus, "SendStartupConfirmationToSystemManager()");
1330   }
1331
1332   if (eFrameworkunifiedStatusOK != l_eStatus) {  // LCOV_EXCL_BR_LINE 200:interface_unified if can not be error.
1333     // LCOV_EXCL_START 200:interface_unified if can not be error.
1334     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1335     l_responseStatus = l_eStatus;  // Save the current status as-is to
1336                                    // send in the message response to the
1337                                    // requester.
1338     l_eStatus = m_oSessionHandler.SendToSupervisor(
1339         SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
1340         (PVOID) &l_responseStatus);
1341
1342     SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
1343                     m__CWORD56_RepIter, "", l_eStatus);
1344
1345     LOG_STATUS(
1346         l_eStatus,
1347         "m_oSessionHandler.SendToSupervisor( " "SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
1348     // LCOV_EXCL_STOP 200:interface_unified if can not be error.
1349   } else {
1350     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1351            " SendStartupConfirmationToSystemManager() successful");
1352   }
1353
1354   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1355   return l_eStatus;
1356 }  // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationRequest( HANDLE h_app )
1357
1358 EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse(HANDLE h_app) {
1359   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1360   EFrameworkunifiedStatus l_eStatus;
1361   EFrameworkunifiedStatus l_responseStatus;
1362
1363   // ReadMsg():                                                        *
1364   //     Check h_app ptr, msg size, msg reception, read msg if all ok.  *
1365   //     Report any errors found.                                      *
1366   //                                                                   *
1367   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EFrameworkunifiedStatus>(h_app, l_responseStatus))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1368     // LCOV_EXCL_START 4: NSFW error case.
1369     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1370     LOG_ERROR("ReadMsg()");
1371     // LCOV_EXCL_STOP 4: NSFW error case.
1372   } else {
1373     l_eStatus = m_oSessionHandler.SendToSupervisor(
1374         SS_POWER_FWD_START_CONFIRMATION_MSG_RESP, sizeof(EFrameworkunifiedStatus),
1375         (PVOID) &l_responseStatus);
1376
1377     SS_PWR_LOG_HIST("SS_POWER_FWD_START_CONFIRMATION_MSG_RESP", m__CWORD56_RepHist,
1378                     m__CWORD56_RepIter, "", l_eStatus);
1379
1380     LOG_STATUS(
1381         l_eStatus,
1382         "m_oSessionHandler.SendToSupervisor(" " SS_POWER_FWD_START_CONFIRMATION_MSG_RESP)");
1383   }
1384
1385   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1386   return l_eStatus;
1387 }  // End of EFrameworkunifiedStatus Power::OnSendStartupConfirmationResponse( HANDLE h_app )
1388 //
1389 // End of Start Confirmation Protocol callback functions
1390 //*****************************************************************************
1391
1392 //*****************************************************************************
1393 // Start HeartBeat Protocol callback functions
1394 // Theory of operation: Forward HB request to SM. If SM crashes, then the HB
1395 // will cease between SM and the _CWORD56_.  Consequently, the  _CWORD56_ will reset the
1396 // system.
1397 EFrameworkunifiedStatus Power::On_CWORD56_HeartBeatRequest(HANDLE h_app) {
1398   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1399   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1400   EPWR_HB_REQ_MSG_STRUCT l_HbReq;
1401
1402   FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "_CWORD56_ HeartBeat Request received.");
1403
1404   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<EPWR_HB_REQ_MSG_STRUCT>(h_app, l_HbReq))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1405     // LCOV_EXCL_START 4: NSFW error case.
1406     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1407     LOG_ERROR("ReadMsg()");
1408     // LCOV_EXCL_STOP 4: NSFW error case.
1409   } else if (eFrameworkunifiedStatusOK != (l_eStatus = Send_CWORD56_HeartBeatRequestToSystemManager(l_HbReq))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1410     // LCOV_EXCL_START 4: NSFW error case.
1411     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1412     LOG_ERROR("Send_CWORD56_HeartBeatRequestToSystemManager()");
1413     // LCOV_EXCL_STOP 4: NSFW error case.
1414   }
1415
1416   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1417   return l_eStatus;
1418 }
1419
1420 EFrameworkunifiedStatus Power::OnSM_CWORD56_HeartBeatResponse(HANDLE h_app) {
1421   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1422   EFrameworkunifiedStatus l_eStatus;
1423
1424   FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Received from SM.");
1425
1426   l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HEARTBEAT_RESP, 0,
1427   NULL);
1428
1429   SS_PWR_LOG_HIST("SS_POWER_HEARTBEAT_RESP", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
1430                   l_eStatus);
1431
1432   LOG_STATUS(l_eStatus,
1433              "m_oSessionHandler.SendToSupervisor( SS_POWER_HEARTBEAT_RESP)");
1434
1435   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1436   return l_eStatus;
1437 }
1438
1439 //
1440 // End of Heartbeat Protocol callback functions
1441 //*****************************************************************************
1442
1443 //*****************************************************************************
1444 // Start CPU Reset Request Protocol callback functions
1445 //
1446 EFrameworkunifiedStatus Power::OnCpuResetRequest(HANDLE h_app) {  // SS_SM_CPU_RESET_REQ
1447   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1448   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1449   TSystemManagerCpuResetInfo l_SmCpuResetInfo;  // SS Type
1450   SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo;  // SS Type translated to PSM type.
1451
1452   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<TSystemManagerCpuResetInfo>(h_app, l_SmCpuResetInfo))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1453     // LCOV_EXCL_START 4: NSFW error case.
1454     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1455     LOG_ERROR("ReadMsg()");
1456     // LCOV_EXCL_STOP 4: NSFW error case.
1457   } else {
1458     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CPU Reset Type: %d",
1459            l_SmCpuResetInfo.resetReason);
1460
1461     switch (l_SmCpuResetInfo.resetReason) {
1462       case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR:
1463       case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR:
1464         l_PsCpuResetInfo.resetReason = epsCpuResetReasonGeneric;
1465         break;
1466
1467       case e_SS_SM_CPU_RESET_REASON_DSP_ERR:
1468         l_PsCpuResetInfo.resetReason = epsCpuResetReasonFatalError;
1469         break;
1470
1471       case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET:
1472         l_PsCpuResetInfo.resetReason = epsCpuResetReasonUserForceReset;
1473         break;
1474
1475       case e_SS_SM_CPU_RESET_REASON_NORMAL:
1476         l_PsCpuResetInfo.resetReason = epsCpuResetReasonNormalReset;
1477         break;
1478       default:
1479         FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset reason '%d' not defined",
1480                l_SmCpuResetInfo.resetReason);
1481         FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1482         return (eFrameworkunifiedStatusInvldParam);
1483     }
1484
1485     snprintf(l_PsCpuResetInfo.messageStr, PWR_RESET_MSG_STR_SIZE, "%s",
1486              l_SmCpuResetInfo.messageStr);
1487
1488     l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
1489                                                    sizeof(l_PsCpuResetInfo),
1490                                                    (PVOID) &l_PsCpuResetInfo);
1491
1492     SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter, "",
1493                     l_eStatus);
1494
1495     LOG_STATUS_IF_ERRORED_PWR_SM_WITH_HIST_LOGGING(
1496         l_eStatus, "m_oSessionHandler.SendToSupervisor( "
1497         "SS_POWER_HARD_RESET_REQ)");
1498   }
1499
1500   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1501   return l_eStatus;
1502 }
1503 //
1504 // End of CPU Reset Request Protocol callback functions
1505 //*****************************************************************************
1506
1507 ///////////////////////////////////////////////////////////////////////
1508 /// SetCmdHist
1509 ///
1510 ///
1511 //////////////////////////////////////////////////////////////////////
1512 void Power::SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it,
1513                        std::string sender) {
1514   pthread_mutex_lock(&pwr_hist_mutex);
1515
1516   UI_64 l_clkcycles = ClockCycle();
1517   /* find out how many cycles per millisecond */
1518   UI_64 l_totalmsec = l_clkcycles / 1000;
1519
1520   it->m_time = l_totalmsec;
1521   it->m_cmd = cmd;
1522   it->m_sender = sender;
1523   it++;
1524
1525   if (it == hist.end()) {
1526     it = hist.begin();
1527   }
1528
1529   pthread_mutex_unlock(&pwr_hist_mutex);
1530 }
1531
1532 ///////////////////////////////////////////////////////////////////////////////
1533 /// \ingroup SSPowerDebugDump
1534 ///     implement post mortem function
1535 ///
1536 /// \param
1537 ///
1538 /// \return void
1539 ///////////////////////////////////////////////////////////////////////////////
1540 VOID Power::SSPowerDebugDump(HANDLE h_app) {  // LCOV_EXCL_START 7:debug code
1541   AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1542   char l_debugDumpData[SS_PWR_DEBUG_DUMP_MAX_SIZE];
1543   UI_16 l_byteCount = 0;
1544   cmdHistIter i;
1545   memset((void*) l_debugDumpData, 0x00, sizeof(l_debugDumpData));  // NOLINT (readability/casting)
1546
1547   l_byteCount = snprintf(l_debugDumpData, SS_PWR_DEBUG_DUMP_MAX_SIZE,
1548                          ("\n <SS POWER DUMP DATA> \n"));
1549
1550   l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1551   SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1552                           "\n ***Error history***\n");
1553
1554   for (i = m_ErrHist.begin(); i != m_ErrHist.end(); ++i) {
1555     l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1556     SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1557                             "\n %s @ %llums EC:%s \n", i->m_cmd.c_str(),
1558                             i->m_time, i->m_sender.c_str());
1559   }
1560
1561   l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1562   SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1563                           "\n ***_CWORD56_ Reply history***\n");
1564
1565   for (i = m__CWORD56_RepHist.begin(); i != m__CWORD56_RepHist.end(); ++i) {
1566     l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1567     SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1568                             "\n %s @ %llums\n", i->m_cmd.c_str(), i->m_time);
1569   }
1570
1571   l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1572   SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1573                           "\n ***Voltage history***\n");
1574
1575   for (i = m_VCmdHist.begin(); i != m_VCmdHist.end(); ++i) {
1576     l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1577     SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1578                             "\n %s @ %llums %s \n", i->m_cmd.c_str(), i->m_time,
1579                             i->m_sender.c_str());
1580   }
1581
1582   l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1583   SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1584                           "\n ***Publishshing history***\n");
1585
1586   for (i = m_PubCmdHist.begin(); i != m_PubCmdHist.end(); ++i) {
1587     l_byteCount += snprintf(l_debugDumpData + l_byteCount,
1588     SS_PWR_DEBUG_DUMP_MAX_SIZE - l_byteCount,
1589                             "\n %s @ %llums \n", i->m_cmd.c_str(), i->m_time);
1590   }
1591
1592   SSDEBUGDUMP("%s", (const char *) &l_debugDumpData);
1593 }
1594 // LCOV_EXCL_STOP 7:debug code
1595
1596 //*****************************************************************************
1597 // Start Remote Data Reset Protocol callback functions
1598 // From SM to PS
1599 EFrameworkunifiedStatus Power::OnRemoteDataResetRequest(HANDLE h_app) {  // SS_SM_REMOTE_DATA_RESET_REQ
1600   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1601   EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1602   ESMDataResetType l_eSmDataResetType;   // SS Type
1603   epsCpuResetReason l_ePsCpuResetReason;  // SS Type translated to PSM CPU reset reason.
1604   BOOL l_bResetRequired;
1605
1606   if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<ESMDataResetType>(h_app, l_eSmDataResetType))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
1607     // LCOV_EXCL_START 4: NSFW error case.
1608     AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1609     LOG_ERROR("ReadMsg()");
1610     // LCOV_EXCL_STOP 4: NSFW error case.
1611   } else {
1612     FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Remote Data Reset Type: %d",
1613            l_eSmDataResetType);
1614     l_bResetRequired = FALSE;
1615     switch (l_eSmDataResetType) {
1616       case e_SS_SM_DATA_RESET_TYPE_USER:
1617         l_ePsCpuResetReason = epsCpuResetReasonUserDataReset;
1618         l_bResetRequired = TRUE;
1619         break;
1620
1621       case e_SS_SM_DATA_RESET_TYPE_FACTORY:
1622         l_ePsCpuResetReason = epsCpuResetReasonFactoryDataReset;
1623         l_bResetRequired = TRUE;
1624         break;
1625
1626       case e_SS_SM_DATA_RESET_TYPE_CONFIGURATION:  // No reset action required.
1627         l_bResetRequired = FALSE;
1628         break;
1629
1630       default:
1631         FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1632                "Error: Remote Reset Data type : %d not defined",
1633                l_eSmDataResetType);
1634         FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1635         return (eFrameworkunifiedStatusInvldParam);
1636     }
1637
1638     if (TRUE == l_bResetRequired) {
1639       SS_Pwr_CpuResetMsgStruct l_PsCpuResetInfo = { };
1640       l_PsCpuResetInfo.resetReason = l_ePsCpuResetReason;
1641       l_eStatus = m_oSessionHandler.SendToSupervisor(SS_POWER_HARD_RESET_REQ,
1642                                                      sizeof(l_PsCpuResetInfo),
1643                                                      (PVOID) &l_PsCpuResetInfo);
1644
1645       if (eFrameworkunifiedStatusOK != l_eStatus) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
1646         // LCOV_EXCL_START 4: NSFW error case.
1647         AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
1648         FRAMEWORKUNIFIEDLOG(
1649             ZONE_ERR,
1650             __FUNCTION__,
1651             "Error: m_oSessionHandler.SendToSupervisor( " "SS_POWER_HARD_RESET_REQ, Reason '%d') errored:%d/'%s'",
1652             l_ePsCpuResetReason, l_eStatus, GetStr(l_eStatus).c_str());
1653         // LCOV_EXCL_STOP
1654       } else {
1655         FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1656                "SS_POWER_HARD_RESET_REQ Reason '%d' sent to PSMShadow",
1657                l_ePsCpuResetReason);
1658       }
1659       SS_PWR_LOG_HIST("SS_POWER_HARD_RESET_REQ", m__CWORD56_RepHist, m__CWORD56_RepIter,
1660                       "", l_eStatus);
1661     }
1662   }
1663
1664   FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1665   return l_eStatus;
1666 }
1667 //
1668 // End of Remote Data Reset Protocol callback functions
1669 //*****************************************************************************
1670
1671 // EOF of /SS_PowerService/src/ss_power.cpp
1672