1 /*************************************************************************** 2 * 3 * Copyright 2010,2011 BMW Car IT GmbH 4 * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh 5 * 6 * 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 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 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. 18 * 19 ****************************************************************************/ 20 #ifndef _ILM_TYPES_H_ 21 #define _ILM_TYPES_H_ 22 23 #include "ilm_platform.h" 24 25 /** 26 * convenience macro to access single bits of a bitmask 27 */ 28 #define ILM_BIT(x) (1 << (x)) 29 30 /** 31 * invalid ID does not refer to an acutaly object id. 32 */ 33 #define INVALID_ID 0xFFFFFFFF 34 35 /** 36 * \brief Represent the logical true value 37 * \ingroup ilmClient 38 **/ 39 #define ILM_TRUE 1u 40 41 /** 42 * \brief Represent the logical false value 43 * \ingroup ilmClient 44 **/ 45 #define ILM_FALSE 0u 46 47 /* GCC visibility */ 48 #if defined(__GNUC__) && __GNUC__ >= 4 49 #define ILM_EXPORT __attribute__ ((visibility("default"))) 50 #else 51 #define ILM_EXPORT 52 #endif 53 54 /* Deprecated attribute */ 55 #if defined(__GNUC__) && __GNUC__ >= 4 56 #define ILM_DEPRECATED __attribute__ ((deprecated)) 57 #else 58 #define ILM_DEPRECATED 59 #endif 60 61 /** 62 * \brief Enumeration on possible error codes 63 * \ingroup ilmClient 64 **/ 65 typedef enum e_ilmErrorTypes 66 { 67 ILM_SUCCESS = 0, /*!< ErrorCode if the method call was successful */ 68 ILM_FAILED = 1, /*!< ErrorCode if the method call has failed */ 69 ILM_ERROR_INVALID_ARGUMENTS = 2, /*!< ErrorCode if the method was called with invalid arguments */ 70 ILM_ERROR_ON_CONNECTION = 3, /*!< ErrorCode if connection error has occured */ 71 ILM_ERROR_RESOURCE_ALREADY_INUSE = 4, /*!< ErrorCode if resource is already in use */ 72 ILM_ERROR_RESOURCE_NOT_FOUND = 5, /*!< ErrorCode if resource was not found */ 73 ILM_ERROR_NOT_IMPLEMENTED = 6, /*!< ErrorCode if feature is not implemented */ 74 ILM_ERROR_UNEXPECTED_MESSAGE = 7 /*!< ErrorCode if received message has unexpected type */ 75 } ilmErrorTypes; 76 77 /** 78 * \brief Macro to translate error codes into error description strings 79 * \ingroup ilmClient 80 **/ 81 #define ILM_ERROR_STRING(x) \ 82 ( (x) == ILM_SUCCESS ? "success" \ 83 : (x) == ILM_FAILED ? "failed" \ 84 : (x) == ILM_ERROR_INVALID_ARGUMENTS ? "invalid arguments provided" \ 85 : (x) == ILM_ERROR_ON_CONNECTION ? "connection error" \ 86 : (x) == ILM_ERROR_RESOURCE_ALREADY_INUSE ? "resource is already in use" \ 87 : (x) == ILM_ERROR_RESOURCE_NOT_FOUND ? "resource was not found" \ 88 : (x) == ILM_ERROR_NOT_IMPLEMENTED ? "feature is not implemented" \ 89 : (x) == ILM_ERROR_UNEXPECTED_MESSAGE ? "unexpected message received" \ 90 : "unknown error code" ) 91 92 93 /** 94 * \brief Enumeration for supported pixelformats 95 * \ingroup ilmClient 96 **/ 97 typedef enum e_ilmPixelFormat 98 { 99 ILM_PIXELFORMAT_R_8 = 0, /*!< Pixelformat value, to describe a 8 bit luminance surface */ 100 ILM_PIXELFORMAT_RGB_888 = 1, /*!< Pixelformat value, to describe a 24 bit rgb surface */ 101 ILM_PIXELFORMAT_RGBA_8888 = 2, /*!< Pixelformat value, to describe a 24 bit rgb surface with 8 bit alpha */ 102 ILM_PIXELFORMAT_RGB_565 = 3, /*!< Pixelformat value, to describe a 16 bit rgb surface */ 103 ILM_PIXELFORMAT_RGBA_5551 = 4, /*!< Pixelformat value, to describe a 16 bit rgb surface, with binary mask */ 104 ILM_PIXELFORMAT_RGBA_6661 = 5, /*!< Pixelformat value, to describe a 18 bit rgb surface, with binars mask */ 105 ILM_PIXELFORMAT_RGBA_4444 = 6, /*!< Pixelformat value, to describe a 12 bit rgb surface, with 4 bit alpha */ 106 ILM_PIXEL_FORMAT_UNKNOWN = 7 /*!< Pixelformat not known */ 107 } ilmPixelFormat; 108 109 /** 110 * \brief Enumeration for supported graphical objects 111 * \ingroup ilmControl 112 **/ 113 typedef enum e_ilmObjectType 114 { 115 ILM_SURFACE = 0, /*!< Surface Object Type */ 116 ILM_LAYER = 1 /*!< Layer Object Type */ 117 } ilmObjectType; 118 119 /** 120 * \brief Enumeration for supported surface types 121 * \ingroup ilmControl 122 **/ 123 typedef enum e_ilmSurfaceType 124 { 125 ILM_SURFACETYPE_RESTRICTED = 0, /*!< SurfaceType value, to describe an IVI type surface*/ 126 ILM_SURFACETYPE_DESKTOP = 1, /*!< SurfaceType value, to describe a desktop compatible surface*/ 127 } ilmSurfaceType; 128 129 /** 130 * \brief Identifier of different input device types. Can be used as a bitmask. 131 * \ingroup ilmClient 132 */ 133 typedef unsigned int ilmInputDevice; 134 #define ILM_INPUT_DEVICE_KEYBOARD ((ilmInputDevice) 1 << 0) 135 #define ILM_INPUT_DEVICE_POINTER ((ilmInputDevice) 1 << 1) 136 #define ILM_INPUT_DEVICE_TOUCH ((ilmInputDevice) 1 << 2) 137 #define ILM_INPUT_DEVICE_ALL ((ilmInputDevice) ~0) 138 139 /** 140 * \brief Typedef for representing a layer 141 * \ingroup ilmClient 142 **/ 143 typedef t_ilm_uint t_ilm_layer; 144 145 /** 146 * \brief Typedef for representing a surface 147 * \ingroup ilmClient 148 **/ 149 typedef t_ilm_uint t_ilm_surface; 150 151 /** 152 * \brief Typedef for representing a display number 153 * \ingroup ilmClient 154 **/ 155 typedef t_ilm_uint t_ilm_display; 156 157 /** 158 * \brief Typedef for representing a native display 159 * \ingroup ilmCommon 160 **/ 161 typedef t_ilm_ulong t_ilm_nativedisplay; 162 163 /** 164 * \brief Typedef for representing a native window handle 165 * \ingroup ilmClient 166 **/ 167 typedef t_ilm_ulong t_ilm_nativehandle; 168 169 /** 170 * \brief Typedef for representing a ascii string 171 * \ingroup ilmClient 172 **/ 173 typedef t_ilm_char* t_ilm_string; 174 175 /** 176 * \brief Typedef for representing a const ascii string 177 * \ingroup ilmClient 178 **/ 179 typedef t_ilm_const_char* t_ilm_const_string; 180 181 /** 182 * \brief Typedef for representing a the surface properties structure 183 * \ingroup ilmClient 184 **/ 185 struct ilmSurfaceProperties 186 { 187 t_ilm_float opacity; /*!< opacity value of the surface */ 188 t_ilm_uint sourceX; /*!< x source position value of the surface */ 189 t_ilm_uint sourceY; /*!< y source position value of the surface */ 190 t_ilm_uint sourceWidth; /*!< source width value of the surface */ 191 t_ilm_uint sourceHeight; /*!< source height value of the surface */ 192 t_ilm_uint origSourceWidth; /*!< original source width value of the surface */ 193 t_ilm_uint origSourceHeight; /*!< original source height value of the surface */ 194 t_ilm_uint destX; /*!< x destination position value of the surface */ 195 t_ilm_uint destY; /*!< y desitination position value of the surface */ 196 t_ilm_uint destWidth; /*!< destination width value of the surface */ 197 t_ilm_uint destHeight; /*!< destination height value of the surface */ 198 t_ilm_bool visibility; /*!< visibility value of the surface */ 199 t_ilm_uint frameCounter; /*!< already rendered frames of surface */ 200 t_ilm_int creatorPid; /*!< process id of application that created this surface */ 201 ilmInputDevice focus; /*!< bitmask of every type of device that this surface has focus in */ 202 }; 203 204 /** 205 * \brief Typedef for representing a the layer properties structure 206 * \ingroup ilmControl 207 **/ 208 struct ilmLayerProperties 209 { 210 t_ilm_float opacity; /*!< opacity value of the layer */ 211 t_ilm_uint sourceX; /*!< x source position value of the layer */ 212 t_ilm_uint sourceY; /*!< y source position value of the layer */ 213 t_ilm_uint sourceWidth; /*!< source width value of the layer */ 214 t_ilm_uint sourceHeight; /*!< source height value of the layer */ 215 t_ilm_uint destX; /*!< x destination position value of the layer */ 216 t_ilm_uint destY; /*!< y desitination position value of the layer */ 217 t_ilm_uint destWidth; /*!< destination width value of the layer */ 218 t_ilm_uint destHeight; /*!< destination height value of the layer */ 219 t_ilm_bool visibility; /*!< visibility value of the layer */ 220 }; 221 222 /** 223 * \brief Typedef for representing a the screen properties structure 224 * \ingroup ilmControl 225 **/ 226 struct ilmScreenProperties 227 { 228 t_ilm_uint layerCount; /*!< number of layers displayed on the screen */ 229 t_ilm_layer* layerIds; /*!< array of layer ids */ 230 t_ilm_uint screenWidth; /*!< width value of screen in pixels */ 231 t_ilm_uint screenHeight; /*!< height value of screen in pixels */ 232 t_ilm_char connectorName[256]; /*!< name of the connector of the screen */ 233 }; 234 235 /** 236 * enum representing the possible flags for changed properties in notification callbacks. 237 */ 238 typedef enum 239 { 240 ILM_NOTIFICATION_VISIBILITY = ILM_BIT(1), 241 ILM_NOTIFICATION_OPACITY = ILM_BIT(2), 242 ILM_NOTIFICATION_ORIENTATION = ILM_BIT(3), 243 ILM_NOTIFICATION_SOURCE_RECT = ILM_BIT(4), 244 ILM_NOTIFICATION_DEST_RECT = ILM_BIT(5), 245 ILM_NOTIFICATION_CONTENT_AVAILABLE = ILM_BIT(6), 246 ILM_NOTIFICATION_CONTENT_REMOVED = ILM_BIT(7), 247 ILM_NOTIFICATION_CONFIGURED = ILM_BIT(8), 248 ILM_NOTIFICATION_ALL = 0xffff 249 } t_ilm_notification_mask; 250 251 /** 252 * enum representing types of possible unrecoverable errors that could lead to ilm shutdown. 253 */ 254 typedef enum 255 { 256 ILM_ERROR_WAYLAND = 1, /*!< ErrorCode if Wayland API returns an error */ 257 ILM_ERROR_POLL = 2 /*!< ErrorCode if Poll returns an error */ 258 }t_ilm_shutdown_error_type; 259 260 261 /** 262 * Typedef for notification callback on property changes of a layer 263 */ 264 typedef void(*layerNotificationFunc)(t_ilm_layer layer, 265 struct ilmLayerProperties*, 266 t_ilm_notification_mask mask); 267 268 /** 269 * Typedef for notification callback on property changes of a surface 270 */ 271 typedef void(*surfaceNotificationFunc)(t_ilm_surface surface, 272 struct ilmSurfaceProperties*, 273 t_ilm_notification_mask mask); 274 275 /** 276 * Typedef for notification callback on object creation/deletion 277 */ 278 typedef void(*notificationFunc)(ilmObjectType object, 279 t_ilm_uint id, 280 t_ilm_bool created, 281 void* user_data); 282 283 /** 284 * Typedef for notification callback on ilm shutdown due to unrecoverable 285 * errors 286 */ 287 typedef void(*shutdownNotificationFunc)(t_ilm_shutdown_error_type error_type, 288 int errornum, 289 void* user_data); 290 typedef void(*shotdoneNotificationFunc)(void* buffer_data, t_ilm_uint size, t_ilm_uint width, t_ilm_uint height, t_ilm_uint format); 291 #endif /* _ILM_TYPES_H_*/ 292