build_flag (WITH_CLIENT_LIB "Build LayerManagement client library" ON)
#===========================================================================================================
if (WITH_CLIENT_LIB)
+ add_subdirectory_once (LayerManagerUtils)
add_subdirectory_once (LayerManagerPlugins/IpcModules)
+ add_subdirectory_once (LayerManagerClient/ilmCommon)
add_subdirectory_once (LayerManagerClient/ilmClient)
endif (WITH_CLIENT_LIB)
#===========================================================================================================
+build_flag (WITH_CONTROL_LIB "Build LayerManagement control library" OFF)
+#===========================================================================================================
+if (WITH_CONTROL_LIB)
+ add_subdirectory_once (LayerManagerUtils)
+ add_subdirectory_once (LayerManagerPlugins/IpcModules)
+ add_subdirectory_once (LayerManagerClient/ilmCommon)
+ add_subdirectory_once (LayerManagerClient/ilmControl)
+endif (WITH_CONTROL_LIB)
+
+#===========================================================================================================
# store used build configuration
#===========================================================================================================
add_subdirectory_once(config)
include_directories(
"include"
"${CMAKE_SOURCE_DIR}/config"
+ "${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmCommon/include"
"${CMAKE_SOURCE_DIR}/LayerManagerBase/include"
"${CMAKE_SOURCE_DIR}/LayerManagerUtils/include"
)
add_library(${PROJECT_NAME} SHARED
- src/generic_ilm_client.c
+ src/ilm_client.c
)
add_dependencies(${PROJECT_NAME}
LayerManagerUtils
+ ilmCommon
)
set(LIBS
${LIBS}
LayerManagerUtils
+ ilmCommon
rt
dl
${CMAKE_THREAD_LIBS_INIT}
install (
FILES include/ilm_client.h
- include/ilm_types.h
- include/ilm_client_platform.h
DESTINATION include/ilm
)
-add_subdirectory(tests)
#define _ILM_CLIENT_H_
#ifdef __cplusplus
+
extern "C" {
#endif /* __cplusplus */
-#include "ilm_types.h"
-/**
- * \defgroup ilmClient Layer Management Client API - API which each application(including HMI) has to use.
- * \defgroup ilmControl Layer Management Control API - Special Control API which has to be used from the HMI/Tooling to control the composition.
- */
-
-/* BEGIN OF CLIENT API */
-/**
- * \brief Initializes the IVI LayerManagement Client.
- * \ingroup ilmClient
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if a connection can not be established to the services.
- */
-ilmErrorTypes ilm_init();
+#include "ilm_common.h"
/**
- * \brief Destroys the IVI LayerManagement Client.
+ * \brief Get the surface properties from the Layermanagement
* \ingroup ilmClient
+ * \param[in] surfaceID surface Indentifier as a Number from 0 .. MaxNumber of Surfaces
+ * \param[out] pSurfaceProperties pointer where the surface properties should be stored
* \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not be closed or was not initialized.
+ * \return ILM_FAILED if the client can not get the resolution.
*/
-ilmErrorTypes ilm_destroy();
+ilmErrorTypes ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, struct ilmSurfaceProperties* pSurfaceProperties);
/**
* \brief Get the screen resolution of a specific screen from the Layermanagement
ilmErrorTypes ilm_getScreenResolution(t_ilm_uint screenID, t_ilm_uint* pWidth, t_ilm_uint* pHeight);
/**
- * \brief Create a surface
- * \ingroup ilmClient
- * \param[in] nativehandle The native windowsystem's handle for the surface
- * \param[in] width The original width of the surface
- * \param[in] height The original height of the surface
- * \param[in] pixelFormat The pixelformat to be used for the surface
- * \param[in] pSurfaceId The value pSurfaceId points to is used as ID for new surface;
- * \param[out] pSurfaceId The ID of the newly created surface is returned in this parameter
- *
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface *pSurfaceId);
-
-/**
- * \brief Remove a surface
- * \ingroup ilmClient
- * \param[in] surfaceId The id of the surface to be removed
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceRemove(const t_ilm_surface surfaceId);
-
-/**
- * \brief Set the native content of an application to be used as surface content
- * \ingroup ilmClient
- * \param[in] nativehandle The native windowsystem's handle for the surface
- * \param[in] width The original width of the surface
- * \param[in] height The original height of the surface
- * \param[in] pixelFormat The pixelformat to be used for the surface
- * \param[in] surfaceId The ID of the surface
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface surfaceId);
-
-/**
- * \brief Remove the native content of a surface
- * \ingroup ilmClient
- * \param[in] surfaceId The ID of the surface
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceRemoveNativeContent(t_ilm_surface surfaceId);
-
-/**
- * \brief Set the area of a surface which should be used for the rendering.
+ * \brief Add a surface to a layer which is currently managed by the service
* \ingroup ilmClient
- * \param[in] surfaceId Id of surface.
- * \param[in] x horizontal start position of the used area
- * \param[in] y vertical start position of the used area
- * \param[in] width width of the area
- * \param[in] height height of the area
+ * \param[in] layerId Id of layer which should host the surface.
+ * \param[in] surfaceId Id of surface which should be added to the layer.
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
+ilmErrorTypes ilm_layerAddSurface(t_ilm_layer layerId, t_ilm_surface surfaceId);
/**
- * \brief Set from which kind of devices the surface can accept input events.
- * By default, a surface accept input events from all kind of devices (keyboards, pointer, ...)
- * By calling this function, you can adjust surface preferences. Note that this function only
- * adjust the acceptance for the specified devices. Non specified are keept untouched.
- *
- * Typicall use case for this function is when dealing with pointer or touch events.
- * Those are normally dispatched to the first visible surface below the coordinate.
- * If you want a different behavior (i.e. forward events to an other surface below the coordinate,
- * you can set all above surfaces to refuse input events)
- *
+ * \brief Removes a surface from a layer which is currently managed by the service
* \ingroup ilmClient
- * \param[in] surfaceId Identifier of the surface to set the keyboard focus on.
- * \param[in] devices Bitmask of ilmInputDevice
- * \param[in] acceptance Indicate if the surface accept or reject input events from the specified devices
- *
+ * \param[in] layerId Id of the layer which contains the surface.
+ * \param[in] surfaceId Id of the surface which should be removed from the layer.
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInputDevice devices, t_ilm_bool acceptance);
+ilmErrorTypes ilm_layerRemoveSurface(t_ilm_layer layerId, t_ilm_surface surfaceId);
/**
* \brief register for notification on property changes of surface
ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificationFunc callback);
/**
- * \brief remove notification on property changes of surface
- * \ingroup ilmClient
- * \param[in] surface id of surface to remove notification
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- * \return ILM_ERROR_INVALID_ARGUMENT if the given surface has no notification callback registered
- */
-ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface);
-
-/**
- * \brief Get the visibility of a surface. If a surface is not visible, the surface
- * will not be rendered.
+ * \brief Create a surface
* \ingroup ilmClient
- * \param[in] surfaceId Id of the surface to get the visibility of.
- * \param[out] pVisibility pointer where the visibility of a surface should be stored
- * ILM_SUCCESS if the surface is visible,
- * ILM_FALSE if the visibility is disabled.
+ * \param[in] nativehandle The native windowsystem's handle for the surface
+ * \param[in] width The original width of the surface
+ * \param[in] height The original height of the surface
+ * \param[in] pixelFormat The pixelformat to be used for the surface
+ * \param[in] pSurfaceId The value pSurfaceId points to is used as ID for new surface;
+ * \param[out] pSurfaceId The ID of the newly created surface is returned in this parameter
+ *
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_surfaceGetVisibility(t_ilm_surface surfaceId, t_ilm_bool *pVisibility);
+ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface *pSurfaceId);
/**
* \brief Get the horizontal and vertical dimension of the surface.
ilmErrorTypes ilm_surfaceGetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension);
/**
- * \brief Get the surface properties from the Layermanagement
- * \ingroup ilmClient
- * \param[in] surfaceID surface Indentifier as a Number from 0 .. MaxNumber of Surfaces
- * \param[out] pSurfaceProperties pointer where the surface properties should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not get the resolution.
- */
-ilmErrorTypes ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, struct ilmSurfaceProperties* pSurfaceProperties);
-
-/**
- * \brief Add a surface to a layer which is currently managed by the service
+ * \brief Get the visibility of a surface. If a surface is not visible, the surface
+ * will not be rendered.
* \ingroup ilmClient
- * \param[in] layerId Id of layer which should host the surface.
- * \param[in] surfaceId Id of surface which should be added to the layer.
+ * \param[in] surfaceId Id of the surface to get the visibility of.
+ * \param[out] pVisibility pointer where the visibility of a surface should be stored
+ * ILM_SUCCESS if the surface is visible,
+ * ILM_FALSE if the visibility is disabled.
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_layerAddSurface(t_ilm_layer layerId, t_ilm_surface surfaceId);
+ilmErrorTypes ilm_surfaceGetVisibility(t_ilm_surface surfaceId, t_ilm_bool *pVisibility);
/**
- * \brief Removes a surface from a layer which is currently managed by the service
+ * \brief Remove a surface
* \ingroup ilmClient
- * \param[in] layerId Id of the layer which contains the surface.
- * \param[in] surfaceId Id of the surface which should be removed from the layer.
+ * \param[in] surfaceId The id of the surface to be removed
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_layerRemoveSurface(t_ilm_layer layerId, t_ilm_surface surfaceId);
+ilmErrorTypes ilm_surfaceRemove(const t_ilm_surface surfaceId);
/**
- * \brief Commit all changes and executed commands since last commit.
+ * \brief Remove the native content of a surface
* \ingroup ilmClient
+ * \param[in] surfaceId The ID of the surface
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_commitChanges();
-
-/* BEGIN OF CONTROL API */
-
-/**
- * \brief Get the layer properties from the Layermanagement
- * \ingroup ilmControl
- * \param[in] layerID layer Indentifier as a Number from 0 .. MaxNumber of Layer
- * \param[out] pLayerProperties pointer where the layer properties should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not get the resolution.
- */
-ilmErrorTypes ilm_getPropertiesOfLayer(t_ilm_uint layerID, struct ilmLayerProperties* pLayerProperties);
-
-/**
- * \brief Get the number of hardware layers of a screen
- * \ingroup ilmControl
- * \param[in] screenID id of the screen, where the number of Hardware Layers should be returned
- * \param[out] pNumberOfHardwareLayers pointer where the number of hardware layers should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not get the resolution.
- */
-ilmErrorTypes ilm_getNumberOfHardwareLayers(t_ilm_uint screenID, t_ilm_uint* pNumberOfHardwareLayers);
-
-/**
- * \brief Get the screen Ids
- * \ingroup ilmControl
- * \param[out] pNumberOfIDs pointer where the number of Screen Ids should be returned
- * \param[out] ppIDs pointer to array where the IDs should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not get the resolution.
- */
-ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs);
-
-/**
- * \brief Get all LayerIds which are currently registered and managed by the services
- * \ingroup ilmControl
- * \param[out] pLength Pointer where length of ids array should be stored
- * \param[out] ppArray Array where the ids should be stored,
- * the array will be allocated inside
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength,t_ilm_layer** ppArray);
-
-/**
- * \brief Get all LayerIds of the given screen
- * \ingroup ilmControl
- * \param[in] screenID The id of the screen to get the layer IDs of
- * \param[out] pLength Pointer where length of ids array should be stored
- * \param[out] ppArray Array where the ids should be stored,
- * the array will be allocated inside
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenID, t_ilm_int* pLength,t_ilm_layer** ppArray);
-
-/**
- * \brief Get all SurfaceIDs which are currently registered and managed by the services
- * \ingroup ilmControl
- * \param[out] pLength Pointer where length of ids array should be stored
- * \param[out] ppArray Array where the ids should be stored,
- * the array will be allocated inside
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength,t_ilm_surface** ppArray);
-
-/**
- * \brief Get all SurfaceIds which are currently registered to a given layer and are managed by the services
- * \ingroup ilmControl
- * \param[in] layer Id of the Layer whose surfaces are to be returned
- * \param[out] pLength Pointer where the array length of ids should be stored
- * \param[out] ppArray Array where the surface id should be stored,
- * the array will be allocated inside
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer,t_ilm_int* pLength,t_ilm_surface** ppArray);
-
-/**
- * \brief Create a layer which should be managed by the service
- * \deprecated Will be removed in later version please use ilm_layerCreateWithDimension
- * \ingroup ilmControl
- * \param[out] pLayerId pointer where the id should be/is stored. It is possible
- * to set a id from outside, 0 will create a new id.
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerCreate(t_ilm_layer* pLayerId);
-
-/**
- * \brief Create a layer which should be managed by the service
- * \ingroup ilmControl
- * \param[out] pLayerId pointer where the id should be/is stored. It is possible
- * to set a id from outside, 0 will create a new id.
- *\param[in] width horizontal dimension of the layer
- *
- * \param[in] height vertical dimension of the layer
- *
-*
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerCreateWithDimension(t_ilm_layer* pLayerId, t_ilm_uint width, t_ilm_uint height);
-
-/**
- * \brief Removes a layer which is currently managed by the service
- * \ingroup ilmControl
- * \param[in] layerId Layer to be removed
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerRemove(t_ilm_layer layerId);
-
-/**
- * \brief Get the current type of the layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer.
- * \param[out] pLayerType pointer to the layerType where the result should be stored.
- * \note ilmLayerType for information on supported types
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetType(t_ilm_layer layerId, ilmLayerType* pLayerType);
-
-/**
- * \brief Set the visibility of a layer. If a layer is not visible, the layer and its
- * surfaces will not be rendered.
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer.
- * \param[in] newVisibility ILM_SUCCESS sets layer visible, ILM_FALSE disables the visibility.
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibility);
-
-/**
- * \brief Get the visibility of a layer. If a layer is not visible, the layer and its
- * surfaces will not be rendered.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[out] pVisibility pointer where the visibility of the layer should be stored
- * ILM_SUCCESS if the Layer is visible,
- * ILM_FALSE if the visibility is disabled.
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId,t_ilm_bool *pVisibility);
-
-/**
- * \brief Set the opacity of a layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer.
- * \param[in] opacity 0.0 means the layer is fully transparent,
- * 1.0 means the layer is fully opaque
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetOpacity(t_ilm_layer layerId, t_ilm_float opacity);
-
-/**
- * \brief Get the opacity of a layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer to obtain the opacity of.
- * \param[out] pOpacity pointer where the layer opacity should be stored.
- * 0.0 means the layer is fully transparent,
- * 1.0 means the layer is fully opaque
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetOpacity(t_ilm_layer layerId, t_ilm_float *pOpacity);
-
-/**
- * \brief Set the area of a layer which should be used for the rendering. Only this part will be visible.
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer.
- * \param[in] x horizontal start position of the used area
- * \param[in] y vertical start position of the used area
- * \param[in] width width of the area
- * \param[in] height height of the area
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetSourceRectangle(t_ilm_layer layerId, t_ilm_uint x, t_ilm_uint y, t_ilm_uint width, t_ilm_uint height);
-
-/**
- * \brief Set the destination area on the display for a layer. The layer will be scaled and positioned to this rectangle for rendering
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer.
- * \param[in] x horizontal start position of the used area
- * \param[in] y vertical start position of the used area
- * \param[in] width width of the area
- * \param[in] height height of the area
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetDestinationRectangle(t_ilm_layer layerId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
-
-/**
- * \brief Get the horizontal and vertical dimension of the layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[out] pDimension pointer to an array where the dimension should be stored.
- * dimension[0]=width, dimension[1]=height
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension);
-
-/**
- * \brief Set the horizontal and vertical dimension of the layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[in] pDimension pointer to an array where the dimension is stored.
- * dimension[0]=width, dimension[1]=height
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension);
-
-/**
- * \brief Get the horizontal and vertical position of the layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[out] pPosition pointer to an array where the position should be stored.
- * dimension[0]=width, dimension[1]=height
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition);
-
-/**
- * \brief Sets the horizontal and vertical position of the layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[in] pPosition pointer to an array where the position is stored.
- * dimension[0]=x, dimension[1]=y
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition);
-
-/**
- * \brief Sets the orientation of a layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[in] orientation Orientation of the layer.
- * \note ilmOrientation for more information on orientation values
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetOrientation(t_ilm_layer layerId, ilmOrientation orientation);
-
-/**
- * \brief Gets the orientation of a layer.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[out] pOrientation Address where orientation of the layer should be stored.
- * \note ilmOrientation for more information on orientation values
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetOrientation(t_ilm_layer layerId, ilmOrientation *pOrientation);
-
-/**
- * \brief Sets the color value which defines the transparency value.
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[in] pColor array of the color value which is defined in red,green, blue
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor);
-
-/**
- * \brief Sets render order of surfaces within one layer
- * \ingroup ilmControl
- * \param[in] layerId Id of layer.
- * \param[in] pSurfaceId array of surface ids
- * \param[in] number Number of elements in the given array of ids
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number);
-
-/**
- * \brief Get the capabilities of a layer
- * \ingroup ilmControl
- * \param[in] layerId Id of the layer to obtain the capabilities of
- * \param[out] pCapabilities The address where the capabilites are returned
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerGetCapabilities(t_ilm_layer layerId, t_ilm_layercapabilities *pCapabilities);
-
-/**
- * \brief Get the possible capabilities of a layertype
- * \ingroup ilmControl
- * \param[in] layerType The layertype to obtain the capabilities of
- * \param[out] pCapabilities The address where the capabilites are returned
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_layerTypeGetCapabilities(ilmLayerType layerType, t_ilm_layercapabilities *pCapabilities);
-
-/**
- * \brief Create the logical surface, which has no native buffer associated
- * \ingroup ilmControl
- * \param[in] pSurfaceId The value pSurfaceId points to is used as ID for new surface;
- * \param[out] pSurfaceId The ID of the newly created surface is returned in this parameter
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceInitialize(t_ilm_surface *pSurfaceId);
-
-/**
- * \brief Set the visibility of a surface. If a surface is not visible it will not be rendered.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of the surface to set the visibility of
- * \param[in] newVisibility ILM_SUCCESS sets surface visible, ILM_FALSE disables the visibility.
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetVisibility(t_ilm_surface surfaceId, t_ilm_bool newVisibility);
-
-/**
- * \brief Set the opacity of a surface.
- * \ingroup ilmControl
- * \param surfaceId Id of the surface to set the opacity of.
- * \param opacity 0.0 means the surface is fully transparent,
- * 1.0 means the surface is fully opaque
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetOpacity(const t_ilm_surface surfaceId, t_ilm_float opacity);
-
-/**
- * \brief Get the opacity of a surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of the surface to get the opacity of.
- * \param[out] pOpacity pointer where the surface opacity should be stored.
- * 0.0 means the surface is fully transparent,
- * 1.0 means the surface is fully opaque
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceGetOpacity(const t_ilm_surface surfaceId, t_ilm_float *pOpacity);
+ilmErrorTypes ilm_surfaceRemoveNativeContent(t_ilm_surface surfaceId);
/**
- * \brief Set the keyboard focus on a certain surface
- * To receive keyboard events, 2 conditions must be fulfilled:
- * 1- The surface must accept events from keyboard. See ilm_UpdateInputEventAcceptanceOn
- * 2- The keyboard focus must be set on that surface
- *
- * \ingroup ilmControl
- * \param[in] surfaceId Identifier of the surface to set the keyboard focus on.
+ * \brief remove notification on property changes of surface
+ * \ingroup ilmClient
+ * \param[in] surface id of surface to remove notification
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
+ * \return ILM_ERROR_INVALID_ARGUMENT if the given surface has no notification callback registered
*/
-ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId);
+ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface);
/**
- * \brief Get the indentifier of the surface which hold the keyboard focus
- *
- * \ingroup ilmControl
- * \param[out] pSurfaceId Pointer on the a surface identifier
+ * \brief Set the native content of an application to be used as surface content
+ * \ingroup ilmClient
+ * \param[in] nativehandle The native windowsystem's handle for the surface
+ * \param[in] width The original width of the surface
+ * \param[in] height The original height of the surface
+ * \param[in] pixelFormat The pixelformat to be used for the surface
+ * \param[in] surfaceId The ID of the surface
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId);
+ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface surfaceId);
/**
- * \brief Set the destination area of a surface within a layer for rendering. The surface will be scaled to this rectangle for rendering.
- * \ingroup ilmControl
+ * \brief Set the area of a surface which should be used for the rendering.
+ * \ingroup ilmClient
* \param[in] surfaceId Id of surface.
* \param[in] x horizontal start position of the used area
* \param[in] y vertical start position of the used area
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
*/
-ilmErrorTypes ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
-
-/**
- * \brief Set the horizontal and vertical dimension of the surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[in] pDimension pointer to an array where the dimension is stored.
- * dimension[0]=width, dimension[1]=height
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension);
-
-/**
- * \brief Get the horizontal and vertical position of the surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[out] pPosition pointer to an array where the position should be stored.
- * position[0]=x, position[1]=y
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceGetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition);
-
-/**
- * \brief Sets the horizontal and vertical position of the surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[in] pPosition pointer to an array where the position is stored.
- * position[0]=x, position[1]=y
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition);
-
-/**
- * \brief Sets the orientation of a surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[in] orientation Orientation of the surface.
- * \note ilmOrientation for information about orientation values
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetOrientation(t_ilm_surface surfaceId, ilmOrientation orientation);
-
-/**
- * \brief Gets the orientation of a surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[out] pOrientation Address where orientation of the surface should be stored.
- * \note ilmOrientation for information about orientation values
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceGetOrientation(t_ilm_surface surfaceId, ilmOrientation *pOrientation);
-
-/**
- * \brief Gets the pixelformat of a surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of surface.
- * \param[out] pPixelformat Pointer where the pixelformat of the surface should be stored
- * \note ilmPixelFormat for information about pixel format values
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceGetPixelformat(t_ilm_layer surfaceId, ilmPixelFormat *pPixelformat);
-
-/**
- * \brief Sets the color value which defines the transparency value of a surface.
- * \ingroup ilmControl
- * \param[in] surfaceId Id of the surface to set the chromakey of.
- * \param[in] pColor array of the color value which is defined in red, green, blue
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor);
-
-/**
- * \brief Sets render order of layers on a display
- * \ingroup ilmControl
- * \param[in] display Id of display to set the given order of layers.
- * \param[in] pLayerId array of layer ids
- * \param[in] number number of layerids in the given array
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_displaySetRenderOrder(t_ilm_display display, t_ilm_layer *pLayerId, const t_ilm_uint number);
-
-/**
- * \brief Take a screenshot from the current displayed layer scene.
- * The screenshot is saved as bmp file with the corresponding filename.
- * \ingroup ilmControl
- * \param[in] screen Id of screen where screenshot should be taken
- * \param[in] filename Location where the screenshot should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_takeScreenshot(t_ilm_uint screen, t_ilm_const_string filename);
-
-/**
- * \brief Take a screenshot of a certain layer
- * The screenshot is saved as bmp file with the corresponding filename.
- * \ingroup ilmControl
- * \param[in] filename Location where the screenshot should be stored
- * \param[in] layerid Identifier of the layer to take the screenshot of
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_takeLayerScreenshot(t_ilm_const_string filename, t_ilm_layer layerid);
-
-/**
- * \brief Take a screenshot of a certain surface
- * The screenshot is saved as bmp file with the corresponding filename.
- * \ingroup ilmControl
- * \param[in] filename Location where the screenshot should be stored
- * \param[in] surfaceid Identifier of the surface to take the screenshot of
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_takeSurfaceScreenshot(t_ilm_const_string filename, t_ilm_surface surfaceid);
-
+ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
/**
- * \brief Enable or disable a rendering optimization
+ * \brief Set from which kind of devices the surface can accept input events.
+ * By default, a surface accept input events from all kind of devices (keyboards, pointer, ...)
+ * By calling this function, you can adjust surface preferences. Note that this function only
+ * adjust the acceptance for the specified devices. Non specified are keept untouched.
+ *
+ * Typicall use case for this function is when dealing with pointer or touch events.
+ * Those are normally dispatched to the first visible surface below the coordinate.
+ * If you want a different behavior (i.e. forward events to an other surface below the coordinate,
+ * you can set all above surfaces to refuse input events)
*
- * \ingroup ilmControl
- * \param[in] id which optimization to change
- * \param[in] mode the mode to set on the optimzation (e.g. ON, OFF, AUTO)
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_SetOptimizationMode(ilmOptimization id, ilmOptimizationMode mode);
-
-/**
- * \brief Get the current enablement for an optimization
+ * \ingroup ilmClient
+ * \param[in] surfaceId Identifier of the surface to set the keyboard focus on.
+ * \param[in] devices Bitmask of ilmInputDevice
+ * \param[in] acceptance Indicate if the surface accept or reject input events from the specified devices
*
- * \ingroup ilmControl
- * \param[in] id which optimization to query
- * \param[out] mode current optimization mode
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- */
-ilmErrorTypes ilm_GetOptimizationMode(ilmOptimization id, ilmOptimizationMode* mode);
-
-/**
- * \brief register for notification on property changes of layer
- * \ingroup ilmControl
- * \param[in] layer id of layer to register for notification
- * \param[in] callback pointer to function to be called for notification
* \return ILM_SUCCESS if the method call was successful
* \return ILM_FAILED if the client can not call the method on the service.
- * \return ILM_ERROR_INVALID_ARGUMENT if the given layer already has notification callback registered
*/
-ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback);
-
-/**
- * \brief remove notification on property changes of layer
- * \ingroup ilmControl
- * \param[in] layer id of layer to remove notification
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not call the method on the service.
- * \return ILM_ERROR_INVALID_ARGUMENT if the given layer has no notification callback registered
- */
-ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer);
-
-/**
- * \brief Get the screen properties from the Layermanagement
- * \ingroup ilmClient
- * \param[in] screenID screen Indentifier
- * \param[out] pScreenProperties pointer where the screen properties should be stored
- * \return ILM_SUCCESS if the method call was successful
- * \return ILM_FAILED if the client can not get the resolution.
- */
-ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties);
+ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInputDevice devices, t_ilm_bool acceptance);
#ifdef __cplusplus
} /**/
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2012 BMW Car IT GmbH
- * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
- * Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
- *
- * 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.
- *
- ****************************************************************************/
-#include "ilm_client.h"
-#include "ilm_types.h"
-#include "IpcModuleLoader.h"
-#include "ObjectType.h"
-#include <pthread.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <semaphore.h>
-#include <unistd.h>
-
-/*
- *=============================================================================
- * global settings
- *=============================================================================
- */
-const int gReceiveTimeout = -1; /* in ms, negative value for infinite */
-const int gResponseTimeout = 500; /* in ms */
-
-/*
- * must be same as GraphicalObject::INVALID_ID, but this is defined in C++
- * and can not be used here
- */
-#define INVALID_ID 0xFFFFFFFF
-
-/* queue names for incoming notifications and messages */
-#define NOTIFICATION_QUEUE_NAME "/ilmClient%dNotification"
-#define INCOMING_QUEUE_NAME "/ilmClient%dIncoming"
-
-/*
- *=============================================================================
- * Implementation of thread-safe circular queue for local use
- *=============================================================================
- */
-typedef struct
-{
- pthread_mutex_t queueMutex;
- sem_t readBlockSemaphore;
-
- t_ilm_uint size;
- t_ilm_uint maxSize;
- t_ilm_uint readPos;
- t_ilm_uint writePos;
-
- t_ilm_message* messages;
-} t_ilm_msg_queue;
-
-
-static void init_msg_queue(t_ilm_msg_queue* pQueue, t_ilm_uint maxSize)
-{
- pQueue->maxSize = maxSize;
- pQueue->messages = malloc(sizeof(t_ilm_message) * maxSize);
-
- pQueue->size = 0;
- pQueue->readPos = 0;
- pQueue->writePos = 0;
-
- pthread_mutex_init(&pQueue->queueMutex, NULL);
- sem_init(&pQueue->readBlockSemaphore, 0, 0);
-}
-
-static t_ilm_bool msg_enqueue(t_ilm_msg_queue* pQueue, t_ilm_message message)
-{
- pthread_mutex_lock(&pQueue->queueMutex);
-
- if (pQueue->size < pQueue->maxSize)
- {
- ++pQueue->size;
- pQueue->messages[pQueue->writePos] = message;
- pQueue->writePos = (pQueue->writePos + 1) % pQueue->maxSize;
-
- /* wakeup a blocked dequeue reqquest */
- sem_post(&pQueue->readBlockSemaphore);
-
- pthread_mutex_unlock(&pQueue->queueMutex);
- return ILM_TRUE;
- }
-
- pthread_mutex_unlock(&pQueue->queueMutex);
- return ILM_FALSE;
-}
-
-static t_ilm_message msg_dequeue(t_ilm_msg_queue* pQueue)
-{
- t_ilm_message result = NULL;
- /* wait until a message is available */
- sem_wait(&pQueue->readBlockSemaphore);
-
- pthread_mutex_lock(&pQueue->queueMutex);
-
- if (pQueue->size > 0)
- {
- --pQueue->size;
- result = pQueue->messages[pQueue->readPos];
- pQueue->readPos = (pQueue->readPos + 1) % pQueue->maxSize;
- }
-
- pthread_mutex_unlock(&pQueue->queueMutex);
- return result;
-}
-
-
-static void destroy_msg_queue(t_ilm_msg_queue* pQueue)
-{
- if (pQueue->maxSize > 0)
- {
- pQueue->maxSize = 0;
- pQueue->size = 0;
- free(pQueue->messages);
- }
-}
-
-
-/*
- *=============================================================================
- * global vars
- *=============================================================================
- */
-extern char *__progname; /* automatically gets assigned argv[0] */
-
-static struct IpcModule gIpcModule;
-
-static pthread_t gReceiveThread;
-static pthread_mutex_t gSendReceiveLock;
-static pthread_t gNotificationThread;
-
-static const int maxQueueSize = 1024;
-static t_ilm_msg_queue incomingQueue;
-static t_ilm_msg_queue notificationQueue;
-
-static t_ilm_bool gInitialized = ILM_FALSE;
-
-/*
- *=============================================================================
- * notification management
- *=============================================================================
- */
-#define MAX_CALLBACK_COUNT 64
-static struct
-{
- t_ilm_uint id;
- layerNotificationFunc callback;
-} gLayerNotificationCallbacks[MAX_CALLBACK_COUNT];
-
-static struct
-{
- t_ilm_uint id;
- surfaceNotificationFunc callback;
-} gSurfaceNotificationCallbacks[MAX_CALLBACK_COUNT];
-
-void initNotificationCallbacks()
-{
- int i = 0;
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- gLayerNotificationCallbacks[i].id = INVALID_ID;
- gLayerNotificationCallbacks[i].callback = NULL;
- gSurfaceNotificationCallbacks[i].id = INVALID_ID;
- gSurfaceNotificationCallbacks[i].callback = NULL;
- }
-}
-
-layerNotificationFunc getLayerNotificationCallback(t_ilm_layer layer)
-{
- int i = 0;
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gLayerNotificationCallbacks[i].id == layer)
- {
- return gLayerNotificationCallbacks[i].callback;
- }
- }
- return NULL;
-}
-
-surfaceNotificationFunc getSurfaceNotificationCallback(t_ilm_surface surface)
-{
- int i = 0;
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gSurfaceNotificationCallbacks[i].id == surface)
- {
- return gSurfaceNotificationCallbacks[i].callback;
- }
- }
- return NULL;
-}
-
-t_ilm_bool findLayerCallback(t_ilm_layer layer)
-{
- int i = 0;
-
- /* try to overwrite existing entry for layer id */
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gLayerNotificationCallbacks[i].id == layer)
- {
- return ILM_TRUE;
- }
- }
- return ILM_FALSE;
-}
-
-t_ilm_bool addLayerCallback(t_ilm_layer layer, layerNotificationFunc func)
-{
- int i = 0;
-
- if (findLayerCallback(layer))
- {
- return ILM_FALSE;
- }
-
- /* find free slot and store callback */
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gLayerNotificationCallbacks[i].id == INVALID_ID)
- {
- gLayerNotificationCallbacks[i].id = layer;
- gLayerNotificationCallbacks[i].callback = func;
- return ILM_TRUE;
- }
- }
- printf("DbusIpcModule: addLayerCallback() failed. no free slots.");
- return ILM_FALSE;
-}
-
-t_ilm_bool findSurfaceCallback(t_ilm_surface surface)
-{
- int i = 0;
-
- /* try to overwrite existing entry for layer id */
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gSurfaceNotificationCallbacks[i].id == surface)
- {
- return ILM_TRUE;
- }
- }
- return ILM_FALSE;
-}
-
-t_ilm_bool addSurfaceCallback(t_ilm_surface surface, surfaceNotificationFunc func)
-{
- int i = 0;
-
- if (findSurfaceCallback(surface))
- {
- return ILM_FALSE;
- }
-
- /* find free slot and store callback */
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gSurfaceNotificationCallbacks[i].id == INVALID_ID)
- {
- gSurfaceNotificationCallbacks[i].id = surface;
- gSurfaceNotificationCallbacks[i].callback = func;
- return ILM_TRUE;
- }
- }
- printf("DbusIpcModule: addSurfaceCallback() failed. no free slots.");
- return ILM_FALSE;
-}
-
-void removeLayerCallback(t_ilm_layer layer)
-{
- int i = 0;
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gLayerNotificationCallbacks[i].id == layer)
- {
- gLayerNotificationCallbacks[i].id = INVALID_ID;
- gLayerNotificationCallbacks[i].callback = NULL;
- return;
- }
- }
-}
-
-void removeSurfaceCallback(t_ilm_surface layer)
-{
- int i = 0;
- for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
- {
- if (gSurfaceNotificationCallbacks[i].id == layer)
- {
- gSurfaceNotificationCallbacks[i].id = INVALID_ID;
- gSurfaceNotificationCallbacks[i].callback = NULL;
- return;
- }
- }
-}
-
-
-/*
- *=============================================================================
- * handling of internal notification thread for dispatching notifications
- * Note: notification callbacks may be blocked by client, but receive thread
- * must not be blocked
- *=============================================================================
- */
-void* notificationThreadLoop(void* param)
-{
- t_ilm_message notification;
-
- (void)param;
-
- while (NULL != (notification = msg_dequeue(¬ificationQueue)))
- {
- t_ilm_const_string name = gIpcModule.getMessageName(notification);
-
- /* this depends on message name, but it is fast */
- if ('L' == name[15])
- {
- t_ilm_uint id;
- t_ilm_uint mask;
- struct ilmLayerProperties properties;
- layerNotificationFunc func;
-
- gIpcModule.getUint(notification, &id);
- gIpcModule.getUint(notification, &mask);
- gIpcModule.getDouble(notification, &properties.opacity);
- gIpcModule.getUint(notification, &properties.sourceX);
- gIpcModule.getUint(notification, &properties.sourceY);
- gIpcModule.getUint(notification, &properties.sourceWidth);
- gIpcModule.getUint(notification, &properties.sourceHeight);
- gIpcModule.getUint(notification, &properties.origSourceWidth);
- gIpcModule.getUint(notification, &properties.origSourceHeight);
- gIpcModule.getUint(notification, &properties.destX);
- gIpcModule.getUint(notification, &properties.destY);
- gIpcModule.getUint(notification, &properties.destWidth);
- gIpcModule.getUint(notification, &properties.destHeight);
- gIpcModule.getUint(notification, &properties.orientation);
- gIpcModule.getBool(notification, &properties.visibility);
- gIpcModule.getUint(notification, &properties.type);
- gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
- gIpcModule.getUint(notification, &properties.chromaKeyRed);
- gIpcModule.getUint(notification, &properties.chromaKeyGreen);
- gIpcModule.getUint(notification, &properties.chromaKeyBlue);
- gIpcModule.getInt(notification, &properties.creatorPid);
-
- func = getLayerNotificationCallback(id);
- if (func)
- {
- (*func)(id, &properties, mask);
- }
- else
- {
- fprintf(stderr, "notification for layer %d received, but no callback set\n", id);
- }
- }
-
- if ('S' == name[15])
- {
- t_ilm_uint id;
- t_ilm_uint mask;
- struct ilmSurfaceProperties properties;
- surfaceNotificationFunc func;
-
- gIpcModule.getUint(notification, &id);
- gIpcModule.getUint(notification, &mask);
- gIpcModule.getDouble(notification, &properties.opacity);
- gIpcModule.getUint(notification, &properties.sourceX);
- gIpcModule.getUint(notification, &properties.sourceY);
- gIpcModule.getUint(notification, &properties.sourceWidth);
- gIpcModule.getUint(notification, &properties.sourceHeight);
- gIpcModule.getUint(notification, &properties.origSourceWidth);
- gIpcModule.getUint(notification, &properties.origSourceHeight);
- gIpcModule.getUint(notification, &properties.destX);
- gIpcModule.getUint(notification, &properties.destY);
- gIpcModule.getUint(notification, &properties.destWidth);
- gIpcModule.getUint(notification, &properties.destHeight);
- gIpcModule.getUint(notification, &properties.orientation);
- gIpcModule.getBool(notification, &properties.visibility);
- gIpcModule.getUint(notification, &properties.frameCounter);
- gIpcModule.getUint(notification, &properties.drawCounter);
- gIpcModule.getUint(notification, &properties.updateCounter);
- gIpcModule.getUint(notification, &properties.pixelformat);
- gIpcModule.getUint(notification, &properties.nativeSurface);
- gIpcModule.getUint(notification, &properties.inputDevicesAcceptance);
- gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
- gIpcModule.getUint(notification, &properties.chromaKeyRed);
- gIpcModule.getUint(notification, &properties.chromaKeyGreen);
- gIpcModule.getUint(notification, &properties.chromaKeyBlue);
- gIpcModule.getInt(notification, &properties.creatorPid);
-
- func = getSurfaceNotificationCallback(id);
- if (func)
- {
- (*func)(id, &properties, mask);
- }
- else
- {
- fprintf(stderr, "notification for surface %d received, but no callback set\n", id);
- }
- }
- gIpcModule.destroyMessage(notification);
- }
- return NULL;
-}
-
-
-/*
- *=============================================================================
- * handling of internal receive thread for event handling
- *=============================================================================
- */
-void* receiveThreadLoop(void* param)
-{
- t_ilm_bool running = ILM_TRUE;
-
- (void)param;
-
- while (running)
- {
- t_ilm_message message = gIpcModule.receive(gReceiveTimeout);
- t_ilm_message_type messageType = gIpcModule.getMessageType(message);
- switch (messageType)
- {
- case IpcMessageTypeNotification:
- if (ILM_FALSE == msg_enqueue(¬ificationQueue, message))
- {
- if (EAGAIN == errno)
- {
- printf("Notification queue full, dropped notification %s\n", gIpcModule.getMessageName(message));
- }
- }
- break;
-
- case IpcMessageTypeCommand:
- case IpcMessageTypeError:
- if (ILM_FALSE == msg_enqueue(&incomingQueue, message))
- {
- if (EAGAIN == errno)
- {
- printf("Incoming queue full, dropped message %s\n", gIpcModule.getMessageName(message));
- }
- }
- break;
-
- case IpcMessageTypeNone:
- break;
-
- default:
- printf("ilmClient: discarded unexpected message (type: %d)\n", (int)messageType);
- gIpcModule.destroyMessage(message);
- break;
- }
- }
-
- return NULL;
-}
-
-void calculateTimeout(struct timeval* currentTime, int giventimeout, struct timespec* timeout)
-{
- /* nanoseconds is old value in nanoseconds + the given milliseconds as nanoseconds */
- t_ilm_ulong newNanoSeconds = currentTime->tv_usec * 1000 + giventimeout * (1000 * 1000);
-
- /* only use non full seconds, otherwise overflow! */
- timeout->tv_nsec = newNanoSeconds % (1000000000);
-
- /* new seconds are old seconds + full seconds from new nanoseconds part */
- timeout->tv_sec = currentTime->tv_sec + (newNanoSeconds / 1000000000 );
-}
-
-t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response, int timeoutInMs, ilmErrorTypes* error)
-{
- t_ilm_message_type responseType = IpcMessageTypeNone;
-
- struct timeval tv;
- struct timespec ts;
-
- (void)timeoutInMs; /* suppress warning */
-
- gettimeofday(&tv, NULL);
- calculateTimeout(&tv, 1000000, &ts);
-
- *response = 0;
-
- /* send / receive may only be performed by one thread at a time */
- pthread_mutex_lock(&gSendReceiveLock);
-
- if (gIpcModule.sendToService(command))
- {
- if (NULL == (*response = msg_dequeue(&incomingQueue)))
- {
- *error = ILM_ERROR_ON_CONNECTION;
- }
- else
- {
- responseType = gIpcModule.getMessageType(*response);
- switch (responseType)
- {
- case IpcMessageTypeCommand:
- break;
-
- case IpcMessageTypeError:
- gIpcModule.getUint(*response, error);
- free(*response);
- *response = 0;
- break;
-
- default:
- fprintf(stderr,"waitForResponse: LayerManagerService returned unexpected message type %d\n", responseType);
- free(*response);
- *response = 0;
- *error = ILM_ERROR_UNEXPECTED_MESSAGE;
- break;
- }
- }
- }
- pthread_mutex_unlock(&gSendReceiveLock);
-
- return (0 != *response);
-}
-
-
-/*
- *=============================================================================
- * implementation
- *=============================================================================
- */
-ilmErrorTypes ilm_init()
-{
- ilmErrorTypes result = ILM_FAILED;
- t_ilm_message response = 0;
- t_ilm_message command;
-
- if (gInitialized)
- {
- printf("ilm_init() was called, but ilmClientLib is already initialized. returning success, but initialization was skipped this time.\n");
- return ILM_SUCCESS;
- }
-
- initNotificationCallbacks();
-
- if (loadIpcModule(&gIpcModule))
- {
- int pid = getpid();
-
- if (gIpcModule.initClientMode())
- {
- pthread_attr_t notificationThreadAttributes;
- int ret;
-
- result = ILM_SUCCESS;
-
- init_msg_queue(¬ificationQueue, maxQueueSize);
-
- init_msg_queue(&incomingQueue, maxQueueSize);
-
- if (notificationQueue.maxSize == 0)
- {
- printf("failed to allocate queue\n");
- return result;
- }
-
- pthread_mutex_init(&gSendReceiveLock, NULL);
-
- pthread_attr_init(¬ificationThreadAttributes);
- pthread_attr_setdetachstate(¬ificationThreadAttributes,
- PTHREAD_CREATE_JOINABLE);
-
- ret = pthread_create(&gReceiveThread,
- ¬ificationThreadAttributes,
- receiveThreadLoop,
- NULL);
- if (0 != ret)
- {
- result = ILM_FAILED;
- printf("Failed to start internal receive thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
- return result;
- }
-
- ret = pthread_create(&gNotificationThread,
- ¬ificationThreadAttributes,
- notificationThreadLoop,
- NULL);
- if (0 != ret)
- {
- result = ILM_FAILED;
- printf("Failed to start internal notification thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
- return result;
- }
- }
- else
- {
- result = ILM_FAILED;
- printf("Failed to initialize Client Ipc Module");
- return result;
- }
-
- command = gIpcModule.createMessage("ServiceConnect");
- if (command
- && gIpcModule.appendUint(command, pid)
- && gIpcModule.appendString(command, __progname)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &result))
- {
- result = ILM_SUCCESS;
- }
- else
- {
- printf("Failed to connect to LayerManagerService.");
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
-
- gInitialized = (result == ILM_SUCCESS) ? ILM_TRUE : ILM_FALSE;
-
- return result;
-}
-
-ilmErrorTypes ilm_destroy()
-{
- ilmErrorTypes result = ILM_FAILED;
- void* threadReturnValue = NULL;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ServiceDisconnect");
- if (command
- && gIpcModule.appendUint(command, getpid())
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &result))
- {
- result = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
-
- /* cancel worker threads */
- pthread_cancel(gReceiveThread);
- pthread_cancel(gNotificationThread);
-
- pthread_join(gReceiveThread, &threadReturnValue);
- pthread_join(gNotificationThread, &threadReturnValue);
-
- pthread_mutex_unlock(&gSendReceiveLock);
-
- pthread_mutex_destroy(&gSendReceiveLock);
-
- gIpcModule.destroy();
-
- destroy_msg_queue(¬ificationQueue);
- destroy_msg_queue(&incomingQueue);
-
- gInitialized = ILM_FALSE;
-
- return result;
-}
-
-ilmErrorTypes ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, struct ilmSurfaceProperties* pSurfaceProperties)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfSurface");
-
- if (pSurfaceProperties
- && command
- && gIpcModule.appendUint(command, surfaceID)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getDouble(response, &pSurfaceProperties->opacity)
- && gIpcModule.getUint(response, &pSurfaceProperties->sourceX)
- && gIpcModule.getUint(response, &pSurfaceProperties->sourceY)
- && gIpcModule.getUint(response, &pSurfaceProperties->sourceWidth)
- && gIpcModule.getUint(response, &pSurfaceProperties->sourceHeight)
- && gIpcModule.getUint(response, &pSurfaceProperties->origSourceWidth)
- && gIpcModule.getUint(response, &pSurfaceProperties->origSourceHeight)
- && gIpcModule.getUint(response, &pSurfaceProperties->destX)
- && gIpcModule.getUint(response, &pSurfaceProperties->destY)
- && gIpcModule.getUint(response, &pSurfaceProperties->destWidth)
- && gIpcModule.getUint(response, &pSurfaceProperties->destHeight)
- && gIpcModule.getUint(response, &pSurfaceProperties->orientation)
- && gIpcModule.getBool(response, &pSurfaceProperties->visibility)
- && gIpcModule.getUint(response, &pSurfaceProperties->frameCounter)
- && gIpcModule.getUint(response, &pSurfaceProperties->drawCounter)
- && gIpcModule.getUint(response, &pSurfaceProperties->updateCounter)
- && gIpcModule.getUint(response, &pSurfaceProperties->pixelformat)
- && gIpcModule.getUint(response, &pSurfaceProperties->nativeSurface)
- && gIpcModule.getUint(response, &pSurfaceProperties->inputDevicesAcceptance)
- && gIpcModule.getBool(response, &pSurfaceProperties->chromaKeyEnabled)
- && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyRed)
- && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyGreen)
- && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyBlue)
- && gIpcModule.getInt(response, &pSurfaceProperties->creatorPid))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getPropertiesOfLayer(t_ilm_uint layerID, struct ilmLayerProperties* pLayerProperties)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfLayer");
- if (pLayerProperties
- && command
- && gIpcModule.appendUint(command, layerID)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getDouble(response, &pLayerProperties->opacity)
- && gIpcModule.getUint(response, &pLayerProperties->sourceX)
- && gIpcModule.getUint(response, &pLayerProperties->sourceY)
- && gIpcModule.getUint(response, &pLayerProperties->sourceWidth)
- && gIpcModule.getUint(response, &pLayerProperties->sourceHeight)
- && gIpcModule.getUint(response, &pLayerProperties->origSourceWidth)
- && gIpcModule.getUint(response, &pLayerProperties->origSourceHeight)
- && gIpcModule.getUint(response, &pLayerProperties->destX)
- && gIpcModule.getUint(response, &pLayerProperties->destY)
- && gIpcModule.getUint(response, &pLayerProperties->destWidth)
- && gIpcModule.getUint(response, &pLayerProperties->destHeight)
- && gIpcModule.getUint(response, &pLayerProperties->orientation)
- && gIpcModule.getBool(response, &pLayerProperties->visibility)
- && gIpcModule.getUint(response, &pLayerProperties->type)
- && gIpcModule.getBool(response, &pLayerProperties->chromaKeyEnabled)
- && gIpcModule.getUint(response, &pLayerProperties->chromaKeyRed)
- && gIpcModule.getUint(response, &pLayerProperties->chromaKeyGreen)
- && gIpcModule.getUint(response, &pLayerProperties->chromaKeyBlue)
- && gIpcModule.getInt(response, &pLayerProperties->creatorPid))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getNumberOfHardwareLayers(t_ilm_uint screenID, t_ilm_uint* pNumberOfHardwareLayers)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetNumberOfHardwareLayers");
- if (pNumberOfHardwareLayers
- && command
- && gIpcModule.appendUint(command, screenID)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pNumberOfHardwareLayers))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getScreenResolution(t_ilm_uint screenID, t_ilm_uint* pWidth, t_ilm_uint* pHeight)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetScreenResolution");
- if (pWidth && pHeight
- && command
- && gIpcModule.appendUint(command, screenID)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pWidth)
- && gIpcModule.getUint(response, pHeight))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength, t_ilm_layer** ppArray)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDS");
- if (pLength && ppArray
- && command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, ppArray, pLength))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenId, t_ilm_int* pLength, t_ilm_layer** ppArray)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDsOnScreen");
- if (pLength && ppArray
- && command
- && gIpcModule.appendUint(command, screenId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, ppArray, pLength))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength, t_ilm_surface** ppArray)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ListAllSurfaceIDS");
- if (pLength && ppArray
- && command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, ppArray, pLength))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer, t_ilm_int* pLength, t_ilm_surface** ppArray)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ListSurfaceofLayer");
- if (pLength && ppArray
- && command
- && gIpcModule.appendUint(command, layer)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, ppArray, pLength))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerCreate(t_ilm_layer* pLayerId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- if (pLayerId && (INVALID_ID != *pLayerId))
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateLayerFromId");
- if (command
- && gIpcModule.appendUint(command, *pLayerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pLayerId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- else
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateLayer");
- if (command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pLayerId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerCreateWithDimension(t_ilm_layer* pLayerId, t_ilm_uint width, t_ilm_uint height)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- if (pLayerId && (INVALID_ID != *pLayerId))
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateLayerFromIdWithDimension");
- if (command
- && gIpcModule.appendUint(command, *pLayerId)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pLayerId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- else
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateLayerWithDimension");
- if (command
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pLayerId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerRemove(t_ilm_layer layerId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("RemoveLayer");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerAddSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("AddSurfaceToLayer");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerRemoveSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceFromLayer");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetType(t_ilm_layer layerId, ilmLayerType* pLayerType)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerType");
- if (pLayerType
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pLayerType))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibility)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerVisibility");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendBool(command, newVisibility)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId, t_ilm_bool *pVisibility)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerVisibility");
- if (pVisibility
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getBool(response, pVisibility))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetOpacity(t_ilm_layer layerId, t_ilm_float opacity)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerOpacity");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendDouble(command, opacity)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetOpacity(t_ilm_layer layerId, t_ilm_float *pOpacity)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerOpacity");
- if (pOpacity
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getDouble(response, pOpacity))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetSourceRectangle(t_ilm_layer layerId, t_ilm_uint x, t_ilm_uint y, t_ilm_uint width, t_ilm_uint height)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerSourceRegion");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUint(command, x)
- && gIpcModule.appendUint(command, y)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetDestinationRectangle(t_ilm_layer layerId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerDestinationRegion");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUint(command, x)
- && gIpcModule.appendUint(command, y)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerDimension");
- if (pDimension
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, &pDimension[0])
- && gIpcModule.getUint(response, &pDimension[1]))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerDimension");
- if (pDimension
- && command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUint(command, pDimension[0])
- && gIpcModule.appendUint(command, pDimension[1])
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerPosition");
- if (pPosition
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, &pPosition[0])
- && gIpcModule.getUint(response, &pPosition[1]))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerPosition");
- if (pPosition
- && command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUint(command, pPosition[0])
- && gIpcModule.appendUint(command, pPosition[1])
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetOrientation(t_ilm_layer layerId, ilmOrientation orientation)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerOrientation");
- if (command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUint(command, orientation)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetOrientation(t_ilm_layer layerId, ilmOrientation *pOrientation)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerOrientation");
- if (pOrientation
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pOrientation))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetLayerChromaKey");
- if (command
- && gIpcModule.appendUint(command, layerId))
- {
- t_ilm_bool comResult = ILM_TRUE;
-
- /* Checking pColor has a content, otherwise chromakey is disabled */
- if (pColor)
- {
- const t_ilm_uint number = 3;
- comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
- }
- if (comResult
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- }
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceRenderOrderWithinLayer");
- if (pSurfaceId
- && command
- && gIpcModule.appendUint(command, layerId)
- && gIpcModule.appendUintArray(command, pSurfaceId, number)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerGetCapabilities(t_ilm_layer layerId, t_ilm_layercapabilities *pCapabilities)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayerCapabilities");
- if (pCapabilities
- && command
- && gIpcModule.appendUint(command, layerId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pCapabilities))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerTypeGetCapabilities(ilmLayerType layerType, t_ilm_layercapabilities *pCapabilities)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetLayertypeCapabilities");
- if (pCapabilities
- && command
- && gIpcModule.appendUint(command, layerType)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pCapabilities))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface* pSurfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- if (pSurfaceId && (INVALID_ID != *pSurfaceId))
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateSurfaceFromId");
- if (command
- && gIpcModule.appendUint(command, nativehandle)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && gIpcModule.appendUint(command, pixelFormat)
- && gIpcModule.appendUint(command, *pSurfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pSurfaceId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- else
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CreateSurface");
- if (command
- && gIpcModule.appendUint(command, nativehandle)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && gIpcModule.appendUint(command, pixelFormat)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pSurfaceId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceInitialize(t_ilm_surface *pSurfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- if (pSurfaceId && (INVALID_ID != *pSurfaceId))
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("InitializeSurfaceFromId");
- if (command
- && gIpcModule.appendUint(command, *pSurfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pSurfaceId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- else
- {
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("InitializeSurface");
- if (command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pSurfaceId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- }
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceNativeContent");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, nativehandle)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && gIpcModule.appendUint(command, pixelFormat)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceRemoveNativeContent(t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceNativeContent");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceRemove(t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("RemoveSurface");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetVisibility(t_ilm_surface surfaceId, t_ilm_bool newVisibility)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceVisibility");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendBool(command, newVisibility)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetVisibility(t_ilm_surface surfaceId, t_ilm_bool *pVisibility)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfaceVisibility");
- if (pVisibility
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getBool(response, pVisibility))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetOpacity(t_ilm_surface surfaceId, t_ilm_float opacity)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceOpacity");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendDouble(command, opacity)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetOpacity(t_ilm_surface surfaceId, t_ilm_float *pOpacity)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfaceOpacity");
- if (pOpacity
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getDouble(response, pOpacity))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceSourceRegion");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, x)
- && gIpcModule.appendUint(command, y)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceDestinationRegion");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, x)
- && gIpcModule.appendUint(command, y)
- && gIpcModule.appendUint(command, width)
- && gIpcModule.appendUint(command, height)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfaceDimension");
- if (pDimension
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, &pDimension[0])
- && gIpcModule.getUint(response, &pDimension[1]))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceDimension");
- if (pDimension
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, pDimension[0])
- && gIpcModule.appendUint(command, pDimension[1])
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfacePosition");
- if (pPosition
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, &pPosition[0])
- && gIpcModule.getUint(response, &pPosition[1]))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfacePosition");
- if (pPosition
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, pPosition[0])
- && gIpcModule.appendUint(command, pPosition[1])
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetOrientation(t_ilm_surface surfaceId, ilmOrientation orientation)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceOrientation");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, orientation)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetOrientation(t_ilm_surface surfaceId, ilmOrientation *pOrientation)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfaceOrientation");
- if (pOrientation
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pOrientation))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceGetPixelformat(t_ilm_layer surfaceId, ilmPixelFormat *pPixelformat)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetSurfacePixelformat");
- if (pPixelformat
- && command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pPixelformat))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetSurfaceChromaKey");
- if (command
- && gIpcModule.appendUint(command, surfaceId))
- {
- t_ilm_bool comResult = ILM_TRUE;
-
- /* Checking pColor has a content, otherwise chromakey is disabled */
- if (pColor)
- {
- const t_ilm_uint number = 3;
- comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
- }
- if (comResult
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_displaySetRenderOrder(t_ilm_display display, t_ilm_layer *pLayerId, const t_ilm_uint number)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetRenderOrderOfLayers");
- if (pLayerId
- && command
- && gIpcModule.appendUintArray(command, pLayerId, number)
- && gIpcModule.appendUint(command, display)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetScreenIDs");
- if (pNumberOfIDs && ppIDs
- && command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, ppIDs, (t_ilm_int *)pNumberOfIDs))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_takeScreenshot(t_ilm_uint screen, t_ilm_const_string filename)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ScreenShot");
- if (command
- && gIpcModule.appendUint(command, screen)
- && gIpcModule.appendString(command, filename)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_takeLayerScreenshot(t_ilm_const_string filename, t_ilm_layer layerid)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ScreenShotOfLayer");
- if (command
- && gIpcModule.appendString(command, filename)
- && gIpcModule.appendUint(command, layerid)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_takeSurfaceScreenshot(t_ilm_const_string filename, t_ilm_surface surfaceid)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("ScreenShotOfSurface");
- if (command
- && gIpcModule.appendString(command, filename)
- && gIpcModule.appendUint(command, surfaceid)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetKeyboardFocusOn");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetKeyboardFocusSurfaceId");
- if (command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pSurfaceId))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInputDevice devices, t_ilm_bool acceptance)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("UpdateInputEventAcceptanceOn");
- if (command
- && gIpcModule.appendUint(command, surfaceId)
- && gIpcModule.appendUint(command, devices)
- && gIpcModule.appendBool(command, acceptance)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_SetOptimizationMode(ilmOptimization id, ilmOptimizationMode mode)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("SetOptimizationMode");
- if (command
- && gIpcModule.appendUint(command,id)
- && gIpcModule.appendUint(command,mode)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_GetOptimizationMode(ilmOptimization id, ilmOptimizationMode* pMode)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetOptimizationMode");
- if (command
- && gIpcModule.appendUint(command,id)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUint(response, pMode))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_commitChanges()
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("CommitChanges");
-
- if (command
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
- t_ilm_message response;
- t_ilm_message command;
-
- if (findLayerCallback(layer))
- {
- return ILM_ERROR_INVALID_ARGUMENTS;
- }
-
- response = 0;
- command = gIpcModule.createMessage("LayerAddNotification");
- if (command
- && gIpcModule.appendUint(command, layer)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- addLayerCallback(layer, callback);
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
- t_ilm_message response;
- t_ilm_message command;
-
- if (!findLayerCallback(layer))
- {
- return ILM_ERROR_INVALID_ARGUMENTS;
- }
-
- response = 0;
- command = gIpcModule.createMessage("LayerRemoveNotification");
- if (command
- && gIpcModule.appendUint(command, layer)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- removeLayerCallback(layer);
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificationFunc callback)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
- t_ilm_message response;
- t_ilm_message command;
-
- if (findSurfaceCallback(surface))
- {
- return ILM_ERROR_INVALID_ARGUMENTS;
- }
-
- response = 0;
- command = gIpcModule.createMessage("SurfaceAddNotification");
- if (command
- && gIpcModule.appendUint(command, surface)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- addSurfaceCallback(surface, callback);
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
- t_ilm_message response;
- t_ilm_message command;
-
- if (!findSurfaceCallback(surface))
- {
- return ILM_ERROR_INVALID_ARGUMENTS;
- }
-
- response = 0;
- command = gIpcModule.createMessage("SurfaceRemoveNotification");
- if (command
- && gIpcModule.appendUint(command, surface)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue))
- {
- removeSurfaceCallback(surface);
- returnValue = ILM_SUCCESS;
- }
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
-
-ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties)
-{
- ilmErrorTypes returnValue = ILM_FAILED;
-
- t_ilm_message response = 0;
- t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfScreen");
- if (pScreenProperties
- && command
- && gIpcModule.appendUint(command, screenID)
- && sendAndWaitForResponse(command, &response, gResponseTimeout, &returnValue)
- && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, (int*)(&pScreenProperties->layerCount))
- && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount)
- && gIpcModule.getUint(response, &pScreenProperties->screenWidth)
- && gIpcModule.getUint(response, &pScreenProperties->screenHeight))
- {
- returnValue = ILM_SUCCESS;
- }
- else
- {
- pScreenProperties->layerCount = 0;
- pScreenProperties->harwareLayerCount = 0;
- pScreenProperties->layerIds = NULL;
- pScreenProperties->screenWidth = 0;
- pScreenProperties->screenHeight = 0;
- }
-
- gIpcModule.destroyMessage(response);
- gIpcModule.destroyMessage(command);
- return returnValue;
-}
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2012,2013 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+ * Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
+ *
+ * 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.
+ *
+ ****************************************************************************/
+#include "ilm_client.h"
+
+ilmErrorTypes ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, struct ilmSurfaceProperties* pSurfaceProperties)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfSurface");
+
+ if (pSurfaceProperties
+ && command
+ && gIpcModule.appendUint(command, surfaceID)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getDouble(response, &pSurfaceProperties->opacity)
+ && gIpcModule.getUint(response, &pSurfaceProperties->sourceX)
+ && gIpcModule.getUint(response, &pSurfaceProperties->sourceY)
+ && gIpcModule.getUint(response, &pSurfaceProperties->sourceWidth)
+ && gIpcModule.getUint(response, &pSurfaceProperties->sourceHeight)
+ && gIpcModule.getUint(response, &pSurfaceProperties->origSourceWidth)
+ && gIpcModule.getUint(response, &pSurfaceProperties->origSourceHeight)
+ && gIpcModule.getUint(response, &pSurfaceProperties->destX)
+ && gIpcModule.getUint(response, &pSurfaceProperties->destY)
+ && gIpcModule.getUint(response, &pSurfaceProperties->destWidth)
+ && gIpcModule.getUint(response, &pSurfaceProperties->destHeight)
+ && gIpcModule.getUint(response, &pSurfaceProperties->orientation)
+ && gIpcModule.getBool(response, &pSurfaceProperties->visibility)
+ && gIpcModule.getUint(response, &pSurfaceProperties->frameCounter)
+ && gIpcModule.getUint(response, &pSurfaceProperties->drawCounter)
+ && gIpcModule.getUint(response, &pSurfaceProperties->updateCounter)
+ && gIpcModule.getUint(response, &pSurfaceProperties->pixelformat)
+ && gIpcModule.getUint(response, &pSurfaceProperties->nativeSurface)
+ && gIpcModule.getUint(response, &pSurfaceProperties->inputDevicesAcceptance)
+ && gIpcModule.getBool(response, &pSurfaceProperties->chromaKeyEnabled)
+ && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyRed)
+ && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyGreen)
+ && gIpcModule.getUint(response, &pSurfaceProperties->chromaKeyBlue)
+ && gIpcModule.getInt(response, &pSurfaceProperties->creatorPid))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+
+ilmErrorTypes ilm_getScreenResolution(t_ilm_uint screenID, t_ilm_uint* pWidth, t_ilm_uint* pHeight)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetScreenResolution");
+ if (pWidth && pHeight
+ && command
+ && gIpcModule.appendUint(command, screenID)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pWidth)
+ && gIpcModule.getUint(response, pHeight))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerAddSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("AddSurfaceToLayer");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerRemoveSurface(t_ilm_layer layerId, t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceFromLayer");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificationFunc callback)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+ t_ilm_message response;
+ t_ilm_message command;
+
+ if (findSurfaceCallback(surface))
+ {
+ return ILM_ERROR_INVALID_ARGUMENTS;
+ }
+
+ response = 0;
+ command = gIpcModule.createMessage("SurfaceAddNotification");
+ if (command
+ && gIpcModule.appendUint(command, surface)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ addSurfaceCallback(surface, callback);
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height,
+ ilmPixelFormat pixelFormat, t_ilm_surface* pSurfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ if (pSurfaceId && (INVALID_ID != *pSurfaceId))
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateSurfaceFromId");
+ if (command
+ && gIpcModule.appendUint(command, nativehandle)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && gIpcModule.appendUint(command, pixelFormat)
+ && gIpcModule.appendUint(command, *pSurfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pSurfaceId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ else
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateSurface");
+ if (command
+ && gIpcModule.appendUint(command, nativehandle)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && gIpcModule.appendUint(command, pixelFormat)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pSurfaceId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfaceDimension");
+ if (pDimension
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, &pDimension[0])
+ && gIpcModule.getUint(response, &pDimension[1]))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetVisibility(t_ilm_surface surfaceId, t_ilm_bool *pVisibility)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfaceVisibility");
+ if (pVisibility
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getBool(response, pVisibility))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceRemove(t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("RemoveSurface");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceRemoveNativeContent(t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("RemoveSurfaceNativeContent");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+ t_ilm_message response;
+ t_ilm_message command;
+
+ if (!findSurfaceCallback(surface))
+ {
+ return ILM_ERROR_INVALID_ARGUMENTS;
+ }
+
+ response = 0;
+ command = gIpcModule.createMessage("SurfaceRemoveNotification");
+ if (command
+ && gIpcModule.appendUint(command, surface)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ removeSurfaceCallback(surface);
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height,
+ ilmPixelFormat pixelFormat, t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceNativeContent");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, nativehandle)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && gIpcModule.appendUint(command, pixelFormat)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceSourceRegion");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, x)
+ && gIpcModule.appendUint(command, y)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInputDevice devices, t_ilm_bool acceptance)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("UpdateInputEventAcceptanceOn");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, devices)
+ && gIpcModule.appendBool(command, acceptance)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
--- /dev/null
+############################################################################
+#
+# Copyright 2010-2012 BMW Car IT 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.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+project(ilmCommon)
+project_type(CORE)
+
+find_package(Threads)
+
+include_directories(
+ "include"
+ "${CMAKE_SOURCE_DIR}/config"
+ "${CMAKE_SOURCE_DIR}/LayerManagerBase/include"
+ "${CMAKE_SOURCE_DIR}/LayerManagerUtils/include"
+)
+
+add_library(${PROJECT_NAME} STATIC
+ src/ilm_common.c
+ src/ilm_tools.c
+)
+
+add_dependencies(${PROJECT_NAME}
+ LayerManagerUtils
+)
+
+set(LIBS
+ ${LIBS}
+ LayerManagerUtils
+ rt
+ dl
+ ${CMAKE_THREAD_LIBS_INIT}
+)
+
+target_link_libraries(${PROJECT_NAME} ${LIBS} -ldl)
+
+#install (
+# TARGETS ${PROJECT_NAME}
+# LIBRARY DESTINATION lib
+#)
+
+install (
+ FILES include/ilm_common.h
+ include/ilm_types.h
+ include/ilm_client_platform.h
+ DESTINATION include/ilm
+)
+
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2010,2011 BMW Car IT GmbH
+* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
+*
+*
+* 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_COMMON_H_
+#define _ILM_COMMON_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "ilm_types.h"
+#include "ilm_configuration.h"
+#include "ilm_tools.h"
+
+extern struct IpcModule gIpcModule;
+
+/**
+ * \brief Initializes the IVI LayerManagement Client.
+ * \ingroup ilmCommon
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if a connection can not be established to the services.
+ */
+ilmErrorTypes ilm_init();
+
+/**
+ * \brief Returns initialization state of the IVI LayerManagement Client.
+ * \ingroup ilmCommon
+ * \return true if client library is initialized
+ * \return false if client library is not initialized
+ */
+t_ilm_bool ilm_isInitialized();
+
+/**
+ * \brief Commit all changes and execute all enqueued commands since last commit.
+ * \ingroup ilmCommon
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_commitChanges();
+
+/**
+ * \brief Destroys the IVI LayerManagement Client.
+ * \ingroup ilmCommon
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not be closed or was not initialized.
+ */
+ilmErrorTypes ilm_destroy();
+
+
+
+#ifdef __cplusplus
+} /**/
+#endif /* __cplusplus */
+
+#endif /* _ILM_COMMON_H_ */
+
+
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2013 BMW Car IT 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_CONFIGURATION_H_
+#define _ILM_CONFIGURATION_H_
+
+#include "IpcModuleLoader.h"
+
+/*
+ * in ms, negative value for infinite
+ */
+#define RECEIVE_TIMEOUT_IN_MS -1
+
+/*
+ * in ms
+ */
+#define RESPONSE_TIMEOUT_IN_MS 500
+
+/*
+ * must be same as GraphicalObject::INVALID_ID, but this is defined in C++
+ * and can not be used here
+ */
+#define INVALID_ID 0xFFFFFFFF
+
+/*
+ * maximum number of registered notification callbacks
+ */
+#define MAX_CALLBACK_COUNT 16
+
+/*
+ * internal thread synchronized queue
+ */
+#define MAX_THREAD_SYNC_QUEUE_SIZE 4
+
+/*
+ * exported from ilm_common.h, shared for all client APIs
+ */
+extern struct IpcModule gIpcModule;
+
+#endif /* _ILM_CONFIGURATION_H_ */
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2013 BMW Car IT 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_TOOLS_H_
+#define _ILM_TOOLS_H_
+
+#include "ilm_configuration.h"
+#include "ilm_types.h"
+#include <pthread.h>
+#include <semaphore.h>
+
+/*
+ *=============================================================================
+ * Implementation of thread-safe circular queue for local use
+ *=============================================================================
+ */
+typedef struct
+{
+ pthread_mutex_t queueMutex;
+ sem_t readBlockSemaphore;
+
+ t_ilm_uint size;
+ t_ilm_uint maxSize;
+ t_ilm_uint readPos;
+ t_ilm_uint writePos;
+
+ t_ilm_message* messages;
+} t_ilm_msg_queue;
+
+extern t_ilm_msg_queue notificationQueue;
+extern t_ilm_msg_queue incomingQueue;
+extern pthread_mutex_t gSendReceiveLock;
+
+void init_msg_queue(t_ilm_msg_queue* pQueue, t_ilm_uint maxSize);
+t_ilm_bool msg_enqueue(t_ilm_msg_queue* pQueue, t_ilm_message message);
+t_ilm_message msg_dequeue(t_ilm_msg_queue* pQueue);
+void destroy_msg_queue(t_ilm_msg_queue* pQueue);
+
+/*
+ *=============================================================================
+ * notification callback management
+ *=============================================================================
+ */
+struct LayerCallback
+{
+ t_ilm_uint id;
+ layerNotificationFunc callback;
+};
+
+struct SurfaceCallback
+{
+ t_ilm_uint id;
+ surfaceNotificationFunc callback;
+};
+
+void initNotificationCallbacks();
+layerNotificationFunc getLayerNotificationCallback(t_ilm_layer layer);
+surfaceNotificationFunc getSurfaceNotificationCallback(t_ilm_surface surface);
+t_ilm_bool findLayerCallback(t_ilm_layer layer);
+t_ilm_bool addLayerCallback(t_ilm_layer layer, layerNotificationFunc func);
+t_ilm_bool findSurfaceCallback(t_ilm_surface surface);
+t_ilm_bool addSurfaceCallback(t_ilm_surface surface, surfaceNotificationFunc func);
+void removeLayerCallback(t_ilm_layer layer);
+void removeSurfaceCallback(t_ilm_surface layer);
+
+/*
+ *=============================================================================
+ * internal thread management
+ *=============================================================================
+ */
+void* notificationThreadLoop(void* param);
+void* receiveThreadLoop(void* param);
+
+/*
+ *=============================================================================
+ * receive with timeout
+ *=============================================================================
+ */
+void calculateTimeout(struct timeval* currentTime, int giventimeout, struct timespec* timeout);
+t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response, int timeoutInMs, ilmErrorTypes* error);
+
+#endif /* _ILM_TOOLS_H_ */
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2012 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+ * Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
+ *
+ * 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.
+ *
+ ****************************************************************************/
+#include "ilm_common.h"
+#include "ilm_tools.h"
+#include "ilm_types.h"
+#include "ilm_configuration.h"
+
+#include "IpcModuleLoader.h"
+#include "ObjectType.h"
+#include <pthread.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <semaphore.h>
+#include <unistd.h>
+
+/*
+ *=============================================================================
+ * global vars
+ *=============================================================================
+ */
+/* automatically gets assigned argv[0] */
+extern char *__progname;
+
+/* available to all client APIs, exported in ilm_common.h */
+struct IpcModule gIpcModule;
+
+/* internal use */
+static t_ilm_bool gInitialized = ILM_FALSE;
+static pthread_t gReceiveThread;
+static pthread_t gNotificationThread;
+
+/*
+ *=============================================================================
+ * implementation
+ *=============================================================================
+ */
+ilmErrorTypes ilm_init()
+{
+ ilmErrorTypes result = ILM_FAILED;
+ t_ilm_message response = 0;
+ t_ilm_message command;
+
+ if (gInitialized)
+ {
+ printf("ilm_init() was called, but ilmClientLib is already initialized. returning success, but initialization was skipped this time.\n");
+ return ILM_SUCCESS;
+ }
+
+ initNotificationCallbacks();
+
+ if (loadIpcModule(&gIpcModule))
+ {
+ int pid = getpid();
+
+ if (gIpcModule.initClientMode())
+ {
+ pthread_attr_t notificationThreadAttributes;
+ int ret;
+
+ result = ILM_SUCCESS;
+
+ init_msg_queue(¬ificationQueue, MAX_THREAD_SYNC_QUEUE_SIZE);
+
+ init_msg_queue(&incomingQueue, MAX_THREAD_SYNC_QUEUE_SIZE);
+
+ if (notificationQueue.maxSize == 0)
+ {
+ printf("failed to allocate queue\n");
+ return result;
+ }
+
+ pthread_mutex_init(&gSendReceiveLock, NULL);
+
+ pthread_attr_init(¬ificationThreadAttributes);
+ pthread_attr_setdetachstate(¬ificationThreadAttributes,
+ PTHREAD_CREATE_JOINABLE);
+
+ ret = pthread_create(&gReceiveThread,
+ ¬ificationThreadAttributes,
+ receiveThreadLoop,
+ NULL);
+ if (0 != ret)
+ {
+ result = ILM_FAILED;
+ printf("Failed to start internal receive thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
+ return result;
+ }
+
+ ret = pthread_create(&gNotificationThread,
+ ¬ificationThreadAttributes,
+ notificationThreadLoop,
+ NULL);
+ if (0 != ret)
+ {
+ result = ILM_FAILED;
+ printf("Failed to start internal notification thread. returned %d = %s\n", ret, (ret == EAGAIN ? "EAGAIN" : "EINVAL"));
+ return result;
+ }
+ }
+ else
+ {
+ result = ILM_FAILED;
+ printf("Failed to initialize Client Ipc Module");
+ return result;
+ }
+
+ command = gIpcModule.createMessage("ServiceConnect");
+ if (command
+ && gIpcModule.appendUint(command, pid)
+ && gIpcModule.appendString(command, __progname)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &result))
+ {
+ result = ILM_SUCCESS;
+ }
+ else
+ {
+ printf("Failed to connect to LayerManagerService.");
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+
+ gInitialized = (result == ILM_SUCCESS) ? ILM_TRUE : ILM_FALSE;
+
+ return result;
+}
+
+t_ilm_bool ilm_isInitialized()
+{
+ return gInitialized;
+}
+
+ilmErrorTypes ilm_commitChanges()
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CommitChanges");
+
+ if (command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_destroy()
+{
+ ilmErrorTypes result = ILM_FAILED;
+ void* threadReturnValue = NULL;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ServiceDisconnect");
+ if (command
+ && gIpcModule.appendUint(command, getpid())
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &result))
+ {
+ result = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+
+ /* cancel worker threads */
+ pthread_cancel(gReceiveThread);
+ pthread_cancel(gNotificationThread);
+
+ pthread_join(gReceiveThread, &threadReturnValue);
+ pthread_join(gNotificationThread, &threadReturnValue);
+
+ pthread_mutex_unlock(&gSendReceiveLock);
+
+ pthread_mutex_destroy(&gSendReceiveLock);
+
+ gIpcModule.destroy();
+
+ destroy_msg_queue(¬ificationQueue);
+ destroy_msg_queue(&incomingQueue);
+
+ gInitialized = ILM_FALSE;
+
+ return result;
+}
--- /dev/null
+#include "ilm_tools.h"
+#include "ilm_types.h"
+
+#include <stdlib.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <IpcModuleLoader.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+
+/* available to all client APIs, exported in ilm_tools.h */
+t_ilm_msg_queue notificationQueue;
+t_ilm_msg_queue incomingQueue;
+pthread_mutex_t gSendReceiveLock;
+
+/*
+ *=============================================================================
+ * Implementation of thread-safe circular queue for local use
+ *=============================================================================
+ */
+void init_msg_queue(t_ilm_msg_queue* pQueue, t_ilm_uint maxSize)
+{
+ pQueue->maxSize = maxSize;
+ pQueue->messages = malloc(sizeof(t_ilm_message) * maxSize);
+
+ pQueue->size = 0;
+ pQueue->readPos = 0;
+ pQueue->writePos = 0;
+
+ pthread_mutex_init(&pQueue->queueMutex, NULL);
+ sem_init(&pQueue->readBlockSemaphore, 0, 0);
+}
+
+t_ilm_bool msg_enqueue(t_ilm_msg_queue* pQueue, t_ilm_message message)
+{
+ pthread_mutex_lock(&pQueue->queueMutex);
+
+ if (pQueue->size < pQueue->maxSize)
+ {
+ ++pQueue->size;
+ pQueue->messages[pQueue->writePos] = message;
+ pQueue->writePos = (pQueue->writePos + 1) % pQueue->maxSize;
+
+ /* wakeup a blocked dequeue reqquest */
+ sem_post(&pQueue->readBlockSemaphore);
+
+ pthread_mutex_unlock(&pQueue->queueMutex);
+ return ILM_TRUE;
+ }
+
+ pthread_mutex_unlock(&pQueue->queueMutex);
+ return ILM_FALSE;
+}
+
+t_ilm_message msg_dequeue(t_ilm_msg_queue* pQueue)
+{
+ t_ilm_message result = NULL;
+ /* wait until a message is available */
+ sem_wait(&pQueue->readBlockSemaphore);
+
+ pthread_mutex_lock(&pQueue->queueMutex);
+
+ if (pQueue->size > 0)
+ {
+ --pQueue->size;
+ result = pQueue->messages[pQueue->readPos];
+ pQueue->readPos = (pQueue->readPos + 1) % pQueue->maxSize;
+ }
+
+ pthread_mutex_unlock(&pQueue->queueMutex);
+ return result;
+}
+
+
+void destroy_msg_queue(t_ilm_msg_queue* pQueue)
+{
+ if (pQueue->maxSize > 0)
+ {
+ pQueue->maxSize = 0;
+ pQueue->size = 0;
+ free(pQueue->messages);
+ }
+}
+
+
+
+/*
+ *=============================================================================
+ * notification management
+ *=============================================================================
+ */
+static struct LayerCallback gLayerNotificationCallbacks[MAX_CALLBACK_COUNT];
+static struct SurfaceCallback gSurfaceNotificationCallbacks[MAX_CALLBACK_COUNT];
+
+void initNotificationCallbacks()
+{
+ int i = 0;
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ gLayerNotificationCallbacks[i].id = INVALID_ID;
+ gLayerNotificationCallbacks[i].callback = NULL;
+ gSurfaceNotificationCallbacks[i].id = INVALID_ID;
+ gSurfaceNotificationCallbacks[i].callback = NULL;
+ }
+}
+
+layerNotificationFunc getLayerNotificationCallback(t_ilm_layer layer)
+{
+ int i = 0;
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gLayerNotificationCallbacks[i].id == layer)
+ {
+ return gLayerNotificationCallbacks[i].callback;
+ }
+ }
+ return NULL;
+}
+
+surfaceNotificationFunc getSurfaceNotificationCallback(t_ilm_surface surface)
+{
+ int i = 0;
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gSurfaceNotificationCallbacks[i].id == surface)
+ {
+ return gSurfaceNotificationCallbacks[i].callback;
+ }
+ }
+ return NULL;
+}
+
+t_ilm_bool findLayerCallback(t_ilm_layer layer)
+{
+ int i = 0;
+
+ /* try to overwrite existing entry for layer id */
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gLayerNotificationCallbacks[i].id == layer)
+ {
+ return ILM_TRUE;
+ }
+ }
+ return ILM_FALSE;
+}
+
+t_ilm_bool addLayerCallback(t_ilm_layer layer, layerNotificationFunc func)
+{
+ int i = 0;
+
+ if (findLayerCallback(layer))
+ {
+ return ILM_FALSE;
+ }
+
+ /* find free slot and store callback */
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gLayerNotificationCallbacks[i].id == INVALID_ID)
+ {
+ gLayerNotificationCallbacks[i].id = layer;
+ gLayerNotificationCallbacks[i].callback = func;
+ return ILM_TRUE;
+ }
+ }
+ printf("DbusIpcModule: addLayerCallback() failed. no free slots.");
+ return ILM_FALSE;
+}
+
+t_ilm_bool findSurfaceCallback(t_ilm_surface surface)
+{
+ int i = 0;
+
+ /* try to overwrite existing entry for layer id */
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gSurfaceNotificationCallbacks[i].id == surface)
+ {
+ return ILM_TRUE;
+ }
+ }
+ return ILM_FALSE;
+}
+
+t_ilm_bool addSurfaceCallback(t_ilm_surface surface, surfaceNotificationFunc func)
+{
+ int i = 0;
+
+ if (findSurfaceCallback(surface))
+ {
+ return ILM_FALSE;
+ }
+
+ /* find free slot and store callback */
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gSurfaceNotificationCallbacks[i].id == INVALID_ID)
+ {
+ gSurfaceNotificationCallbacks[i].id = surface;
+ gSurfaceNotificationCallbacks[i].callback = func;
+ return ILM_TRUE;
+ }
+ }
+ printf("DbusIpcModule: addSurfaceCallback() failed. no free slots.");
+ return ILM_FALSE;
+}
+
+void removeLayerCallback(t_ilm_layer layer)
+{
+ int i = 0;
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gLayerNotificationCallbacks[i].id == layer)
+ {
+ gLayerNotificationCallbacks[i].id = INVALID_ID;
+ gLayerNotificationCallbacks[i].callback = NULL;
+ return;
+ }
+ }
+}
+
+void removeSurfaceCallback(t_ilm_surface layer)
+{
+ int i = 0;
+ for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
+ {
+ if (gSurfaceNotificationCallbacks[i].id == layer)
+ {
+ gSurfaceNotificationCallbacks[i].id = INVALID_ID;
+ gSurfaceNotificationCallbacks[i].callback = NULL;
+ return;
+ }
+ }
+}
+
+
+/*
+ *=============================================================================
+ * handling of internal notification thread for dispatching notifications
+ * Note: notification callbacks may be blocked by client, but receive thread
+ * must not be blocked
+ *=============================================================================
+ */
+
+void* notificationThreadLoop(void* param)
+{
+ t_ilm_message notification;
+
+ (void)param;
+
+ while (NULL != (notification = msg_dequeue(¬ificationQueue)))
+ {
+ t_ilm_const_string name = gIpcModule.getMessageName(notification);
+
+ /* this depends on message name, but it is fast */
+ if ('L' == name[15])
+ {
+ t_ilm_uint id;
+ t_ilm_uint mask;
+ struct ilmLayerProperties properties;
+ layerNotificationFunc func;
+
+ gIpcModule.getUint(notification, &id);
+ gIpcModule.getUint(notification, &mask);
+ gIpcModule.getDouble(notification, &properties.opacity);
+ gIpcModule.getUint(notification, &properties.sourceX);
+ gIpcModule.getUint(notification, &properties.sourceY);
+ gIpcModule.getUint(notification, &properties.sourceWidth);
+ gIpcModule.getUint(notification, &properties.sourceHeight);
+ gIpcModule.getUint(notification, &properties.origSourceWidth);
+ gIpcModule.getUint(notification, &properties.origSourceHeight);
+ gIpcModule.getUint(notification, &properties.destX);
+ gIpcModule.getUint(notification, &properties.destY);
+ gIpcModule.getUint(notification, &properties.destWidth);
+ gIpcModule.getUint(notification, &properties.destHeight);
+ gIpcModule.getUint(notification, &properties.orientation);
+ gIpcModule.getBool(notification, &properties.visibility);
+ gIpcModule.getUint(notification, &properties.type);
+ gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
+ gIpcModule.getUint(notification, &properties.chromaKeyRed);
+ gIpcModule.getUint(notification, &properties.chromaKeyGreen);
+ gIpcModule.getUint(notification, &properties.chromaKeyBlue);
+ gIpcModule.getInt(notification, &properties.creatorPid);
+
+ func = getLayerNotificationCallback(id);
+ if (func)
+ {
+ (*func)(id, &properties, mask);
+ }
+ else
+ {
+ fprintf(stderr, "notification for layer %d received, but no callback set\n", id);
+ }
+ }
+
+ if ('S' == name[15])
+ {
+ t_ilm_uint id;
+ t_ilm_uint mask;
+ struct ilmSurfaceProperties properties;
+ surfaceNotificationFunc func;
+
+ gIpcModule.getUint(notification, &id);
+ gIpcModule.getUint(notification, &mask);
+ gIpcModule.getDouble(notification, &properties.opacity);
+ gIpcModule.getUint(notification, &properties.sourceX);
+ gIpcModule.getUint(notification, &properties.sourceY);
+ gIpcModule.getUint(notification, &properties.sourceWidth);
+ gIpcModule.getUint(notification, &properties.sourceHeight);
+ gIpcModule.getUint(notification, &properties.origSourceWidth);
+ gIpcModule.getUint(notification, &properties.origSourceHeight);
+ gIpcModule.getUint(notification, &properties.destX);
+ gIpcModule.getUint(notification, &properties.destY);
+ gIpcModule.getUint(notification, &properties.destWidth);
+ gIpcModule.getUint(notification, &properties.destHeight);
+ gIpcModule.getUint(notification, &properties.orientation);
+ gIpcModule.getBool(notification, &properties.visibility);
+ gIpcModule.getUint(notification, &properties.frameCounter);
+ gIpcModule.getUint(notification, &properties.drawCounter);
+ gIpcModule.getUint(notification, &properties.updateCounter);
+ gIpcModule.getUint(notification, &properties.pixelformat);
+ gIpcModule.getUint(notification, &properties.nativeSurface);
+ gIpcModule.getUint(notification, &properties.inputDevicesAcceptance);
+ gIpcModule.getBool(notification, &properties.chromaKeyEnabled);
+ gIpcModule.getUint(notification, &properties.chromaKeyRed);
+ gIpcModule.getUint(notification, &properties.chromaKeyGreen);
+ gIpcModule.getUint(notification, &properties.chromaKeyBlue);
+ gIpcModule.getInt(notification, &properties.creatorPid);
+
+ func = getSurfaceNotificationCallback(id);
+ if (func)
+ {
+ (*func)(id, &properties, mask);
+ }
+ else
+ {
+ fprintf(stderr, "notification for surface %d received, but no callback set\n", id);
+ }
+ }
+ gIpcModule.destroyMessage(notification);
+ }
+ return NULL;
+}
+
+
+/*
+ *=============================================================================
+ * handling of internal receive thread for event handling
+ *=============================================================================
+ */
+
+void* receiveThreadLoop(void* param)
+{
+ t_ilm_bool running = ILM_TRUE;
+
+ (void)param;
+
+ while (running)
+ {
+ t_ilm_message message = gIpcModule.receive(RECEIVE_TIMEOUT_IN_MS);
+ t_ilm_message_type messageType = gIpcModule.getMessageType(message);
+ switch (messageType)
+ {
+ case IpcMessageTypeNotification:
+ if (ILM_FALSE == msg_enqueue(¬ificationQueue, message))
+ {
+ if (EAGAIN == errno)
+ {
+ printf("Notification queue full, dropped notification %s\n", gIpcModule.getMessageName(message));
+ }
+ }
+ break;
+
+ case IpcMessageTypeCommand:
+ case IpcMessageTypeError:
+ if (ILM_FALSE == msg_enqueue(&incomingQueue, message))
+ {
+ if (EAGAIN == errno)
+ {
+ printf("Incoming queue full, dropped message %s\n", gIpcModule.getMessageName(message));
+ }
+ }
+ break;
+
+ case IpcMessageTypeNone:
+ break;
+
+ default:
+ printf("ilmClient: discarded unexpected message (type: %d)\n", (int)messageType);
+ gIpcModule.destroyMessage(message);
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+void calculateTimeout(struct timeval* currentTime, int giventimeout, struct timespec* timeout)
+{
+ /* nanoseconds is old value in nanoseconds + the given milliseconds as nanoseconds */
+ t_ilm_ulong newNanoSeconds = currentTime->tv_usec * 1000 + giventimeout * (1000 * 1000);
+
+ /* only use non full seconds, otherwise overflow! */
+ timeout->tv_nsec = newNanoSeconds % (1000000000);
+
+ /* new seconds are old seconds + full seconds from new nanoseconds part */
+ timeout->tv_sec = currentTime->tv_sec + (newNanoSeconds / 1000000000);
+}
+
+t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response, int timeoutInMs, ilmErrorTypes* error)
+{
+ t_ilm_message_type responseType = IpcMessageTypeNone;
+
+ struct timeval tv;
+ struct timespec ts;
+
+ (void)timeoutInMs; /* suppress warning */
+
+ gettimeofday(&tv, NULL);
+ calculateTimeout(&tv, 1000000, &ts);
+
+ *response = 0;
+
+ /* send / receive may only be performed by one thread at a time */
+ pthread_mutex_lock(&gSendReceiveLock);
+
+ if (gIpcModule.sendToService(command))
+ {
+ if (NULL == (*response = msg_dequeue(&incomingQueue)))
+ {
+ *error = ILM_ERROR_ON_CONNECTION;
+ }
+ else
+ {
+ responseType = gIpcModule.getMessageType(*response);
+ switch (responseType)
+ {
+ case IpcMessageTypeCommand:
+ break;
+
+ case IpcMessageTypeError:
+ gIpcModule.getUint(*response, error);
+ free(*response);
+ *response = 0;
+ break;
+
+ default:
+ fprintf(stderr, "waitForResponse: LayerManagerService returned unexpected message type %d\n", responseType);
+ free(*response);
+ *response = 0;
+ *error = ILM_ERROR_UNEXPECTED_MESSAGE;
+ break;
+ }
+ }
+ }
+ pthread_mutex_unlock(&gSendReceiveLock);
+
+ return (0 != *response);
+}
--- /dev/null
+############################################################################
+#
+# Copyright 2010-2012 BMW Car IT 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.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+project(ilmControl)
+project_type(CORE)
+
+find_package(Threads)
+
+include_directories(
+ "include"
+ "${CMAKE_SOURCE_DIR}/config"
+ "${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmCommon/include"
+ "${CMAKE_SOURCE_DIR}/LayerManagerBase/include"
+ "${CMAKE_SOURCE_DIR}/LayerManagerUtils/include"
+)
+
+add_library(${PROJECT_NAME} SHARED
+ src/ilm_control.c
+)
+
+add_dependencies(${PROJECT_NAME}
+ LayerManagerUtils
+ ilmCommon
+)
+
+set(LIBS
+ ${LIBS}
+ LayerManagerUtils
+ ilmCommon
+ rt
+ dl
+ ${CMAKE_THREAD_LIBS_INIT}
+)
+
+target_link_libraries(${PROJECT_NAME} ${LIBS})
+
+install (
+ TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION lib
+)
+
+install (
+ FILES include/ilm_control.h
+ DESTINATION include/ilm
+)
+
+add_subdirectory(tests)
--- /dev/null
+/***************************************************************************
+*
+* Copyright 2010,2011 BMW Car IT GmbH
+* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
+*
+*
+* 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_CONTROL_H_
+#define _ILM_CONTROL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "ilm_common.h"
+
+/**
+ * \brief Get the layer properties from the Layermanagement
+ * \ingroup ilmControl
+ * \param[in] layerID layer Indentifier as a Number from 0 .. MaxNumber of Layer
+ * \param[out] pLayerProperties pointer where the layer properties should be stored
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not get the resolution.
+ */
+ilmErrorTypes ilm_getPropertiesOfLayer(t_ilm_uint layerID, struct ilmLayerProperties* pLayerProperties);
+
+/**
+ * \brief Get the screen properties from the Layermanagement
+ * \ingroup ilmControl
+ * \param[in] screenID screen Indentifier
+ * \param[out] pScreenProperties pointer where the screen properties should be stored
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not get the resolution.
+ */
+ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties);
+
+/**
+ * \brief Get the number of hardware layers of a screen
+ * \ingroup ilmControl
+ * \param[in] screenID id of the screen, where the number of Hardware Layers should be returned
+ * \param[out] pNumberOfHardwareLayers pointer where the number of hardware layers should be stored
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not get the resolution.
+ */
+ilmErrorTypes ilm_getNumberOfHardwareLayers(t_ilm_uint screenID, t_ilm_uint* pNumberOfHardwareLayers);
+
+/**
+ * \brief Get the screen Ids
+ * \ingroup ilmControl
+ * \param[out] pNumberOfIDs pointer where the number of Screen Ids should be returned
+ * \param[out] ppIDs pointer to array where the IDs should be stored
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not get the resolution.
+ */
+ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs);
+
+/**
+ * \brief Get all LayerIds which are currently registered and managed by the services
+ * \ingroup ilmControl
+ * \param[out] pLength Pointer where length of ids array should be stored
+ * \param[out] ppArray Array where the ids should be stored,
+ * the array will be allocated inside
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength,t_ilm_layer** ppArray);
+
+/**
+ * \brief Get all LayerIds of the given screen
+ * \ingroup ilmControl
+ * \param[in] screenID The id of the screen to get the layer IDs of
+ * \param[out] pLength Pointer where length of ids array should be stored
+ * \param[out] ppArray Array where the ids should be stored,
+ * the array will be allocated inside
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenID, t_ilm_int* pLength,t_ilm_layer** ppArray);
+
+/**
+ * \brief Get all SurfaceIDs which are currently registered and managed by the services
+ * \ingroup ilmControl
+ * \param[out] pLength Pointer where length of ids array should be stored
+ * \param[out] ppArray Array where the ids should be stored,
+ * the array will be allocated inside
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength,t_ilm_surface** ppArray);
+
+/**
+ * \brief Get all SurfaceIds which are currently registered to a given layer and are managed by the services
+ * \ingroup ilmControl
+ * \param[in] layer Id of the Layer whose surfaces are to be returned
+ * \param[out] pLength Pointer where the array length of ids should be stored
+ * \param[out] ppArray Array where the surface id should be stored,
+ * the array will be allocated inside
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer,t_ilm_int* pLength,t_ilm_surface** ppArray);
+
+/**
+ * \brief Create a layer which should be managed by the service
+ * \deprecated Will be removed in later version please use ilm_layerCreateWithDimension
+ * \ingroup ilmControl
+ * \param[out] pLayerId pointer where the id should be/is stored. It is possible
+ * to set a id from outside, 0 will create a new id.
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerCreate(t_ilm_layer* pLayerId);
+
+/**
+ * \brief Create a layer which should be managed by the service
+ * \ingroup ilmControl
+ * \param[out] pLayerId pointer where the id should be/is stored. It is possible
+ * to set a id from outside, 0 will create a new id.
+ *\param[in] width horizontal dimension of the layer
+ *
+ * \param[in] height vertical dimension of the layer
+ *
+*
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerCreateWithDimension(t_ilm_layer* pLayerId, t_ilm_uint width, t_ilm_uint height);
+
+/**
+ * \brief Removes a layer which is currently managed by the service
+ * \ingroup ilmControl
+ * \param[in] layerId Layer to be removed
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerRemove(t_ilm_layer layerId);
+
+/**
+ * \brief Get the current type of the layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer.
+ * \param[out] pLayerType pointer to the layerType where the result should be stored.
+ * \note ilmLayerType for information on supported types
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetType(t_ilm_layer layerId, ilmLayerType* pLayerType);
+
+/**
+ * \brief Set the visibility of a layer. If a layer is not visible, the layer and its
+ * surfaces will not be rendered.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer.
+ * \param[in] newVisibility ILM_SUCCESS sets layer visible, ILM_FALSE disables the visibility.
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibility);
+
+/**
+ * \brief Get the visibility of a layer. If a layer is not visible, the layer and its
+ * surfaces will not be rendered.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[out] pVisibility pointer where the visibility of the layer should be stored
+ * ILM_SUCCESS if the Layer is visible,
+ * ILM_FALSE if the visibility is disabled.
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId,t_ilm_bool *pVisibility);
+
+/**
+ * \brief Set the opacity of a layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer.
+ * \param[in] opacity 0.0 means the layer is fully transparent,
+ * 1.0 means the layer is fully opaque
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetOpacity(t_ilm_layer layerId, t_ilm_float opacity);
+
+/**
+ * \brief Get the opacity of a layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer to obtain the opacity of.
+ * \param[out] pOpacity pointer where the layer opacity should be stored.
+ * 0.0 means the layer is fully transparent,
+ * 1.0 means the layer is fully opaque
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetOpacity(t_ilm_layer layerId, t_ilm_float *pOpacity);
+
+/**
+ * \brief Set the area of a layer which should be used for the rendering. Only this part will be visible.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer.
+ * \param[in] x horizontal start position of the used area
+ * \param[in] y vertical start position of the used area
+ * \param[in] width width of the area
+ * \param[in] height height of the area
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetSourceRectangle(t_ilm_layer layerId, t_ilm_uint x, t_ilm_uint y, t_ilm_uint width, t_ilm_uint height);
+
+/**
+ * \brief Set the destination area on the display for a layer. The layer will be scaled and positioned to this rectangle for rendering
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer.
+ * \param[in] x horizontal start position of the used area
+ * \param[in] y vertical start position of the used area
+ * \param[in] width width of the area
+ * \param[in] height height of the area
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetDestinationRectangle(t_ilm_layer layerId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
+
+/**
+ * \brief Get the horizontal and vertical dimension of the layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[out] pDimension pointer to an array where the dimension should be stored.
+ * dimension[0]=width, dimension[1]=height
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension);
+
+/**
+ * \brief Set the horizontal and vertical dimension of the layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[in] pDimension pointer to an array where the dimension is stored.
+ * dimension[0]=width, dimension[1]=height
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension);
+
+/**
+ * \brief Get the horizontal and vertical position of the layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[out] pPosition pointer to an array where the position should be stored.
+ * dimension[0]=width, dimension[1]=height
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition);
+
+/**
+ * \brief Sets the horizontal and vertical position of the layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[in] pPosition pointer to an array where the position is stored.
+ * dimension[0]=x, dimension[1]=y
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition);
+
+/**
+ * \brief Sets the orientation of a layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[in] orientation Orientation of the layer.
+ * \note ilmOrientation for more information on orientation values
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetOrientation(t_ilm_layer layerId, ilmOrientation orientation);
+
+/**
+ * \brief Gets the orientation of a layer.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[out] pOrientation Address where orientation of the layer should be stored.
+ * \note ilmOrientation for more information on orientation values
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetOrientation(t_ilm_layer layerId, ilmOrientation *pOrientation);
+
+/**
+ * \brief Sets the color value which defines the transparency value.
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[in] pColor array of the color value which is defined in red,green, blue
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor);
+
+/**
+ * \brief Sets render order of surfaces within one layer
+ * \ingroup ilmControl
+ * \param[in] layerId Id of layer.
+ * \param[in] pSurfaceId array of surface ids
+ * \param[in] number Number of elements in the given array of ids
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number);
+
+/**
+ * \brief Get the capabilities of a layer
+ * \ingroup ilmControl
+ * \param[in] layerId Id of the layer to obtain the capabilities of
+ * \param[out] pCapabilities The address where the capabilites are returned
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerGetCapabilities(t_ilm_layer layerId, t_ilm_layercapabilities *pCapabilities);
+
+/**
+ * \brief Get the possible capabilities of a layertype
+ * \ingroup ilmControl
+ * \param[in] layerType The layertype to obtain the capabilities of
+ * \param[out] pCapabilities The address where the capabilites are returned
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_layerTypeGetCapabilities(ilmLayerType layerType, t_ilm_layercapabilities *pCapabilities);
+
+/**
+ * \brief Create the logical surface, which has no native buffer associated
+ * \ingroup ilmControl
+ * \param[in] pSurfaceId The value pSurfaceId points to is used as ID for new surface;
+ * \param[out] pSurfaceId The ID of the newly created surface is returned in this parameter
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceInitialize(t_ilm_surface *pSurfaceId);
+
+/**
+ * \brief Set the visibility of a surface. If a surface is not visible it will not be rendered.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of the surface to set the visibility of
+ * \param[in] newVisibility ILM_SUCCESS sets surface visible, ILM_FALSE disables the visibility.
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetVisibility(t_ilm_surface surfaceId, t_ilm_bool newVisibility);
+
+/**
+ * \brief Set the opacity of a surface.
+ * \ingroup ilmControl
+ * \param surfaceId Id of the surface to set the opacity of.
+ * \param opacity 0.0 means the surface is fully transparent,
+ * 1.0 means the surface is fully opaque
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetOpacity(const t_ilm_surface surfaceId, t_ilm_float opacity);
+
+/**
+ * \brief Get the opacity of a surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of the surface to get the opacity of.
+ * \param[out] pOpacity pointer where the surface opacity should be stored.
+ * 0.0 means the surface is fully transparent,
+ * 1.0 means the surface is fully opaque
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceGetOpacity(const t_ilm_surface surfaceId, t_ilm_float *pOpacity);
+
+/**
+ * \brief Set the keyboard focus on a certain surface
+ * To receive keyboard events, 2 conditions must be fulfilled:
+ * 1- The surface must accept events from keyboard. See ilm_UpdateInputEventAcceptanceOn
+ * 2- The keyboard focus must be set on that surface
+ *
+ * \ingroup ilmControl
+ * \param[in] surfaceId Identifier of the surface to set the keyboard focus on.
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId);
+
+/**
+ * \brief Get the indentifier of the surface which hold the keyboard focus
+ *
+ * \ingroup ilmControl
+ * \param[out] pSurfaceId Pointer on the a surface identifier
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId);
+
+/**
+ * \brief Set the destination area of a surface within a layer for rendering. The surface will be scaled to this rectangle for rendering.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[in] x horizontal start position of the used area
+ * \param[in] y vertical start position of the used area
+ * \param[in] width width of the area
+ * \param[in] height height of the area
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height);
+
+/**
+ * \brief Set the horizontal and vertical dimension of the surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[in] pDimension pointer to an array where the dimension is stored.
+ * dimension[0]=width, dimension[1]=height
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension);
+
+/**
+ * \brief Get the horizontal and vertical position of the surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[out] pPosition pointer to an array where the position should be stored.
+ * position[0]=x, position[1]=y
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceGetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition);
+
+/**
+ * \brief Sets the horizontal and vertical position of the surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[in] pPosition pointer to an array where the position is stored.
+ * position[0]=x, position[1]=y
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition);
+
+/**
+ * \brief Sets the orientation of a surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[in] orientation Orientation of the surface.
+ * \note ilmOrientation for information about orientation values
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetOrientation(t_ilm_surface surfaceId, ilmOrientation orientation);
+
+/**
+ * \brief Gets the orientation of a surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[out] pOrientation Address where orientation of the surface should be stored.
+ * \note ilmOrientation for information about orientation values
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceGetOrientation(t_ilm_surface surfaceId, ilmOrientation *pOrientation);
+
+/**
+ * \brief Gets the pixelformat of a surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of surface.
+ * \param[out] pPixelformat Pointer where the pixelformat of the surface should be stored
+ * \note ilmPixelFormat for information about pixel format values
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceGetPixelformat(t_ilm_layer surfaceId, ilmPixelFormat *pPixelformat);
+
+/**
+ * \brief Sets the color value which defines the transparency value of a surface.
+ * \ingroup ilmControl
+ * \param[in] surfaceId Id of the surface to set the chromakey of.
+ * \param[in] pColor array of the color value which is defined in red, green, blue
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor);
+
+/**
+ * \brief Sets render order of layers on a display
+ * \ingroup ilmControl
+ * \param[in] display Id of display to set the given order of layers.
+ * \param[in] pLayerId array of layer ids
+ * \param[in] number number of layerids in the given array
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_displaySetRenderOrder(t_ilm_display display, t_ilm_layer *pLayerId, const t_ilm_uint number);
+
+/**
+ * \brief Take a screenshot from the current displayed layer scene.
+ * The screenshot is saved as bmp file with the corresponding filename.
+ * \ingroup ilmControl
+ * \param[in] screen Id of screen where screenshot should be taken
+ * \param[in] filename Location where the screenshot should be stored
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_takeScreenshot(t_ilm_uint screen, t_ilm_const_string filename);
+
+/**
+ * \brief Take a screenshot of a certain layer
+ * The screenshot is saved as bmp file with the corresponding filename.
+ * \ingroup ilmControl
+ * \param[in] filename Location where the screenshot should be stored
+ * \param[in] layerid Identifier of the layer to take the screenshot of
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_takeLayerScreenshot(t_ilm_const_string filename, t_ilm_layer layerid);
+
+/**
+ * \brief Take a screenshot of a certain surface
+ * The screenshot is saved as bmp file with the corresponding filename.
+ * \ingroup ilmControl
+ * \param[in] filename Location where the screenshot should be stored
+ * \param[in] surfaceid Identifier of the surface to take the screenshot of
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_takeSurfaceScreenshot(t_ilm_const_string filename, t_ilm_surface surfaceid);
+
+/**
+ * \brief Enable or disable a rendering optimization
+ *
+ * \ingroup ilmControl
+ * \param[in] id which optimization to change
+ * \param[in] mode the mode to set on the optimzation (e.g. ON, OFF, AUTO)
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_SetOptimizationMode(ilmOptimization id, ilmOptimizationMode mode);
+
+/**
+ * \brief Get the current enablement for an optimization
+ *
+ * \ingroup ilmControl
+ * \param[in] id which optimization to query
+ * \param[out] mode current optimization mode
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_GetOptimizationMode(ilmOptimization id, ilmOptimizationMode* mode);
+
+/**
+ * \brief register for notification on property changes of layer
+ * \ingroup ilmControl
+ * \param[in] layer id of layer to register for notification
+ * \param[in] callback pointer to function to be called for notification
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ * \return ILM_ERROR_INVALID_ARGUMENT if the given layer already has notification callback registered
+ */
+ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback);
+
+/**
+ * \brief remove notification on property changes of layer
+ * \ingroup ilmControl
+ * \param[in] layer id of layer to remove notification
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ * \return ILM_ERROR_INVALID_ARGUMENT if the given layer has no notification callback registered
+ */
+ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer);
+
+#ifdef __cplusplus
+} /**/
+#endif /* __cplusplus */
+
+#endif /* _ILM_CONTROL_H_ */
+
+
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2012 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+ * Copyright (C) 2012 Bayerische Motorenwerke Aktiengesellschaft
+ *
+ * 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.
+ *
+ ****************************************************************************/
+#include "ilm_common.h"
+
+ilmErrorTypes ilm_getPropertiesOfLayer(t_ilm_uint layerID, struct ilmLayerProperties* pLayerProperties)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfLayer");
+ if (pLayerProperties
+ && command
+ && gIpcModule.appendUint(command, layerID)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getDouble(response, &pLayerProperties->opacity)
+ && gIpcModule.getUint(response, &pLayerProperties->sourceX)
+ && gIpcModule.getUint(response, &pLayerProperties->sourceY)
+ && gIpcModule.getUint(response, &pLayerProperties->sourceWidth)
+ && gIpcModule.getUint(response, &pLayerProperties->sourceHeight)
+ && gIpcModule.getUint(response, &pLayerProperties->origSourceWidth)
+ && gIpcModule.getUint(response, &pLayerProperties->origSourceHeight)
+ && gIpcModule.getUint(response, &pLayerProperties->destX)
+ && gIpcModule.getUint(response, &pLayerProperties->destY)
+ && gIpcModule.getUint(response, &pLayerProperties->destWidth)
+ && gIpcModule.getUint(response, &pLayerProperties->destHeight)
+ && gIpcModule.getUint(response, &pLayerProperties->orientation)
+ && gIpcModule.getBool(response, &pLayerProperties->visibility)
+ && gIpcModule.getUint(response, &pLayerProperties->type)
+ && gIpcModule.getBool(response, &pLayerProperties->chromaKeyEnabled)
+ && gIpcModule.getUint(response, &pLayerProperties->chromaKeyRed)
+ && gIpcModule.getUint(response, &pLayerProperties->chromaKeyGreen)
+ && gIpcModule.getUint(response, &pLayerProperties->chromaKeyBlue)
+ && gIpcModule.getInt(response, &pLayerProperties->creatorPid))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfScreen");
+ if (pScreenProperties
+ && command
+ && gIpcModule.appendUint(command, screenID)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, (int*)(&pScreenProperties->layerCount))
+ && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount)
+ && gIpcModule.getUint(response, &pScreenProperties->screenWidth)
+ && gIpcModule.getUint(response, &pScreenProperties->screenHeight))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ else
+ {
+ pScreenProperties->layerCount = 0;
+ pScreenProperties->harwareLayerCount = 0;
+ pScreenProperties->layerIds = NULL;
+ pScreenProperties->screenWidth = 0;
+ pScreenProperties->screenHeight = 0;
+ }
+
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getNumberOfHardwareLayers(t_ilm_uint screenID, t_ilm_uint* pNumberOfHardwareLayers)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetNumberOfHardwareLayers");
+ if (pNumberOfHardwareLayers
+ && command
+ && gIpcModule.appendUint(command, screenID)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pNumberOfHardwareLayers))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetScreenIDs");
+ if (pNumberOfIDs && ppIDs
+ && command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, ppIDs, (t_ilm_int *)pNumberOfIDs))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength, t_ilm_layer** ppArray)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDS");
+ if (pLength && ppArray
+ && command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, ppArray, pLength))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenId, t_ilm_int* pLength, t_ilm_layer** ppArray)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ListAllLayerIDsOnScreen");
+ if (pLength && ppArray
+ && command
+ && gIpcModule.appendUint(command, screenId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, ppArray, pLength))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength, t_ilm_surface** ppArray)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ListAllSurfaceIDS");
+ if (pLength && ppArray
+ && command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, ppArray, pLength))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer, t_ilm_int* pLength, t_ilm_surface** ppArray)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ListSurfaceofLayer");
+ if (pLength && ppArray
+ && command
+ && gIpcModule.appendUint(command, layer)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUintArray(response, ppArray, pLength))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+
+ilmErrorTypes ilm_layerCreate(t_ilm_layer* pLayerId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ if (pLayerId && (INVALID_ID != *pLayerId))
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateLayerFromId");
+ if (command
+ && gIpcModule.appendUint(command, *pLayerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pLayerId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ else
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateLayer");
+ if (command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pLayerId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerCreateWithDimension(t_ilm_layer* pLayerId, t_ilm_uint width, t_ilm_uint height)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ if (pLayerId && (INVALID_ID != *pLayerId))
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateLayerFromIdWithDimension");
+ if (command
+ && gIpcModule.appendUint(command, *pLayerId)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pLayerId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ else
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("CreateLayerWithDimension");
+ if (command
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pLayerId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerRemove(t_ilm_layer layerId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("RemoveLayer");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetType(t_ilm_layer layerId, ilmLayerType* pLayerType)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerType");
+ if (pLayerType
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pLayerType))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibility)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerVisibility");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendBool(command, newVisibility)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId, t_ilm_bool *pVisibility)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerVisibility");
+ if (pVisibility
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getBool(response, pVisibility))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetOpacity(t_ilm_layer layerId, t_ilm_float opacity)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerOpacity");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendDouble(command, opacity)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetOpacity(t_ilm_layer layerId, t_ilm_float *pOpacity)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerOpacity");
+ if (pOpacity
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getDouble(response, pOpacity))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetSourceRectangle(t_ilm_layer layerId, t_ilm_uint x, t_ilm_uint y, t_ilm_uint width, t_ilm_uint height)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerSourceRegion");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUint(command, x)
+ && gIpcModule.appendUint(command, y)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetDestinationRectangle(t_ilm_layer layerId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerDestinationRegion");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUint(command, x)
+ && gIpcModule.appendUint(command, y)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerDimension");
+ if (pDimension
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, &pDimension[0])
+ && gIpcModule.getUint(response, &pDimension[1]))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetDimension(t_ilm_layer layerId, t_ilm_uint *pDimension)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerDimension");
+ if (pDimension
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUint(command, pDimension[0])
+ && gIpcModule.appendUint(command, pDimension[1])
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerPosition");
+ if (pPosition
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, &pPosition[0])
+ && gIpcModule.getUint(response, &pPosition[1]))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetPosition(t_ilm_layer layerId, t_ilm_uint *pPosition)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerPosition");
+ if (pPosition
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUint(command, pPosition[0])
+ && gIpcModule.appendUint(command, pPosition[1])
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetOrientation(t_ilm_layer layerId, ilmOrientation orientation)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerOrientation");
+ if (command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUint(command, orientation)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetOrientation(t_ilm_layer layerId, ilmOrientation *pOrientation)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerOrientation");
+ if (pOrientation
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pOrientation))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetLayerChromaKey");
+ if (command
+ && gIpcModule.appendUint(command, layerId))
+ {
+ t_ilm_bool comResult = ILM_TRUE;
+
+ /* Checking pColor has a content, otherwise chromakey is disabled */
+ if (pColor)
+ {
+ const t_ilm_uint number = 3;
+ comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
+ }
+ if (comResult
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ }
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerSetRenderOrder(t_ilm_layer layerId, t_ilm_layer *pSurfaceId, t_ilm_int number)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceRenderOrderWithinLayer");
+ if (pSurfaceId
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && gIpcModule.appendUintArray(command, pSurfaceId, number)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerGetCapabilities(t_ilm_layer layerId, t_ilm_layercapabilities *pCapabilities)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayerCapabilities");
+ if (pCapabilities
+ && command
+ && gIpcModule.appendUint(command, layerId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pCapabilities))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerTypeGetCapabilities(ilmLayerType layerType, t_ilm_layercapabilities *pCapabilities)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetLayertypeCapabilities");
+ if (pCapabilities
+ && command
+ && gIpcModule.appendUint(command, layerType)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pCapabilities))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceInitialize(t_ilm_surface *pSurfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ if (pSurfaceId && (INVALID_ID != *pSurfaceId))
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("InitializeSurfaceFromId");
+ if (command
+ && gIpcModule.appendUint(command, *pSurfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pSurfaceId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ else
+ {
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("InitializeSurface");
+ if (command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pSurfaceId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ }
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetVisibility(t_ilm_surface surfaceId, t_ilm_bool newVisibility)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceVisibility");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendBool(command, newVisibility)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetOpacity(t_ilm_surface surfaceId, t_ilm_float opacity)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceOpacity");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendDouble(command, opacity)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetOpacity(t_ilm_surface surfaceId, t_ilm_float *pOpacity)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfaceOpacity");
+ if (pOpacity
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getDouble(response, pOpacity))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetKeyboardFocusOn");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetKeyboardFocusSurfaceId");
+ if (command
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pSurfaceId))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId, t_ilm_int x, t_ilm_int y, t_ilm_int width, t_ilm_int height)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceDestinationRegion");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, x)
+ && gIpcModule.appendUint(command, y)
+ && gIpcModule.appendUint(command, width)
+ && gIpcModule.appendUint(command, height)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetDimension(t_ilm_surface surfaceId, t_ilm_uint *pDimension)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceDimension");
+ if (pDimension
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, pDimension[0])
+ && gIpcModule.appendUint(command, pDimension[1])
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfacePosition");
+ if (pPosition
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, &pPosition[0])
+ && gIpcModule.getUint(response, &pPosition[1]))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetPosition(t_ilm_surface surfaceId, t_ilm_uint *pPosition)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfacePosition");
+ if (pPosition
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, pPosition[0])
+ && gIpcModule.appendUint(command, pPosition[1])
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetOrientation(t_ilm_surface surfaceId, ilmOrientation orientation)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceOrientation");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId)
+ && gIpcModule.appendUint(command, orientation)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetOrientation(t_ilm_surface surfaceId, ilmOrientation *pOrientation)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfaceOrientation");
+ if (pOrientation
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pOrientation))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceGetPixelformat(t_ilm_layer surfaceId, ilmPixelFormat *pPixelformat)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetSurfacePixelformat");
+ if (pPixelformat
+ && command
+ && gIpcModule.appendUint(command, surfaceId)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pPixelformat))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetSurfaceChromaKey");
+ if (command
+ && gIpcModule.appendUint(command, surfaceId))
+ {
+ t_ilm_bool comResult = ILM_TRUE;
+
+ /* Checking pColor has a content, otherwise chromakey is disabled */
+ if (pColor)
+ {
+ const t_ilm_uint number = 3;
+ comResult = gIpcModule.appendUintArray(command, (t_ilm_uint *)pColor, number);
+ }
+ if (comResult
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_displaySetRenderOrder(t_ilm_display display, t_ilm_layer *pLayerId, const t_ilm_uint number)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetRenderOrderOfLayers");
+ if (pLayerId
+ && command
+ && gIpcModule.appendUintArray(command, pLayerId, number)
+ && gIpcModule.appendUint(command, display)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_takeScreenshot(t_ilm_uint screen, t_ilm_const_string filename)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ScreenShot");
+ if (command
+ && gIpcModule.appendUint(command, screen)
+ && gIpcModule.appendString(command, filename)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_takeLayerScreenshot(t_ilm_const_string filename, t_ilm_layer layerid)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ScreenShotOfLayer");
+ if (command
+ && gIpcModule.appendString(command, filename)
+ && gIpcModule.appendUint(command, layerid)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_takeSurfaceScreenshot(t_ilm_const_string filename, t_ilm_surface surfaceid)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("ScreenShotOfSurface");
+ if (command
+ && gIpcModule.appendString(command, filename)
+ && gIpcModule.appendUint(command, surfaceid)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_SetOptimizationMode(ilmOptimization id, ilmOptimizationMode mode)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("SetOptimizationMode");
+ if (command
+ && gIpcModule.appendUint(command, id)
+ && gIpcModule.appendUint(command, mode)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_GetOptimizationMode(ilmOptimization id, ilmOptimizationMode* pMode)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+ t_ilm_message response = 0;
+ t_ilm_message command = gIpcModule.createMessage("GetOptimizationMode");
+ if (command
+ && gIpcModule.appendUint(command, id)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue)
+ && gIpcModule.getUint(response, pMode))
+ {
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+ t_ilm_message response;
+ t_ilm_message command;
+
+ if (findLayerCallback(layer))
+ {
+ return ILM_ERROR_INVALID_ARGUMENTS;
+ }
+
+ response = 0;
+ command = gIpcModule.createMessage("LayerAddNotification");
+ if (command
+ && gIpcModule.appendUint(command, layer)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ addLayerCallback(layer, callback);
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
+
+ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer)
+{
+ ilmErrorTypes returnValue = ILM_FAILED;
+ t_ilm_message response;
+ t_ilm_message command;
+
+ if (!findLayerCallback(layer))
+ {
+ return ILM_ERROR_INVALID_ARGUMENTS;
+ }
+
+ response = 0;
+ command = gIpcModule.createMessage("LayerRemoveNotification");
+ if (command
+ && gIpcModule.appendUint(command, layer)
+ && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue))
+ {
+ removeLayerCallback(layer);
+ returnValue = ILM_SUCCESS;
+ }
+ gIpcModule.destroyMessage(response);
+ gIpcModule.destroyMessage(command);
+ return returnValue;
+}
enable_testing()
- project(ilmClient_Test)
+ include_directories(
+ "${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmClient/include"
+ )
+
+ project(ilmControl_Test)
project_type(TEST)
set(LIBS
${LIBS}
ilmClient
+ ilmControl
)
add_executable(${PROJECT_NAME}
- IlmCommandTest.cpp
- IlmNotificationTest.cpp
+ ilm_control_test.cpp
+ ilm_control_notification_test.cpp
)
target_link_libraries(${PROJECT_NAME}
DESTINATION bin
)
- add_test(ilmClient ${PROJECT_NAME})
+ add_test(ilmControl ${PROJECT_NAME})
endif(WITH_TESTS)
\ No newline at end of file
extern "C" {
#include "ilm_client.h"
+ #include "ilm_control.h"
}
layer = 345;
ilm_layerRemove(layer);
ilm_commitChanges();
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
ilm_commitChanges();
// create a surface
surface = 456;
// create a layer
t_ilm_uint layer = 89;
- ASSERT_EQ(ILM_SUCCESS,ilm_layerCreate(&layer));
+ ASSERT_EQ(ILM_SUCCESS,ilm_layerCreateWithDimension(&layer, 800, 480));
ASSERT_EQ(ILM_SUCCESS,ilm_commitChanges());
// add notification
extern "C" {
#include "ilm_client.h"
+ #include "ilm_control.h"
}
class IlmCommandTest : public ::testing::Test {
TEST_F(IlmCommandTest, SetGetLayerDimension) {
uint layer = 4316;
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
t_ilm_uint dim[2] = {115,125};
ilm_layerSetDimension(layer,dim);
TEST_F(IlmCommandTest, SetGetLayerPosition) {
uint layer = 4316;
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
t_ilm_uint pos[2] = {115,125};
ilm_layerSetPosition(layer,pos);
TEST_F(IlmCommandTest, SetGetLayerOrientation) {
uint layer = 4316;
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
ilm_commitChanges();
ilmOrientation returned;
uint layer2 = 44;
t_ilm_float opacity;
- ilm_layerCreate(&layer1);
- ilm_layerCreate(&layer2);
+ ilm_layerCreateWithDimension(&layer1, 800, 480);
+ ilm_layerCreateWithDimension(&layer2, 800, 480);
ilm_layerSetOpacity(layer1,0.88);
ilm_commitChanges();
uint layer1 = 36;
t_ilm_bool visibility;
- ilm_layerCreate(&layer1);
+ ilm_layerCreateWithDimension(&layer1, 800, 480);
ilm_layerSetVisibility(layer1,ILM_TRUE);
ilm_commitChanges();
uint layer1 = 3246;
uint layer2 = 46586;
- ilm_layerCreate(&layer1);
- ilm_layerCreate(&layer2);
+ ilm_layerCreateWithDimension(&layer1, 800, 480);
+ ilm_layerCreateWithDimension(&layer2, 800, 480);
ilm_commitChanges();
t_ilm_int length;
t_ilm_layer layer2 = 46586;
t_ilm_uint roLength = 2;
t_ilm_layer idRenderOrder[2] = {layer1,layer2};
- ilm_layerCreate(&layer1);
- ilm_layerCreate(&layer2);
+ ilm_layerCreateWithDimension(&layer1, 800, 480);
+ ilm_layerCreateWithDimension(&layer2, 800, 480);
ilm_displaySetRenderOrder(0,idRenderOrder,roLength);
ilm_commitChanges();
TEST_F(IlmCommandTest, ilm_layerCreate_Remove) {
uint layer1 = 3246;
uint layer2 = 46586;
- ilm_layerCreate(&layer1);
- ilm_layerCreate(&layer2);
+ ilm_layerCreateWithDimension(&layer1, 800, 480);
+ ilm_layerCreateWithDimension(&layer2, 800, 480);
ilm_commitChanges();
t_ilm_int length;
TEST_F(IlmCommandTest, ilm_layerAddSurface_ilm_layerRemoveSurface_ilm_getSurfaceIDsOnLayer) {
uint layer = 3246;
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
uint surface1 = 3246;
uint surface2 = 46586;
ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface1);
TEST_F(IlmCommandTest, ilm_getPropertiesOfLayer_ilm_layerSetSourceRectangle_ilm_layerSetDestinationRectangle_ilm_layerSetChromaKey) {
t_ilm_uint layer;
t_ilm_int chromaKey[3] = {3, 22, 111};
- ilm_layerCreate(&layer);
+ ilm_layerCreateWithDimension(&layer, 800, 480);
ilm_commitChanges();
ilm_layerSetOpacity(layer,0.8765);
ilmScreenProperties screenProperties;
t_ilm_layer layerIds[3] = {100, 200, 300};//t_ilm_layer layerIds[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
- ilm_layerCreate(layerIds);
- ilm_layerCreate(layerIds + 1);
- ilm_layerCreate(layerIds + 2);
+ ilm_layerCreateWithDimension(layerIds, 800, 480);
+ ilm_layerCreateWithDimension(layerIds + 1, 800, 480);
+ ilm_layerCreateWithDimension(layerIds + 2, 800, 480);
ilm_commitChanges();
include_directories(
include
- "../../LayerManagerClient/ilmClient/include"
- "../../LayerManagerUtils/include"
+ "${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmClient/include"
+ "${CMAKE_SOURCE_DIR}/LayerManagerUtils/include"
)
add_executable(${PROJECT_NAME}
include_directories(
${CMAKE_SOURCE_DIR}/config
${CMAKE_SOURCE_DIR}/3rdParty
- ${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmClient/include
+ ${CMAKE_SOURCE_DIR}/LayerManagerClient/ilmCommon/include
)
/**
* \defgroup ServiceAPI Layer Management Service API
- * \defgroup ilmClient Layer Management Client API
- * \defgroup ilmControl Layer Management Control API
+ * \defgroup ilmCommon Layer Management Common API - API used by all clients implementing lifecycle and communication
+ * \defgroup ilmClient Layer Management Client API - API which each application (including HMI) has to use.
+ * \defgroup ilmControl Layer Management Control API - Special Control API which has to be used from the HMI/Tooling to control the composition.
* \defgroup SceneAPI Layer Management Scene API
* \defgroup RendererAPI Layer Management Renderer API
* \defgroup CommunicatorAPI Layer Management Communicator API