summaryrefslogtreecommitdiffstats
path: root/logger_service/server/include
diff options
context:
space:
mode:
authorToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:39:24 +0900
committerToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:39:24 +0900
commit91f5345046f18f406071befd62e0e05322a5a1de (patch)
tree74fb8e365988ae7aef69711a053a50045977abbd /logger_service/server/include
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
ss-loggerservice branch
Diffstat (limited to 'logger_service/server/include')
-rw-r--r--logger_service/server/include/loggerservicedebug_loggerservicelog.h81
-rw-r--r--logger_service/server/include/loggerservicedebug_thread_if.h319
-rw-r--r--logger_service/server/include/loggerservicedebug_writer_Evntworker.h211
-rw-r--r--logger_service/server/include/readerWriter/reader/mem_reader.h51
-rw-r--r--logger_service/server/include/readerWriter/reader/queue_reader.h49
-rw-r--r--logger_service/server/include/readerWriter/reader/reader.h52
-rw-r--r--logger_service/server/include/readerWriter/reader_writer.h77
-rw-r--r--logger_service/server/include/readerWriter/reader_writer_cfg.h35
-rw-r--r--logger_service/server/include/readerWriter/writer/cached_file_writer.h45
-rw-r--r--logger_service/server/include/readerWriter/writer/file_writer.h51
-rw-r--r--logger_service/server/include/readerWriter/writer/udp_file_writer.h54
-rw-r--r--logger_service/server/include/readerWriter/writer/udp_writer.h63
-rw-r--r--logger_service/server/include/readerWriter/writer/writer.h56
-rw-r--r--logger_service/server/include/ss_logger_cfg.h172
-rw-r--r--logger_service/server/include/ss_logger_common.h115
-rw-r--r--logger_service/server/include/ss_logger_device_detection.h66
-rw-r--r--logger_service/server/include/ss_logger_error_event.h156
-rw-r--r--logger_service/server/include/ss_logger_error_event_archive.h77
-rw-r--r--logger_service/server/include/ss_logger_error_event_can_evt_reply.h48
-rw-r--r--logger_service/server/include/ss_logger_error_event_cfg.h132
-rw-r--r--logger_service/server/include/ss_logger_error_event_storage.h82
-rw-r--r--logger_service/server/include/ss_logger_fs_directory.h108
-rw-r--r--logger_service/server/include/ss_logger_popups.h51
-rw-r--r--logger_service/server/include/ss_logger_reader_writer_control.h49
-rw-r--r--logger_service/server/include/ss_logger_scrshot.h30
-rw-r--r--logger_service/server/include/ss_logger_service_callbacks.h96
-rw-r--r--logger_service/server/include/ss_logger_types.h52
-rw-r--r--logger_service/server/include/ss_logger_util.h127
28 files changed, 2505 insertions, 0 deletions
diff --git a/logger_service/server/include/loggerservicedebug_loggerservicelog.h b/logger_service/server/include/loggerservicedebug_loggerservicelog.h
new file mode 100644
index 00000000..1564fb5d
--- /dev/null
+++ b/logger_service/server/include/loggerservicedebug_loggerservicelog.h
@@ -0,0 +1,81 @@
+/*
+ * @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_NS_LogTraceSender
+/// \brief This file supports AGL application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_PRD_INFO3 ZONEMASK(26)
+#define ZONE_PRD_INFO2 ZONEMASK(27)
+#define ZONE_PRD_INFO1 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 "Product Info3"
+#define ZONE_TEXT_27 "Product Info2"
+#define ZONE_TEXT_28 "Product Info1"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS(LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO, ZONE_FUNC, ZONE_ERR, ZONE_WARN, ZONE_PRD_INFO1, ZONE_PRD_INFO2, ZONE_PRD_INFO3
+#endif
+
+extern const CHAR AppName[];
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_LOGGERSERVICELOG_H_
diff --git a/logger_service/server/include/loggerservicedebug_thread_if.h b/logger_service/server/include/loggerservicedebug_thread_if.h
new file mode 100644
index 00000000..8203a68f
--- /dev/null
+++ b/logger_service/server/include/loggerservicedebug_thread_if.h
@@ -0,0 +1,319 @@
+/*
+ * @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_NS_LogTraceSender
+/// \brief This file supports the logging thread interface.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
+
+#include <pthread.h>
+#ifdef AGL_STUB
+#else
+#include <sys/neutrino.h>
+#include <sys/dispatch.h>
+#endif
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_thread_priority.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include "loggerservicedebug_loggerservicelog.h"
+
+typedef std::string ThreadName; //< service name
+
+typedef enum _EThreadCommandIds {
+ eThrdCmdUsbEject = 5463, ///< USB eject --> frameworkunifieddebug
+ eThrdCmdUsbCaptureLogs, ///< USB Capture log --> frameworkunifieddebug
+ eThrdCmdUsbStoreLogs, ///< USB Store log --> frameworkunifieddebug
+ eThrdCmdWriteFilesToUsb, ///< frameworkunifieddebug --> Writer
+ eThrdCmdWriteDataToFile, ///< Reader --> Writer
+ eThrdCmdWriterStop, ///< frameworkunifieddebug --> Writer (Stop writing to the file)
+ eThrdCmdWriterResume, ///< frameworkunifieddebug --> Writer (Continue writing to the file)
+ eThrdCmdCaptureLogScriptExit, ///< LogCaptureScript - > frameworkunifieddebug
+ eThrdCmdWriteEvntFilesToUsb, ///< Wreite Event files to USB
+ eThrdCmdcopytofile,
+ eThrdCmdClearEvntLogs, ///< Clear event logs
+ eThrdCmdStatisticalCounter, ///< Read statistical counter
+ eThrdCmdStatisticalCounterSuccessResp, ///< Statistical counter positiv Response from child thread
+ eThrdCmdStatisticalCounterErrorResp, ///< Statistical counter Negative Response from child thread
+ eThrdCmdResetStatisticalCntrs,
+ eThrdCmdCopyEventLogUSBResponse, ///< Copy event logs to usb response from child thread
+ eThrdCmdClearEventLogResponse, ///< Clear event logs response fromchild thread
+ eThrdCmdPersistLogs, ///< Statistical counter Response fromchild thread
+ eThrdCmdSetVINnumber,
+ eThrdCmdImmPersistEvtLog,
+ eThrdCmdMileageData,
+ eThrdCmdGetNumberOfEventsLogged,
+ eThrdCmdNumberOfEventsLoggedResponse,
+ eThrdCmdUploadEventLog,
+ eThrdCmdUploadEventLogResponse,
+ eThrdCmdCopyEvntLogToTmp,
+ eThrdCmdCopyEvntLogToTmpResponse
+} EThreadCommandIds;
+
+typedef struct _TThrdWriteDataToFileEvt {
+ static const UI_32 LN_LEN = 1024;
+ CHAR line[LN_LEN];
+ UI_32 length;
+} TThrdWriteLogDataToFileEvt, TThrdWriteTransmitDataToFileEvt;
+
+typedef struct _TThrdWriteFilesToUsbEvt {
+ static const UI_32 LOC_PATH_LEN = 256;
+ CHAR location[LOC_PATH_LEN]; ///< full path where files should be copied too
+ UI_32 loc_len;
+} TThrdWriteLogFilesToUsbEvt, TThrdWriteTransmitFilesToUsbEvt;
+
+typedef struct _TThrdCaptureLogsEvt {
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdCaptureLogsEvt;
+
+// Structure to hold the USB device informaton
+typedef struct _TThrdEvtLogStore {
+ BOOL IsDeviceAvailable;
+ static const UI_32 FN_LEN = 256;
+ CHAR location[FN_LEN];
+ CHAR parse_fn[FN_LEN]; ///< full path an name of the file that should be parsed for event actions.
+} TThrdEvtLogStore;
+
+typedef struct _TInitFlag {
+ UI_8 mileage_flagbit :1;
+ UI_8 statcounter_flagbit :1;
+ UI_8 eventlog_flagbit :1;
+ UI_8 reghandlers_flagbit :1;
+} TInitFlag;
+
+typedef struct _TSessionData {
+ std::string strSrcName;
+ UI_32 session_id;
+} TSessionData;
+
+typedef struct _TEvntNumber {
+ TSessionData stSessiondata;
+ UI_16 u16numberofeventslogged;
+} TEvntsLogged;
+
+typedef struct _TWriteFilesToUsbCmdData {
+ TSessionData stSessiondata;
+ EEvtLogUSBDevNumber eDevId;
+} TWriteFilesToUsbCmdData;
+
+typedef struct _TWriteFilesToUsbCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TWriteFilesToUsbCmdResponse;
+
+typedef struct _TClearEvntLogCmdResponse {
+ TSessionData stSessiondata;
+ UI_8 u8Response;
+} TClearEvntLogCmdResponse;
+
+typedef struct _TStatisticalCountersCmd {
+ TSessionData stSessiondata;
+ EStatCounterGroupID eGroupId;
+} TStatisticalCountersCmd;
+
+typedef struct _TStatisticalCntCmdSuccessResp {
+ TSessionData stSessiondata;
+ SStatisticalCounter stBuffer;
+} TStatisticalCntCmdSuccessResp;
+
+typedef struct _TUploadEventLogResp {
+ TSessionData stSessiondata;
+ STEventLogPersistBuffer stEventLogBuffer;
+} TUploadEventLogResp;
+
+typedef struct _TEventLogCopyStatus {
+ static const UI_8 FilePathSize = 64;
+ CHAR EventLogFilePath[FilePathSize];
+ UI_8 status;
+} TEventLogCopyStatus;
+
+typedef enum _ECaptureLogScriptResp {
+ ekCLSStatusCompleteSuccessful,
+ ekCLSStatusInitError,
+ ekCLSStatusExecuteError,
+ ekCLSStatusCopyError,
+ ekCLSStatusChmodError,
+} ECaptureLogScriptResp;
+
+class ThreadWrapper {
+ public:
+
+ ThreadWrapper(const char* t_name, void* (*routine)(void*), void* arg) { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ pthread_attr_t attr;
+ struct sched_param params;
+
+ if (EOK != pthread_attr_init(&attr)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_init failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_getschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_getschedparam failed errno: %d", errno);
+ }
+ SI_32 prio = frameworkunified::framework::CFrameworkunifiedThreadPriorities::GetPriority(
+ std::string(t_name));
+ if (-1 != prio) {
+ params.sched_priority = prio;
+ if (EOK != pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setinheritsched failed errno: %d", errno);
+ }
+ if (EOK != pthread_attr_setschedparam(&attr, &params)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
+ "Error: pthread_attr_setschedparam failed errno: %d", errno);
+ }
+ }
+
+ if (EOK != pthread_create(&m_thread, &attr, routine, arg)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_create failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+
+ ~ThreadWrapper() { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+// todo: Need a clean way to cleanup thread in case class closes
+ }
+ // LCOV_EXCL_STOP
+
+
+ operator pthread_t() const { // LCOV_EXCL_START 8:ThreadWrapper class is never used
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_thread;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ pthread_t m_thread;
+};
+
+
+class CChild {
+ public:
+ CChild(const char* parentsName, const char * sendDataToQue,
+ const char * clientsName, void* (*routine)(void*),
+ const char * sendToUdpQue = "")
+ : m_clientName(clientsName),
+ m_parentName(parentsName),
+ m_sendDataToQueuName(sendDataToQue),
+ m_sendDataToUdpQueName(sendToUdpQue),
+ m_barInit(InitBarrier()),
+ m_thread(clientsName, routine, reinterpret_cast<void*>(this)) { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ }
+ // LCOV_EXCL_STOP
+
+ void Join() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (EOK != pthread_join(m_thread, NULL)) {
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: pthread_join failed errno: %d",
+ errno);
+ }
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ParentName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_parentName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * ClientName() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_clientName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToQue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToQueuName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ const char * SendDataToUdpQueue() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ return m_sendDataToUdpQueName.c_str();
+ }
+ // LCOV_EXCL_STOP
+
+ bool IsValidWaitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ if (m_barInit) {
+ int wbret = pthread_barrier_wait(&m_barrier);
+ return ( PTHREAD_BARRIER_SERIAL_THREAD == wbret) || (0 == wbret);
+ }
+
+ return false;
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ bool InitBarrier() { // LCOV_EXCL_START 7:debug code
+ AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
+ /// Note: the count value should match the number of threads that are readers and usb notifiers
+ return (EOK == pthread_barrier_init(&m_barrier, NULL, 2) ? true : false);
+ }
+ // LCOV_EXCL_STOP
+
+ private:
+ ThreadName m_clientName;
+ ThreadName m_parentName;
+ ThreadName m_sendDataToQueuName;
+ ThreadName m_sendDataToUdpQueName;
+ bool m_barInit;
+ ThreadWrapper m_thread;
+ pthread_barrier_t m_barrier;
+};
+
+class LoggerserviceDebugChildThread {
+ public:
+ typedef enum e {
+ kLoggerserviceDebugLogQueReader,
+ kLoggerserviceDebugTransmitQueReader,
+ kLoggerservicePerformanceLogQueReader,
+ kLoggerserviceDebugCaptureLogScript,
+ kLoggerserviceDebugEventLogque,
+ kLoggerserviceDebugMax
+ } ELoggerserviceDebugThreads;
+
+ LoggerserviceDebugChildThread();
+ virtual ~LoggerserviceDebugChildThread();
+ BOOL Start(ELoggerserviceDebugThreads id, const char* parentsName,
+ const char * sendDataToQue, void* (*routine)(void*),
+ const char * sendToUdpQue = "");
+ void Stop(ELoggerserviceDebugThreads id);
+ void StopAll();
+ const char * Name(ELoggerserviceDebugThreads id);
+ void LiftWaitBarrier(ELoggerserviceDebugThreads id);
+ BOOL Running(ELoggerserviceDebugThreads id) const;
+ private:
+ ThreadName names[kLoggerserviceDebugMax];
+ CChild * threads[kLoggerserviceDebugMax];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_THREAD_IF_H_
diff --git a/logger_service/server/include/loggerservicedebug_writer_Evntworker.h b/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
new file mode 100644
index 00000000..70dc1bea
--- /dev/null
+++ b/logger_service/server/include/loggerservicedebug_writer_Evntworker.h
@@ -0,0 +1,211 @@
+/*
+ * @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_NS_LogTraceSender
+/// \brief frameworkunifieddebug writer thread class, handles writing a log file
+/// all really done by my_writer class.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
+
+#include <stdlib.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/ns_eventlogger.h>
+#include <map>
+#include <iostream>
+#include <deque>
+#include "loggerservicedebug_thread_if.h"
+
+
+// File path names for Evnet and counter logs
+extern const CHAR DEBUG_EVNTLOG_PATH_FN[];
+extern const CHAR g_strEvntLogQueWorkerName[];
+extern const CHAR DEBUG_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_FN[];
+extern const CHAR Counter_LOG_PATH_STARTFN[];
+extern const CHAR Counter_LOG_PATH_SHUTFN[];
+extern const CHAR Mileage_LOG_PATH_FN[];
+
+typedef struct _TevntWriterInfo {
+ static const UI_32 FN_LEN = 256;
+ UI_32 max_filelen;
+ CHAR base_cnt_filename[FN_LEN];
+ CHAR mileage_filename[FN_LEN];
+} TEvntWriterInfo;
+
+typedef enum _eDatatype_ {
+ COMMON_DATA,
+ EVENT_SPECIFIC_DATA
+} EDatatype_SS;
+
+typedef enum _eSystemPhase_ {
+ STARTUP_SS = 0x21,
+ NORMAL_SS = 0x22,
+ SHUTDOWN_SS = 0x23
+} ESystemPhase_SS;
+
+#pragma pack(1)
+typedef struct _stLogEventFull_ {
+ UI_32 ts;
+ UI_8 grp_ID;
+ UI_8 event_id;
+ UI_8 data[4];
+ ESystemPhase_SS phase;
+ UI_16 cnt_ID;
+ EDatatype_SS typeofdata;
+} st_LogEvent_full;
+#pragma pack(0)
+
+// Deque to hold the Event information
+typedef std::deque<st_LogEvent_ss> DEQUE_Event_Type;
+
+// Map to hold the Counter information on phase
+typedef std::map<UI_16, UI_32> Counter;
+
+/*Map to hold the all the counter information */
+typedef std::map<EStatCounterGroupID, Counter> CounterInformation;
+
+class CEvntWriterWorker {
+ public:
+ CEvntWriterWorker();
+ CEvntWriterWorker(TEvntWriterInfo & wi); // NOLINT (runtime/references)
+ virtual ~CEvntWriterWorker();
+ // initialize the object
+ EFrameworkunifiedStatus Initialize(HANDLE hThread);
+
+ /// Copy event logs to USB request from parent thread
+ EFrameworkunifiedStatus OnCmdWriteEventFilesToUsb(HANDLE hThread);
+
+ /// Event logging request from NS logger
+ EFrameworkunifiedStatus OnCmdEventLog(UI_8* pbuf);
+
+ /// Clear event logs request from parent thread
+ EFrameworkunifiedStatus OnCmdClearEventLogs(HANDLE hThread);
+
+ /// Read statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdReadStatisticalCounter(HANDLE hThread);
+
+ /// Read statistical counter based on counter group ID
+ EFrameworkunifiedStatus ReadStatisticalCounter(EStatCounterGroupID eStatCounterGroupID,
+ SStatisticalCounter& buffer); // NOLINT (runtime/references)
+
+ /// Reset statistical counter request from parent thread
+ EFrameworkunifiedStatus OnCmdResetStatisticalCounter(HANDLE hThread);
+
+ /// Reset statistical counter based on counter group ID
+ EFrameworkunifiedStatus ResetStatisticalCounter(EStatCounterGroupID eStatCounterGroupID);
+
+ EFrameworkunifiedStatus OnCmdStop(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdStart(HANDLE hThread);
+
+ /// Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrcount(UI_8* pbuf);
+
+ /// Event and Counter logging request from NS logger
+ EFrameworkunifiedStatus OnCmdIncrwriteevent(UI_8* pbuf);
+
+ /// Reading counter value from file based on phase
+ EFrameworkunifiedStatus readCountFromFile(PCSTR filename);
+
+ /// Writing counter value from file based on phase
+ EFrameworkunifiedStatus writeCountToFile(PCSTR filename);
+
+ /// Writing event value from file based on phase
+ EFrameworkunifiedStatus write_event_to_file(const CHAR* filename);
+
+ /// Copy event files to USB based onUSB device number
+ UI_8 copy_event_files_to_usb(TThrdEvtLogStore *pStUSBIndo);
+
+ /// Functioncall to populate the counter value to map
+ VOID OnCmdIncrcount_phase(st_LogCount *cnt);
+
+ /// Function call to populate the event value to deque
+ VOID OnCmdWriteEventLogs(st_LogEvent_ss *ev);
+
+ /// Set the VIN number
+ EFrameworkunifiedStatus OnCmdSetVIN(HANDLE hThread);
+
+ /// Get the VIN number
+ VOID OnCmdGetVIN(STVIN_NUMBER& f_stVIN_Number); // NOLINT (runtime/references)
+
+ /// Functional call to write events from deque to local buffer
+ VOID write_events_to_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to read events from buffer to deque
+ VOID read_events_from_buffer(STEventLogPersistBuffer* f_stEvtLogBuf);
+
+ /// Functional call to immediate persist event log
+ EFrameworkunifiedStatus immediate_persist_event_log(HANDLE hThread);
+
+ /// Functional call to set mileage information in Evt thread space
+ EFrameworkunifiedStatus EvtThd_SetMileage(HANDLE hThread);
+
+ /// Functional call to write mileage data to file for persisting
+ EFrameworkunifiedStatus write_mileage_to_file(const CHAR* filename);
+
+ /// Functional call to read mileage data from persistent file during startup
+ EFrameworkunifiedStatus read_mileage_from_file(const CHAR* filename);
+
+ EFrameworkunifiedStatus OnCmdReadNumberOfEventsLogged(HANDLE hThread);
+
+ EFrameworkunifiedStatus EventLogRegisterCbHandlers(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdUploadEventLog(HANDLE hThread);
+
+ EFrameworkunifiedStatus OnCmdCopyEvntLogToTmp(HANDLE hThread);
+ /// Static Members for Event and counter logging
+ static CounterInformation counter;
+ static DEQUE_Event_Type deque_event_info;
+
+ private:
+ STVIN_NUMBER m_stVINnumber;
+ UI_32 m_u32MileageData;
+ UI_32 m_u32NumberEventsLogged;
+ TUploadEventLogResp m_stUploadEventLogResp;
+ EFrameworkunifiedStatus counterIncrementByValue(EStatCounterGroupID group, UI_16 id,
+ UI_32 value);
+ EFrameworkunifiedStatus writeGroupToFile(FILE *fp, EStatCounterGroupID group);
+};
+
+/// Event logging Child thread start and shut down functions
+EFrameworkunifiedStatus EvntWriterWorkerOnStart(HANDLE hThread);
+EFrameworkunifiedStatus EvntWriterWorkerOnStop(HANDLE hThread);
+
+/// USBdevice detectioncall backs
+EFrameworkunifiedStatus DD_USBSrvDetectionCallBack(HANDLE hApp);
+EFrameworkunifiedStatus DD_USBServiceAvailabilityCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBOpenSessionAckCallBack(HANDLE hThread);
+EFrameworkunifiedStatus DD_USBCloseSessionAckCallBack(HANDLE hApp);
+
+inline void u16copy(PUI_8 pDest, UI_16 Source) {
+ *(pDest++) = (UI_8) (Source & 0x00FF);
+ *(pDest++) = (UI_8) ((Source & 0xFF00) >> 8);
+}
+inline void u32copy(PUI_8 pDest, UI_32 Source) {
+ *(pDest++) = (UI_8) (Source & 0x000000FF);
+ *(pDest++) = (UI_8) ((Source & 0x0000FF00) >> 8);
+ *(pDest++) = (UI_8) ((Source & 0x00FF0000) >> 16);
+ *(pDest++) = (UI_8) ((Source & 0xFF000000) >> 24);
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_LOGGERSERVICEDEBUG_WRITER_EVNTWORKER_H_
diff --git a/logger_service/server/include/readerWriter/reader/mem_reader.h b/logger_service/server/include/readerWriter/reader/mem_reader.h
new file mode 100644
index 00000000..4d37242d
--- /dev/null
+++ b/logger_service/server/include/readerWriter/reader/mem_reader.h
@@ -0,0 +1,51 @@
+/*
+ * @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.
+ */
+
+/*
+ * mem_reader.h
+ *
+ * Created on: Oct 22, 2013
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
+
+#include <native_service/ns_sharedmem.h>
+#include <native_service/ns_sharedmem_reader.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+class CMemReader : public ReaderWriter::CReader {
+ public:
+ CMemReader();
+ virtual ~CMemReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus Open(void);
+ BOOL IsOpen(void);
+ void Close();
+ EFrameworkunifiedStatus ResetPosition(void);
+
+ private:
+ CNSSharedMemReader* m_pSharedBuf;
+ UI_32 m_sharedBufSize;
+};
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_MEM_READER_H_
diff --git a/logger_service/server/include/readerWriter/reader/queue_reader.h b/logger_service/server/include/readerWriter/reader/queue_reader.h
new file mode 100644
index 00000000..3706d642
--- /dev/null
+++ b/logger_service/server/include/readerWriter/reader/queue_reader.h
@@ -0,0 +1,49 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
+
+#include <mqueue.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "reader.h"
+
+namespace ReaderWriter {
+
+class CQueueReader : public CReader {
+ public:
+ CQueueReader();
+ virtual ~CQueueReader();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize);
+ EFrameworkunifiedStatus Read(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesRead); // NOLINT (runtime/references)
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ void Close();
+ private:
+ mqd_t m_handle;
+ std::string m_queName;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_QUEUE_READER_H_
diff --git a/logger_service/server/include/readerWriter/reader/reader.h b/logger_service/server/include/readerWriter/reader/reader.h
new file mode 100644
index 00000000..269cd8aa
--- /dev/null
+++ b/logger_service/server/include/readerWriter/reader/reader.h
@@ -0,0 +1,52 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CReader {
+ public:
+ CReader();
+ virtual ~CReader();
+
+ static CReader* OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_name, UI_32 f_maxSize);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_name,
+ UI_32 f_maxSize) = 0;
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+ virtual EFrameworkunifiedStatus Read(UI_8* f_data, UI_32 f_length, SI_32& f_bytesRead) = 0; // NOLINT (runtime/references)
+ virtual EFrameworkunifiedStatus ReadToFile(std::string f_fileName, UI_32& f_Written); // NOLINT (runtime/references)
+
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus ResetPosition(void);
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_READER_H_
diff --git a/logger_service/server/include/readerWriter/reader_writer.h b/logger_service/server/include/readerWriter/reader_writer.h
new file mode 100644
index 00000000..44c37bd4
--- /dev/null
+++ b/logger_service/server/include/readerWriter/reader_writer.h
@@ -0,0 +1,77 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
+
+#include <pthread.h>
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "readerWriter/reader/reader.h"
+#include "readerWriter/writer/writer.h"
+
+namespace ReaderWriter {
+
+class CReaderWriter {
+ public:
+ CReaderWriter();
+ virtual ~CReaderWriter();
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize);
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, EReaderType f_readerType,
+ std::string f_readerName, UI_32 f_readerMaxSize,
+ EWriterType f_writerType, std::string f_writer1Name,
+ UI_32 f_writer1MaxSize, std::string f_writer2Name,
+ UI_32 f_writer2MaxSize);
+ EFrameworkunifiedStatus Start(std::string f_readerName);
+ EFrameworkunifiedStatus Stop();
+ void ThreadFunction(CReaderWriter* l_pObj);
+ void Cleanup(CReaderWriter* l_pObj);
+ EFrameworkunifiedStatus FlushCache(std::string f_filename);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+
+ private:
+ void Pause(void);
+ void Resume(void);
+ static void* ThreadFunctionWrapper(void* param);
+
+ static void CleanupWrapper(void* param);
+ CLoggerCfg* m_pLoggerCfg;
+ CReader* m_reader;
+ CWriter* m_writer;
+ BOOL m_running;
+ pthread_t m_thread;
+ pthread_barrier_t m_barrier;
+ std::string m_readerName;
+
+ pthread_mutex_t m_writeMutex;
+ pthread_mutex_t m_pauseMutex;
+ pthread_cond_t m_condVariable;
+ BOOL m_paused;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_H_
diff --git a/logger_service/server/include/readerWriter/reader_writer_cfg.h b/logger_service/server/include/readerWriter/reader_writer_cfg.h
new file mode 100644
index 00000000..bc6602b5
--- /dev/null
+++ b/logger_service/server/include/readerWriter/reader_writer_cfg.h
@@ -0,0 +1,35 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
+namespace ReaderWriter {
+typedef enum _ERWType {
+ eReaderWriterTypeFile,
+ eReaderWriterTypeQueue,
+ eReaderWriterTypeUdp,
+ eReaderWriterTypeUdpAndFile, // Only for writer | pass filename and queueName
+ eReaderWriterTypeMem,
+ eReaderWriterTypeInvalid
+} EReaderType, EWriterType;
+}
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_READER_WRITER_CFG_H_
diff --git a/logger_service/server/include/readerWriter/writer/cached_file_writer.h b/logger_service/server/include/readerWriter/writer/cached_file_writer.h
new file mode 100644
index 00000000..06d7bbce
--- /dev/null
+++ b/logger_service/server/include/readerWriter/writer/cached_file_writer.h
@@ -0,0 +1,45 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include "file_writer.h"
+
+#define CACHED_BLOCK_SIZE (UI_32)(4*1024)
+
+namespace ReaderWriter {
+
+class CCachedFileWriter : public CFileWriter {
+ public:
+ CCachedFileWriter();
+ virtual ~CCachedFileWriter();
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ UI_8 m_buffer[CACHED_BLOCK_SIZE ];
+ UI_32 m_index;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_CACHED_FILE_WRITER_H_
diff --git a/logger_service/server/include/readerWriter/writer/file_writer.h b/logger_service/server/include/readerWriter/writer/file_writer.h
new file mode 100644
index 00000000..190232b5
--- /dev/null
+++ b/logger_service/server/include/readerWriter/writer/file_writer.h
@@ -0,0 +1,51 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+
+namespace ReaderWriter {
+
+class CFileWriter : public CWriter {
+ public:
+ CFileWriter();
+ virtual ~CFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ protected:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ private:
+ int m_FileHandle;
+ off_t m_fileposn;
+ UI_32 m_maxFileSize;
+ std::string m_filename;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_FILE_WRITER_H_
diff --git a/logger_service/server/include/readerWriter/writer/udp_file_writer.h b/logger_service/server/include/readerWriter/writer/udp_file_writer.h
new file mode 100644
index 00000000..095ca352
--- /dev/null
+++ b/logger_service/server/include/readerWriter/writer/udp_file_writer.h
@@ -0,0 +1,54 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "writer.h"
+#include "udp_writer.h"
+#include "file_writer.h"
+
+namespace ReaderWriter {
+
+class CUdpFileWriter : public CWriter {
+ public:
+ CUdpFileWriter();
+ virtual ~CUdpFileWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ private:
+ CUdpWriter *m_pUdpWriter;
+ CFileWriter *m_pFileWriter;
+ CLoggerCfg* m_pLoggerCfg;
+ std::string m_ipAddress;
+ UI_32 m_port;
+ std::string m_FileName;
+ UI_32 m_FileSize;
+};
+} // namespace ReaderWriter
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_FILE_WRITER_H_
diff --git a/logger_service/server/include/readerWriter/writer/udp_writer.h b/logger_service/server/include/readerWriter/writer/udp_writer.h
new file mode 100644
index 00000000..34923e82
--- /dev/null
+++ b/logger_service/server/include/readerWriter/writer/udp_writer.h
@@ -0,0 +1,63 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
+
+#include <netinet/in.h>
+#include <string>
+#include "writer.h"
+
+#define REMOTE_IP_PORT 3500
+namespace ReaderWriter {
+#define UDP_MAX_LENGTH (UI_32)1024*4
+#define UDP_CACHED_BLOCK_SIZE (UI_32)1024*4
+#define SEND_RETRY_VALUE (UI_8) 5
+
+#define OWN_ADDRESS "169.254.80.8"
+class CUdpWriter : public CWriter {
+ public:
+ CUdpWriter();
+ virtual ~CUdpWriter();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2, UI_32 f_size2);
+
+ EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+ void Close();
+ EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ BOOL IsOpen(void);
+ EFrameworkunifiedStatus Open(void);
+ EFrameworkunifiedStatus FlushCache(void);
+ private:
+ EFrameworkunifiedStatus WriteData(UI_8 *f_data, UI_32 f_length, SI_32 &f_bytesWritten); // NOLINT (runtime/references)
+
+ int m_SocketHandle;
+ sockaddr_in m_oSAInfo;
+ std::string m_IPAddress;
+ UI_32 m_index;
+ UI_32 m_port;
+ BOOL m_InitialTimeElapsed;
+ UI_8 m_buffer[UDP_CACHED_BLOCK_SIZE];
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_UDP_WRITER_H_
diff --git a/logger_service/server/include/readerWriter/writer/writer.h b/logger_service/server/include/readerWriter/writer/writer.h
new file mode 100644
index 00000000..d5a397f2
--- /dev/null
+++ b/logger_service/server/include/readerWriter/writer/writer.h
@@ -0,0 +1,56 @@
+/*
+ * @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 TODO
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_cfg.h"
+
+namespace ReaderWriter {
+
+class CWriter {
+ public:
+ CWriter();
+ virtual ~CWriter();
+
+ static CWriter* OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
+ std::string f_Name1, UI_32 f_size1,
+ std::string f_Name2, UI_32 f_size2);
+ virtual EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg, std::string f_Name1,
+ UI_32 f_size1, std::string f_Name2,
+ UI_32 f_size2) = 0;
+ virtual EFrameworkunifiedStatus Write(UI_8 *f_data, UI_32 f_length,
+ SI_32 &f_bytesWritten) = 0; // NOLINT (runtime/references)
+ virtual void Close() = 0;
+ virtual EFrameworkunifiedStatus FlushCache(void);
+ virtual EFrameworkunifiedStatus UpdateLoggingParameters(void);
+ virtual BOOL IsOpen(void) = 0;
+ virtual EFrameworkunifiedStatus Open(void) = 0;
+
+ protected:
+ CLoggerCfg * m_pLoggerCfg;
+};
+
+} // namespace ReaderWriter
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_READERWRITER_WRITER_WRITER_H_
diff --git a/logger_service/server/include/ss_logger_cfg.h b/logger_service/server/include/ss_logger_cfg.h
new file mode 100644
index 00000000..3e8da800
--- /dev/null
+++ b/logger_service/server/include/ss_logger_cfg.h
@@ -0,0 +1,172 @@
+/*
+ * @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 Provide support for SS Logger module configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/ns_config_parser_if.h>
+#include <native_service/ns_logger_if.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_logger_service.h>
+#include <system_service/ss_logger_service_local.h>
+#include <string>
+#include <vector>
+#include "loggerservicedebug_loggerservicelog.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+/*Default values for the storage thread*/
+#define ERROR_EVENT_STORAGE_QUEUE_NAME "/SSLoggerStrage"
+#define ERROR_EVENT_STORAGE_PRIORITY (UI_8)30
+#define ERROR_EVENT_STORAGE_SLEEP_TIME (useconds_t)50000
+#define ERROR_EVENT_STORAGE_SLEEP_AFTER (UI_8)5
+
+#if ENABLE_PRODUCTION_BUILD == 1
+#define SS_LOGGER_DEFAULT_VALUE eDeactivate
+#else
+#define SS_LOGGER_DEFAULT_VALUE eActivate
+#endif
+
+#define LOGGERSERVICELOG_EMMC_COUNTER_MAX 99999u
+
+struct SLoggerStorageInfo {
+ SLoggerStorageInfo()
+ : Name(ERROR_EVENT_STORAGE_QUEUE_NAME),
+ Priority(ERROR_EVENT_STORAGE_PRIORITY),
+ Timeout(ERROR_EVENT_STORAGE_SLEEP_TIME),
+ TimeoutAfter(ERROR_EVENT_STORAGE_SLEEP_AFTER) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ std::string Name;
+ SI_32 Priority;
+ SI_32 Timeout;
+ SI_32 TimeoutAfter;
+};
+
+enum EInsertEventType {
+ eInsertEventEELStorage,
+ eInsertEventEELActive,
+ eInsertEventLoggerserviceEmmcLogs,
+ eInsertEventInvalid
+};
+
+class CLoggerCfg {
+ public:
+ CLoggerCfg(void) noexcept;
+ ~CLoggerCfg(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus Load(const std::string &f_filePathAndName);
+ EFrameworkunifiedStatus Validate(void);
+ void Print(void);
+
+ EFrameworkunifiedStatus SetLoggingParams(HANDLE f_hApp,
+ STLoggerSetParams f_stLoggerSetParams) noexcept;
+
+ EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, ELOGGER_STAT f_eUDPLoggingStatus)
+ noexcept;
+
+ EFrameworkunifiedStatus PersistLoggingParam(HANDLE f_hApp);
+ std::string getEmmcOutputPath(void);
+ std::string getEmmcOutputNaviLogPath(void);
+ std::string getUsb0MountPath(void);
+ std::string getUsb1MountPath(void);
+ std::string getSdMountPath(void);
+ std::string getDeviceName(void);
+ void setUsb0MountPath(std::string &f_deviceMountpath); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetUserInvokedDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetEmmcDestination(std::string &f_dest); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus GetEmmcNaviLogDestination(std::string &f_dest); // NOLINT (runtime/references)
+
+ UI_32 GetUserInvokedCounter(void);
+ EFrameworkunifiedStatus GetIncrementAndPersistUserInvokedCounter(HANDLE f_hApp,
+ UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter) noexcept; // NOLINT (runtime/references)
+ EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) noexcept; // NOLINT (runtime/references)
+
+ void ResetEmmcCounter(void);
+
+ SI_32 m_logMaxFileSize;
+ UI_32 m_logMask[ZONE_MASK_ARRAY_ELTS];
+ SI_32 m_performanceLogMaxFileSize;
+ SI_32 m_emmcOutputMax;
+ SI_32 m_emmcOutputErrMax;
+ SI_32 m_emmcOutputGrpRelaunchMax;
+ SI_32 m_emmcOutputNaviLogMax;
+ SI_32 m_emmcOutputNaviLogNmlMax;
+ SI_32 m_emmcOutputNaviLogErrMax;
+
+ std::string m_emmcOutputPath;
+ std::string m_emmcOutputNaviLogPath;
+ std::string m_usb0MountPath;
+ std::string m_usb1MountPath;
+ std::string m_sdMountPath;
+
+ EDEV_TYPE GetConnectedDevice(std::string f_devPath);
+ EInsertEventType GetInsertEventType(std::string f_relPath);
+
+ std::string GetEELActivateRelPath(void);
+ std::string GetDebugFolderContentRelPath(void);
+ std::string GetEELExportRelPath(void);
+
+ BOOL IsUDPLoggingEnabled(void);
+ void AddLoggingParamCB(CbFuncPtr f_fp);
+
+ EFrameworkunifiedStatus GetLoggerStorageInfo(SLoggerStorageInfo &f_info); // NOLINT (runtime/references)
+ BOOL IsLoggingEnabled(void);
+ EFrameworkunifiedStatus EelActivateLogging(HANDLE f_hApp);
+
+ private:
+ void UpdateLoggingStatus(void) noexcept;
+ std::vector<CbFuncPtr> m_LoggingCallBack;
+ void GetHighestEmmcCounterValue(UI_32 &f_counter); // NOLINT (runtime/references)
+
+ EDEV_TYPE m_eDevType;
+ UI_32 m_UserInvokedLoggingNumber;
+ UI_32 m_EmmcCounter;
+ ELOGGER_STAT m_eLoggerUDPLoggingStatus;
+ BOOL m_udpEnvFlag;
+ ELOGGER_STAT m_eLoggerStatus;
+
+ std::string m_EELStorageRelPath;
+
+ std::string m_EELActivateRelPath;
+
+ std::string m_LoggerserviceEmmcLogsRelPath;
+
+ EFrameworkunifiedStatus SetandPersistLoggingParams(HANDLE f_hApp,
+ STLoggerSetAllParams f_Params,
+ BOOL f_InitCall);
+ SLoggerStorageInfo m_loggerStorageInfo;
+
+ void RemoveCarriageReturn(std::string &f_str); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
+
diff --git a/logger_service/server/include/ss_logger_common.h b/logger_service/server/include/ss_logger_common.h
new file mode 100644
index 00000000..2cf5958e
--- /dev/null
+++ b/logger_service/server/include/ss_logger_common.h
@@ -0,0 +1,115 @@
+/*
+ * @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.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief This file contains the callback for Notifications and Protocol
+/// commands.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup logger_service
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_types.h>
+
+const CHAR DEBUG_LOG_PATH_DIR[] = "/tmp/frameworkunifiedlog";
+const CHAR DEBUG_LOG_PATH_FN[] = "/tmp/frameworkunified_debug.log";
+const CHAR TRANSMIT_LOG_PATH_FN[] = "/tmp/interfaceunified_transmit.log";
+const CHAR PERFORMANCE_LOG_PATH_FN[] = "/tmp/frameworkunified_performance.log";
+const CHAR DRINITIAL_LOG_PATH_FN[] = "/tmp/loggerservice_drinitial.log";
+const CHAR DRLOCATION_LOG_PATH_FN[] = "/tmp/loggerservice_drlocation.log";
+const CHAR KERNEL_LOG_PATH_FN[] = "/tmp/kernel.log";
+const CHAR KERNEL_BOOT_LOG_PATH_FN[] = "/ramd/log/frameworkunifiedlog/kernelboot.log";
+
+const UI_32 PERFORMANCELOG_FILE_SZ = 256 * 1024;
+
+#define CLEAR_LOG_PATH_FN "/nv/log/frameworkunifiedlog/"
+#define NULLCHAR '\0'
+
+#define DEBUG_USB_PATH "/mnt/sda1"
+#define KERNEL_LOG_PATH_DIR "kernellog"
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+class cpp_callback {
+ public:
+ static CallbackFunctionPtr set(void* pInst) {
+ if (pInst == NULL)
+ throw;
+ ms_pInst = pInst;
+ return &cpp_callback::call;
+ }
+ static EFrameworkunifiedStatus call(HANDLE y) {
+ if (ms_pInst == NULL)
+ return eFrameworkunifiedStatusFault;
+ C* c = static_cast<C*>(ms_pInst);
+ return (c->*M)(y);
+ }
+ private:
+ static void* ms_pInst;
+};
+
+template<typename C, EFrameworkunifiedStatus (C::*M)(HANDLE)>
+void* cpp_callback<C, M>::ms_pInst = NULL;
+
+typedef enum _LoggerServiceStatus {
+ eLSInit,
+ eLSStart,
+ eLSStop,
+} ELOGGERSERVICESTATUS;
+
+typedef enum {
+ SS_LOGGER_KLOG_GET, /* type : get kernel.log */
+ SS_LOGGER_KBOOTLOG_CREATE /* type : create kernelboot.log */
+} SS_LOGGER_KLOG_OPE_TYPE;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup StopLoggingFunction
+/// \~english @par Summary
+/// Stop the logging function.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval
+/// None
+/// \~english @par Detail
+/// - The API stops the logging function.\n
+/// \n
+/// - Include ss_logger_common.h
+/// - Library libSS_SystemIfUnified.so
+/// \~english @par Classification
+/// Public
+/// \~english @see
+/// None
+////////////////////////////////////////////////////////////////////////////////////////////
+void StopLoggingFunction(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_COMMON_H_
+
+/** @}*/ // end of LoggerService
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/logger_service/server/include/ss_logger_device_detection.h b/logger_service/server/include/ss_logger_device_detection.h
new file mode 100644
index 00000000..0522c9ea
--- /dev/null
+++ b/logger_service/server/include/ss_logger_device_detection.h
@@ -0,0 +1,66 @@
+/*
+ * @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_NS_InterfaceunifiedLogCapture
+/// \brief This file supports USB logging threads.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
+
+#include <system_service/ss_devicedetection_service_notifications.h>
+#include <system_service/ss_devicedetection_service_ifc.h>
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+
+extern const char * USB_INSERTED_RULE;
+
+// USB device is ejected
+extern const CHAR USB_EJECTED_RULE[];
+
+// The trigger event file (/log/retrievelog.evt) file is found on USB
+extern const CHAR USB_CAPTURE_LOG_EVENT_RULE[];
+
+// When the command to update system with script is executed all the console
+// output will be redirected to this file on /tmp folder. later it will be
+// moved to USB stick
+extern const CHAR CAPTURE_LOG_FILENAME[];
+
+//
+extern const SI_32 INVALID_FD;
+class CLoggerDeviceDetection {
+ public:
+ CLoggerDeviceDetection();
+ ~CLoggerDeviceDetection();
+
+ EFrameworkunifiedStatus Initialize(HANDLE hApp, CLoggerCfg *f_pLoggerCfg);
+ EFrameworkunifiedStatus DD_ServiceAvailabilityCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_OpenSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionAckCallBack(HANDLE hApp);
+ EFrameworkunifiedStatus DD_CloseSessionWithDevDetectionSrv(HANDLE hApp);
+ EFrameworkunifiedStatus DD_MediaDetectCallBack(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnStop(void);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+
+ /// Device Detection Class Instance
+ DeviceDetectionServiceIf m_devDetect;
+
+ CLoggerUtil *m_loggerUtil;
+};
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_DEVICE_DETECTION_H_
diff --git a/logger_service/server/include/ss_logger_error_event.h b/logger_service/server/include/ss_logger_error_event.h
new file mode 100644
index 00000000..80b6bd8a
--- /dev/null
+++ b/logger_service/server/include/ss_logger_error_event.h
@@ -0,0 +1,156 @@
+/*
+ * @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 supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_timer.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <string>
+#include <vector>
+#include "ss_logger_popups.h"
+#include "ss_logger_common.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_cfg.h"
+#include "ss_logger_util.h"
+#include "readerWriter/reader_writer.h"
+#include "readerWriter/reader_writer_cfg.h"
+#include "ss_logger_error_event_storage.h"
+#include "ss_logger_error_event_can_evt_reply.h"
+
+class CErrorEvent {
+ public:
+ CErrorEvent();
+ ~CErrorEvent();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CReaderWriterControl *f_pReaderWriterControl,
+ HANDLE f_thrdEvntLogWriter,
+ std::string f_strEvntLogQueWorkerName);
+
+ EFrameworkunifiedStatus RegisterSessionErrorEvent(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnOpenSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus OnCloseSession(HANDLE f_hApp, PCSTR f_pRequesterName,
+ HANDLE f_hSession);
+
+ EFrameworkunifiedStatus StartLogging(HANDLE f_hApp, EErrorEventType f_eventType);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode);
+
+ EFrameworkunifiedStatus sendDiagEventErrorResponse(EELL_ErrorCode f_errCode,
+ std::string f_destName);
+
+ EFrameworkunifiedStatus sendDiagEventResponse(void);
+
+ EFrameworkunifiedStatus SetDiagEventSourceName(std::string f_serviceName);
+
+ void SetMileage(UI_32 f_mileage);
+
+ void SetDiagSessionHandle(HANDLE hSession);
+
+ EFrameworkunifiedStatus SaveNaviLog(EPWR_SHUTDOWN_TRIGGER_TYPE errorType);
+ EFrameworkunifiedStatus CreateKernelLog(HANDLE f_hApp, SS_LOGGER_KLOG_OPE_TYPE type);
+
+ private:
+ typedef enum {
+ kSSL_ERROR_EVENT_TIMER_LOGGING_START_RSPN,
+ kSSL_ERROR_EVENT_TIMER_ARTIFACT_RSPN,
+ kSSL_ERROR_EVENT_TIMER_END
+ } ESSLErrorEventTimers;
+
+ // Logging Protocol Function Prototypes
+ EFrameworkunifiedStatus OnStartLogging(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnLogStartResponseTimeout(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestNextArtifact(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnArtifactResponseTimeout(HANDLE f_hApp);
+
+ // Protocol functions sent to self.
+ EFrameworkunifiedStatus OnArtifactRequest(HANDLE f_hApp);
+
+ // Error Event Artifact Request Function Prototypes
+ EFrameworkunifiedStatus SendLogArtifactResponseToSelf(
+ HANDLE f_hApp, EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnObtainLoggerserviceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainTransmitLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainPerformanceLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainScreenShotResponse(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainKernelLogInfoRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRInitialLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainDRLocationLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseOk(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseWriteFailed(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNotFound(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnStorageResponseNoWritten(HANDLE f_hApp);
+ EFrameworkunifiedStatus CheckPathForArtifact(HANDLE f_hApp, TLoggingArtifact f_artifact);
+ EFrameworkunifiedStatus OnClearAllLogRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnNaviLogRequest(HANDLE f_hApp);
+
+ // verify function for external storage
+ EFrameworkunifiedStatus VerifyExtStorage(TLoggerErrorEvent event);
+ bool IsNeedVerify(EErrorEventType type);
+
+ HANDLE m_hApp;
+ bool m_bIsPrevEventCompleted;
+ CErrorEventCfg m_errorEventCfg;
+ TLoggerErrorEvent m_errorEventNtfData;
+ Timer m_errorEventTimers[kSSL_ERROR_EVENT_TIMER_END];
+ std::vector<TLoggingArtifact> m_artifactRequestVec;
+ TArtifactResponseVec m_artifactResponseVec;
+ std::vector<FrameworkunifiedProtocolCallbackHandler> m_requesterCallbacksVec;
+ std::string m_archiveDestination;
+ CLoggerUtil m_loggerUtil;
+ CLoggerPopups m_loggerPopups;
+ CLoggerCfg* m_pLoggerCfg;
+ CLoggerErrorEventStorage m_loggerStorage;
+ CLoggerErrorEventCANEvtReply m_loggerCanEvent;
+ static const UI_32 m_loggingStartRspnToSec = 1;
+ static const UI_32 m_screenShotRspnToSec = 2;
+ CReaderWriterControl* m_pReaderWriterControl;
+
+ std::string m_ServiceName;
+ uint32_t m_time;
+ UI_32 m_currentEventTriggerNumber;
+ HANDLE m_diagsessionhandle;
+
+ HANDLE m_thrdEvntLogWriter;
+
+ public:
+ int m_sfd;
+};
+
+EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp, TLoggingArtifact f_artifact);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_H_
+
diff --git a/logger_service/server/include/ss_logger_error_event_archive.h b/logger_service/server/include/ss_logger_error_event_archive.h
new file mode 100644
index 00000000..feaba965
--- /dev/null
+++ b/logger_service/server/include/ss_logger_error_event_archive.h
@@ -0,0 +1,77 @@
+/*
+ * @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 supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#include <libtar_listhash.h>
+#include <libtar.h>
+
+#include <system_service/ss_system_types.h>
+#include <string>
+#include <vector>
+
+class CErrorEventArchive {
+ public:
+ CErrorEventArchive();
+ ~CErrorEventArchive();
+
+ EFrameworkunifiedStatus openArchive(std::string f_pathAndName);
+
+ EFrameworkunifiedStatus addToArchive(std::vector<std::string> f_filePathAndNameList);
+
+ EFrameworkunifiedStatus addToArchive(std::string f_filePathAndName,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ EFrameworkunifiedStatus closeArchive(void);
+
+ static SI_32 gzOpenArchive(PCHAR f_pcPathname, SI_32 f_siOflags,
+ SI_32 f_siMode);
+
+ static SI_32 gzCloseArchive();
+
+ static ssize_t gzWriteArchive(int fd, const void* buf, size_t count);
+
+ static ssize_t gzReadArchive(int fd, void* buf, size_t count);
+
+ static const UI_8 MAX_DIRECTORY_DEPTH = 4;
+
+ private:
+ EFrameworkunifiedStatus addFileToArchive(std::string f_filename,
+ std::string f_destinationName);
+
+ EFrameworkunifiedStatus addDirectoryToArchive(std::string f_path,
+ std::string f_destinationName, UI_8 f_depth =
+ CErrorEventArchive::MAX_DIRECTORY_DEPTH);
+
+ tartype_t m_gztype;
+ TAR *m_pTarInfo;
+ std::string m_pathAndName;
+ std::string m_tmpName;
+
+ static const UI_32 TARMODE = 0644;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_ARCHIVE_H_
diff --git a/logger_service/server/include/ss_logger_error_event_can_evt_reply.h b/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
new file mode 100644
index 00000000..7ebb6ec4
--- /dev/null
+++ b/logger_service/server/include/ss_logger_error_event_can_evt_reply.h
@@ -0,0 +1,48 @@
+/*
+ * @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 supports notifying CAN abou HK and CAN error events
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+#include "ss_logger_common.h"
+class CLoggerErrorEventCANEvtReply {
+ public:
+ CLoggerErrorEventCANEvtReply();
+ virtual ~CLoggerErrorEventCANEvtReply();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+
+ BOOL IsEventNeeded(TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishStartEvent(HANDLE f_hApp, TLoggerErrorEvent f_event);
+ EFrameworkunifiedStatus PublishEndEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_32 f_triggerNumber, uint32_t f_time);
+
+ EFrameworkunifiedStatus PublishErrorEvent(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ BOOL f_isValid, UI_32 f_triggerNumber,
+ uint32_t f_time);
+ private:
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CAN_EVT_REPLY_H_
diff --git a/logger_service/server/include/ss_logger_error_event_cfg.h b/logger_service/server/include/ss_logger_error_event_cfg.h
new file mode 100644
index 00000000..b9b13094
--- /dev/null
+++ b/logger_service/server/include/ss_logger_error_event_cfg.h
@@ -0,0 +1,132 @@
+/*
+ * @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 supports error event logging configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
+#include <system_service/ss_system_manager_if.h>
+#include <vector>
+#include <map>
+#include <string>
+
+typedef UI_32 ARTIFACT_BIT_MASK;
+typedef UI_32 EVENT_BIT_MASK;
+
+#define NBR_ARTIFACT_BITS (sizeof(ARTIFACT_BIT_MASK) * 8)
+
+enum EVENT_BIT {
+ EVENT_BIT_NONE = 0x00000000,
+ EVENT_BIT_POPUP = 1 << (UI_32) 1,
+ EVENT_BIT_CAN_NOTIFICATION = 1 << (UI_32) 2,
+ EVENT_BIT_DIAG = 1 << (UI_32) 3,
+};
+
+struct TLoggingErrorEventInformation {
+ ARTIFACT_BIT_MASK ArtifactBitMask;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifactCfg {
+ EErrorEventType ErrorType;
+ TLoggingErrorEventInformation Information;
+};
+struct TLoggerErrorEvent {
+ TLoggerErrorEvent()
+ : EventType(eErrorEventTypeMaxValue),
+ ModuleName(""),
+ isNeedReboot(FALSE),
+ EventBitMask(EVENT_BIT_NONE) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
+ }
+ TLoggerErrorEvent(SMErrorEventNtfData l_SMErrorEvent) { // NOLINT (runtime/explicit)
+ EventType = l_SMErrorEvent.EventType;
+ ModuleName = l_SMErrorEvent.ModuleName;
+ isNeedReboot = l_SMErrorEvent.isNeedReboot;
+ EventBitMask = EVENT_BIT_NONE;
+ }
+ EErrorEventType EventType;
+ std::string ModuleName;
+ BOOL isNeedReboot;
+ EVENT_BIT_MASK EventBitMask;
+};
+struct TLoggingArtifact;
+
+typedef EFrameworkunifiedStatus (*TLoggingCbFunction)(HANDLE, TLoggingArtifact);
+
+enum ECallbackType {
+ eCbTypePath = 0,
+ eCbTypeFunction,
+ eCbTypeInvalid
+};
+
+struct TLoggingArtifactCallback {
+ ECallbackType Type;
+ std::string Path;
+ TLoggingCbFunction Function;
+};
+
+struct TLoggingArtifactInformation {
+ std::string OwnerServiceName;
+ UI_32 RequestTimeoutMs;
+ TLoggingArtifactCallback Cb;
+ BOOL Remove;
+};
+struct TLoggingArtifact {
+ EArtifactId ArtifactId;
+ TLoggingArtifactInformation Information;
+};
+
+struct TLoggingArtifactResponse {
+ EArtifactId ArtifactId;
+ std::string Filepath;
+ BOOL Remove;
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+///// External function definition for Logger callbacks
+//////////////////////////////////////////////////////////////////////////////////////////
+extern EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
+extern EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp,
+ TLoggingArtifact f_artifact);
+
+typedef std::map<EErrorEventType, TLoggingErrorEventInformation> TArtifactBitMaskMap;
+typedef std::map<EArtifactId, TLoggingArtifactInformation> TArtifactMap;
+typedef std::vector<TLoggingArtifactResponse> TArtifactResponseVec;
+
+class CErrorEventCfg {
+ public:
+ CErrorEventCfg(void);
+
+ ~CErrorEventCfg(void);
+
+ EFrameworkunifiedStatus Initialize(void);
+
+ void GetArtifactRequestVec(
+ EErrorEventType f_eventType,
+ std::vector<TLoggingArtifact> &f_refArtifactRequestVec); // NOLINT (runtime/references)
+ EVENT_BIT_MASK GetEventsForErrorEvent(EErrorEventType f_eventType);
+ private:
+ UI_32 ValidateConfiguration(void);
+ TArtifactBitMaskMap m_errorEventTypeToArtifactBitMaskMap;
+ TArtifactMap m_errorArtifactMap;
+
+ static TLoggingArtifactCfg m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue];
+ static TLoggingArtifact m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
diff --git a/logger_service/server/include/ss_logger_error_event_storage.h b/logger_service/server/include/ss_logger_error_event_storage.h
new file mode 100644
index 00000000..e5620e81
--- /dev/null
+++ b/logger_service/server/include/ss_logger_error_event_storage.h
@@ -0,0 +1,82 @@
+/*
+ * @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 supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <mqueue.h>
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <ss_logger_error_event_cfg.h>
+//#include <vehicle_service/Clock_API.h>
+#include <string>
+#include "ss_logger_cfg.h"
+
+enum ELoggerStorageThreadCommands {
+ eLoggerStorageThreadCmdOK = 0xAFFE,
+ eLoggerStorageThreadCmdWriteFailed,
+ eLoggerStorageThreadCmdNotFound,
+ eLoggerStorageThreadCmdNoWritten
+};
+
+class CLoggerErrorEventStorage {
+ public:
+ CLoggerErrorEventStorage();
+ virtual ~CLoggerErrorEventStorage();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, std::string f_ParentName,
+ CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus Start(std::string f_target, TArtifactResponseVec f_responseVector,
+ uint32_t f_time);
+
+ void ThreadFunction(void);
+ void Cleanup(void);
+
+ private:
+ static void* ThreadFunctionWrapper(void* param);
+ static void CleanupWrapper(void* param);
+
+ EFrameworkunifiedStatus PackageAndPlaceArtifacts(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, // NOLINT (runtime/references)
+ uint32_t l_logTime);
+
+ SI_32 CopyFiles(std::string f_archiveDestination,
+ TArtifactResponseVec &f_responseVector, BOOL isDeleteFiles); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus RemoveDeprecatedArtifacts(TArtifactResponseVec &f_responseVector); // NOLINT (runtime/references)
+ HANDLE m_parentMcQueue;
+ pthread_t m_thread;
+ pthread_mutex_t m_mutex;
+ mqd_t m_sendQueue;
+ mqd_t m_receiveQueue;
+ std::string m_destination;
+ TArtifactResponseVec m_responseVec;
+ struct mq_attr m_mqattr;
+ SI_32 m_mutexInit;
+ CLoggerCfg *m_pLoggerCfg;
+ SLoggerStorageInfo m_loggerStorageInfo;
+ uint32_t m_logTime;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_STORAGE_H_
diff --git a/logger_service/server/include/ss_logger_fs_directory.h b/logger_service/server/include/ss_logger_fs_directory.h
new file mode 100644
index 00000000..9006f5fa
--- /dev/null
+++ b/logger_service/server/include/ss_logger_fs_directory.h
@@ -0,0 +1,108 @@
+/*
+ * @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 declaration of class CFSDirectory.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
+#include <native_service/frameworkunified_types.h>
+#include<string>
+
+// Class to provide file system directory operations like create,delete etc.
+class CFSDirectory {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// CFSDirectory
+ /// Constructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~CFSDirectory
+ /// Destructor of CFSDirectory class
+ ///
+ /// \param
+ ///
+ /// \return
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ~CFSDirectory();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to check if the directory exists.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL DoesDirectoryExist(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to create a directory.
+ ///
+ /// \param [in] f_cDirPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static EFrameworkunifiedStatus CreateDirectory(std::string &f_cDirPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to verify directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL IsDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete directory.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// This method is used to delete file in direcotry.
+ ///
+ /// \param [in] f_cPath
+ /// std::string - Path of the directory to delete.
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ static BOOL RemoveSubDirectory(std::string &f_cPath); // NOLINT (runtime/references)
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_FS_DIRECTORY_H_
diff --git a/logger_service/server/include/ss_logger_popups.h b/logger_service/server/include/ss_logger_popups.h
new file mode 100644
index 00000000..d45459df
--- /dev/null
+++ b/logger_service/server/include/ss_logger_popups.h
@@ -0,0 +1,51 @@
+/*
+ * @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 supports error event logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_logger_service_protocol.h>
+#include <string>
+#include <vector>
+
+#include "ss_logger_cfg.h"
+#include "ss_logger_error_event_cfg.h"
+class CLoggerPopups {
+ public:
+ CLoggerPopups();
+ virtual ~CLoggerPopups();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ BOOL IsPopupNeeded(TLoggerErrorEvent f_event);
+ BOOL CanShowStartPopup(std::vector<TLoggingArtifact>* f_remainingArtifact);
+ EFrameworkunifiedStatus ShowStartPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::vector<TLoggingArtifact>* f_remainingArtifact,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowEndPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ std::string f_dest);
+ EFrameworkunifiedStatus ShowErrorPopup(HANDLE f_hApp, TLoggerErrorEvent f_event,
+ UI_16 f_errCode);
+ std::string getDeviceName(std::string f_dest);
+ private:
+ CLoggerCfg *m_pLoggerCfg;
+ BOOL m_startShown;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_POPUPS_H_
diff --git a/logger_service/server/include/ss_logger_reader_writer_control.h b/logger_service/server/include/ss_logger_reader_writer_control.h
new file mode 100644
index 00000000..4587ac7b
--- /dev/null
+++ b/logger_service/server/include/ss_logger_reader_writer_control.h
@@ -0,0 +1,49 @@
+/*
+ * @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.
+ */
+
+/*
+ * ss_logger_reader_writer_control.h
+ */
+
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <string>
+#include "readerWriter/reader_writer.h"
+#include "ss_logger_cfg.h"
+
+enum EReaderWriterType {
+ eReaderWriterLogDebug,
+ eReaderWriterLogTransmit,
+ eReaderWriterLogPerformance,
+ eReaderWriterLogInvalid
+};
+class CReaderWriterControl {
+ public:
+ CReaderWriterControl();
+ virtual ~CReaderWriterControl();
+ EFrameworkunifiedStatus Initialize(CLoggerCfg* f_pLoggerCfg);
+ EFrameworkunifiedStatus UpdateLoggingParams(void* param);
+ EFrameworkunifiedStatus FlushCache(EReaderWriterType f_type);
+ private:
+ CLoggerCfg * m_pLoggerCfg;
+ ReaderWriter::CReaderWriter m_debugReaderWriter;
+ ReaderWriter::CReaderWriter m_transmitReaderWriter;
+ ReaderWriter::CReaderWriter m_performanceReaderWriter;
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_READER_WRITER_CONTROL_H_
diff --git a/logger_service/server/include/ss_logger_scrshot.h b/logger_service/server/include/ss_logger_scrshot.h
new file mode 100644
index 00000000..a9e1b311
--- /dev/null
+++ b/logger_service/server/include/ss_logger_scrshot.h
@@ -0,0 +1,30 @@
+/*
+ * @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
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
+
+#define JPEG_PATH_CH0 "/nv/log/work/screenShot/screen_shot_Ch0.jpeg"
+#define JPEG_PATH_CH1 "/nv/log/work/screenShot/screen_shot_Ch1.jpeg"
+#define SCRSHOT_EXE_PATH "/usr/agl/bin/SS_ScrShot"
+#define SCREEN_SHOT_PATH "/nv/log/work/screenShot"
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SCRSHOT_H_
diff --git a/logger_service/server/include/ss_logger_service_callbacks.h b/logger_service/server/include/ss_logger_service_callbacks.h
new file mode 100644
index 00000000..c466ee11
--- /dev/null
+++ b/logger_service/server/include/ss_logger_service_callbacks.h
@@ -0,0 +1,96 @@
+/*
+ * @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.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <native_service/frameworkunified_framework_types.h>
+#include <system_service/ss_error_event_common.h>
+#include "ss_logger_error_event.h"
+#include "ss_logger_reader_writer_control.h"
+#include "ss_logger_cfg.h"
+
+class CLoggerServiceCallbacks {
+ private:
+ static const UI_32 kNUMBER_PROTOCOL_HANDLERS = 17u;
+ FrameworkunifiedProtocolCallbackHandler m_protocolHandlers[kNUMBER_PROTOCOL_HANDLERS];
+ CLoggerCfg *m_pLoggerCfg;
+ CErrorEvent *m_pErrorEvent;
+
+ public:
+ CLoggerServiceCallbacks();
+ ~CLoggerServiceCallbacks();
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp, CLoggerCfg *f_pLoggerCfg,
+ CErrorEvent *f_pErrorEvent);
+
+ EFrameworkunifiedStatus LoggerServerOnOpenSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServerOnCloseSession(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetMileageData(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetLoggerParams(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UDPLogging(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_SetCurrentDateTime(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UpdateCommonInfo(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_Handle_CWORD56_Events(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_LogResetEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEmergencyLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCANTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnDTCTrigger(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_On_SHTDWN_Complete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetVIN(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnCopyEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnClearEvntLog(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadNumberOfEvents(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnReadStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnResetStatCounter(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_OnSetDiagID(HANDLE hApp);
+
+ EFrameworkunifiedStatus LoggerServer_UploadEventLog(HANDLE hApp);
+
+ HANDLE RetrieveRegisteredClientHandle(HANDLE hApp, PCSTR pRequester);
+};
+
+EFrameworkunifiedStatus LoggerService_OnStop(HANDLE hApp);
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_SERVICE_CALLBACKS_H_
+
diff --git a/logger_service/server/include/ss_logger_types.h b/logger_service/server/include/ss_logger_types.h
new file mode 100644
index 00000000..dba34e99
--- /dev/null
+++ b/logger_service/server/include/ss_logger_types.h
@@ -0,0 +1,52 @@
+/*
+ * @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 supports shared internal logger module data types.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
+
+#include <native_service/frameworkunified_sm_eventdata.h>
+
+typedef enum _ENPS_Archivetype {
+ ARCHTYPE_COMPRESSION = 0, // Compression
+ ARCHTYPE_DECOMPRESSION = 1 // DeCompression
+} ENPS_Archivetype;
+
+typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
+
+typedef enum _LOGGERSERVICE_COMPRESSION_TYPE {
+ eLoggerserviceNone = 0, // No Compression before file persistence
+ eLoggerserviceDefaultCompression, // Compress file before persistence using default compression method
+ eLoggerserviceCompressUsingLibz // Compress file before persistence using libz
+} LOGGERSERVICE_COMPRESSION_TYPE;
+
+typedef struct _NPS_CopyInfoMsg {
+ CopyInfoStr m_cSourcePath; // Source path
+ CopyInfoStr m_cDestinationPath; // Destination path
+ ENPS_Archivetype m_eArchiveType; // Compression or DeCompression
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyInfoCmd;
+
+typedef struct _NPS_CopyStatus {
+ BOOL m_bPersistenceChk; // Persistence Success or Failure
+ LOGGERSERVICE_COMPRESSION_TYPE m_eCompressionType; // Check for Compression of the file
+} NSP_CopyStatusResponse, NSP_CopyCancel;
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_TYPES_H_
diff --git a/logger_service/server/include/ss_logger_util.h b/logger_service/server/include/ss_logger_util.h
new file mode 100644
index 00000000..a5d83c53
--- /dev/null
+++ b/logger_service/server/include/ss_logger_util.h
@@ -0,0 +1,127 @@
+/*
+ * @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 Provide support for SS Logger module utility functions.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+#define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+
+///////////////////////////////////////////////////////////////////////////////
+// INCLUDES
+///////////////////////////////////////////////////////////////////////////////
+
+#include <time.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_if.h>
+#include <string>
+#include <vector>
+#include "ss_logger_error_event_cfg.h"
+#include "loggerservicedebug_loggerservicelog.h"
+#include "ss_logger_cfg.h"
+///////////////////////////////////////////////////////////////////////////////
+// DEFINE
+///////////////////////////////////////////////////////////////////////////////
+// If you changed BUF_MAX_SIZE, To contact the secure team.
+// Because There is impact for decrypt tool.
+#define BUF_MAX_SIZE (1024*8)
+#define USB_PATH_SIZE 64
+#ifdef RELEASE_BUILD
+#define DEV_ENC_EXTENSION ".enc1"
+#define REL_ENC_EXTENSION ".enc2"
+#define ALIGNMENT_SIZE 4
+#endif // RELEASE_BUILD
+#define LOGGER_TMP_FN "__LOGGER.tmp"
+
+///////////////////////////////////////////////////////////////////////////////
+// CONFIGURATION CLASS DEFINITION
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _ELoggerserviceLogType {
+ eLoggerservicelogTypeNormal,
+ eLoggerservicelogTypeAbnormal,
+ eLoggerservicelogTypeGrpRelaunch,
+ eLoggerservicelogTypeOther,
+} ELOGGERSERVICELOGTYPE;
+
+class CLoggerUtil {
+ public:
+ CLoggerUtil(void);
+
+ ~CLoggerUtil(void);
+
+ EFrameworkunifiedStatus Initialize(CLoggerCfg *f_pLoggerCfg);
+
+ EFrameworkunifiedStatus checkDestinationAvailable(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ std::string getDestination(TLoggerErrorEvent &f_eventNtfData); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus getFilePathAndName(HANDLE f_hApp,
+ TLoggerErrorEvent &f_eventNtfData, // NOLINT (runtime/references)
+ uint32_t f_time, std::string &f_pathAndName); // NOLINT (runtime/references)
+ void SetMilage(UI_32 f_milage);
+
+ EFrameworkunifiedStatus getEmmcNaviLogParams(uint32_t f_time,
+ EPWR_SHUTDOWN_TRIGGER_TYPE errorType,
+ std::string &f_pathAndName, UI_32 &f_logMax); // NOLINT (runtime/references)
+
+ EFrameworkunifiedStatus deleteOldLog(std::string log_path,
+ std::vector<std::string> &l_vector, // NOLINT (runtime/references)
+ std::string &f_archive_destination, UI_32 max_num); // NOLINT (runtime/references)
+ EFrameworkunifiedStatus deleteOldEmmcLog(std::string &f_archive_destination, // NOLINT (runtime/references)
+ EErrorEventType type);
+ static EFrameworkunifiedStatus forceDeleteOldLog(std::string f_archive_destination,
+ size_t f_req_size);
+ static size_t deleteRequestLogs(std::string f_emmcpath, ELOGGERSERVICELOGTYPE f_reqtype,
+ size_t f_reqsize, ELOGGERSERVICELOGTYPE f_deltype);
+ static EFrameworkunifiedStatus CopyFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus CopyUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus CopyDirectory(std::string f_source,
+ std::string f_destination);
+
+ static EFrameworkunifiedStatus MoveFile(std::string f_source, std::string f_destination);
+ static EFrameworkunifiedStatus MoveUntyped(std::string f_source,
+ std::string f_destination);
+ static EFrameworkunifiedStatus MoveDirectory(std::string f_source,
+ std::string f_destination);
+
+ static ELOGGERSERVICELOGTYPE QueryLoggerservicelogType(std::string f_logname);
+ static void SyncDir(std::string f_dir_path);
+#ifdef RELEASE_BUILD
+ static EFrameworkunifiedStatus PathCheckAndCopyFile(std::string f_source,
+ std::string f_destination);
+#endif // RELEASE_BUILD
+ void SetUsbMountPath(std::string usbpath);
+
+ private:
+ std::string GetUserInvokedFilename(HANDLE f_hApp, uint32_t f_time);
+ std::string GetEmmcFilename(uint32_t f_time);
+ std::string GetEmmcErrorFilename(uint32_t f_time);
+ std::string GetEmmcNaviLogFilename(uint32_t f_time);
+ std::string GetTimeString(uint32_t f_time);
+
+ EFrameworkunifiedStatus getNaviLogFilePathAndName(std::string &f_prefix, uint32_t f_time, // NOLINT (runtime/references)
+ std::string &f_pathAndName); // NOLINT (runtime/references)
+
+ CLoggerCfg *m_pCfg;
+ UI_32 m_Milage;
+ UI_32 m_bootCount;
+ static char m_usbpath[USB_PATH_SIZE];
+};
+
+#endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_UTIL_H_
+