summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>2012-09-10 05:55:44 -0700
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>2012-10-02 01:19:01 -0700
commitf1e9369e2b4edb077e5684274b783c20d0fa628c (patch)
tree0ad3531035a620414a6d4f132a67872b717bab72
parent0976ad957fd5fa0f77759b9f0d084063518bd2fe (diff)
downloadlayer_management-f1e9369e2b4edb077e5684274b783c20d0fa628c.tar.gz
ilmClient: added notification API
added API functions for adding and removing notifications for layers and surfaces.
-rw-r--r--LayerManagerClient/ilmClient/include/ilm_client.h39
-rw-r--r--LayerManagerClient/ilmClient/include/ilm_types.h52
-rw-r--r--LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp9
3 files changed, 92 insertions, 8 deletions
diff --git a/LayerManagerClient/ilmClient/include/ilm_client.h b/LayerManagerClient/ilmClient/include/ilm_client.h
index 3fccaa9..d9c0777 100644
--- a/LayerManagerClient/ilmClient/include/ilm_client.h
+++ b/LayerManagerClient/ilmClient/include/ilm_client.h
@@ -856,6 +856,45 @@ ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInput
*/
ilmErrorTypes ilm_commitChanges();
+/**
+ * \brief register for notification on property changes of layer
+ * \ingroup ilmClient
+ * \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.
+ */
+ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback);
+
+/**
+ * \brief remove notification on property changes of layer
+ * \ingroup ilmClient
+ * \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.
+ */
+ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer);
+
+/**
+ * \brief register for notification on property changes of surface
+ * \ingroup ilmClient
+ * \param[in] surface id of surface 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.
+ */
+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.
+ */
+ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface);
+
+
#ifdef __cplusplus
} //
#endif // __cplusplus
diff --git a/LayerManagerClient/ilmClient/include/ilm_types.h b/LayerManagerClient/ilmClient/include/ilm_types.h
index ac85619..24e4928 100644
--- a/LayerManagerClient/ilmClient/include/ilm_types.h
+++ b/LayerManagerClient/ilmClient/include/ilm_types.h
@@ -23,6 +23,12 @@
#include "ilm_client_platform.h"
/**
+ * convenience macro to access single bits of a bitmask
+ */
+#define BIT(x) (1 << (x))
+
+
+/**
* \brief Represent the logical true value
* \ingroup ilmClient
**/
@@ -220,15 +226,51 @@ struct ilmLayerProperties
t_ilm_uint chromaKeyBlue; /*!< chromakey's blue value of the layer */
};
-
-enum IpcMessageType
+/**
+ * enum representing all possible incoming events for ilmClient and
+ * Communicator Plugin
+ */
+typedef enum e_t_ilm_message_type
{
IpcMessageTypeNone = 0,
IpcMessageTypeCommand,
- //IpcMessageTypeConnect,
+ IpcMessageTypeConnect,
IpcMessageTypeDisconnect,
IpcMessageTypeNotification,
- IpcMessageTypeError
-};
+ IpcMessageTypeError,
+ IpcMessageTypeShutdown
+} t_ilm_message_type;
+
+/**
+ * Typedef for opaque handling of client handles within an IpcModule
+ */
+typedef void* t_ilm_client_handle;
+
+/**
+ * enum representing the possible flags for changed properties in notification callbacks.
+ */
+typedef enum
+{
+ ILM_NOTIFICATION_VISIBILITY = BIT(1),
+ ILM_NOTIFICATION_OPACITY = BIT(2),
+ ILM_NOTIFICATION_ORIENTATION = BIT(3),
+ ILM_NOTIFICATION_SOURCE_RECT = BIT(4),
+ ILM_NOTIFICATION_DEST_RECT = BIT(5),
+ ILM_NOTIFICATION_ALL = 0xffff
+} t_ilm_notification_mask;
+
+/**
+ * Typedef for notification callback on property changes of a layer
+ */
+typedef void(*layerNotificationFunc)(t_ilm_layer layer,
+ struct ilmLayerProperties*,
+ t_ilm_notification_mask mask);
+
+/**
+ * Typedef for notification callback on property changes of a surface
+ */
+typedef void(*surfaceNotificationFunc)(t_ilm_surface surface,
+ struct ilmSurfaceProperties*,
+ t_ilm_notification_mask mask);
#endif // _ILM_TYPES_H_
diff --git a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
index 076eed3..6ce8529 100644
--- a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
+++ b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
@@ -43,12 +43,15 @@ public:
IlmCommandTest(){
}
- void SetUp() {
+ static void SetUpTestCase() {
ilm_init();
}
+ static void TearDownTestCase() {
+ ilm_destroy();
+ }
+
void TearDown() {
removeAll();
- ilm_destroy();
}
void removeAll(){
@@ -740,7 +743,7 @@ TEST_F(IlmCommandTest, ilm_takeScreenshot) {
ilm_takeScreenshot(0, "/tmp/test.bmp");
- usleep(50000); // TODO
+ sleep(1);
f = fopen("/tmp/test.bmp","r");
ASSERT_TRUE(f!=NULL);
fclose(f);