summaryrefslogtreecommitdiffstats
path: root/power_service/server/src/ss_power_state_machine.cpp
blob: 092e88c6bdffb4b46ab2e72adf3659c36c5d5657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
/*
 * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_PowerService
/// \brief    This file supports the power service state machine.
///
///////////////////////////////////////////////////////////////////////////////

#include "ss_power_state_machine.h"
#include <system_service/ss_power_service_protocol.h>
#include <system_service/ss_power_service.h>
#include <system_service/ss_power_service_notifications.h>
#include <system_service/ss_power_service_local.h>
#include <system_service/ss_power_service_notifications_local.h>
#include <system_service/ss_services.h>
#include <native_service/ns_timer_if.h>
#include <native_service/frameworkunified_framework_if.h>


#include "ss_power_session.h"
#include "ss_power_powerservicelog.h"

/// Define static members of the class.
PowerStateMachine::Wakeup PowerStateMachine::WakeupState;
PowerStateMachine::WakeupActive PowerStateMachine::WakeupActiveState;
PowerStateMachine::WakeupPending PowerStateMachine::WakeupPendingState;
PowerStateMachine::LowVoltage1 PowerStateMachine::LowVoltage1State;
PowerStateMachine::LowVoltage1Active PowerStateMachine::LowVoltage1ActiveState;
PowerStateMachine::LowVoltage2 PowerStateMachine::LowVoltage2State;
PowerStateMachine::LowVoltage2Active PowerStateMachine::LowVoltage2ActiveState;
PowerStateMachine::Shutdown PowerStateMachine::ShutdownState;
PowerStateMachine::ShutdownActive PowerStateMachine::ShutdownActiveState;
PowerStateMachine::NormalVoltage PowerStateMachine::NormalVoltageState;
PowerStateMachine::SoftwareUpdate PowerStateMachine::SoftwareUpdateState;

/// Constructor
PowerStateMachine::PowerStateMachine()
    : m_pCurrentState(&WakeupState),
      m_pPreviousState(NULL),
      m_pOnHysteresisTimeoutState(NULL),
      m_oShutdownHysteresis(),
      m_oLowVoltage1Hysteresis(),
      m_oLowVoltage2Hysteresis(),
      m_hHysteresisTimer(NULL),
      m_tStateInfo() {
}

/// Deconstructor
PowerStateMachine::~PowerStateMachine() {  // LCOV_EXCL_START 14 Resident process, not called by NSFW
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
}
// LCOV_EXCL_STOP 14 Resident process, not called by NSFW

void PowerStateMachine::onEvent(HANDLE h_app, PowerSessionHandler & oSession,
                                ePowerStateMachineEvents evt) {
  FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "+");
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "(ENTRY) Power StateMachine Current State: %s, Previous State: %s",
         m_pCurrentState->name(),
         (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));

  switch (evt) {  // LCOV_EXCL_BR_LINE 8: dead code
    case PowerStateMachine::epsmeWAKEUP:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeWAKEUP");
      m_pCurrentState->onWakeup(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeSTART_COMPLETE:  // LCOV_EXCL_START 8: no one send the event
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTART_COMPLETE");
      m_pCurrentState->onStartComplete(*this, h_app, oSession);
      break;
    // LCOV_EXCL_STOP 8: no one send the event
    case PowerStateMachine::epsmeSHUTDOWN:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSHUTDOWN");
      m_pCurrentState->onShutdown(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeSTOP_COMPLETE:  // LCOV_EXCL_START 8: no one send the event
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSTOP_COMPLETE");
      m_pCurrentState->onStopComplete(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeLVI1_ENCOUNTERED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_ENCOUNTERED");
      m_pCurrentState->onLowVoltage1Encountered(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeLVI2_ENCOUNTERED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_ENCOUNTERED");
      m_pCurrentState->onLowVoltage2Encountered(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeNORMAL_VOLTAGE_ENCOUNTERED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
              "Power StateMachine Event Received: epsmeNORMAL_VOLTAGE_ENCOUNTERED");
      m_pCurrentState->onNormalVoltageEncountered(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeSOFTWARE_UPDATE:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeSOFTWARE_UPDATE");
      m_pCurrentState->onSoftwareUpdate(*this, h_app, oSession);
      break;
    case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_ABORTED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
              "Power StateMachine Event Received: epsmeSHUTDOWN_HYSTERESIS_ABORTED");
    case PowerStateMachine::epsmeLVI1_HYSTERESIS_ABORTED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI1_HYSTERESIS_ABORTED");
    case PowerStateMachine::epsmeLVI2_HYSTERESIS_ABORTED:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "Power StateMachine Event Received: epsmeLVI2_HYSTERESIS_ABORTED");
      m_pCurrentState->onHysteresisAborted(*this, h_app, oSession);
      break;
    // LCOV_EXCL_STOP 8: no one send the event
    case PowerStateMachine::epsmeSHUTDOWN_HYSTERESIS_TM_OUT:
      FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,  // LCOV_EXCL_BR_LINE 15:marco defined in "native_service/ns_logger_if.h"  // NOLINT[whitespace/line_length]
              "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]
    case PowerStateMachine::epsmeLVI1_HYSTERESIS_TM_OUT:
      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]
    case PowerStateMachine::epsmeLVI2_HYSTERESIS_TM_OUT:
      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]
      m_pCurrentState->onHysteresisTimeout(*this, h_app, oSession);
      break;
    default:
      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]
      break;
  }  // ZONE_POWER_STATEMACHINE

  FRAMEWORKUNIFIEDLOG0(ZONE_FUNC, __FUNCTION__, "-");
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "(EXIT) Power StateMachine Current State: %s, Previous State: %s",
         m_pCurrentState->name(),
         (m_pPreviousState == NULL ? "Ivalid" : m_pPreviousState->name()));
}

PCSTR PowerStateMachine::name() {  // LCOV_EXCL_START 8: do not be called
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  if (NULL != m_pCurrentState) {
    return m_pCurrentState->name();
  }

  return "Invalid Current State is NULL...";
}
// LCOV_EXCL_STOP 8: do not be called

/// Switch to the next State and save the previous state.
void PowerStateMachine::NextState(Base_State & refState, HANDLE h_app,
                                  PowerSessionHandler & oSession) {
  m_pPreviousState = m_pCurrentState;
  m_pPreviousState->onExit(*this, h_app, oSession);
  m_pCurrentState = &refState;
  m_pCurrentState->onEntry(*this, h_app, oSession);
}

// LCOV_EXCL_START 8: do not be called
void PowerStateMachine::OnVoltage(Base_State * pState, HANDLE h_app,
                                  PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
    Pwr_ServiceSetInterface tServiceIf;

    if (eFrameworkunifiedStatusOK
        == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
                               sizeof(Pwr_ServiceSetInterface))) {
      /// Need to store the voltage information
      m_tStateInfo.voltage = tServiceIf.data.voltage.state;

      if (NULL != pState) {
        NextState(*pState, h_app, oSession);
      }
    }
  }
}
// LCOV_EXCL_STOP 8: do not be called
void PowerStateMachine::GotoStateOnHysteresisTimeout(Base_State & refState) {
  m_pOnHysteresisTimeoutState = &refState;
}

void PowerStateMachine::startHysteresisTimer(PowerStateHysteresis & hys_info) {
  /// clear the try counter.
  hys_info.clearTryCounter();

  /// bump the hysteresis try counter (prime the counter).
  hys_info.bumbTryCounter();

  /// setup the hysteresis timer
  NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
      MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };

  /// start the hysteresis timer
  NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
}

void PowerStateMachine::reStartHysteresisTimer(
    PowerStateHysteresis & hys_info) {
  /// bump the hysteresis try counter.
  hys_info.bumbTryCounter();

  /// setup the hysteresis timer (one shot)
  NSTimerInfo turn_on_hysteresis = { WholeSeconds(hys_info.getTimeout()),
      MSToNS(RemainderMs(hys_info.getTimeout())), 0, 0, 0 };
  /// start the hysteresis timer
  NS_TimerSetTime(m_hHysteresisTimer, turn_on_hysteresis);
}

void PowerStateMachine::stopHysteresisTimer(PowerStateHysteresis & hys_info) {
  NSTimerInfo turn_off_hysteresis = { 0, 0, 0, 0, 0 };
  NS_TimerSetTime(m_hHysteresisTimer, turn_off_hysteresis);
  /// clear the try counter.
  hys_info.clearTryCounter();
}

// LCOV_EXCL_START 8: can not be called
void PowerStateMachine::publishPowerLVIStatus(HANDLE h_app, PCSTR nNotifNm,
                                              UI_32 value) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
  PowerSrvLVIStatus eLviStatus = static_cast<PowerSrvLVIStatus>(value);
  if (eFrameworkunifiedStatusOK
      != (eStatus = FrameworkunifiedNPPublishNotification(h_app, nNotifNm, &eLviStatus,
                                             sizeof(eLviStatus)))) {
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
           " Error: FrameworkunifiedNPPublishNotification( %s ) errored: 0x%X", nNotifNm,
           eStatus);
  }
}
// LCOV_EXCL_STOP 8: can not be called
void PowerStateMachine::publishPowerLevelType(HANDLE h_app, UI_32 value) {
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
  PowerSrvLevelType eLevelType = static_cast<PowerSrvLevelType>(value);
  if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedNPPublishNotification (h_app, szNTFY_PowerLevel, &eLevelType, sizeof (eLevelType)))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4: NSFW error case.
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
           " Error: FrameworkunifiedNPPublishNotification %s Failed Status:0x%x ",
           szNTFY_PowerLevel, eStatus);
  // LCOV_EXCL_STOP 4: NSFW error case.
  }
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Base_State::onStartComplete(
    PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  oSession.StartComplete(h_app);
}
// LCOV_EXCL_STOP 8: do not be called

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Base_State::onStopComplete(
    PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  oSession.StopComplete(h_app);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: no one call this function
void PowerStateMachine::Base_State::onLaunchComplete(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  FrameworkunifiedDeferMessage(h_app);
}
// LCOV_EXCL_STOP 8: do not be called

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Base_State::onShutdownComplete(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  FrameworkunifiedDeferMessage(h_app);
}
// LCOV_EXCL_STOP 8: no one call this function
PCSTR PowerStateMachine::Wakeup::name() {
  return "Wakeup";
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Wakeup::onLowVoltage1Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage1State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: do not be called

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Wakeup::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage2State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::Wakeup::onNormalVoltageEncountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "NORMAL ENCOUNTERED %s (no switch)", FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event
void PowerStateMachine::Wakeup::onShutdown(PowerStateMachine &u, HANDLE h_app,
                                           PowerSessionHandler & oSession) {
  u.NextState(ShutdownState, h_app, oSession);
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Wakeup::onSoftwareUpdate(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.NextState(SoftwareUpdateState, h_app, oSession);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Wakeup::onWakeup(PowerStateMachine &u, HANDLE h_app,
                                         PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  Pwr_ServiceSetInterface tServiceIf;
  if (sizeof(Pwr_ServiceSetInterface) == FrameworkunifiedGetMsgLength(h_app)) {
    if (eFrameworkunifiedStatusOK
        == FrameworkunifiedGetMsgDataOfSize(h_app, (PVOID) &tServiceIf,
                               sizeof(Pwr_ServiceSetInterface))) {
      if (epswsPWRON == tServiceIf.data.wake.powerupType) {
        /// Need to store the wakeup \ shutdown information
        u.m_tStateInfo.wake = tServiceIf.data.wake.powerupType;
        u.m_tStateInfo.level = tServiceIf.data.wake.up.level;
        u.m_tStateInfo.factor = tServiceIf.data.wake.up.factor;

        u.NextState(WakeupPendingState, h_app, oSession);
      }
    }
  }
}
// LCOV_EXCL_STOP 8: no one send the event

PCSTR PowerStateMachine::WakeupActive::name() {
  return "Wakeup Active";
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::WakeupActive::onLowVoltage1Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage1State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::WakeupActive::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage2State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event
void PowerStateMachine::WakeupActive::onShutdown(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  u.NextState(ShutdownState, h_app, oSession);
}

PCSTR PowerStateMachine::WakeupPending::name() {
  return "Wakeup Pending";
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::WakeupPending::onNormalVoltageEncountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&NormalVoltageState, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::WakeupPending::onStartComplete(
    PowerStateMachine &, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  oSession.StartComplete(h_app);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: no one call this function
void PowerStateMachine::WakeupPending::onLaunchComplete(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
  if (epsvsNORMAL == u.m_tStateInfo.voltage) {
    u.NextState(NormalVoltageState, h_app, oSession);
  }
}
// LCOV_EXCL_STOP 8: no one call this function

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::WakeupPending::onWakeup(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  if (oSession.WakeupComplete(u.m_lstWakeupModules)) {
    oSession.SendToSupervisor(SS_POWER_WAKEUP_COMPLETE, 0, NULL);
  }
}
// LCOV_EXCL_STOP 8: no one send the event

void PowerStateMachine::WakeupPending::onEntry(PowerStateMachine &u,
                                               HANDLE h_app,
                                               PowerSessionHandler & oSession) {
  if (!FrameworkunifiedIsDeferQueueEmpty(h_app)) {
    FrameworkunifiedRetrieveDeferMessage(h_app);
  }
}

PCSTR PowerStateMachine::Shutdown::name() {
  return "Shutdown";
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Shutdown::onLowVoltage1Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(LowVoltage1State);
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::Shutdown::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(LowVoltage2State);
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::Shutdown::onHysteresisAborted(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.NextState(*(u.m_pPreviousState), h_app, oSession);
}
// LCOV_EXCL_STOP 8: no one send the event
void PowerStateMachine::Shutdown::onHysteresisTimeout(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  if (!u.m_oShutdownHysteresis.maxTries()) {
    FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
           "epsmeSHUTDOWN_TM_OUT tries: %d", u.m_oShutdownHysteresis.getTries());

    u.reStartHysteresisTimer(u.m_oShutdownHysteresis);
  } else {
    // Move directorly to next state.
    u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
  }
}

void PowerStateMachine::Shutdown::onEntry(PowerStateMachine &u, HANDLE h_app,
                                          PowerSessionHandler & oSession) {
  if (u.m_oShutdownHysteresis.getEnabled()) {
    FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
           "Starting epsmeSHUTDOWN_HYSTERESIS_TM_OUT timeout: %d tries: %d",
           u.m_oShutdownHysteresis.getTimeout(),
           u.m_oShutdownHysteresis.getTries());
    // Set the goto state state.
    u.GotoStateOnHysteresisTimeout(ShutdownActiveState);
    // Start the hysteresis timer for low voltage 2
    u.startHysteresisTimer(u.m_oShutdownHysteresis);
  } else {
    FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
            "SHUTDOWN_HYSTERESIS is not enabled. Going directly to ShutdownActiveState");
    // Move directly to next state.
    u.NextState(ShutdownActiveState, h_app, oSession);
  }
}

void PowerStateMachine::Shutdown::onExit(PowerStateMachine &u, HANDLE h_app,
                                         PowerSessionHandler & oSession) {
  u.stopHysteresisTimer(u.m_oShutdownHysteresis);
  FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) Shutdown State");
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::Shutdown::onWakeup(PowerStateMachine &u, HANDLE h_app,
                                           PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(WakeupPendingState);
}
// LCOV_EXCL_STOP 8: no one send the event

PCSTR PowerStateMachine::ShutdownActive::name() {
  return "Shutdown Active";
}

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::ShutdownActive::onLowVoltage1Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage1State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::ShutdownActive::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage2State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event
void PowerStateMachine::ShutdownActive::onEntry(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  u.publishPowerLevelType(h_app, epspltSHUTDOWN);

  if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
    oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
  }
}

void PowerStateMachine::ShutdownActive::onShutdown(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  if (oSession.ShutdownComplete(u.m_lstShutdownModules)) {
    oSession.SendToSupervisor(SS_POWER_SHUTDOWN_COMPLETE, 0, NULL);
  }
}

PCSTR PowerStateMachine::LowVoltage1::name() {  // LCOV_EXCL_START 8: can not be LowVoltage1status
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  return "Low Voltage I";
}
// LCOV_EXCL_STOP 8: can not be LowVoltage1status

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage1::onHysteresisAborted(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.NextState(*(u.m_pPreviousState), h_app, oSession);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be LowVoltage1status
void PowerStateMachine::LowVoltage1::onHysteresisTimeout(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  if (!u.m_oLowVoltage1Hysteresis.maxTries()) {
    FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
           "epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT tries: %d",
           u.m_oLowVoltage1Hysteresis.getTries());

    u.reStartHysteresisTimer(u.m_oLowVoltage1Hysteresis);
  } else {
    // Move directorly to next state.
    u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
  }
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage1::onWakeup(PowerStateMachine &u, HANDLE h_app,
                                              PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(NormalVoltageState);
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: can not be LowVoltage1status

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage1::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(LowVoltage2State);
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "LOW VOLTAGE 2 ENCOUNTERED %s (no switch waiting for hysteresis to)",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage1::onNormalVoltageEncountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.GotoStateOnHysteresisTimeout(NormalVoltageState);
  u.OnVoltage(NULL, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
         "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be LowVoltage1status
void PowerStateMachine::LowVoltage1::onEntry(PowerStateMachine &u, HANDLE h_app,
                                             PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  if (u.m_oLowVoltage1Hysteresis.getEnabled()) {
    FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
           "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
           u.m_oLowVoltage1Hysteresis.getTimeout(),
           u.m_oLowVoltage1Hysteresis.getTries());
    // Set the goto state state.
    u.GotoStateOnHysteresisTimeout(LowVoltage1ActiveState);
    // Start the hysteresis timer for low voltage 1
    u.startHysteresisTimer(u.m_oLowVoltage1Hysteresis);
  } else {
    FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
            "LOW_VOLTAGE_HYSTERESIS is not enabled. Going directly to LowVoltage1ActiveState");
    // Move directly to next state.
    u.NextState(LowVoltage1ActiveState, h_app, oSession);
  }
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage1::onExit(PowerStateMachine &u, HANDLE h_app,
                                            PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.stopHysteresisTimer(u.m_oLowVoltage1Hysteresis);
  FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage1 State");
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
PCSTR PowerStateMachine::LowVoltage1Active::name() {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  return "Low Voltage I Active";
}
// LCOV_EXCL_STOP 8: can not be LowVoltage1status

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage1Active::onLowVoltage2Encountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&LowVoltage2State, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage1Active::onNormalVoltageEncountered(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.OnVoltage(&NormalVoltageState, h_app, oSession);
  FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
         FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be LowVoltage1Activestatus
void PowerStateMachine::LowVoltage1Active::onEntry(
    PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  u.publishPowerLevelType(h_app, epspltEMERGENCY);
u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_Active);
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage1Active::onExit(
  PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI1, ePwSrvLVI_Status_InActive);
}
// LCOV_EXCL_STOP 8: can not be LowVoltage1Activestatus

PCSTR PowerStateMachine::LowVoltage2::name() {  // LCOV_EXCL_START 8: can not be LowVoltage2status
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
return "Low Voltage II";
}
// LCOV_EXCL_STOP 8: can not be LowVoltage2status

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage2::onHysteresisAborted(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.NextState(*(u.m_pPreviousState), h_app, oSession);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be LowVoltage2status
void PowerStateMachine::LowVoltage2::onHysteresisTimeout(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
if (!u.m_oLowVoltage2Hysteresis.maxTries()) {
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
       "epsmeLOW_VOLTAGE2_HYSTERESIS_TM_OUT tries: %d",
       u.m_oLowVoltage2Hysteresis.getTries());

u.reStartHysteresisTimer(u.m_oLowVoltage2Hysteresis);
} else {
// Move directorly to next state.
u.NextState(*(u.m_pOnHysteresisTimeoutState), h_app, oSession);
}
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2::onEntry(PowerStateMachine &u, HANDLE h_app,
                                             PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
if (u.m_oLowVoltage2Hysteresis.getEnabled()) {
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
       "Starting epsmeLOW_VOLTAGE_HYSTERESIS_TM_OUT timeout: %d tries: %d",
       u.m_oLowVoltage2Hysteresis.getTimeout(),
       u.m_oLowVoltage2Hysteresis.getTries());
// Set the goto state state.
u.GotoStateOnHysteresisTimeout(LowVoltage2ActiveState);
// Start the hysteresis timer for low voltage 2
u.startHysteresisTimer(u.m_oLowVoltage2Hysteresis);
} else {
FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__,
        "LOW_VOLTAGE2_HYSTERESIS is not enabled. Going directly to LowVoltage2ActiveState");
// Move directly to next state.
u.NextState(LowVoltage2ActiveState, h_app, oSession);
}
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2::onExit(PowerStateMachine &u, HANDLE h_app,
                                            PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.stopHysteresisTimer(u.m_oLowVoltage2Hysteresis);
FRAMEWORKUNIFIEDLOG0(ZONE_POWER_STATEMACHINE, __FUNCTION__, "(EXITING) LowVoltage2 State");
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2::onWakeup(PowerStateMachine &u, HANDLE h_app,
                                              PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.GotoStateOnHysteresisTimeout(WakeupPendingState);
}
// LCOV_EXCL_STOP 8: can not be LowVoltage2status

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage2::onLowVoltage1Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.GotoStateOnHysteresisTimeout(LowVoltage1State);
u.OnVoltage(NULL, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
       "LOW VOLTAGE 1 ENCOUNTERED %s (no switch waiting for hysteresis to)",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2::onNormalVoltageEncountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.GotoStateOnHysteresisTimeout(NormalVoltageState);
u.OnVoltage(NULL, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__,
       "NORMAL VOLTAGE ENCOUNTERED %s (no switch waiting for hysteresis to)",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

PCSTR PowerStateMachine::LowVoltage2Active::name() {  // LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
return "Low Voltage II Active";
}
// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::LowVoltage2Active::onLowVoltage1Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&LowVoltage1State, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2Active::onNormalVoltageEncountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&NormalVoltageState, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "NORMAL VOLTAGE ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be LowVoltage2Activestatus
void PowerStateMachine::LowVoltage2Active::onEntry(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.publishPowerLevelType(h_app, epspltEMERGENCY);
u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_Active);
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::LowVoltage2Active::onExit(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.publishPowerLVIStatus(h_app, szNTFY_PowerLVI2, ePwSrvLVI_Status_InActive);
oSession.SendToSupervisor(SS_POWER_LVI2_SHUTDOWN_COMPLETE, 0, NULL);
}
// LCOV_EXCL_STOP 8: can not be LowVoltage2Activestatus

PCSTR PowerStateMachine::NormalVoltage::name() {  // LCOV_EXCL_START 8: can not be NormalVoltageState
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
return "Normal Voltage";
}
// LCOV_EXCL_STOP 8: can not be NormalVoltageState

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::NormalVoltage::onLowVoltage1Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&LowVoltage1State, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::NormalVoltage::onLowVoltage2Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&LowVoltage2State, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be NormalVoltageState
void PowerStateMachine::NormalVoltage::onShutdown(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.NextState(ShutdownState, h_app, oSession);
}
// LCOV_EXCL_STOP 8: can not be NormalVoltageState

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::NormalVoltage::onSoftwareUpdate(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.NextState(SoftwareUpdateState, h_app, oSession);
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be NormalVoltageState
void PowerStateMachine::NormalVoltage::onEntry(PowerStateMachine &u,
                                               HANDLE h_app,
                                               PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.publishPowerLevelType(h_app, epspltNORMAL);
}
// LCOV_EXCL_STOP 8: can not be NormalVoltageState

PCSTR PowerStateMachine::SoftwareUpdate::name() {  // LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
return "Software Update";
}
// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus

// LCOV_EXCL_START 8: no one send the event
void PowerStateMachine::SoftwareUpdate::onLowVoltage1Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&LowVoltage1State, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 1 ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::SoftwareUpdate::onLowVoltage2Encountered(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
u.OnVoltage(&LowVoltage2State, h_app, oSession);
FRAMEWORKUNIFIEDLOG(ZONE_POWER_STATEMACHINE, __FUNCTION__, "LOW VOLTAGE 2 ENCOUNTERED %s",
       FrameworkunifiedGetMsgSrc(h_app));
}
// LCOV_EXCL_STOP 8: no one send the event

// LCOV_EXCL_START 8: can not be SoftwareUpdatestatus
void PowerStateMachine::SoftwareUpdate::onShutdown(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::SoftwareUpdate::onEntry(
PowerStateMachine &u, HANDLE h_app, PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
}
// LCOV_EXCL_STOP 8: no one send the event to call this function

// LCOV_EXCL_START 8: no one send the event to call this function
void PowerStateMachine::SoftwareUpdate::onExit(PowerStateMachine &u,
                                               HANDLE h_app,
                                               PowerSessionHandler & oSession) {
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
}
// LCOV_EXCL_STOP 8: can not be SoftwareUpdatestatus