summaryrefslogtreecommitdiffstats
path: root/logger_service/server/src/ss_logger_server_callbacks.cpp
blob: 2cdf12cf613955c32cdb3efe806caa30e885fcff (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
/*
 * @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_SS_LoggerService
/// \brief    This file contains the callback for Notifications and Protocol
///           commands.
///
///////////////////////////////////////////////////////////////////////////////
#include "ss_logger_service_callbacks.h"
#include <string.h>
#include <boost/bind.hpp>
#include <errno.h>
#include <native_service/frameworkunified_framework_if.h>
#include <native_service/frameworkunified_multithreading.h>
#include <system_service/ss_logger_service.h>
#include <ss_logger_common.h>
#include <system_service/ss_logger_service_notifications.h>
#include <system_service/ss_logger_service_protocol.h>
#include <native_service/ns_config_parser_if.h>
#include <native_service/nslogutil_cmd_if.h>
#include <system_service/ss_sm_client_if.h>
#include <queue>
#include <new>
#include <string>
#include "ss_logger_error_event.h"
#include "loggerservicedebug_loggerservicelog.h"
#include "loggerservicedebug_thread_if.h"
extern CErrorEvent g_errorEventHandler;
extern HANDLE g_thrdEvntLogWriter;

// Global variables
STCanCurrentDateTime g_stDateAndTime = { 0 };
UEvtLoggerCommonInfo g_uEvtLoggerCommonInfo;
UI_16 g_u16DiagId = 0;

CLoggerServiceCallbacks::CLoggerServiceCallbacks()
    : m_pLoggerCfg(NULL),
      m_pErrorEvent(NULL) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  FrameworkunifiedProtocolCallbackHandler l_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS] =
      { { SS_LOGGER_MILEAGE_DATA, boost::bind(
          &CLoggerServiceCallbacks::LoggerServer_SetMileageData, this, _1) },
          { SS_LOGGER_SET_PARAMS, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_SetLoggerParams, this, _1) },
          { SS_LOGGER_UDP_LOGGING, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_UDPLogging, this, _1) },
          { SS_LOGGERCOPYEVENTUSB, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog, this,_1) },
          { SS_LOGGERCLEAREVENT, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog, this, _1) },
          { SS_LOGGER_READ_STATL_COUNTER, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter, this, _1) },
          { SS_LOGGER_EVENT_COMMONINFO, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo, this, _1) },
          { SS_LOGGER__CWORD56__EVENT_INFO, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events, this, _1) },
          { SS_LOGGER_RESET_STATL_COUNTER, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter, this, _1) },
          { SS_LOGGER_SET_VIN, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnSetVIN, this, _1) },
          { SS_LOGGERCOPYEMERGENCYLOGS, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog, this, _1) },
          { eSSLoggerCANProtocolIDCANTrigger, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnCANTrigger, this, _1) },
          { eSSLoggerCANProtocolIDDTCTrigger, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger, this, _1) },
          { SS_LOGGER_SHUTDOWN_COMPLETE, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete, this, _1) },
          { SS_LOGGER_ENG_READ_NUMOFEVENTS, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents, this, _1) },
          { SS_LOGGER_SET_DIAGID, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_OnSetDiagID, this, _1) },
          { SS_LOGGER_UPLOAD_EVENTLOG, boost::bind(
              &CLoggerServiceCallbacks::LoggerServer_UploadEventLog, this, _1) } };  // LCOV_EXCL_BR_LINE 11:Unexpected branch

  for (UI_8 i = 0u; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
    m_protocolHandlers[i].iCmd = l_protocolHandlers[i].iCmd;
    m_protocolHandlers[i].callBack = l_protocolHandlers[i].callBack;  // LCOV_EXCL_BR_LINE 11:Unexpected branch
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
}

CLoggerServiceCallbacks::~CLoggerServiceCallbacks() {  // LCOV_EXCL_START 14:globle instance
  AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
}
// LCOV_EXCL_STOP

EFrameworkunifiedStatus CLoggerServiceCallbacks::Initialize(HANDLE f_hApp,
                                               CLoggerCfg *f_pLoggerCfg,
                                               CErrorEvent* f_pErrorEvent) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  m_pLoggerCfg = f_pLoggerCfg;
  m_pErrorEvent = f_pErrorEvent;

  if ((NULL == m_pLoggerCfg) || (NULL == m_pErrorEvent)) {  // LCOV_EXCL_BR_LINE 200:As it is always TRUE
    // LCOV_EXCL_START 200:As it is always TRUE
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
           "NULL pointer passed to Initialize function!!!!!");
    l_eStatus = eFrameworkunifiedStatusNullPointer;
    // LCOV_EXCL_STOP
  } else {
    // Attach callback : Open Session Request
    if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(f_hApp, FRAMEWORKUNIFIED_ANY_SOURCE, PROTOCOL_OPEN_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnOpenSession, this, _1)))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
      // LCOV_EXCL_START 4:NSFW
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG(
          ZONE_ERR,
          __FUNCTION__,
          "FrameworkunifiedAttachCallbackToDispatcher PROTOCOL_OPEN_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
          l_eStatus);
      // LCOV_EXCL_STOP
    } else if ( eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(f_hApp, NTFY_SS_LoggerService_Availability))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
      // LCOV_EXCL_START 4:NSFW
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
             "Failed to set service availability notification:0x%x ", l_eStatus);
      // LCOV_EXCL_STOP
    } else {
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

//////////////////////////////////////////
//  Function : DevDetectionServerOnOpenSession
//  Callback for PROTOCOL_OPEN_SESSION_REQ
//////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnOpenSession(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  HANDLE l_hClientService = NULL;
  HANDLE l_hSession = NULL;

  // Get the requester name
  PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
  OpenSessionAck tOpenAck;

  if (pRequester) {  // LCOV_EXCL_BR_LINE 4:NSFW
    l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);

    if (l_hClientService) {  // LCOV_EXCL_BR_LINE 4:NSFW
      // Create a session
      l_hSession = FrameworkunifiedCreateSession(hApp, pRequester);
      UI_32 l_nSessionId = 0;
      if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbacksToDispatcher( hApp, pRequester, m_protocolHandlers, kNUMBER_PROTOCOL_HANDLERS, l_hSession))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(
            ZONE_ERR,
            __PRETTY_FUNCTION__,
            "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
            l_eStatus);
        // LCOV_EXCL_STOP
      }

      l_eStatus = this->m_pErrorEvent->OnOpenSession(hApp, pRequester,
                                                     l_hSession);
      if (eFrameworkunifiedStatusOK != l_eStatus) {  // LCOV_EXCL_BR_LINE 200:To ensure success
        // LCOV_EXCL_START 200:To ensure success
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
               " Error. m_pErrorEvent->OnOpenSession(%s, %p) returned: %d.",
               pRequester, l_hSession, l_eStatus);
        // LCOV_EXCL_STOP
      }

      // Attach callback : close Session Request
      if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, pRequester, PROTOCOL_CLOSE_SESSION_REQ, boost::bind(&CLoggerServiceCallbacks::LoggerServerOnCloseSession, this, _1)))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(
            ZONE_ERR,
            __FUNCTION__,
            "FrameworkunifiedAttachCallbackToDispatcher " "PROTOCOL_CLOSE_SESSION_REQ (FRAMEWORKUNIFIED_ANY_SOURCE) Failed Status:0x%x ",
            l_eStatus);
        // LCOV_EXCL_STOP
      }

      l_nSessionId = FrameworkunifiedGetSessionId(l_hSession);

      FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Session id is %d", l_nSessionId);  // LCOV_EXCL_BR_LINE 15:macro
      // sending the session open
      tOpenAck.eStatus = eFrameworkunifiedStatusOK;
      tOpenAck.sessionId = l_nSessionId;
      tOpenAck.sessionType = 1;

      // Copy session name to data structure
      strncpy(tOpenAck.cSessionName, FrameworkunifiedGetAppName(hApp),
              MAX_QUEUE_NAME_SIZE - 1);
      tOpenAck.cSessionName[MAX_QUEUE_NAME_SIZE - 1] = '\0';

      // send OpenSession ACK
      if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_OPEN_SESSION_ACK, sizeof(OpenSessionAck), (PVOID) &tOpenAck))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
               "FrameworkunifiedSendMsg PROTOCOL_OPEN_SESSION_ACK Failed Status:0x%x ",
               l_eStatus);
        // LCOV_EXCL_STOP
      } else {
        l_eStatus = FrameworkunifiedSetSessionHandle(hApp, FrameworkunifiedGetMsgSrc(hApp), l_hSession);
        LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSessionHandle()");  // LCOV_EXCL_BR_LINE 15:macro
      }
    }
    l_eStatus = FrameworkunifiedMcClose(l_hClientService);
    LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedMcClose()");  // LCOV_EXCL_BR_LINE 15:macro
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");

  return l_eStatus;
}

//////////////////////////////////////////
//  Function : DevDetectionServerOnCloseSession
//  Callback for PROTOCOL_CLOSE_SESSION_REQ
//////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServerOnCloseSession(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
  HANDLE hSession = NULL;
  HANDLE l_hClientService = NULL;
  // Get the requester name
  PCSTR pRequester = FrameworkunifiedGetMsgSrc(hApp);
  CloseSessionAck tCloseAck;
  CloseSessionReq tClose;

  if (pRequester) {  // LCOV_EXCL_BR_LINE 4:NSFW
    l_hClientService = FrameworkunifiedMcOpenSender(hApp, pRequester);
    if (l_hClientService) {  // LCOV_EXCL_BR_LINE 4:NSFW
      // Read the data from the message
      if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &tClose, sizeof(tClose), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");

        if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) {
          FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed");
        }
        FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
        return eStatus;
        // LCOV_EXCL_STOP
      }

      hSession = FrameworkunifiedGetSessionHandle(hApp, pRequester, tClose.sessionId);

      // Create a list of commands to be detached from the dispatcher
      UI_32 cmd_array[kNUMBER_PROTOCOL_HANDLERS] = { 0 };
      for (UI_32 i = 0; i < kNUMBER_PROTOCOL_HANDLERS; i++) {
        cmd_array[i] = m_protocolHandlers[i].iCmd;
      }

      if (NULL != hSession) {  // LCOV_EXCL_BR_LINE 4:NSFW
        // Detach callbacks associated with client
        if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDetachCallbacksFromDispatcher(hApp, pRequester, cmd_array, kNUMBER_PROTOCOL_HANDLERS, hSession))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
          // LCOV_EXCL_START 4:NSFW
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          FRAMEWORKUNIFIEDLOG(
              ZONE_ERR,
              __PRETTY_FUNCTION__,
              "FrameworkunifiedAttachCallbacksToDispatcher ss_logger_server_protocol_handlers Failed Status:0x%x ",
              eStatus);
          // LCOV_EXCL_STOP
        }

        eStatus = m_pErrorEvent->OnCloseSession(hApp, pRequester, hSession);
        if (eFrameworkunifiedStatusOK != eStatus) {  // LCOV_EXCL_BR_LINE 200:To ensure success
          // LCOV_EXCL_START 200:To ensure success
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
                 " Error. m_pErrorEvent->OnCloseSession(%s, %p) returned: %d.",
                 pRequester, hSession, eStatus);
          // LCOV_EXCL_STOP
        }

        // API to destroy the session handle and remove it from the Application Framework.
        // LCOV_EXCL_BR_START 4:NSFW
        if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedDestroySession(hApp,  // Application Handle
            hSession))) {  // Session Handle
        // LCOV_EXCL_BR_STOP
          // LCOV_EXCL_START 4:NSFW
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session destroy failed");
          // LCOV_EXCL_STOP
        }
      }
      // sending the session close ack
      tCloseAck.eStatus = eFrameworkunifiedStatusOK;
      tCloseAck.sessionId = tClose.sessionId;

      // send CloseSession ACK
      if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedSendMsg(l_hClientService, PROTOCOL_CLOSE_SESSION_ACK, sizeof(CloseSessionAck), (PVOID) &tCloseAck))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
               "FrameworkunifiedSendMsg PROTOCOL_CLOSE_SESSION_ACK Failed Status:0x%x ",
               eStatus);
        // LCOV_EXCL_STOP
      }
      if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedMcClose(l_hClientService))) {  // LCOV_EXCL_BR_LINE 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedMcClose failed");  // LCOV_EXCL_LINE 15:macro
      }
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return eStatus;
}

//////////////////////////////////////////
//  Function : LoggerServer_SetMileageData
//  Callback for SS_LOGGER_MILEAGE_DATA
//////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetMileageData(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  STLOGGER_CANDIAGSTAT MileageInfo_t;
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  memset(&MileageInfo_t, 0x00, sizeof(STLOGGER_CANDIAGSTAT));
  if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &MileageInfo_t, sizeof(MileageInfo_t), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
    l_eStatus = eFrameworkunifiedStatusFail;
    // LCOV_EXCL_STOP
  } else {
    UI_32 l_mileage = (MileageInfo_t.Odo_MSB_H << 24
        | MileageInfo_t.Odo_MSB_L << 16 | MileageInfo_t.Odo_LSB_H << 8
        | MileageInfo_t.Odo_LSB_L);
    // if value set to SNA
    if (0xFFFFFFFF != l_mileage) {
      this->m_pErrorEvent->SetMileage(l_mileage);
      // Immediate Persist Event Log
      if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdMileageData, sizeof(UI_32), &l_mileage))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%d", l_eStatus);  // LCOV_EXCL_LINE 15:macro
      }
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return l_eStatus;
}

//////////////////////////////////////////
//  Function : LoggerServer_SetLoggerParams
//  Callback for SS_LOGGER_SET_PARAMS
//////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_SetLoggerParams(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
  STLoggerSetParams l_stLoggerSetParams = { eInvalid_LoggerState, eDevUSB1 };

  if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stLoggerSetParams, sizeof(l_stLoggerSetParams), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
    eStatus = eFrameworkunifiedStatusFail;
    FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
    return eStatus;
    // LCOV_EXCL_STOP
  } else {
    eStatus = m_pLoggerCfg->SetLoggingParams(hApp, l_stLoggerSetParams);
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return eStatus;
}

//////////////////////////////////////////
//  Function : LoggerServer_SetLoggerParams
//  Callback for SS_LOGGER_SET_PARAMS
//////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UDPLogging(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  ELOGGER_STAT l_eUDPLoggingStatus = eInvalid_LoggerState;

  if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_eUDPLoggingStatus, sizeof(l_eUDPLoggingStatus), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedGetMsgDataOfSize Failed");
    l_eStatus = eFrameworkunifiedStatusFail;
    // LCOV_EXCL_STOP
  } else {
    l_eStatus = m_pLoggerCfg->SetUDPLogging(hApp, l_eUDPLoggingStatus);
    LOG_STATUS_IF_ERRORED(  // LCOV_EXCL_BR_LINE 15:macro
        l_eStatus,
        "m_pLoggerCfg->SetUDPLogging()");
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UpdateCommonInfo(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;

  if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo, sizeof(g_uEvtLoggerCommonInfo.u_stEvtLoggerCommonInfo), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
    eStatus = eFrameworkunifiedStatusFail;
    // LCOV_EXCL_STOP
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return eStatus;
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_Handle_CWORD56_Events(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
  STEventLoggerEventInfo l_stEventLoggingEventInfo;
  UI_16 l_evtid = 0;

  if (eFrameworkunifiedStatusOK != (eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stEventLoggingEventInfo, sizeof(l_stEventLoggingEventInfo), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " FrameworkunifiedGetMsgDataOfSize Failed");
    eStatus = eFrameworkunifiedStatusFail;
    // LCOV_EXCL_STOP
  }
  l_evtid = static_cast<UI_16>(((l_stEventLoggingEventInfo.EventGroup & 0x00FF) << 8)
      | (l_stEventLoggingEventInfo.EventIdentifier & 0x00FF));
  FRAMEWORKUNIFIEDLOG_EVT(ZONE_INFO, l_evtid, 4, l_stEventLoggingEventInfo.EventData[3],
             l_stEventLoggingEventInfo.EventData[2],
             l_stEventLoggingEventInfo.EventData[1],
             l_stEventLoggingEventInfo.EventData[0]);

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return eStatus;
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEmergencyLog(
    HANDLE f_hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  EDevNumber l_eDevNumber;
  std::string l_path = "";
  std::string l_srcName = "";

  if (NULL != f_hApp) {  // LCOV_EXCL_BR_LINE 6: it can't be null.
    PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(f_hApp);
    if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 6: it can't be null.
      l_srcName = l_tmp_srcname;
    }

    if (eFrameworkunifiedStatusOK
        == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_eDevNumber,
                                            sizeof(l_eDevNumber), eSMRRelease))) {
      switch (l_eDevNumber) {
        case eEEL_USB1:
          l_path = m_pLoggerCfg->m_usb0MountPath;
          break;

        case eEEL_USB2:
          l_path = m_pLoggerCfg->m_usb1MountPath;
          break;

        case eEEL_SD:
          l_path = m_pLoggerCfg->m_sdMountPath;
          break;

        default:
          /*send back error response wrong param*/
          l_eStatus = eFrameworkunifiedStatusInvldParam;
          break;
      }
    } else {
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
    }

    HANDLE l_hSession = NULL;
    if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(f_hApp))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
      // LCOV_EXCL_START 4: NSFW error case.
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
      // LCOV_EXCL_STOP
    } else {
      m_pErrorEvent->SetDiagSessionHandle(l_hSession);
    }
    if (0 == l_srcName.length()) {  // LCOV_EXCL_BR_LINE 6: it can't be 0.
      // LCOV_EXCL_START 6: it can't be 0.
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
             " Error. Could not get name of source service.");
    // LCOV_EXCL_STOP
      l_eStatus = eFrameworkunifiedStatusInvldHandle;
    } else if (eFrameworkunifiedStatusOK != l_eStatus) {
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
             " Error. Invalid parameter l_eDevNumber(%d).", l_eDevNumber);
      l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
                                                            l_srcName);
      LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
      l_eStatus = eFrameworkunifiedStatusInvldParam;
    } else if (eFrameworkunifiedStatusOK
        != (l_eStatus = m_pErrorEvent->SetDiagEventSourceName(l_srcName))) {
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
             " Error. m_pErrorEvent->SetDiagEventSourceName() returned %d.", l_eStatus);
      l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO,
                                                            l_srcName);
      LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse(l_srcName)");
      l_eStatus = eFrameworkunifiedStatusFail;
    } else if (eFrameworkunifiedStatusOK != (l_eStatus =
        SendDiagLoggingRequestToSystemManager(l_path))) {  // LCOV_EXCL_BR_LINE 4: NSFW error case.
      // LCOV_EXCL_START 4: NSFW error case.
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      /* call System Manager interface*/
      FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
             " Error. SendDiagLoggingRequestToSystemManager() returned %d.", l_eStatus);
      l_eStatus = m_pErrorEvent->sendDiagEventErrorResponse(eNO_ERROR_INFO);
      LOG_STATUS_IF_ERRORED(l_eStatus, "m_pErrorEvent->sendDiagEventErrorResponse()");
      l_eStatus = eFrameworkunifiedStatusFail;
      // LCOV_EXCL_STOP
    } else {
      FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Log Request passed to SystemManager.");
    }
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCANTrigger(HANDLE f_hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  l_eStatus = SendCANLoggingRequestToSystemManager();
  LOG_STATUS_IF_ERRORED(l_eStatus, "SendCANLoggingRequestToSystemManager()");  // LCOV_EXCL_BR_LINE 15:macro
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnDTCTrigger(HANDLE f_hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  UI_32 l_dtc;
  if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_dtc, sizeof(l_dtc), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error. Could not get msg Data.");
    // LCOV_EXCL_STOP
  } else {
    l_eStatus = SendDTCLoggingRequestToSystemManager(l_dtc);
    LOG_STATUS_IF_ERRORED(l_eStatus, "SendDTCLoggingRequestToSystemManager(dtc)");  // LCOV_EXCL_BR_LINE 15:macro
    // Immediate Persist Event Log
    if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(f_hApp, g_thrdEvntLogWriter, eThrdCmdImmPersistEvtLog, 0x00, NULL))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
      // LCOV_EXCL_START 4:NSFW
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
      // LCOV_EXCL_STOP
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_On_SHTDWN_Complete(
    HANDLE f_hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  l_eStatus = LoggerService_OnStop(f_hApp);
  LOG_STATUS_IF_ERRORED(l_eStatus, "LoggerService_OnStop()");  // LCOV_EXCL_BR_LINE 15:macro
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnSetVIN
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetVIN(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  STVIN_NUMBER l_stVIN_Number;

  if (eFrameworkunifiedStatusOK == (l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, &l_stVIN_Number, sizeof(l_stVIN_Number), eSMRRelease))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
    if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdSetVINnumber, sizeof(STVIN_NUMBER), &l_stVIN_Number))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
      // LCOV_EXCL_START 4:NSFW
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedSendChild msg failed:%X", l_eStatus);
      // LCOV_EXCL_STOP
    }
  } else {
    // LCOV_EXCL_START 4:NSFW
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedGetMsgDataOfSize failed errval: %X",
           l_eStatus);
    // LCOV_EXCL_STOP
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnCopyEvntLog
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnCopyEvntLog(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;

  TWriteFilesToUsbCmdData l_stCmdData;
  HANDLE l_hSession = NULL;

  if (hApp != NULL) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
    if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
    }
    if (l_stCmdData.stSessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 6: it can not be empty
      // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetMsgSrc()");
      // LCOV_EXCL_STOP
    } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      // LCOV_EXCL_START 6: it can not be null
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
      // LCOV_EXCL_STOP
    } else {
      l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
      if (eFrameworkunifiedStatusOK
          != (l_eStatus = ReadMsg<EEvtLogUSBDevNumber>(hApp, l_stCmdData.eDevId))) {
        LOG_ERROR("ReadMsg()");
      } else {
        if (eFrameworkunifiedStatusOK
            != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter,  // LCOV_EXCL_BR_LINE 4:NSFW
                                         eThrdCmdWriteEvntFilesToUsb,
                                         sizeof(TWriteFilesToUsbCmdData),
                                         &l_stCmdData))) {
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          LOG_ERROR("FrameworkunifiedSendChild()");  // LCOV_EXCL_LINE 4:NSFW
        }
      }
    }
  } else {
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid App handler");  // LCOV_EXCL_LINE 6: it can not be null
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnClearEvntLog
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnClearEvntLog(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;

  if (hApp != NULL) {  // LCOV_EXCL_BR_LINE 200:As it is not always NULL
    TSessionData l_sessiondata;
    HANDLE l_hSession = NULL;
    PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);  // LCOV_EXCL_BR_LINE 11:Unexpected branch
    if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 4:NSFW
      l_sessiondata.strSrcName = l_tmp_srcname;
    }
    if (l_sessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 4:As it is guaranteed by NSFW and is not always an empty string
      // LCOV_EXCL_START 4:As it is guaranteed by NSFW and is not always an empty string
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetMsgSrc()");
      // LCOV_EXCL_STOP
    } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 4:NSFW
      // LCOV_EXCL_START 4:NSFW
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
      // LCOV_EXCL_STOP
    } else {
      l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);  // LCOV_EXCL_BR_LINE 11:Unexpected branch
      if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter, eThrdCmdClearEvntLogs, sizeof(TSessionData), &l_sessiondata))) {  // LCOV_EXCL_BR_LINE 4:NSFW  // NOLINT[whitespace/line_length]
        // LCOV_EXCL_START 4:NSFW
        AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
        LOG_ERROR("FrameworkunifiedSendChild()");
        // LCOV_EXCL_STOP
      }
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnReadStatCounter
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadStatCounter(
    HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;

  if (hApp != NULL) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    TStatisticalCountersCmd l_stCmdData;
    HANDLE l_hSession = NULL;

    PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
    if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
    }
    if (l_stCmdData.stSessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 6: it can not be empty
      // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetMsgSrc()");
      // LCOV_EXCL_STOP
    } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
      // LCOV_EXCL_STOP
    } else {
      l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
      if (eFrameworkunifiedStatusOK
          != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
                                                       l_stCmdData.eGroupId))) {
        LOG_ERROR("ReadMsg()");
      } else {
        if (eFrameworkunifiedStatusOK
            != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter,  // LCOV_EXCL_BR_LINE 4:NSFW
                                         eThrdCmdStatisticalCounter,
                                         sizeof(TStatisticalCountersCmd),
                                         &l_stCmdData))) {
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          LOG_ERROR("FrameworkunifiedSendChild()");// LCOV_EXCL_LINE 4:NSFW
        }
      }
    }
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnResetStatCounter
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnResetStatCounter(
    HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;

  if (hApp != NULL) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    TStatisticalCountersCmd l_stCmdData;
    HANDLE l_hSession = NULL;
    PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
    if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      l_stCmdData.stSessiondata.strSrcName = l_tmp_srcname;
    }
    if (l_stCmdData.stSessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 6: it can not be empty
      // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetMsgSrc()");
      // LCOV_EXCL_STOP
    } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 6: it can not be null
      // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      l_eStatus = eFrameworkunifiedStatusNullPointer;
      LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
      // LCOV_EXCL_STOP
    } else {
      l_stCmdData.stSessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
      if (eFrameworkunifiedStatusOK
          != (l_eStatus = ReadMsg<EStatCounterGroupID>(hApp,
                                                       l_stCmdData.eGroupId))) {
        LOG_ERROR("ReadMsg()");
      } else {
        if (eFrameworkunifiedStatusOK
            != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter,  // LCOV_EXCL_BR_LINE 4:NSFW
                                         eThrdCmdResetStatisticalCntrs,
                                         sizeof(TStatisticalCountersCmd),
                                         &l_stCmdData))) {
          AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
          LOG_ERROR("FrameworkunifiedSendChild()");  // LCOV_EXCL_LINE 4:NSFW
        }
      }
    }
  }
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnReadNumberOfEvents
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnReadNumberOfEvents(
    HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  TSessionData l_sessiondata;
  HANDLE l_hSession = NULL;

  l_sessiondata.strSrcName = FrameworkunifiedGetMsgSrc(hApp);
  if (l_sessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 6: it can not be empty
    // LCOV_EXCL_START 6: it can not be empty
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    l_eStatus = eFrameworkunifiedStatusNullPointer;
    LOG_ERROR("FrameworkunifiedGetMsgSrc()");
    // LCOV_EXCL_STOP
  } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    // LCOV_EXCL_START 6: it can not be empty
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    l_eStatus = eFrameworkunifiedStatusNullPointer;
    LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
    // LCOV_EXCL_STOP
  } else {
    l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
    if (eFrameworkunifiedStatusOK
        != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter,  // LCOV_EXCL_BR_LINE 4:NSFW
                                     eThrdCmdGetNumberOfEventsLogged,
                                     sizeof(TSessionData), &l_sessiondata))) {
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      LOG_ERROR("FrameworkunifiedSendChild()");  // LCOV_EXCL_LINE 4:NSFW
    }
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_OnSetDiagID
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_OnSetDiagID(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  UI_16 l_DiagId = 0;

  if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg<UI_16>(hApp, l_DiagId))) {  // LCOV_EXCL_BR_LINE 200:To ensure success
    // LCOV_EXCL_START 200:To ensure success
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    LOG_ERROR("ReadMsg()");
    // LCOV_EXCL_STOP
  } else {
    g_u16DiagId = l_DiagId;
  }
  return l_eStatus;
}

///////////////////////////////////////////////////////////////////////
/// Function :LoggerServer_UploadEventLog
///////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CLoggerServiceCallbacks::LoggerServer_UploadEventLog(HANDLE hApp) {
  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
  EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
  TSessionData l_sessiondata;
  HANDLE l_hSession = NULL;

  PCSTR l_tmp_srcname = FrameworkunifiedGetMsgSrc(hApp);
  if (NULL != l_tmp_srcname) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    l_sessiondata.strSrcName = l_tmp_srcname;
  }
  if (l_sessiondata.strSrcName.empty()) {  // LCOV_EXCL_BR_LINE 6: it can not be empty
    // LCOV_EXCL_START 6: it can not be empty
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    l_eStatus = eFrameworkunifiedStatusNullPointer;
    LOG_ERROR("FrameworkunifiedGetMsgSrc()");
    // LCOV_EXCL_STOP
  } else if (NULL == (l_hSession = FrameworkunifiedGetCurrentSessionHandle(hApp))) {  // LCOV_EXCL_BR_LINE 6: it can not be null
    // LCOV_EXCL_START 6: it can not be null
    AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
    l_eStatus = eFrameworkunifiedStatusNullPointer;
    LOG_ERROR("FrameworkunifiedGetCurrentSessionHandle()");
    // LCOV_EXCL_STOP
  } else {
    l_sessiondata.session_id = FrameworkunifiedGetSessionId(l_hSession);
    if (eFrameworkunifiedStatusOK
        != (l_eStatus = FrameworkunifiedSendChild(hApp, g_thrdEvntLogWriter,  // LCOV_EXCL_BR_LINE 4:NSFW
                                     eThrdCmdUploadEventLog,
                                     sizeof(TSessionData), &l_sessiondata))) {
      AGL_ASSERT_NOT_TESTED();  // LCOV_EXCL_LINE 200: test assert
      LOG_ERROR("FrameworkunifiedSendChild()");  // LCOV_EXCL_LINE 4:NSFW
    }
  }

  FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
  return (l_eStatus);
}