2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_SystemServices_Logger
19 /// \brief This file supports the _CWORD77_ logger service.
21 ///////////////////////////////////////////////////////////////////////////////
22 #include "system_service/ss_logger_service_ifc.h"
24 #include <native_service/frameworkunified_application.h>
25 #include <native_service/frameworkunified_framework_if.h>
26 #include <native_service/frameworkunified_types.h>
27 #include <native_service/frameworkunified_framework_types.h>
29 #include "system_service/ss_logger_service_protocol.h"
30 #include "system_service/ss_logger_service_notifications.h"
31 #include "system_service/ss_logger_service.h"
32 #include "system_service/ss_logger_service_local.h"
33 #include "system_service/ss_services.h"
34 #include "ss_logger_service_if_interfaceunifiedlog.h"
36 LoggerServiceIf::LoggerServiceIf()
42 LoggerServiceIf::~LoggerServiceIf() {
43 CloseSessionRequest(); // if the session is still connected
48 } // LCOV_EXCL_BR_LINE 10:Because destructor
50 EFrameworkunifiedStatus LoggerServiceIf::NotifyOnLoggerServiceAvailability(
51 CbFuncPtr f_pCallBackFn) {
52 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
53 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
54 if (NULL != m_hApp && NULL != f_pCallBackFn) {
56 FrameworkunifiedNotificationCallbackHandler g_aryLogger_Notif_Cbs[] = {
57 // Notifications name, Call back function
58 { NTFY_SS_LoggerService_Availability, f_pCallBackFn }, };
60 if (0 != strcmp(SERVICE_LOGGER, FrameworkunifiedGetAppName(m_hApp))) {
61 // Subscribe and attach call backs to notifications
62 if (eFrameworkunifiedStatusOK
63 != (eStatus = FrameworkunifiedSubscribeNotificationsWithCallback(
64 m_hApp, g_aryLogger_Notif_Cbs, _countof(g_aryLogger_Notif_Cbs)))) {
65 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
66 "FrameworkunifiedAttachNotificationCallbacksToDispatcher Failed Status:0x%x ",
71 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
75 EFrameworkunifiedStatus LoggerServiceIf::NotifyOnOpenSessionAck(CbFuncPtr f_pCallBackFn) {
76 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
77 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
78 if (NULL != m_hApp && NULL != f_pCallBackFn) {
79 if (eFrameworkunifiedStatusOK
80 != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
82 PROTOCOL_OPEN_SESSION_ACK,
84 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
85 "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
88 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
92 EFrameworkunifiedStatus LoggerServiceIf::NotifyOnCloseSessionAck(CbFuncPtr f_pCallBackFn) {
93 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
94 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
96 if (NULL != m_hApp && NULL != f_pCallBackFn) {
97 if (eFrameworkunifiedStatusOK
98 != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
100 PROTOCOL_CLOSE_SESSION_ACK,
102 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
103 "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
107 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
111 BOOL LoggerServiceIf::Initialize(HANDLE hApp) {
112 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
113 BOOL l_eStatus = TRUE;
118 l_eStatus = FALSE; // eFrameworkunifiedStatusInvldHandle;
120 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
124 EFrameworkunifiedStatus LoggerServiceIf::OpenSessionRequest() {
125 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
126 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
127 if (NULL != m_hApp) {
128 // if the session is there then we need to close it first!
129 if (NULL != m_hService) {
130 CloseSessionRequest();
133 BOOL l_bServiceAvailable = FrameworkunifiedIsServiceAvailable(m_hApp);
134 if (FALSE == l_bServiceAvailable) {
135 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, "Service is unavailable");
136 l_eStatus = eFrameworkunifiedStatusFail;
138 // Now open the service.
139 if (l_bServiceAvailable
140 && (NULL != (m_hService = OpenService()))) { // LCOV_EXCL_BR_LINE 8:Because bServiceAvailable is always TRUE
141 // [DM: TODO] Check if we need to open a session with some data sent to Server.
142 UI_32 l_pTestData = 1;
143 if (eFrameworkunifiedStatusOK
144 != (l_eStatus = FrameworkunifiedOpenSessionWithData(m_hService,
145 (PVOID) &l_pTestData,
147 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
148 "FrameworkunifiedOpenSessionWithData Failed, errval :%d", l_eStatus);
151 l_eStatus = eFrameworkunifiedStatusFail;
152 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
153 "FrameworkunifiedOpenService Failed, errval :%d", l_eStatus);
157 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
161 HANDLE LoggerServiceIf::OpenService() {
162 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
163 HANDLE l_hService = NULL;
165 if (NULL == (l_hService = FrameworkunifiedOpenService(m_hApp, SERVICE_LOGGER))) {
166 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
167 "FrameworkunifiedOpenService : Failed to open Logger Service");
169 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
173 EFrameworkunifiedStatus LoggerServiceIf::DecodeOpenSessionResponse() {
174 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
175 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
176 std::string l_strSessionName;
177 if (NULL != m_hService
178 && NULL != m_hApp) { // LCOV_EXCL_BR_LINE 8:Because there is no case where m_hApp is NULL and m_hService is not NULL
179 if (NULL == (m_hSession = FrameworkunifiedGetOpenSessionHandle(m_hApp))) {
180 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__,
181 "Error in extracting OpenSessionAck response.");
182 l_eStatus = eFrameworkunifiedStatusFail;
184 l_eStatus = eFrameworkunifiedStatusOK;
185 l_strSessionName = FrameworkunifiedGetSessionName(m_hSession);
186 if (l_strSessionName.empty()) {
187 l_eStatus = eFrameworkunifiedStatusFail;
188 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SessionName is empty");
190 if (eFrameworkunifiedStatusOK
191 != (FrameworkunifiedSetSessionHandle(m_hApp, l_strSessionName.c_str(), m_hSession))) {
192 l_eStatus = eFrameworkunifiedStatusFail;
193 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: FrameworkunifiedSetSessionHandle() failed");
199 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
203 EFrameworkunifiedStatus LoggerServiceIf::CloseSessionRequest() {
204 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
205 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
207 if (NULL != m_hService && NULL != m_hSession) {
208 if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedCloseSession(m_hService, m_hSession))) {
209 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedCloseSession Failed");
211 m_hSession = NULL; // clear our session handle
213 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
217 EFrameworkunifiedStatus LoggerServiceIf::RegisterForLoggerEvent(
218 SS_LoggerServerEvents f_eLoggerEvent, CbFuncPtr f_pCallBackFn) {
219 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
220 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
222 if (NULL != m_hSession && NULL != f_pCallBackFn) {
223 if (eFrameworkunifiedStatusOK
224 != (eStatus = FrameworkunifiedAttachCallbackToDispatcher(m_hApp,
227 f_pCallBackFn, m_hSession))) {
228 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
229 "FrameworkunifiedAttachCallbackToDispatcher Failed Status:0x%x ", eStatus);
232 // client registers for the event
233 if (eFrameworkunifiedStatusOK
234 != (eStatus = FrameworkunifiedRegisterEvent(m_hSession, f_eLoggerEvent))) {
235 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedRegisterEvents Failed Status:0x%x",
238 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "FrameworkunifiedRegisterEvents Status:0x%x", eStatus);
240 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
244 EFrameworkunifiedStatus LoggerServiceIf::UnRegisterForLoggerEvent(
245 SS_LoggerServerEvents f_eLoggerEvent) {
246 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
247 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusInvldHandle;
249 if (NULL != m_hSession) {
250 eStatus = eFrameworkunifiedStatusOK;
252 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
256 ////////////////////////////////////////////////////////////////////////////////////////////
258 /// API to send CAN Diagnostic status data(it has mileage info) to Logger Service
259 /// (Command: SS_LOGGER_MILEAGE_DATA)
262 /// EFrameworkunifiedStatus - success or error
263 ////////////////////////////////////////////////////////////////////////////////////////////
265 EFrameworkunifiedStatus LoggerServiceIf::SendDiagStat(STLOGGER_CANDIAGSTAT *pCanDiagStat_t) {
266 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
267 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
268 STLOGGER_CANDIAGSTAT l_candiagstat;
270 memcpy(&l_candiagstat, pCanDiagStat_t, sizeof(STLOGGER_CANDIAGSTAT));
272 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Before Valid Session");
273 if (NULL != m_hService && NULL != m_hSession) {
274 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Entered Valid Session");
275 if (eFrameworkunifiedStatusOK
276 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_MILEAGE_DATA,
277 sizeof(STLOGGER_CANDIAGSTAT), &l_candiagstat))) {
278 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
280 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Msg Send Successfully");
282 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
286 ///////////////////////////////////////////////////////////////////////
287 /// Function :LoggerIf_CANGetCurrentDateAndTime
288 ///////////////////////////////////////////////////////////////////////
289 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANGetCurrentDateAndTime(
290 STCanCurrentDateTime stDateAndTime) {
291 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
292 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
294 if (NULL != m_hService && NULL != m_hSession) {
295 if (eFrameworkunifiedStatusOK
296 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DATETIME,
297 sizeof(stDateAndTime), &stDateAndTime))) {
298 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
301 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
305 ///////////////////////////////////////////////////////////////////////
306 /// Function :LoggerIf_CANSetVIN
307 ///////////////////////////////////////////////////////////////////////
308 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_CANSetVIN(STVIN_NUMBER& stVinNumber) {
309 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
310 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
312 stVinNumber.VINstr[stVinNumber.VIN_LEN - 1] = '\0';
314 if (NULL != m_hService && NULL != m_hSession) {
315 if (eFrameworkunifiedStatusOK
316 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_VIN,
317 sizeof(STVIN_NUMBER), &stVinNumber))) {
318 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg() Failed with error: %X",
322 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Service or Session Handle NULL");
324 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
328 ////////////////////////////////////////////////////////////////////////////////////////////
329 /// LoggerIf_SetLoggerParams
330 /// API is to inform Logger Service about the device selected to store the logs
331 /// and about Enable/Disable Logging.
332 /// (Command: SS_LOGGER_SET_PARAMS)
335 /// EFrameworkunifiedStatus - success or error
336 ////////////////////////////////////////////////////////////////////////////////////////////
337 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetLoggerParams(ELOGGER_STAT eLoggerStatus,
338 EDEV_TYPE eDevType) {
339 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
340 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
341 STLoggerSetParams l_stLoggerParams;
343 l_stLoggerParams.Logger_State = eLoggerStatus;
344 l_stLoggerParams.Device_Type = eDevType;
346 if (NULL != m_hService && NULL != m_hSession) {
347 if (eFrameworkunifiedStatusOK
348 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_PARAMS,
349 sizeof(STLoggerSetParams), &l_stLoggerParams))) {
350 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
353 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
357 ////////////////////////////////////////////////////////////////////////////////////////////
358 /// LoggerIf_UDPLogging
359 /// API is to inform Logger Service about UDP logging
360 /// and about Enable/Disable Logging.
361 /// (Command: SS_LOGGER_UDP_LOGGING)
364 /// EFrameworkunifiedStatus - success or error
365 ////////////////////////////////////////////////////////////////////////////////////////////
366 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UDPLogging(ELOGGER_STAT eLoggerStatus) {
367 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
368 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
370 if (NULL != m_hService && NULL != m_hSession) {
371 if (eFrameworkunifiedStatusOK
372 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UDP_LOGGING,
373 sizeof(ELOGGER_STAT), &eLoggerStatus))) {
374 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
377 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
381 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_ScreenCaptureEventACK(
382 STScreenCaptureEvt stScreenCaptureInfo) {
383 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
384 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
386 if (NULL != m_hSession) {
387 if (eFrameworkunifiedStatusOK
388 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SCREENCAPTURE_EVT_ACK,
389 sizeof(stScreenCaptureInfo),
390 &stScreenCaptureInfo))) {
391 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
393 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Screen shot ACK sent successfully.");
396 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
397 "Error. m_hSession is NULL. Screen shot capture ACK not sent.");
399 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
403 ///////////////////////////////////////////////////////////////////////
404 /// Function :LoggerIf_EventLoggingCommonInfo
405 ///////////////////////////////////////////////////////////////////////
406 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingCommonInfo(
407 STEventLoggerCommonInfo stEventCommonInfo) {
408 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
409 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
411 if (NULL != m_hService && NULL != m_hSession) {
412 if (eFrameworkunifiedStatusOK
413 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_EVENT_COMMONINFO,
414 sizeof(stEventCommonInfo),
415 &stEventCommonInfo))) {
416 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
419 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
423 ///////////////////////////////////////////////////////////////////////
424 /// Function :LoggerIf_EventLoggingEventInfo
425 ///////////////////////////////////////////////////////////////////////
426 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingEventInfo(
427 STEventLoggerEventInfo stEventInfo) {
428 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
429 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
431 if (NULL != m_hService && NULL != m_hSession) {
432 if (eFrameworkunifiedStatusOK
433 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__EVENT_INFO,
434 sizeof(stEventInfo), &stEventInfo))) {
435 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
438 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
442 ///////////////////////////////////////////////////////////////////////
443 /// Function :LoggerIf_EventLoggingResetInfo
444 /// (Command: SS_LOGGER__CWORD56__RESET_INFO)
445 ///////////////////////////////////////////////////////////////////////
446 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_EventLoggingResetInfo(
447 STEventLoggerResetInfo stResetInfo) {
448 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
449 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
451 if (NULL != m_hService && NULL != m_hSession) {
452 if (eFrameworkunifiedStatusOK
453 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER__CWORD56__RESET_INFO,
454 sizeof(stResetInfo), &stResetInfo))) {
455 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
458 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
462 ///////////////////////////////////////////////////////////////////////
463 /// Function :LoggerIf_EventLoggingResetInfo
464 /// (Command: SS_LOGGER_DIAGDTC_ACTIVE)
465 ///////////////////////////////////////////////////////////////////////
466 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_PersistEventLogOnActiveDTC(void) {
467 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
468 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
470 if (NULL != m_hService && NULL != m_hSession) {
471 if (eFrameworkunifiedStatusOK
472 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_DIAGDTC_ACTIVE, 0x00,
474 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
477 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
481 ///////////////////////////////////////////////////////////////////////
482 /// Function :LoggerIf_EventLoggingResetInfo
483 /// (Command: SS_LOGGER_SHUTDOWN_COMPLETE)
484 ///////////////////////////////////////////////////////////////////////
485 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_Shutdown_Complete(void) {
486 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
487 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
489 if (NULL != m_hService && NULL != m_hSession) {
490 if (eFrameworkunifiedStatusOK
491 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SHUTDOWN_COMPLETE,
493 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
496 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
500 ///////////////////////////////////////////////////////////////////////
501 /// Function :StoreEventLogsToUSB
502 ///////////////////////////////////////////////////////////////////////
503 EFrameworkunifiedStatus LoggerServiceIf::StoreEventLogsToUSB(
504 EEvtLogUSBDevNumber eUSBDevNumber) {
506 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
508 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
510 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
511 "Copy the Event logs in to USB command received:%X", eUSBDevNumber);
513 if (NULL != m_hSession) {
514 if (eFrameworkunifiedStatusOK
515 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEVENTUSB,
516 sizeof(EEvtLogUSBDevNumber), &eUSBDevNumber))) {
517 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
520 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
523 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
527 ///////////////////////////////////////////////////////////////////////
528 /// Function :StoreEmergencyErrorLogsToUSB
529 ///////////////////////////////////////////////////////////////////////
530 EFrameworkunifiedStatus LoggerServiceIf::StoreEmergencyErrorLogsToUSB(
531 EDevNumber eDevNumber) {
533 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
535 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
538 ZONE_INFO, __FUNCTION__,
539 "Copy the Emergency Error logs in to External Device command received:%X",
542 if (NULL != m_hSession) {
543 if (eFrameworkunifiedStatusOK
544 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCOPYEMERGENCYLOGS,
545 sizeof(EDevNumber), &eDevNumber))) {
546 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
549 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
551 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
555 ///////////////////////////////////////////////////////////////////////
556 /// Function :ClearEventLogs
557 ///////////////////////////////////////////////////////////////////////
558 EFrameworkunifiedStatus LoggerServiceIf::ClearEventLogs(void) {
559 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
561 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
563 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request for clearing the event logs");
565 if (NULL != m_hSession) {
566 if (eFrameworkunifiedStatusOK
567 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGERCLEAREVENT, 0, NULL))) {
568 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
571 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
573 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
577 ///////////////////////////////////////////////////////////////////////
578 /// Function :ReadStatisticalCounter
579 ///////////////////////////////////////////////////////////////////////
580 EFrameworkunifiedStatus LoggerServiceIf::ReadStatisticalCounter(
581 EStatCounterGroupID eCounterGroup) {
582 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
584 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
586 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
587 "Request to read the statistical counter for group ID:%X",
590 if (NULL != m_hSession) {
591 if (eFrameworkunifiedStatusOK
592 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_READ_STATL_COUNTER,
593 sizeof(EStatCounterGroupID), &eCounterGroup))) {
594 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
597 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
599 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
603 ///////////////////////////////////////////////////////////////////////
604 /// Function :ReadStatisticalCounter
605 ///////////////////////////////////////////////////////////////////////
606 EFrameworkunifiedStatus LoggerServiceIf::ResetStatisticalCounter(
607 EStatCounterGroupID eCounterGroup) {
609 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
611 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
613 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
614 "Request to reset the statistical counter for group ID:%X",
617 if (NULL != m_hSession) {
618 if (eFrameworkunifiedStatusOK
619 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_RESET_STATL_COUNTER,
620 sizeof(EStatCounterGroupID), &eCounterGroup))) {
621 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
624 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
626 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
630 ///////////////////////////////////////////////////////////////////////
631 /// Function LoggerServiceIf::StartDTCLoggingToEmmc
632 ///////////////////////////////////////////////////////////////////////
633 EFrameworkunifiedStatus LoggerServiceIf::StartDTCLoggingToEmmc(UI_32 f_dtc) {
634 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
635 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
636 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start logging for DTC:0x%4X",
638 l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDDTCTrigger,
639 (UI_32) sizeof(f_dtc), &f_dtc);
640 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
644 ///////////////////////////////////////////////////////////////////////
645 /// Function LoggerServiceIf::StartCANLogging
646 ///////////////////////////////////////////////////////////////////////
647 EFrameworkunifiedStatus LoggerServiceIf::StartCANLogging(void) {
648 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
649 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
650 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "Request to start CAN logging.");
651 l_eStatus = this->SendMessage(eSSLoggerCANProtocolIDCANTrigger, 0, NULL);
652 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
656 ///////////////////////////////////////////////////////////////////////
657 /// Function LoggerServiceIf::RegisterLoggingStartNotification
658 ///////////////////////////////////////////////////////////////////////
659 EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingStartNotification(
660 CbFuncPtr f_pCallBackFn) {
661 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
662 EFrameworkunifiedStatus l_eStatus;
664 if (NULL == this->m_hApp) {
665 l_eStatus = eFrameworkunifiedStatusNullPointer;
666 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
667 } else if (NULL == f_pCallBackFn) {
668 l_eStatus = eFrameworkunifiedStatusNullPointer;
669 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
671 l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(this->m_hApp,
672 eSSLoggerCANEventStart,
675 if (eFrameworkunifiedStatusOK != l_eStatus) {
679 "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventStart) returned %X",
684 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
688 ///////////////////////////////////////////////////////////////////////
689 /// Function LoggerServiceIf::RegisterLoggingStartNotification
690 ///////////////////////////////////////////////////////////////////////
691 EFrameworkunifiedStatus LoggerServiceIf::RegisterLoggingFinishNotification(
692 CbFuncPtr f_pCallBackFn) {
693 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
694 EFrameworkunifiedStatus l_eStatus;
696 if (NULL == this->m_hApp) {
697 l_eStatus = eFrameworkunifiedStatusNullPointer;
698 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == this->m_hApp)");
699 } else if (NULL == f_pCallBackFn) {
700 l_eStatus = eFrameworkunifiedStatusNullPointer;
701 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "(NULL == f_pCallBackFn)");
703 l_eStatus = FrameworkunifiedSubscribeToSessionEventWithCallback(
704 this->m_hApp, eSSLoggerCANEventFinished, f_pCallBackFn,
707 if (eFrameworkunifiedStatusOK != l_eStatus) {
711 "FrameworkunifiedSubscribeToSessionEventWithCallback(eSSLoggerCANEventFinished) returned %X",
716 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
720 ///////////////////////////////////////////////////////////////////////
721 /// Function :SendMessage
722 ///////////////////////////////////////////////////////////////////////
723 EFrameworkunifiedStatus LoggerServiceIf::SendMessage(UI_32 f_cmdID, UI_32 f_size,
725 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
726 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusInvldHandle;
728 if ((NULL != m_hSession)
729 && ((f_pData != NULL) || (f_size == 0))) { // LCOV_EXCL_BR_LINE 8:Because there is no case where f_pData is NULL and f_size is not 0
730 if (eFrameworkunifiedStatusOK
731 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, f_cmdID, f_size, f_pData))) {
732 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed");
735 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
737 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
741 ///////////////////////////////////////////////////////////////////////
742 /// Function :LoggerIf_SetDiagID
743 ///////////////////////////////////////////////////////////////////////
744 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_SetDiagID(UI_16 f_u16DiagID) {
745 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
746 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
748 if (NULL != m_hSession) {
749 if (eFrameworkunifiedStatusOK
750 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_SET_DIAGID,
751 sizeof(UI_16), &f_u16DiagID))) {
752 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
755 l_eStatus = eFrameworkunifiedStatusNullPointer;
756 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
758 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
762 ///////////////////////////////////////////////////////////////////////
763 /// Function :LoggerIf_UploadEventLog
764 ///////////////////////////////////////////////////////////////////////
765 EFrameworkunifiedStatus LoggerServiceIf::LoggerIf_UploadEventLog() {
766 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
767 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
769 if (NULL != m_hSession) {
770 if (eFrameworkunifiedStatusOK
771 != (l_eStatus = FrameworkunifiedSendMsg(m_hSession, SS_LOGGER_UPLOAD_EVENTLOG, 0x00,
773 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "FrameworkunifiedSendMsg Failed %d", l_eStatus);
776 l_eStatus = eFrameworkunifiedStatusNullPointer;
777 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Session failed");
779 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
781 } // LCOV_EXCL_BR_LINE 10:Because the last line