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 This file supports error event logging configuration.
21 ///////////////////////////////////////////////////////////////////////////////
22 #ifndef LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
23 #define LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_
24 #include <system_service/ss_system_manager_if.h>
29 #include "ss_logger_cfg.h"
31 typedef UI_32 ARTIFACT_BIT_MASK;
32 typedef UI_32 EVENT_BIT_MASK;
34 #define NBR_ARTIFACT_BITS (sizeof(ARTIFACT_BIT_MASK) * 8)
37 EVENT_BIT_NONE = 0x00000000,
38 EVENT_BIT_POPUP = 1 << (UI_32) 1,
39 EVENT_BIT_CAN_NOTIFICATION = 1 << (UI_32) 2,
40 EVENT_BIT_DIAG = 1 << (UI_32) 3,
43 struct TLoggingErrorEventInformation {
44 ARTIFACT_BIT_MASK ArtifactBitMask;
45 EVENT_BIT_MASK EventBitMask;
47 struct TLoggingArtifactCfg {
48 EErrorEventType ErrorType;
49 TLoggingErrorEventInformation Information;
51 struct TLoggerErrorEvent {
53 : EventType(eErrorEventTypeMaxValue),
56 EventBitMask(EVENT_BIT_NONE) { // LCOV_EXCL_BR_LINE 11:Unexpected branch
58 TLoggerErrorEvent(SMErrorEventNtfData l_SMErrorEvent) { // NOLINT (runtime/explicit)
59 EventType = l_SMErrorEvent.EventType;
60 ModuleName = l_SMErrorEvent.ModuleName;
61 isNeedReboot = l_SMErrorEvent.isNeedReboot;
62 EventBitMask = EVENT_BIT_NONE;
64 EErrorEventType EventType;
65 std::string ModuleName;
67 EVENT_BIT_MASK EventBitMask;
69 struct TLoggingArtifact;
71 typedef EFrameworkunifiedStatus (*TLoggingCbFunction)(HANDLE, TLoggingArtifact);
79 struct TLoggingArtifactCallback {
82 TLoggingCbFunction Function;
85 struct TLoggingArtifactInformation {
86 std::string OwnerServiceName;
87 UI_32 RequestTimeoutMs;
88 TLoggingArtifactCallback Cb;
91 struct TLoggingArtifact {
92 EArtifactId ArtifactId;
93 TLoggingArtifactInformation Information;
96 struct TLoggingArtifactResponse {
97 EArtifactId ArtifactId;
102 //////////////////////////////////////////////////////////////////////////////////////////
103 ///// External function definition for Logger callbacks
104 //////////////////////////////////////////////////////////////////////////////////////////
105 extern EFrameworkunifiedStatus SSLogger_SendtoSM(HANDLE f_hApp, TLoggingArtifact f_artifact);
106 extern EFrameworkunifiedStatus SSLogger_SendtoSelf(HANDLE f_hApp,
107 TLoggingArtifact f_artifact);
109 typedef std::map<EErrorEventType, TLoggingErrorEventInformation> TArtifactBitMaskMap;
110 typedef std::map<EArtifactId, TLoggingArtifactInformation> TArtifactMap;
111 typedef std::vector<TLoggingArtifactResponse> TArtifactResponseVec;
113 class CErrorEventCfg {
115 CErrorEventCfg(void);
117 ~CErrorEventCfg(void);
119 EFrameworkunifiedStatus Initialize(CLoggerCfg* p_logger_cfg);
121 void GetArtifactRequestVec(
122 EErrorEventType f_eventType,
123 std::vector<TLoggingArtifact> &f_refArtifactRequestVec); // NOLINT (runtime/references)
124 EVENT_BIT_MASK GetEventsForErrorEvent(EErrorEventType f_eventType);
126 UI_32 ValidateConfiguration();
127 TArtifactBitMaskMap m_errorEventTypeToArtifactBitMaskMap;
128 TArtifactMap m_errorArtifactMap;
131 static TLoggingArtifactCfg m_loggerErrorEventCfgTbl[eErrorEventTypeMaxValue];
132 static TLoggingArtifact m_loggerErrorArtifactCfgTbl[eArtifactIdMaxValue];
135 #endif // LOGGER_SERVICE_SERVER_INCLUDE_SS_LOGGER_ERROR_EVENT_CFG_H_