summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>2020-03-30 08:20:38 +0200
committerRajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>2020-07-08 07:24:38 +0200
commitcc70d5349a190ef73c5b1b4ad4caf2bf6e39dc8c (patch)
treee477b3b055e6c3302aad3f448a1307bb1ea12be5
parente63979fedeb5947ed8a7902ff57ec1137d8e739d (diff)
downloadwayland-ivi-extension-cc70d5349a190ef73c5b1b4ad4caf2bf6e39dc8c.tar.gz
ilmCommon: Implement a shutdown notification for ilm
Added new ilm API using which user could register for the shutdown notification. Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
-rw-r--r--ivi-layermanagement-api/ilmCommon/include/ilm_common.h13
-rw-r--r--ivi-layermanagement-api/ilmCommon/include/ilm_types.h17
-rw-r--r--ivi-layermanagement-api/ilmCommon/src/ilm_common.c9
3 files changed, 39 insertions, 0 deletions
diff --git a/ivi-layermanagement-api/ilmCommon/include/ilm_common.h b/ivi-layermanagement-api/ilmCommon/include/ilm_common.h
index fa86824..61e240a 100644
--- a/ivi-layermanagement-api/ilmCommon/include/ilm_common.h
+++ b/ivi-layermanagement-api/ilmCommon/include/ilm_common.h
@@ -65,6 +65,19 @@ t_ilm_bool ilm_isInitialized(void);
ilmErrorTypes ilm_commitChanges(void);
/**
+ * \brief register for notification on an event of ilm shutdown
+ * \ingroup ilmCommon
+ * \param[in] callback pointer to function to be called for notification
+ callback function is defined as:
+ void cb(t_ilm_shutdown_error_type error_type, int errornum, void *user_data)
+ * \param[in] user_data pointer to data which will be passed to a notification callback
+ * \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_registerShutdownNotification(shutdownNotificationFunc callback,
+ void *user_data);
+
+/**
* \brief Destroys the IVI LayerManagement Client.
* \ingroup ilmCommon
* \return ILM_SUCCESS if the method call was successful
diff --git a/ivi-layermanagement-api/ilmCommon/include/ilm_types.h b/ivi-layermanagement-api/ilmCommon/include/ilm_types.h
index a88f2b0..98a8e62 100644
--- a/ivi-layermanagement-api/ilmCommon/include/ilm_types.h
+++ b/ivi-layermanagement-api/ilmCommon/include/ilm_types.h
@@ -249,6 +249,16 @@ typedef enum
} t_ilm_notification_mask;
/**
+ * enum representing types of possible unrecoverable errors that could lead to ilm shutdown.
+ */
+typedef enum
+{
+ ILM_ERROR_WAYLAND = 1, /*!< ErrorCode if Wayland API returns an error */
+ ILM_ERROR_POLL = 2 /*!< ErrorCode if Poll returns an error */
+}t_ilm_shutdown_error_type;
+
+
+/**
* Typedef for notification callback on property changes of a layer
*/
typedef void(*layerNotificationFunc)(t_ilm_layer layer,
@@ -270,4 +280,11 @@ typedef void(*notificationFunc)(ilmObjectType object,
t_ilm_bool created,
void* user_data);
+/**
+ * Typedef for notification callback on ilm shutdown due to unrecoverable
+ * errors
+ */
+typedef void(*shutdownNotificationFunc)(t_ilm_shutdown_error_type error_type,
+ int errornum,
+ void* user_data);
#endif /* _ILM_TYPES_H_*/
diff --git a/ivi-layermanagement-api/ilmCommon/src/ilm_common.c b/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
index b4f8818..63342b9 100644
--- a/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
+++ b/ivi-layermanagement-api/ilmCommon/src/ilm_common.c
@@ -26,6 +26,9 @@
#include "ilm_types.h"
ILM_EXPORT ilmErrorTypes ilmControl_init(t_ilm_nativedisplay);
+ILM_EXPORT ilmErrorTypes ilmControl_registerShutdownNotification(
+ shutdownNotificationFunc callback,
+ void *user_data);
ILM_EXPORT void ilmControl_destroy(void);
static pthread_mutex_t g_initialize_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -98,6 +101,12 @@ ilm_isInitialized(void)
}
ILM_EXPORT ilmErrorTypes
+ilm_registerShutdownNotification(shutdownNotificationFunc callback, void *user_data)
+{
+ return ilmControl_registerShutdownNotification(callback, user_data);
+}
+
+ILM_EXPORT ilmErrorTypes
ilm_destroy(void)
{
ilmErrorTypes retVal;