add event_keep_last_event_data api 98/77798/9 submit/tizen/20160809.011327
authorJiwoong Im <jiwoong.im@samsung.com>
Fri, 1 Jul 2016 06:38:18 +0000 (15:38 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 8 Aug 2016 05:12:55 +0000 (22:12 -0700)
- keep last User-Event data for receiver applications

Change-Id: If3e00902a943cc2777c34dc38cf2f73c9db43bc2
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
event/event.c
include/app_event.h

index 1f90517..edb6c16 100644 (file)
@@ -264,3 +264,21 @@ int event_publish_trusted_app_event(const char *event_name, bundle *event_data)
 
        return EVENT_ERROR_NONE;
 }
+
+int event_keep_last_event_data(const char *event_name)
+{
+       int ret;
+
+       if (event_name == NULL)
+               return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       ret = eventsystem_keep_last_event_data(event_name);
+       if (ret < 0) {
+               if (ret == ES_R_ENOMEM)
+                       return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+               else
+                       return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
+       }
+
+       return EVENT_ERROR_NONE;
+}
index 9a2b9a3..812d063 100644 (file)
@@ -933,6 +933,22 @@ int event_publish_app_event(const char *event_name, bundle *event_data);
 int event_publish_trusted_app_event(const char *event_name, bundle *event_data);
 
 /**
+ * @brief Keeps last User-Event data for receiver applications.
+ *
+ * @since_tizen 3.0
+ * @remarks The receiver applications will receive this last event data after adding their new handlers via event_add_event_handler() API since the sender application called this API.
+ * @remarks If a sender application sends same event via trusted API and non-trusted API, then a trusted receiver will get latest data regardless of trusted or non-trusted, but non-trusted receiver will get the last data only from non-trusted API.
+ * @remarks The effect of this API continues during runtime. That means when the sender application process restarts, the sender application needs to call this api again to make the event to keep the last event.
+ * @param[in] event_name The event's name to keep last event data
+ * @return 0 on success, otherwise a negative error value
+ * @retval #EVENT_ERROR_NONE Successful
+ * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
+ * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int event_keep_last_event_data(const char *event_name);
+
+/**
  * @}
  */