1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
23 #include "ilm_platform.h"
26 * convenience macro to access single bits of a bitmask
28 #define ILM_BIT(x) (1 << (x))
32 * \brief Represent the logical true value
38 * \brief Represent the logical false value
44 * \brief Enumeration on possible error codes
47 typedef enum e_ilmErrorTypes
49 ILM_SUCCESS = 0, /*!< ErrorCode if the method call was successful */
50 ILM_FAILED = 1, /*!< ErrorCode if the method call has failed */
51 ILM_ERROR_INVALID_ARGUMENTS = 2, /*!< ErrorCode if the method was called with invalid arguments */
52 ILM_ERROR_ON_CONNECTION = 3, /*!< ErrorCode if connection error has occured */
53 ILM_ERROR_RESOURCE_ALREADY_INUSE = 4, /*!< ErrorCode if resource is already in use */
54 ILM_ERROR_RESOURCE_NOT_FOUND = 5, /*!< ErrorCode if resource was not found */
55 ILM_ERROR_NOT_IMPLEMENTED = 6, /*!< ErrorCode if feature is not implemented */
56 ILM_ERROR_UNEXPECTED_MESSAGE = 7 /*!< ErrorCode if received message has unexpected type */
60 * \brief Macro to translate error codes into error description strings
63 #define ILM_ERROR_STRING(x) \
64 ( (x) == ILM_SUCCESS ? "success" \
65 : (x) == ILM_FAILED ? "failed" \
66 : (x) == ILM_ERROR_INVALID_ARGUMENTS ? "invalid arguments provided" \
67 : (x) == ILM_ERROR_ON_CONNECTION ? "connection error" \
68 : (x) == ILM_ERROR_RESOURCE_ALREADY_INUSE ? "resource is already in use" \
69 : (x) == ILM_ERROR_RESOURCE_NOT_FOUND ? "resource was not found" \
70 : (x) == ILM_ERROR_NOT_IMPLEMENTED ? "feature is not implemented" \
71 : (x) == ILM_ERROR_UNEXPECTED_MESSAGE ? "unexpected message received" \
72 : "unknown error code" )
76 * \brief Enumeration for supported pixelformats
79 typedef enum e_ilmPixelFormat
81 ILM_PIXELFORMAT_R_8 = 0, /*!< Pixelformat value, to describe a 8 bit luminance surface */
82 ILM_PIXELFORMAT_RGB_888 = 1, /*!< Pixelformat value, to describe a 24 bit rgb surface */
83 ILM_PIXELFORMAT_RGBA_8888 = 2, /*!< Pixelformat value, to describe a 24 bit rgb surface with 8 bit alpha */
84 ILM_PIXELFORMAT_RGB_565 = 3, /*!< Pixelformat value, to describe a 16 bit rgb surface */
85 ILM_PIXELFORMAT_RGBA_5551 = 4, /*!< Pixelformat value, to describe a 16 bit rgb surface, with binary mask */
86 ILM_PIXELFORMAT_RGBA_6661 = 5, /*!< Pixelformat value, to describe a 18 bit rgb surface, with binars mask */
87 ILM_PIXELFORMAT_RGBA_4444 = 6, /*!< Pixelformat value, to describe a 12 bit rgb surface, with 4 bit alpha */
88 ILM_PIXEL_FORMAT_UNKNOWN = 7 /*!< Pixelformat not known */
92 * \brief Enumeration for supported layertypes
95 typedef enum e_ilmLayerType
97 ILM_LAYERTYPE_UNKNOWN = 0, /*!< LayerType not known */
98 ILM_LAYERTYPE_HARDWARE = 1, /*!< LayerType value, to describe a hardware layer */
99 ILM_LAYERTYPE_SOFTWARE2D = 2, /*!< LayerType value, to describe a redirected offscreen buffer layer */
100 ILM_LAYERTYPE_SOFTWARE2_5D = 3 /*!< LayerType value, to describe a redirected offscreen buffer layer,
101 which can be rotated in the 3d space */
105 * \brief Enumeration for supported graphical objects
106 * \ingroup ilmControl
108 typedef enum e_ilmObjectType
110 ILM_SURFACE = 0, /*!< Surface Object Type */
111 ILM_LAYER = 1 /*!< Layer Object Type */
115 * \brief Enumeration of renderer optimizations
116 * \ingroup ilmControl
118 typedef enum e_ilmOptimization
120 ILM_OPT_MULTITEXTURE = 0, /*!< Multi-texture optimization */
121 ILM_OPT_SKIP_CLEAR = 1 /*!< Skip clearing the screen */
125 * \brief Enablement states for individual optimizations
126 * \ingroup ilmControl
128 typedef enum e_ilmOptimizationMode
130 ILM_OPT_MODE_FORCE_OFF = 0, /*!< Disable optimization */
131 ILM_OPT_MODE_FORCE_ON = 1, /*!< Enable optimization */
132 ILM_OPT_MODE_HEURISTIC = 2, /*!< Let renderer choose enablement */
133 ILM_OPT_MODE_TOGGLE = 3 /*!< Toggle on/and off rapidly for debugging */
134 } ilmOptimizationMode;
137 * \brief Enumeration for supported orientations of booth, surface and layer
138 * \ingroup ilmControl
140 typedef enum e_ilmOrientation
142 ILM_ZERO = 0, /*!< Orientation value, to describe 0 degree of rotation regarding the z-axis*/
143 ILM_NINETY = 1, /*!< Orientation value, to describe 90 degree of rotation regarding the z-axis*/
144 ILM_ONEHUNDREDEIGHTY = 2, /*!< Orientation value, to describe 180 degree of rotation regarding the z-axis*/
145 ILM_TWOHUNDREDSEVENTY = 3 /*!< Orientation value, to describe 270 degree of rotation regarding the z-axis*/
149 * \brief Identifier of different input device types. Can be used as a bitmask.
152 typedef unsigned int ilmInputDevice;
153 #define ILM_INPUT_DEVICE_KEYBOARD ((ilmInputDevice) 1 << 0)
154 #define ILM_INPUT_DEVICE_POINTER ((ilmInputDevice) 1 << 1)
155 #define ILM_INPUT_DEVICE_TOUCH ((ilmInputDevice) 1 << 2)
156 #define ILM_INPUT_DEVICE_ALL ((ilmInputDevice) ~0)
160 * \brief Typedef for representing a layer
163 typedef t_ilm_uint t_ilm_layer;
166 * \brief Typedef for representing a surface
169 typedef t_ilm_uint t_ilm_surface;
172 * \brief Typedef for representing a display number
175 typedef t_ilm_uint t_ilm_display;
178 * \brief Typedef for representing layer capabilities
179 * \ingroup ilmControl
181 typedef t_ilm_uint t_ilm_layercapabilities;
184 * \brief Typedef for representing a native window handle
187 typedef t_ilm_ulong t_ilm_nativehandle;
190 * \brief Typedef for representing a ascii string
193 typedef t_ilm_char* t_ilm_string;
196 * \brief Typedef for representing a const ascii string
199 typedef t_ilm_const_char* t_ilm_const_string;
202 * \brief Typedef for representing a the surface properties structure
205 struct ilmSurfaceProperties
207 t_ilm_float opacity; /*!< opacity value of the surface */
208 t_ilm_uint sourceX; /*!< x source position value of the surface */
209 t_ilm_uint sourceY; /*!< y source position value of the surface */
210 t_ilm_uint sourceWidth; /*!< source width value of the surface */
211 t_ilm_uint sourceHeight; /*!< source height value of the surface */
212 t_ilm_uint origSourceWidth; /*!< original source width value of the surface */
213 t_ilm_uint origSourceHeight; /*!< original source height value of the surface */
214 t_ilm_uint destX; /*!< x destination position value of the surface */
215 t_ilm_uint destY; /*!< y desitination position value of the surface */
216 t_ilm_uint destWidth; /*!< destination width value of the surface */
217 t_ilm_uint destHeight; /*!< destination height value of the surface */
218 ilmOrientation orientation; /*!< orientation value of the surface */
219 t_ilm_bool visibility; /*!< visibility value of the surface */
220 t_ilm_uint frameCounter; /*!< already rendered frames of surface */
221 t_ilm_uint drawCounter; /*!< content updates of surface */
222 t_ilm_uint updateCounter; /*!< content updates of surface */
223 t_ilm_uint pixelformat; /*!< pixel format of surface */
224 t_ilm_uint nativeSurface; /*!< native surface handle of surface */
225 ilmInputDevice inputDevicesAcceptance; /*!< bitmask of ilmInputDevice from which the surface can accept input events */
226 t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the surface */
227 t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the surface */
228 t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the surface */
229 t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the surface */
230 t_ilm_int creatorPid; /*!< process id of application that created this surface */
234 * \brief Typedef for representing a the layer properties structure
235 * \ingroup ilmControl
237 struct ilmLayerProperties
239 t_ilm_float opacity; /*!< opacity value of the layer */
240 t_ilm_uint sourceX; /*!< x source position value of the layer */
241 t_ilm_uint sourceY; /*!< y source position value of the layer */
242 t_ilm_uint sourceWidth; /*!< source width value of the layer */
243 t_ilm_uint sourceHeight; /*!< source height value of the layer */
244 t_ilm_uint origSourceWidth; /*!< original source width value of the layer */
245 t_ilm_uint origSourceHeight; /*!< original source height value of the layer */
246 t_ilm_uint destX; /*!< x destination position value of the layer */
247 t_ilm_uint destY; /*!< y desitination position value of the layer */
248 t_ilm_uint destWidth; /*!< destination width value of the layer */
249 t_ilm_uint destHeight; /*!< destination height value of the layer */
250 ilmOrientation orientation; /*!< orientation value of the layer */
251 t_ilm_bool visibility; /*!< visibility value of the layer */
252 t_ilm_uint type; /*!< type of layer */
253 t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the layer */
254 t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the layer */
255 t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the layer */
256 t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the layer */
257 t_ilm_int creatorPid; /*!< process id of application that created this layer */
261 * \brief Typedef for representing a the screen properties structure
262 * \ingroup ilmControl
264 struct ilmScreenProperties
266 t_ilm_uint layerCount; /*!< number of layers displayed on the screen */
267 t_ilm_layer* layerIds; /*!< array of layer ids */
268 t_ilm_uint harwareLayerCount; /*!< number of hardware layers */
269 t_ilm_uint screenWidth; /*!< width value of screen in pixels */
270 t_ilm_uint screenHeight; /*!< height value of screen in pixels */
274 * enum representing all possible incoming events for ilmClient and
275 * Communicator Plugin
277 typedef enum e_t_ilm_message_type
279 IpcMessageTypeNone = 0,
280 IpcMessageTypeCommand,
281 IpcMessageTypeConnect,
282 IpcMessageTypeDisconnect,
283 IpcMessageTypeNotification,
285 IpcMessageTypeTimeout,
286 IpcMessageTypeShutdown
287 } t_ilm_message_type;
290 * Typedef for opaque handling of client handles within an IpcModule
292 typedef void* t_ilm_client_handle;
295 * Typedef for opaque handling of messages from IpcModule
297 typedef void* t_ilm_message;
300 * enum representing the possible flags for changed properties in notification callbacks.
304 ILM_NOTIFICATION_VISIBILITY = ILM_BIT(1),
305 ILM_NOTIFICATION_OPACITY = ILM_BIT(2),
306 ILM_NOTIFICATION_ORIENTATION = ILM_BIT(3),
307 ILM_NOTIFICATION_SOURCE_RECT = ILM_BIT(4),
308 ILM_NOTIFICATION_DEST_RECT = ILM_BIT(5),
309 ILM_NOTIFICATION_ALL = 0xffff
310 } t_ilm_notification_mask;
313 * Typedef for notification callback on property changes of a layer
315 typedef void(*layerNotificationFunc)(t_ilm_layer layer,
316 struct ilmLayerProperties*,
317 t_ilm_notification_mask mask);
320 * Typedef for notification callback on property changes of a surface
322 typedef void(*surfaceNotificationFunc)(t_ilm_surface surface,
323 struct ilmSurfaceProperties*,
324 t_ilm_notification_mask mask);
327 * enum for identifying different health states
337 * enum for identifying plugin types and versions
339 * All plugins are started in the order defined by their value
340 * in this enum (lowest first, highest last).
341 * The plugins are stopped in opposite order (highest first,
344 typedef enum PluginApi
346 Renderer_Api = 0x00010000,
349 SceneProvider_Api = 0x00020000,
350 SceneProvider_Api_v1,
352 Communicator_Api = 0x00040000,
355 HealthMonitor_Api = 0x00080000,
359 #define PLUGIN_IS_COMMUNICATOR(x) ((x) & Communicator_Api)
360 #define PLUGIN_IS_RENDERER(x) ((x) & Renderer_Api)
361 #define PLUGIN_IS_SCENEPROVIDER(x) ((x) & SceneProvider_Api)
362 #define PLUGIN_IS_HEALTHMONITOR(x) ((x) & HealthMonitor_Api)
364 #endif /* _ILM_TYPES_H_*/