2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_SS_LoggerService
19 /// \brief Provide support for SS Logger module configuration.
21 ///////////////////////////////////////////////////////////////////////////////
22 #ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
23 #define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_
25 ///////////////////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////////////////
29 #include <native_service/frameworkunified_types.h>
30 #include <native_service/ns_config_parser_if.h>
31 #include <native_service/ns_logger_if.h>
32 #include <system_service/ss_templates.h>
33 #include <system_service/ss_logger_service.h>
34 #include <system_service/ss_logger_service_local.h>
37 #include "loggerservicedebug_loggerservicelog.h"
39 ///////////////////////////////////////////////////////////////////////////////
40 // CONFIGURATION CLASS DEFINITION
41 ///////////////////////////////////////////////////////////////////////////////
42 /*Default values for the storage thread*/
43 #define ERROR_EVENT_STORAGE_QUEUE_NAME "/SSLoggerStrage"
44 #define ERROR_EVENT_STORAGE_PRIORITY (UI_8)30
45 #define ERROR_EVENT_STORAGE_SLEEP_TIME (useconds_t)50000
46 #define ERROR_EVENT_STORAGE_SLEEP_AFTER (UI_8)5
48 #if ENABLE_PRODUCTION_BUILD == 1
49 #define SS_LOGGER_DEFAULT_VALUE eDeactivate
51 #define SS_LOGGER_DEFAULT_VALUE eActivate
54 #define LOGGERSERVICELOG_EMMC_COUNTER_MAX 99999u
56 struct SLoggerStorageInfo {
58 : Name(ERROR_EVENT_STORAGE_QUEUE_NAME),
59 Priority(ERROR_EVENT_STORAGE_PRIORITY),
60 Timeout(ERROR_EVENT_STORAGE_SLEEP_TIME),
61 TimeoutAfter(ERROR_EVENT_STORAGE_SLEEP_AFTER) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
69 enum EInsertEventType {
70 eInsertEventEELStorage,
71 eInsertEventEELActive,
72 eInsertEventLoggerserviceEmmcLogs,
76 struct ExternalLogInfo {
82 struct ExternalLogList {
85 ExternalLogInfo* p_info;
93 EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
95 EFrameworkunifiedStatus Load(const std::string &f_filePathAndName);
96 EFrameworkunifiedStatus Validate(void);
99 EFrameworkunifiedStatus SetLoggingParams(HANDLE f_hApp,
100 STLoggerSetParams f_stLoggerSetParams);
102 EFrameworkunifiedStatus SetUDPLogging(HANDLE f_hApp, const ELOGGER_STAT f_eUDPLoggingStatus);
104 EFrameworkunifiedStatus PersistLoggingParam(HANDLE f_hApp);
105 std::string getEmmcOutputPath(void);
106 std::string getEmmcOutputNaviLogPath(void);
107 std::string getUsb0MountPath(void);
108 std::string getUsb1MountPath(void);
109 std::string getSdMountPath(void);
110 std::string getDeviceName(void);
111 void setUsb0MountPath(std::string &f_deviceMountpath); // NOLINT (runtime/references)
112 EFrameworkunifiedStatus GetUserInvokedDestination(std::string &f_dest); // NOLINT (runtime/references)
114 EFrameworkunifiedStatus GetEmmcDestination(std::string &f_dest); // NOLINT (runtime/references)
115 EFrameworkunifiedStatus GetEmmcNaviLogDestination(std::string &f_dest); // NOLINT (runtime/references)
117 UI_32 GetUserInvokedCounter(void);
118 EFrameworkunifiedStatus GetIncrementAndPersistUserInvokedCounter(HANDLE f_hApp,
119 UI_32 &f_counter); // NOLINT (runtime/references)
121 EFrameworkunifiedStatus GetAndIncrementEmmcCounter(UI_32 &f_counter); // NOLINT (runtime/references)
122 EFrameworkunifiedStatus RefreshEmmcCounter(UI_32 &f_counter) const; // NOLINT (runtime/references)
124 void ResetEmmcCounter(void);
126 SI_32 m_logMaxFileSize;
127 UI_32 m_logMask[ZONE_MASK_ARRAY_ELTS];
128 SI_32 m_performanceLogMaxFileSize;
129 SI_32 m_emmcOutputMax;
130 SI_32 m_emmcOutputErrMax;
131 SI_32 m_emmcOutputGrpRelaunchMax;
132 SI_32 m_emmcOutputNaviLogMax;
133 SI_32 m_emmcOutputNaviLogNmlMax;
134 SI_32 m_emmcOutputNaviLogErrMax;
135 ExternalLogList m_ExternalLogList;
137 std::string m_emmcOutputPath;
138 std::string m_emmcOutputNaviLogPath;
139 std::string m_usb0MountPath;
140 std::string m_usb1MountPath;
141 std::string m_sdMountPath;
143 EDEV_TYPE GetConnectedDevice(std::string f_devPath);
144 EInsertEventType GetInsertEventType(std::string f_relPath);
146 std::string GetEELActivateRelPath(void);
147 std::string GetDebugFolderContentRelPath(void);
148 std::string GetEELExportRelPath(void);
150 BOOL IsUDPLoggingEnabled(void);
151 void AddLoggingParamCB(CbFuncPtr f_fp);
153 EFrameworkunifiedStatus GetLoggerStorageInfo(SLoggerStorageInfo &f_info); // NOLINT (runtime/references)
154 BOOL IsLoggingEnabled(void);
155 EFrameworkunifiedStatus EelActivateLogging(HANDLE f_hApp);
156 ExternalLogList GetExternalLogList(void);
159 void UpdateLoggingStatus(void);
160 std::vector<CbFuncPtr> m_LoggingCallBack;
161 void GetHighestEmmcCounterValue(UI_32 &f_counter); // NOLINT (runtime/references)
163 EDEV_TYPE m_eDevType;
164 UI_32 m_UserInvokedLoggingNumber;
166 ELOGGER_STAT m_eLoggerUDPLoggingStatus;
168 ELOGGER_STAT m_eLoggerStatus;
170 std::string m_EELStorageRelPath;
172 std::string m_EELActivateRelPath;
174 std::string m_LoggerserviceEmmcLogsRelPath;
176 EFrameworkunifiedStatus SetandPersistLoggingParams(HANDLE f_hApp,
177 STLoggerSetAllParams f_Params,
179 SLoggerStorageInfo m_loggerStorageInfo;
181 void RemoveCarriageReturn(std::string &f_str); // NOLINT (runtime/references)
184 #endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_CFG_H_