Re-organized sub-directory by category
[staging/basesystem.git] / service / system / interface_unified / library / include / system_service / ss_logger_service.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file ss_logger_service.h
19  * @brief \~english This file supports the the Logger Service.
20  */
21 /** @addtogroup BaseSystem
22  *  @{
23  */
24 /** @addtogroup system_service
25  *  @ingroup BaseSystem
26  *  @{
27  */
28 /** @addtogroup interface_unified
29  *  @ingroup system_service
30  *  @{
31  */
32 #ifndef SS_LOGGER_SERVICE_H_  // NOLINT (build/header_guard)
33 #define SS_LOGGER_SERVICE_H_
34
35
36 #include <native_service/frameworkunified_types.h>
37
38 #define MAX_STATISTICAL_BUFFER 240
39
40 ///////////////////////////////////////////////////////////////////////////////
41 /// \ingroup  logger_service
42 /// \brief    Shared Memory names
43 ///////////////////////////////////////////////////////////////////////////////
44 #define SHMEM_DRLOCATIONLOG      "/DRLocationLog"
45
46 ///////////////////////////////////////////////////////////////////////////////
47 /// \ingroup  logger_service
48 /// \brief    Shared Memory names
49 ///////////////////////////////////////////////////////////////////////////////
50 #define SHMEM_DRINITIALLOG      "/DRInitialLog"
51
52 ///////////////////////////////////////////////////////////////////////////////
53 /// \ingroup  logger_service
54 /// \brief    VIN numbers
55 ///////////////////////////////////////////////////////////////////////////////
56 typedef struct _TVINnumber {
57   static const UI_8 VIN_LEN = 18;
58   CHAR        VINstr[VIN_LEN];
59 } STVIN_NUMBER;
60
61 ///////////////////////////////////////////////////////////////////////////////
62 /// \ingroup  logger_service
63 /// \brief    CAN Diagnostic status data
64 ///////////////////////////////////////////////////////////////////////////////
65 typedef struct _TInterfaceunifiedCANMileageInfo {
66   UI_8  DidA_ExtTest_Pres;
67   UI_8  EngRun_Stat;
68   UI_8  Odo_MSB_H;
69   UI_8  Odo_MSB_L;
70   UI_8  Odo_LSB_H;
71   UI_8  Odo_LSB_L;
72   UI_8  PN14_SupBat_Volt;
73 } STLOGGER_CANDIAGSTAT;
74
75 ///////////////////////////////////////////////////////////////////////////////
76 /// \ingroup  logger_service
77 /// \brief    CAN current date and time
78 ///////////////////////////////////////////////////////////////////////////////
79 /**
80 * @struct __CWORD62_DateAndTime
81 * @brief \~english CAN current date and time
82 */
83 typedef struct __CWORD62_DateAndTime {
84   UI_8 DateTime_Stat; /*!< \~english Date time status*/
85   UI_8 DateTimeDay; /*!< \~english Date*/
86   UI_8 DateTimeHour; /*!< \~english Hour*/
87   UI_8 DateTimeMinute; /*!< \~english Minute*/
88   UI_8 DateTimeMonth; /*!< \~english Month*/
89   UI_8 DateTimeSecond; /*!< \~english Second*/
90   UI_8 DateTimeYear; /*!< \~english Year*/
91   UI_8 TimeFormat; /*!< \~english Format*/
92 }STCanCurrentDateTime;
93
94 ///////////////////////////////////////////////////////////////////////////////
95 /// \ingroup  logger_service
96 /// \brief    Logger Device Type
97 ///////////////////////////////////////////////////////////////////////////////
98 typedef enum _ELoggerDeviceTypes {
99   eDevUSB1,
100   eDevUSB2,
101   eDevSD,
102   eTotalDevicesTypes,
103   eInvalid_DevType
104 }EDEV_TYPE;
105
106 ///////////////////////////////////////////////////////////////////////////////
107 /// \ingroup  logger_service
108 /// \brief    Logger State
109 ///////////////////////////////////////////////////////////////////////////////
110 typedef enum _ELoggerState {
111   eDeactivate,
112   eActivate,
113   eInvalid_LoggerState
114 }ELOGGER_STAT;
115
116 typedef enum _ELoggerErrorCodes {
117   eSelectedDeviceNotFound = 0x0001,
118   eWriteToDeviceFailed  = 0x0002,
119   eScreenCaptureFailed  = 0x0003,
120   eScreenCaptureSaveTimeExpired = 0x0004,
121   eScreenCaptureStoreTimeExpired = 0x0005,
122   eNoLogToStore           = 0x0006,
123 }ELOGGERERR_CODES;
124
125 ///////////////////////////////////////////////////////////////////////////////
126 /// \ingroup  logger_service
127 /// \brief    Screen Capture Event data
128 ///////////////////////////////////////////////////////////////////////////////
129 typedef struct _TInterfaceunifiedScreenCaptureEvt {
130   static const UI_16              STR_BUFF_LEN = 64;
131   BOOL                            fSucessful;
132   UI_32                           uiSceenShotId;
133   CHAR                            strNameAndLocation[STR_BUFF_LEN];
134   UI_32                           uiFaultReasonCode;
135 }STScreenCaptureEvt;
136
137 ///////////////////////////////////////////////////////////////////////////////
138 /// \ingroup  logger_service
139 /// \brief    USB source number to store event logs.
140 ///////////////////////////////////////////////////////////////////////////////
141 typedef enum _EEventLoggerUSBDeviceNumber {
142   USB0 = 0,
143   USB1 = 1,
144   SD = 2
145 }EEvtLogUSBDevNumber;
146
147 ///////////////////////////////////////////////////////////////////////////////
148 /// \ingroup  logger_service
149 /// \brief    USB source number to store emergency error logs.
150 ///////////////////////////////////////////////////////////////////////////////
151 typedef enum _EDevNumber {
152   eEEL_USB1 = 1,
153   eEEL_USB2 = 2,
154   eEEL_SD = 3
155 }EDevNumber;
156
157 ///////////////////////////////////////////////////////////////////////////////
158 /// \ingroup  logger_service
159 /// \brief    Counter group ID.
160 ///////////////////////////////////////////////////////////////////////////////
161 typedef enum _ECounterGroupID {
162   STARTUP_SHUTDOWN_COUNTER_GROUP = 0x01,
163   APP_USAGE_COUNTER_GROUP,
164   F_BLK_STABILITY_COUNTER_GROUP,
165   MAX_COUNTER_GROUP
166 }EStatCounterGroupID;
167
168 ///////////////////////////////////////////////////////////////////////////////
169 /// \ingroup  logger_service
170 /// \brief    Statistical counter.
171 ///////////////////////////////////////////////////////////////////////////////
172 typedef struct _SStatisticalCounter {
173   UI_16 u16StartupCounterLength;        ///< No of Counter from startup phase
174   UI_16 u16NormalCounterLength;        ///< No of Counter from Normal phase
175   UI_16 u16ShutDownCounterLength;      ///< No of Counter from Shut down phase
176   UI_8 StatisticalCountBuffer[MAX_STATISTICAL_BUFFER];  ///< Counter values for startup,normal and shutsown phases
177 }SStatisticalCounter;
178
179 typedef enum _EEventLoggerSuccessCode {
180   COPY_EVT_USB_SUCCESS = 0x20,
181   CLEAR_EVENT_LOG_SUCCESS = 0x21,
182   STATISTICAL_COUNTER_READ_SUCCESS = 0x22
183 }EEvtLoggerSuccessCode;
184
185 ///////////////////////////////////////////////////////////////////////////////
186 /// \ingroup  logger_service
187 /// \brief    Event Logger error code
188 ///////////////////////////////////////////////////////////////////////////////
189 typedef enum _EEventLoggerErrorCode {
190   USB_DEVICE_NOT_AVAILABLE = 0x10,
191   USB_DEVICE_WRITE_ERROR = 0x11,
192   CLEAR_EVENT_LOG_FAILED = 0x12,
193   STATISTICAL_COUNTER_READ_FAILED = 0x13,
194   NO_ERROR_INFO = 0x14
195 }EEvtLoggerErrorCode;
196
197 ///////////////////////////////////////////////////////////////////////////////
198 /// \ingroup  logger_service
199 /// \brief    Emergency Log error code
200 ///////////////////////////////////////////////////////////////////////////////
201 typedef enum _EEmergencyLogErrorCode {
202   eDEVICE_NOT_AVAILABLE = 0x10,
203   eDEVICE_WRITE_ERROR = 0x11,
204   eNO_ERROR_INFO = 0x12
205 }EELL_ErrorCode;
206
207 ///////////////////////////////////////////////////////////////////////////////
208 /// \ingroup  logger_service
209 /// \brief    Event logger common information
210 ///////////////////////////////////////////////////////////////////////////////
211 typedef struct _SEventLoggerCommonInfo {
212   UI_8 BodyCAN_Stat:4;
213   UI_8 HeadUnitCAN_Stat:4;
214   UI_8 HMIInteraction:4;
215   UI_8 IGN_Status:4;
216   UI_8 FOT_Temp:2;
217   UI_8 SystemVoltage:6;
218 }STEventLoggerCommonInfo;
219
220 ///////////////////////////////////////////////////////////////////////////////
221 /// \ingroup  logger_service
222 /// \brief    Event logger resets counter information
223 ///////////////////////////////////////////////////////////////////////////////
224 typedef struct _SEventLoggerResetInfo {
225   UI_8 _CWORD56__ResetInfo;
226   UI_8 _CWORD102__ResetInfo;
227 }STEventLoggerResetInfo;
228
229 ///////////////////////////////////////////////////////////////////////////////
230 /// \ingroup  logger_service
231 /// \brief    Event logger _CWORD56_ events information
232 ///////////////////////////////////////////////////////////////////////////////
233 typedef struct _SEventLoggerEventInfo {
234   UI_8 NumberOfEvents;
235   UI_8 EventGroup;
236   UI_8 EventIdentifier;
237   UI_8 EventData[4];
238 }STEventLoggerEventInfo;
239
240 ///////////////////////////////////////////////////////////////////////////////
241 /// \ingroup  logger_service
242 /// \brief    Event logger CAN events information
243 ///////////////////////////////////////////////////////////////////////////////
244 typedef struct _SEventCANLoggerEventInfo {
245     BOOL                 success;
246     BOOL                 valid;
247     UI_32                triggerNumber;
248     STCanCurrentDateTime dateAndTime;
249 }STEventCANLoggerEventInfo;
250
251 #endif /* SS_LOGGER_SERVICE_H_ */  // NOLINT (build/header_guard)
252 /** @}*/
253 /** @}*/
254 /** @}*/
255