Remove unused directories and files in video_in_hal
[staging/basesystem.git] / service / native / framework_unified / client / include / native_service / frameworkunified_types.h
1 /*
2  *
3  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /**
19  * @file frameworkunified_types.h
20  * @brief \~english This file contains basic define,enum and struct of framework_unified.
21  *
22  */
23 /** @addtogroup BaseSystem
24  *  @{
25  */
26 /** @addtogroup native_service
27  *  @ingroup BaseSystem
28  *  @{
29  */
30 /** @addtogroup framework_unified
31  *  @ingroup native_service
32  *  @{
33  */
34 /** @addtogroup framework
35  *  @ingroup framework_unified
36  *  @{
37  */
38 #ifndef FRAMEWORKUNIFIED_TYPES_H_   // NOLINT  (build/header_guard)
39 #define FRAMEWORKUNIFIED_TYPES_H_
40
41 #include <stdint.h>
42
43 #define DEFINE_HANDLE_TYPE(struct_type, handle_type) typedef struct struct_type* handle_type;
44
45 #define MIN_VAL(a, b) ((a) < (b)? (a) : (b))
46
47 #ifndef NULL
48 #define NULL    0
49 #endif
50 #ifndef VOID
51 typedef void VOID;
52 #endif
53 #ifndef CONST
54 #define CONST   const
55 #endif
56
57 /// Lengths and Max Sizes
58 #define INVALID_HANDLE    NULL
59 #define MAX_QUEUE_MSG_SIZE  4096
60 // #define MAX_QUEUE_NAME_SIZE 24
61 #define MAX_QUEUE_NAME_SIZE 20
62 #define LIMIT_QUEUE_NAME_SIZE 16
63 #define MAX_SYS_INFO_SIZE 64
64
65 #define MAX_NAME_SIZE_APP             MAX_QUEUE_NAME_SIZE  ///< Maximum name size of the APP (Client/Service)
66 #define LIMIT_NAME_SIZE_APP           LIMIT_QUEUE_NAME_SIZE  ///< Limit name size of the APP (Client/Service)
67 #define MAX_NAME_SIZE_NOTIFICATION    24  ///< Maximum name size of the Notification
68 #define MAX_STRING_SIZE_NOTIFICATION  64
69
70 #define MAX_STRING_SIZE_TAG  64
71 #define MAX_PATH_LENGTH      255
72
73
74 #define NS_SHM_ERROR       -1
75
76 // Types
77 typedef int8_t        SI_8;
78 typedef uint8_t       UI_8;
79 typedef int16_t       SI_16;
80 typedef uint16_t      UI_16;
81 typedef int32_t       SI_32;
82 typedef uint32_t      UI_32;
83 typedef int64_t       SI_64;
84 typedef uint64_t      UI_64;
85 typedef float       F_32;
86 typedef double        F_64;
87 // use it defined kernelmoduleevklibdd.h typedef UI_32       BOOL;
88 #define PFALSE ((BOOL)0)
89 #define PTRUE  ((BOOL)1)
90
91 #ifndef FALSE
92 #define FALSE PFALSE
93 #endif
94 #ifndef TRUE
95 #define TRUE PTRUE
96 #endif
97
98 // Pointer Types
99 typedef BOOL                *PBOOL;
100 typedef SI_8        *PSI_8;
101 typedef UI_8              *PUI_8;
102 typedef SI_16             *PSI_16;
103 typedef UI_16             *PUI_16;
104 typedef UI_32             *PUI_32;
105 typedef SI_32             *PSI_32;
106 typedef UI_64             *PUI_64;
107 typedef SI_64             *PSI_64;
108 typedef F_32                *PF_32;
109 typedef void              *PVOID;
110 typedef CONST void        *PCVOID;
111
112 typedef char        CHAR, *PCHAR;
113 typedef CONST char      *PCSTR;
114 typedef char        *PSTR;
115
116 typedef UI_8          _TUCHAR;
117 typedef SI_32         HFILE;
118 typedef PVOID         HANDLE;
119 typedef HANDLE        *PHANDLE;
120 typedef CHAR        TSysMsgSystemInfo[MAX_SYS_INFO_SIZE];  ///< Information passed via the framework
121
122
123 /// CR carry over types...
124 /// \brief Types that have been carried
125 /// over from Color Radio header file WPFAPI_types.h.
126 typedef UI_16     MID;
127 typedef UI_16     FRAMEWORKUNIFIED_CID;
128 typedef UI_8      RID;
129 typedef UI_16     PNO;
130 typedef UI_8      BYTE;
131
132 #define LOWORD(l)           ((WORD)(l))
133 #define HIWORD(l)           ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
134 #define _countof(array) (sizeof(array)/sizeof(array[0]))
135
136 /// \typedef EFrameworkunifiedStatus
137 /// \brief Status and return types
138 typedef enum eFrameworkunifiedStatus {
139   eFrameworkunifiedStatusEmptyMediaList    = -10,  ///< Empty media list
140   eFrameworkunifiedStatusSessionLimitMaxedOut  = -9,   ///< Maximum session limit reached
141   eFrameworkunifiedStatusDbRecNotFound       = -8,  ///< Database record not found
142   eFrameworkunifiedStatusDbResultError       = -7,  ///< Database result error
143   eFrameworkunifiedStatusDbExecuteFail       = -6,  ///< Database execute fail
144   eFrameworkunifiedStatusSemCloseFail        = -5,  ///< Semaphore close failed
145   eFrameworkunifiedStatusSemUnlockFail       = -4,  ///< Semaphore unlock failed
146   eFrameworkunifiedStatusSemLockFail         = -3,  ///< Semaphore lock failed
147   eFrameworkunifiedStatusFail                = -2,  ///< Failed
148   eFrameworkunifiedStatusErrOther            = -1,  ///< Unknown error
149   eFrameworkunifiedStatusOK                  = 0,   ///< Success / Pass / OK
150   eFrameworkunifiedStatusInvldBuf            = 1,   ///< Invalid buffer
151   eFrameworkunifiedStatusInvldHandle         = 2,   ///< Invalid handle
152   eFrameworkunifiedStatusInvldHndlType       = 3,   ///< Invalid handle type
153   eFrameworkunifiedStatusInvldQName        = 4,   ///< Invalid messasge queue name
154   eFrameworkunifiedStatusMsgQFull            = 5,   ///< Message queue full
155   eFrameworkunifiedStatusInvldNotification   = 6,  ///< The Notification event not present
156   eFrameworkunifiedStatusInvldParam        = 7,   ///< Invalid parameter
157   eFrameworkunifiedStatusInvldBufSize        = 8,   ///< Buf size too small
158   eFrameworkunifiedStatusInvldID             = 9,   ///< Unrecognized ID
159   eFrameworkunifiedStatusCannotRelease       = 10,  ///< Cannot release resource
160   eFrameworkunifiedStatusBadConnection       = 11,  ///< Could not locate resource
161   eFrameworkunifiedStatusExit            = 12,   ///< Normal application termination
162   eFrameworkunifiedStatusNotImplemented      = 13,   ///< incomplete feature
163   eFrameworkunifiedStatusThreadBusy          = 14,   ///< Joined thread is already being joined
164   eFrameworkunifiedStatusThreadSelfJoin      = 15,   ///< Thread is joining itself
165   eFrameworkunifiedStatusThreadInvalidVal    = 16,  ///< Invalid value passed
166   eFrameworkunifiedStatusThreadNotExist      = 17,   ///< The thread does not exist
167   eFrameworkunifiedStatusFault               = 18,   ///< A fault occurred while attempting to make call
168   eFrameworkunifiedStatusServNotFound        = 19,   ///< Service not present in serv dir
169   eFrameworkunifiedStatusServerInUse         = 20,   ///< Service already processing 1 client request
170   eFrameworkunifiedStatusDbIndexing        = 21,   ///< Database Indexing in progress
171   eFrameworkunifiedStatusNullPointer       = 22,
172   eFrameworkunifiedStatusMsgNotProcessed     = 23,
173   eFrameworkunifiedStatusFileLoadSuccess     = 24,  ///< File Load Success
174   eFrameworkunifiedStatusFileLoadError       = 25,  ///< File Load Error
175   eFrameworkunifiedStatusAccessError         = 26,  ///< Error when accessing resource
176   eFrameworkunifiedStatusDuplicate           = 27,  ///< Duplicate entry
177   eFrameworkunifiedStatusMsgQEmpty             = 28,  ///< Message queue empty
178   eFrameworkunifiedStatusThreadAlreadyRunning  = 29,
179   eFrameworkunifiedStatusErrNoEBADF            = 30,   ///< Bad file descriptor
180   eFrameworkunifiedStatusErrNoEAGAIN           = 31,   ///< Resource unavailable, try again
181   eFrameworkunifiedStatusErrNoEINTR            = 32,   ///< Interrupted system call
182   eFrameworkunifiedStatusSessionErr      = 33,   ///< Error in session handling
183   eFrameworkunifiedStatusDBCorrupt       = 34,   ///< Database corrupt
184   eFrameworkunifiedStatusDBFileNotFound    = 35   ///< Database file not found
185 } EFrameworkunifiedStatus, *PEFrameworkunifiedStatus;
186
187 /// \typedef EFrameworkunifiedNotificationType
188 /// \brief Notification types
189 typedef enum _EFrameworkunifiedNotificationType {
190   eFrameworkunifiedNotificationVar = 0,   ///< Non Persistent. Not stored locally by NPS
191   eFrameworkunifiedStateVar,   ///< Non Persistent. stored locally by NPS
192   eFrameworkunifiedPersistedStateVar,   ///< Persistent. Also stored locally by NPS
193   eFrameworkunifiedPersistedStateUserVar,   ///< User specific Persistent. Also stored locally by NPS
194   eFrameworkunifiedImmediatePersistedStateVar,     ///< Not to be used. See \ref FrameworkunifiedNPRegisterImmediatePersistNotification
195   eFrameworkunifiedUnknown     ///< This is not a type of notification and should not be used while
196   ///< defining any notification.
197 } EFrameworkunifiedNotificationType;
198
199 /// \typedef ENS_ApplicationState
200 /// \brief Application States that all module must handle
201 /// this should be handle by Publishing a "ModuleName/State"
202 /// with the parameter being one of these state values.
203 typedef enum _EApplicationStates {
204   eAppInital = 0,    ///< Initial: state value
205   eAppIdle,        ///< Idle: application shouldn't be processing anything
206   eAppReady,       ///< Ready: application is ready to do work
207   eAppConnecting,    ///< Connecting: Service is connecting
208   eAppDisconnecting  ///< Disconnecting: Service is disconnecting
209 } EApplicationStates;
210
211
212 typedef enum _EFrameworkunifiedMessagePriorties {
213   eFrameworkunifiedMsgPrioVeryLow = 1,
214   eFrameworkunifiedMsgPrioLow = 8,
215   eFrameworkunifiedMsgPrioNormal = 16,
216   eFrameworkunifiedMsgPrioEmergency = 30,
217 } EFrameworkunifiedMessagePriorties;
218
219 // defines what data to delete from persistent memory
220 typedef enum _EFrameworkunifiedClearPersistence {
221   eFrameworkunifiedClearAllData = 0,          ///< clears all the data in persistence memory for all users
222   ///< (currently only this enum value is supported.)
223   eFrameworkunifiedClearAllApplicationData,       ///< clears all the data(files, folders) related to all application for all users
224   eFrameworkunifiedClearAllNotificationData,      ///< clears all the notification data related to all application for all users
225   eFrameworkunifiedClearCurrentUserData,        ///< clears all the data in persistence memory for current users
226   eFrameworkunifiedClearCurrentUserApplicationData,  ///< clears all the data(files, folders)
227                                         ///< related to all application for current users
228   eFrameworkunifiedClearCurrentUserNotificationData   ///< clears all the notification data
229                                         ///< related to all application for current users
230 } EFrameworkunifiedClearPersistence;
231
232 /// Enum defining category of persistent data
233 typedef enum _EFrameworkunifiedPersistCategory {
234   eFrameworkunifiedUserData        = 0x0001,
235   eFrameworkunifiedFactoryData       = 0x0010,
236   eFrameworkunifiedFactoryCustomerData   = 0x0100,
237   eFrameworkunifiedDealerData        = 0x1000
238 } EFrameworkunifiedPersistCategory;
239
240 // defines the type of system error
241 typedef enum _EFrameworkunifiedSystemError {
242   // TODO(framework_unified): add generic system errors
243   eFrameworkunifiedSystemErrorNone = 0,
244   eFrameworkunifiedDSPHardwareReset = 1  // system error is DSP hardware reset.
245                          // It was commented, because this is product
246                          // specific error. Must handle by SystemServices only.
247                          // Uncommented per system services request.
248 } EFrameworkunifiedSystemError;
249
250 /// defines the shutdown types
251 typedef enum _EFrameworkunifiedShutdownType {
252   eFrameworkunifiedNormalShutdown = 0,
253   eFrameworkunifiedQuickShutdown,
254   eFrameworkunifiedDataResetShutdown
255 } EFrameworkunifiedShutdownType;
256
257 /// defines the Release types
258 typedef enum _EFrameworkunifiedReleaseType {
259   eFrameworkunifiedNotOnRelease = 0,    ///< 0:not on release
260   eFrameworkunifiedPersistOnShutdown,     ///< 1:persist on shutdown
261   eFrameworkunifiedPersistInstantly,    ///< 2:persist instantly
262 } EFrameworkunifiedReleaseType;
263
264 #endif  // FRAMEWORKUNIFIED_TYPES_H_   // NOLINT  (build/header_guard))
265 /** @}*/
266 /** @}*/
267 /** @}*/
268 /** @}*/