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_client_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, which can be rotated in the 3d space */
104 * \brief Enumeration for supported graphical objects
105 * \ingroup ilmControl
107 typedef enum e_ilmObjectType
109 ILM_SURFACE = 0, /*!< Surface Object Type */
110 ILM_LAYER = 1 /*!< Layer Object Type */
114 * \brief Enumeration of renderer optimizations
115 * \ingroup ilmControl
117 typedef enum e_ilmOptimization
119 ILM_OPT_MULTITEXTURE = 0, /*!< Multi-texture optimization */
120 ILM_OPT_SKIP_CLEAR = 1 /*!< Skip clearing the screen */
124 * \brief Enablement states for individual optimizations
125 * \ingroup ilmControl
127 typedef enum e_ilmOptimizationMode
129 ILM_OPT_MODE_FORCE_OFF = 0, /*!< Disable optimization */
130 ILM_OPT_MODE_FORCE_ON = 1, /*!< Enable optimization */
131 ILM_OPT_MODE_HEURISTIC = 2, /*!< Let renderer choose enablement */
132 ILM_OPT_MODE_TOGGLE = 3 /*!< Toggle on/and off rapidly for debugging */
133 } ilmOptimizationMode;
136 * \brief Enumeration for supported orientations of booth, surface and layer
137 * \ingroup ilmControl
139 typedef enum e_ilmOrientation
141 ILM_ZERO = 0, /*!< Orientation value, to describe 0 degree of rotation regarding the z-axis*/
142 ILM_NINETY = 1, /*!< Orientation value, to describe 90 degree of rotation regarding the z-axis*/
143 ILM_ONEHUNDREDEIGHTY = 2, /*!< Orientation value, to describe 180 degree of rotation regarding the z-axis*/
144 ILM_TWOHUNDREDSEVENTY = 3 /*!< Orientation value, to describe 270 degree of rotation regarding the z-axis*/
148 * \brief Identifier of different input device types. Can be used as a bitmask.
151 typedef unsigned int ilmInputDevice;
152 #define ILM_INPUT_DEVICE_KEYBOARD ((ilmInputDevice) 1 << 0)
153 #define ILM_INPUT_DEVICE_POINTER ((ilmInputDevice) 1 << 1)
154 #define ILM_INPUT_DEVICE_TOUCH ((ilmInputDevice) 1 << 2)
155 #define ILM_INPUT_DEVICE_ALL ((ilmInputDevice) ~0)
159 * \brief Typedef for representing a layer
162 typedef t_ilm_uint t_ilm_layer;
165 * \brief Typedef for representing a surface
168 typedef t_ilm_uint t_ilm_surface;
171 * \brief Typedef for representing a display number
174 typedef t_ilm_uint t_ilm_display;
177 * \brief Typedef for representing layer capabilities
178 * \ingroup ilmControl
180 typedef t_ilm_uint t_ilm_layercapabilities;
183 * \brief Typedef for representing a native window handle
186 typedef t_ilm_ulong t_ilm_nativehandle;
189 * \brief Typedef for representing a ascii string
192 typedef t_ilm_char* t_ilm_string;
195 * \brief Typedef for representing a const ascii string
198 typedef t_ilm_const_char* t_ilm_const_string;
201 * \brief Typedef for representing a the surface properties structure
204 struct ilmSurfaceProperties
206 t_ilm_float opacity; /*!< opacity value of the surface */
207 t_ilm_uint sourceX; /*!< x source position value of the surface */
208 t_ilm_uint sourceY; /*!< y source position value of the surface */
209 t_ilm_uint sourceWidth; /*!< source width value of the surface */
210 t_ilm_uint sourceHeight; /*!< source height value of the surface */
211 t_ilm_uint origSourceWidth; /*!< original source width value of the surface */
212 t_ilm_uint origSourceHeight; /*!< original source height value of the surface */
213 t_ilm_uint destX; /*!< x destination position value of the surface */
214 t_ilm_uint destY; /*!< y desitination position value of the surface */
215 t_ilm_uint destWidth; /*!< destination width value of the surface */
216 t_ilm_uint destHeight; /*!< destination height value of the surface */
217 ilmOrientation orientation; /*!< orientation value of the surface */
218 t_ilm_bool visibility; /*!< visibility value of the surface */
219 t_ilm_uint frameCounter; /*!< already rendered frames of surface */
220 t_ilm_uint drawCounter; /*!< content updates of surface */
221 t_ilm_uint updateCounter; /*!< content updates of surface */
222 t_ilm_uint pixelformat; /*!< pixel format of surface */
223 t_ilm_uint nativeSurface; /*!< native surface handle of surface */
224 ilmInputDevice inputDevicesAcceptance; /*!< bitmask of ilmInputDevice from which the surface can accept input events */
225 t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the surface */
226 t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the surface */
227 t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the surface */
228 t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the surface */
229 t_ilm_int creatorPid; /*!< process id of application that created this surface */
233 * \brief Typedef for representing a the layer properties structure
234 * \ingroup ilmControl
236 struct ilmLayerProperties
238 t_ilm_float opacity; /*!< opacity value of the layer */
239 t_ilm_uint sourceX; /*!< x source position value of the layer */
240 t_ilm_uint sourceY; /*!< y source position value of the layer */
241 t_ilm_uint sourceWidth; /*!< source width value of the layer */
242 t_ilm_uint sourceHeight; /*!< source height value of the layer */
243 t_ilm_uint origSourceWidth; /*!< original source width value of the layer */
244 t_ilm_uint origSourceHeight; /*!< original source height value of the layer */
245 t_ilm_uint destX; /*!< x destination position value of the layer */
246 t_ilm_uint destY; /*!< y desitination position value of the layer */
247 t_ilm_uint destWidth; /*!< destination width value of the layer */
248 t_ilm_uint destHeight; /*!< destination height value of the layer */
249 ilmOrientation orientation; /*!< orientation value of the layer */
250 t_ilm_bool visibility; /*!< visibility value of the layer */
251 t_ilm_uint type; /*!< type of layer */
252 t_ilm_bool chromaKeyEnabled; /*!< chromakey validness of the layer */
253 t_ilm_uint chromaKeyRed; /*!< chromakey's red value of the layer */
254 t_ilm_uint chromaKeyGreen; /*!< chromakey's green value of the layer */
255 t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the layer */
256 t_ilm_int creatorPid; /*!< process id of application that created this layer */
260 * \brief Typedef for representing a the screen properties structure
261 * \ingroup ilmControl
263 struct ilmScreenProperties
265 t_ilm_uint layerCount; /*!< number of layers displayed on the screen */
266 t_ilm_layer* layerIds; /*!< array of layer ids */
267 t_ilm_uint harwareLayerCount; /*!< number of hardware layers */
268 t_ilm_uint screenWidth; /*!< width value of screen in pixels */
269 t_ilm_uint screenHeight; /*!< height value of screen in pixels */
273 * enum representing all possible incoming events for ilmClient and
274 * Communicator Plugin
276 typedef enum e_t_ilm_message_type
278 IpcMessageTypeNone = 0,
279 IpcMessageTypeCommand,
280 IpcMessageTypeConnect,
281 IpcMessageTypeDisconnect,
282 IpcMessageTypeNotification,
284 IpcMessageTypeShutdown
285 } t_ilm_message_type;
288 * Typedef for opaque handling of client handles within an IpcModule
290 typedef void* t_ilm_client_handle;
293 * Typedef for opaque handling of messages from IpcModule
295 typedef void* t_ilm_message;
298 * enum representing the possible flags for changed properties in notification callbacks.
302 ILM_NOTIFICATION_VISIBILITY = ILM_BIT(1),
303 ILM_NOTIFICATION_OPACITY = ILM_BIT(2),
304 ILM_NOTIFICATION_ORIENTATION = ILM_BIT(3),
305 ILM_NOTIFICATION_SOURCE_RECT = ILM_BIT(4),
306 ILM_NOTIFICATION_DEST_RECT = ILM_BIT(5),
307 ILM_NOTIFICATION_ALL = 0xffff
308 } t_ilm_notification_mask;
311 * Typedef for notification callback on property changes of a layer
313 typedef void(*layerNotificationFunc)(t_ilm_layer layer,
314 struct ilmLayerProperties*,
315 t_ilm_notification_mask mask);
318 * Typedef for notification callback on property changes of a surface
320 typedef void(*surfaceNotificationFunc)(t_ilm_surface surface,
321 struct ilmSurfaceProperties*,
322 t_ilm_notification_mask mask);
325 * enum for identifying different health states
335 * enum for identifying plugin types and versions
337 * All plugins are started in the order defined by their value
338 * in this enum (lowest first, highest last).
339 * The plugins are stopped in opposite order (highest first,
342 typedef enum PluginApi
344 Renderer_Api = 0x00010000,
347 SceneProvider_Api = 0x00020000,
348 SceneProvider_Api_v1,
350 Communicator_Api = 0x00040000,
353 HealthMonitor_Api = 0x00080000,
357 #define PLUGIN_IS_COMMUNICATOR(x) ((x) & Communicator_Api)
358 #define PLUGIN_IS_RENDERER(x) ((x) & Renderer_Api)
359 #define PLUGIN_IS_SCENEPROVIDER(x) ((x) & SceneProvider_Api)
360 #define PLUGIN_IS_HEALTHMONITOR(x) ((x) & HealthMonitor_Api)
362 #endif /* _ILM_TYPES_H_*/