summaryrefslogtreecommitdiff
path: root/ivi-layermanagement-api/ilmCommon/include/ilm_types.h
blob: 0d9a6dd22c08055fb97d8ae5a9c4a4d462bb7ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
/***************************************************************************
*
* Copyright 2010,2011 BMW Car IT GmbH
* Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
*
*
* 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.
*
****************************************************************************/
#ifndef _ILM_TYPES_H_
#define _ILM_TYPES_H_

#include "ilm_platform.h"

/**
 * convenience macro to access single bits of a bitmask
 */
#define ILM_BIT(x) (1 << (x))

/**
 * invalid ID does not refer to an acutaly object id.
 */
#define INVALID_ID 0xFFFFFFFF

/**
 * \brief Represent the logical true value
 * \ingroup ilmClient
 **/
#define ILM_TRUE     1u

/**
 * \brief Represent the logical false value
 * \ingroup ilmClient
 **/
#define ILM_FALSE     0u

/**
 * \brief Enumeration on possible error codes
 * \ingroup ilmClient
 **/
typedef enum e_ilmErrorTypes
{
    ILM_SUCCESS = 0,                       /*!< ErrorCode if the method call was successful */
    ILM_FAILED = 1,                        /*!< ErrorCode if the method call has failed */
    ILM_ERROR_INVALID_ARGUMENTS = 2,       /*!< ErrorCode if the method was called with invalid arguments */
    ILM_ERROR_ON_CONNECTION = 3,           /*!< ErrorCode if connection error has occured */
    ILM_ERROR_RESOURCE_ALREADY_INUSE = 4,  /*!< ErrorCode if resource is already in use */
    ILM_ERROR_RESOURCE_NOT_FOUND = 5,      /*!< ErrorCode if resource was not found */
    ILM_ERROR_NOT_IMPLEMENTED = 6,         /*!< ErrorCode if feature is not implemented */
    ILM_ERROR_UNEXPECTED_MESSAGE = 7       /*!< ErrorCode if received message has unexpected type */
} ilmErrorTypes;

/**
 * \brief Macro to translate error codes into error description strings
 * \ingroup ilmClient
 **/
#define ILM_ERROR_STRING(x)                                                   \
    ( (x) == ILM_SUCCESS                      ? "success"                     \
    : (x) == ILM_FAILED                       ? "failed"                      \
    : (x) == ILM_ERROR_INVALID_ARGUMENTS      ? "invalid arguments provided"  \
    : (x) == ILM_ERROR_ON_CONNECTION          ? "connection error"            \
    : (x) == ILM_ERROR_RESOURCE_ALREADY_INUSE ? "resource is already in use"  \
    : (x) == ILM_ERROR_RESOURCE_NOT_FOUND     ? "resource was not found"      \
    : (x) == ILM_ERROR_NOT_IMPLEMENTED        ? "feature is not implemented"  \
    : (x) == ILM_ERROR_UNEXPECTED_MESSAGE     ? "unexpected message received" \
    : "unknown error code"                                                    )


/**
 * \brief Enumeration for supported pixelformats
 * \ingroup ilmClient
 **/
typedef enum e_ilmPixelFormat
{
    ILM_PIXELFORMAT_R_8 = 0,           /*!< Pixelformat value, to describe a 8 bit luminance surface */
    ILM_PIXELFORMAT_RGB_888 = 1,       /*!< Pixelformat value, to describe a 24 bit rgb surface */
    ILM_PIXELFORMAT_RGBA_8888 = 2,      /*!< Pixelformat value, to describe a 24 bit rgb surface with 8 bit alpha */
    ILM_PIXELFORMAT_RGB_565 = 3,       /*!< Pixelformat value, to describe a 16 bit rgb surface */
    ILM_PIXELFORMAT_RGBA_5551 = 4,     /*!< Pixelformat value, to describe a 16 bit rgb surface, with binary mask */
    ILM_PIXELFORMAT_RGBA_6661 = 5,     /*!< Pixelformat value, to describe a 18 bit rgb surface, with binars mask */
    ILM_PIXELFORMAT_RGBA_4444 = 6,     /*!< Pixelformat value, to describe a 12 bit rgb surface, with 4 bit alpha */
    ILM_PIXEL_FORMAT_UNKNOWN = 7       /*!< Pixelformat not known */
} ilmPixelFormat;

/**
 * \brief Enumeration for supported layertypes
 * \ingroup ilmControl
 **/
typedef enum e_ilmLayerType
{
    ILM_LAYERTYPE_UNKNOWN = 0,         /*!< LayerType not known */
    ILM_LAYERTYPE_HARDWARE = 1,        /*!< LayerType value, to describe a hardware layer */
    ILM_LAYERTYPE_SOFTWARE2D = 2,      /*!< LayerType value, to describe a redirected offscreen buffer layer */
    ILM_LAYERTYPE_SOFTWARE2_5D = 3     /*!< LayerType value, to describe a redirected offscreen buffer layer,
                                            which can be rotated in the 3d space */
} ilmLayerType;

/**
 * \brief Enumeration for supported graphical objects
 * \ingroup ilmControl
 **/
typedef enum e_ilmObjectType
{
    ILM_SURFACE = 0,                   /*!< Surface Object Type */
    ILM_LAYER = 1                      /*!< Layer Object Type */
} ilmObjectType;

/**
 * \brief Enumeration of renderer optimizations
 * \ingroup ilmControl
 **/
typedef enum e_ilmOptimization
{
    ILM_OPT_MULTITEXTURE = 0,          /*!< Multi-texture optimization */
    ILM_OPT_SKIP_CLEAR = 1             /*!< Skip clearing the screen */
} ilmOptimization;

/**
 * \brief Enablement states for individual optimizations
 * \ingroup ilmControl
 **/
typedef enum e_ilmOptimizationMode
{
    ILM_OPT_MODE_FORCE_OFF = 0,        /*!< Disable optimization */
    ILM_OPT_MODE_FORCE_ON = 1,         /*!< Enable optimization */
    ILM_OPT_MODE_HEURISTIC = 2,        /*!< Let renderer choose enablement */
    ILM_OPT_MODE_TOGGLE = 3            /*!< Toggle on/and off rapidly for debugging */
} ilmOptimizationMode;

/**
 * \brief Enumeration for supported orientations of booth, surface and layer
 * \ingroup ilmControl
 **/
typedef enum e_ilmOrientation
{
    ILM_ZERO = 0,                       /*!< Orientation value, to describe 0 degree of rotation regarding the z-axis*/
    ILM_NINETY = 1,                     /*!< Orientation value, to describe 90 degree of rotation regarding the z-axis*/
    ILM_ONEHUNDREDEIGHTY = 2,           /*!< Orientation value, to describe 180 degree of rotation regarding the z-axis*/
    ILM_TWOHUNDREDSEVENTY = 3           /*!< Orientation value, to describe 270 degree of rotation regarding the z-axis*/
} ilmOrientation;

/**
 * \brief Identifier of different input device types. Can be used as a bitmask.
 * \ingroup ilmClient
 */
typedef unsigned int ilmInputDevice;
#define ILM_INPUT_DEVICE_KEYBOARD   ((ilmInputDevice) 1 << 0)
#define ILM_INPUT_DEVICE_POINTER    ((ilmInputDevice) 1 << 1)
#define ILM_INPUT_DEVICE_TOUCH      ((ilmInputDevice) 1 << 2)
#define ILM_INPUT_DEVICE_ALL        ((ilmInputDevice) ~0)


/**
 * \brief Typedef for representing a layer
 * \ingroup ilmClient
 **/
typedef t_ilm_uint     t_ilm_layer;

/**
 * \brief Typedef for representing a surface
 * \ingroup ilmClient
 **/
typedef t_ilm_uint     t_ilm_surface;

/**
 * \brief Typedef for representing a display number
 * \ingroup ilmClient
 **/
typedef t_ilm_uint     t_ilm_display;

/**
 * \brief Typedef for representing layer capabilities
 * \ingroup ilmControl
 **/
typedef t_ilm_uint     t_ilm_layercapabilities;

/**
 * \brief Typedef for representing a native display
 * \ingroup ilmCommon
 **/
typedef t_ilm_ulong    t_ilm_nativedisplay;

/**
 * \brief Typedef for representing a native window handle
 * \ingroup ilmClient
 **/
typedef t_ilm_ulong    t_ilm_nativehandle;

/**
 * \brief Typedef for representing a ascii string
 * \ingroup ilmClient
 **/
typedef t_ilm_char* t_ilm_string;

/**
 * \brief Typedef for representing a const ascii string
 * \ingroup ilmClient
 **/
typedef t_ilm_const_char* t_ilm_const_string;

/**
 * \brief Typedef for representing a the surface properties structure
 * \ingroup ilmClient
 **/
struct ilmSurfaceProperties
{
    t_ilm_float opacity;                    /*!< opacity value of the surface */
    t_ilm_uint sourceX;                     /*!< x source position value of the surface */
    t_ilm_uint sourceY;                     /*!< y source position value of the surface */
    t_ilm_uint sourceWidth;                 /*!< source width value of the surface */
    t_ilm_uint sourceHeight;                /*!< source height value of the surface */
    t_ilm_uint origSourceWidth;             /*!< original source width value of the surface */
    t_ilm_uint origSourceHeight;            /*!< original source height value of the surface */
    t_ilm_uint destX;                       /*!< x destination position value of the surface */
    t_ilm_uint destY;                       /*!< y desitination position value of the surface */
    t_ilm_uint destWidth;                   /*!< destination width value of the surface */
    t_ilm_uint destHeight;                  /*!< destination height value of the surface */
    ilmOrientation orientation;             /*!< orientation value of the surface */
    t_ilm_bool visibility;                  /*!< visibility value of the surface */
    t_ilm_uint frameCounter;                /*!< already rendered frames of surface */
    t_ilm_uint drawCounter;                 /*!< content updates of surface */
    t_ilm_uint updateCounter;               /*!< content updates of surface */
    t_ilm_uint pixelformat;                 /*!< pixel format of surface */
    t_ilm_uint nativeSurface;               /*!< native surface handle of surface */
    ilmInputDevice inputDevicesAcceptance;  /*!< bitmask of ilmInputDevice from which the surface can accept input events */
    t_ilm_bool chromaKeyEnabled;            /*!< chromakey validness of the surface */
    t_ilm_uint chromaKeyRed;                /*!< chromakey's red value of the surface */
    t_ilm_uint chromaKeyGreen;              /*!< chromakey's green value of the surface */
    t_ilm_uint chromaKeyBlue;               /*!< chromakey's blue value of the surface */
    t_ilm_int  creatorPid;                  /*!< process id of application that created this surface */
};

/**
 * \brief Typedef for representing a the layer properties structure
 * \ingroup ilmControl
 **/
struct ilmLayerProperties
{
    t_ilm_float opacity;         /*!< opacity value of the layer */
    t_ilm_uint sourceX;          /*!< x source position value of the layer */
    t_ilm_uint sourceY;          /*!< y source position value of the layer */
    t_ilm_uint sourceWidth;      /*!< source width value of the layer */
    t_ilm_uint sourceHeight;     /*!< source height value of the layer */
    t_ilm_uint origSourceWidth;  /*!< original source width value of the layer */
    t_ilm_uint origSourceHeight; /*!< original source height value of the layer */
    t_ilm_uint destX;            /*!< x destination position value of the layer */
    t_ilm_uint destY;            /*!< y desitination position value of the layer */
    t_ilm_uint destWidth;        /*!< destination width value of the layer */
    t_ilm_uint destHeight;       /*!< destination height value of the layer */
    ilmOrientation orientation;  /*!< orientation value of the layer */
    t_ilm_bool visibility;       /*!< visibility value of the layer */
    t_ilm_uint type;             /*!< type of layer */
    t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the layer */
    t_ilm_uint chromaKeyRed;     /*!< chromakey's red value of the layer */
    t_ilm_uint chromaKeyGreen;   /*!< chromakey's green value of the layer */
    t_ilm_uint chromaKeyBlue;    /*!< chromakey's blue value of the layer */
    t_ilm_int  creatorPid;       /*!< process id of application that created this layer */
};

/**
 * \brief Typedef for representing a the screen properties structure
 * \ingroup ilmControl
 **/
struct ilmScreenProperties
{
    t_ilm_uint layerCount;          /*!< number of layers displayed on the screen */
    t_ilm_layer* layerIds;          /*!< array of layer ids */
    t_ilm_uint harwareLayerCount;   /*!< number of hardware layers */
    t_ilm_uint screenWidth;         /*!< width value of screen in pixels */
    t_ilm_uint screenHeight;        /*!< height value of screen in pixels */
};

/**
 * enum representing all possible incoming events for ilmClient and
 * Communicator Plugin
 */
typedef enum e_t_ilm_message_type
{
    IpcMessageTypeNone = 0,
    IpcMessageTypeCommand,
    IpcMessageTypeConnect,
    IpcMessageTypeDisconnect,
    IpcMessageTypeNotification,
    IpcMessageTypeError,
    IpcMessageTypeShutdown
} t_ilm_message_type;

/**
 * Typedef for opaque handling of client handles within an IpcModule
 */
typedef void* t_ilm_client_handle;

/**
 * Typedef for opaque handling of messages from IpcModule
 */
typedef void* t_ilm_message;

/**
 * enum representing the possible flags for changed properties in notification callbacks.
 */
typedef enum
{
    ILM_NOTIFICATION_VISIBILITY = ILM_BIT(1),
    ILM_NOTIFICATION_OPACITY = ILM_BIT(2),
    ILM_NOTIFICATION_ORIENTATION = ILM_BIT(3),
    ILM_NOTIFICATION_SOURCE_RECT = ILM_BIT(4),
    ILM_NOTIFICATION_DEST_RECT = ILM_BIT(5),
    ILM_NOTIFICATION_CONTENT_AVAILABLE = ILM_BIT(6),
    ILM_NOTIFICATION_CONTENT_REMOVED = ILM_BIT(7),
    ILM_NOTIFICATION_ALL = 0xffff
} t_ilm_notification_mask;

/**
 * Typedef for notification callback on property changes of a layer
 */
typedef void(*layerNotificationFunc)(t_ilm_layer layer,
                                        struct ilmLayerProperties*,
                                        t_ilm_notification_mask mask);

/**
 * Typedef for notification callback on property changes of a surface
 */
typedef void(*surfaceNotificationFunc)(t_ilm_surface surface,
                                        struct ilmSurfaceProperties*,
                                        t_ilm_notification_mask mask);

/**
 * enum for identifying different health states
 */
enum HealthCondition
{
    HealthStopped,
    HealthRunning,
    HealthDead
};

/**
 * enum for identifying plugin types and versions
 *
 * All plugins are started in the order defined by their value
 * in this enum (lowest first, highest last).
 * The plugins are stopped in opposite order (highest first,
 * lowest last).
 */
typedef enum PluginApi
{
    Renderer_Api = 0x00010000,
    Renderer_Api_v1,

    SceneProvider_Api = 0x00020000,
    SceneProvider_Api_v1,

    Communicator_Api = 0x00040000,
    Communicator_Api_v1,

    HealthMonitor_Api = 0x00080000,
    HealthMonitor_Api_v1
} ilmPluginApi;

#define PLUGIN_IS_COMMUNICATOR(x)  ((x) & Communicator_Api)
#define PLUGIN_IS_RENDERER(x)      ((x) & Renderer_Api)
#define PLUGIN_IS_SCENEPROVIDER(x) ((x) & SceneProvider_Api)
#define PLUGIN_IS_HEALTHMONITOR(x) ((x) & HealthMonitor_Api)

#endif /* _ILM_TYPES_H_*/