From cb3d9ab07ff8a8ce86ebeba974dbf51f0b0ce87a Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Fri, 27 Feb 2015 21:41:21 +0900 Subject: [PATCH] New API set for 'heads-up notification' Change-Id: I196652a01bfec0681630f68b2b7ec97225de21b9 --- include/notification.h | 108 ++++++++++++++++++++++++++++++++++++++++ include/notification_error.h | 1 + include/notification_internal.h | 27 ---------- include/notification_type.h | 14 ++++++ src/notification.c | 12 ++++- 5 files changed, 134 insertions(+), 28 deletions(-) diff --git a/include/notification.h b/include/notification.h index 97627e0..47ccd84 100755 --- a/include/notification.h +++ b/include/notification.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -47,6 +48,8 @@ extern "C" { /** * @brief Sets an absolute path for an image file to display on the notification view. * @since_tizen 2.3 + * @privlevel N/P + * @feature http://tizen.org/feature/notification * @param[in] noti The notification handle * @param[in] type The notification image type * @param[in] image_path The image file full path @@ -694,6 +697,84 @@ int notification_set_launch_option(notification_h noti, int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option); + +/** + * @brief Sets the handler for a specific event. + * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle.\n + * Setting event handler of a button means that the notification will show the button. + * @since_tizen 2.4 + * @privlevel N/P + * @feature http://tizen.org/feature/notification + * @param[in] noti The notification handle + * @param[in] event_type event type + * @param[in] event_handler app control handle + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_event_type_e + * @par Sample code: + * @code +#include +... +{ + notification_h noti = NULL; + app_control_h app_control = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + ... + + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); + + ... + + noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + app_control_destroy(app_control); +} + * @endcode + */ +int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler); + +/** + * @brief Gets the event handler of a specific event. + * @remarks You must release @a app_control using app_control_destroy(). + * @since_tizen 2.4 + * @privlevel N/P + * @feature http://tizen.org/feature/notification + * @param[in] noti The notification handle + * @param[in] event_type Launching option type + * @param[out] option The pointer of App Control handler + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_event_type_e + * @par Sample code: + * @code +#include +... +{ + app_control_h app_control = NULL; + app_control_create(&app_control); + + ... + + noti_err = notification_get_launch_option(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, (void *)&app_control); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler); + /** * @brief Sets the property of the notification. * @since_tizen 2.3 @@ -1472,6 +1553,33 @@ int notification_set_tag(notification_h noti, const char *tag); int notification_get_tag(notification_h noti, const char **tag); /** + * @brief Gets the package name of the notification + * @since_tizen 2.4 + * @privlevel NP + * @param[in] noti Notification handle + * @param[out] pkgname package name of the notification + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @par Sample code: + * @code +#include +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + char *pkgname = NULL; + + noti_err = notification_get_pkgname(noti, &pkgname); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_pkgname(notification_h noti, char **pkgname); + +/** * @brief Loads a notification from the notification's database with the tag. * @since_tizen 2.3 * @privlevel public diff --git a/include/notification_error.h b/include/notification_error.h index 1179838..cf9bed7 100755 --- a/include/notification_error.h +++ b/include/notification_error.h @@ -48,6 +48,7 @@ typedef enum _notification_error { NOTIFICATION_ERROR_FROM_DBUS = TIZEN_ERROR_NOTIFICATION | 0x03, /**< Error from DBus */ NOTIFICATION_ERROR_NOT_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x04, /**< Not exist private ID */ NOTIFICATION_ERROR_SERVICE_NOT_READY = TIZEN_ERROR_NOTIFICATION | 0x05, /**< No reponse from notification service */ + NOTIFICATION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< This operation is not supported */ } notification_error_e; /** diff --git a/include/notification_internal.h b/include/notification_internal.h index 79f99c5..6944284 100755 --- a/include/notification_internal.h +++ b/include/notification_internal.h @@ -356,33 +356,6 @@ NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti, /** * @internal * @brief This function will be deprecated. - * @param[in] noti Notification handle - * @param[out] pkgname Caller package name - * @return NOTIFICATION_ERROR_NONE on success, other value on failure - * @retval NOTIFICATION_ERROR_NONE Success - * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value - * @par Sample code: - * @code -#include -... -{ - notification_h noti = NULL; - int noti_err = NOTIFICATION_ERROR_NONE; - char *pkgname = NULL; - - noti_err = notification_get_pkgname(noti, &pkgname); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -NOTIFICATION_DEPRECATED_API int notification_get_pkgname(notification_h noti, - char **pkgname); - -/** - * @internal - * @brief This function will be deprecated. * @details If @a pkgname is NULL, caller_pkgname is set internally. * @param[in] pkgname Caller application package name or NULL * @param[in] type Notification type diff --git a/include/notification_type.h b/include/notification_type.h index 1fcd343..366fb32 100755 --- a/include/notification_type.h +++ b/include/notification_type.h @@ -75,6 +75,19 @@ typedef enum _notification_launch_option_type { } notification_launch_option_type; /** + * @brief Enumeration for event type on notification. + * @since_tizen 2.4 + */ +typedef enum _notification_event_type { + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 = 1, /** < Event type : Click on button 1 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2 = 2, /** < Event type : Click on button 2 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3 = 3, /** < Event type : Click on button 3 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_4 = 4, /** < Event type : Click on button 4 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_ICON = 5, /** < Event type : Click on icon */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_THUMBNAIL = 6, /** < Event type : Click on thumbnail */ +} notification_event_type_e; + +/** * @brief Enumeration for notification sound type. * @since_tizen 2.3 */ @@ -290,6 +303,7 @@ enum _notificaton_display_applist { NOTIFICATION_DISPLAY_APP_LOCK = 0x00000004, /**< Lock screen */ NOTIFICATION_DISPLAY_APP_INDICATOR = 0x00000008,/**< Indicator */ + NOTIFICATION_DISPLAY_APP_HEADS_UP = 0x00000010,/**< Heads-up notification */ NOTIFICATION_DISPLAY_APP_ALL = 0xffffffff, /**< All display application */ }; diff --git a/src/notification.c b/src/notification.c index 1ec0a8e..643a868 100755 --- a/src/notification.c +++ b/src/notification.c @@ -1412,6 +1412,16 @@ EXPORT_API int notification_get_launch_option(notification_h noti, return NOTIFICATION_ERROR_NONE; } +EXPORT_API int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler) +{ + return NOTIFICATION_ERROR_NOT_SUPPORTED; +} + +EXPORT_API int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler) +{ + return NOTIFICATION_ERROR_NOT_SUPPORTED; +} + EXPORT_API int notification_set_execute_option(notification_h noti, notification_execute_type_e type, const char *text, @@ -3123,4 +3133,4 @@ void notification_call_posted_toast_cb(const char *message) if (posted_toast_message_cb != NULL) { posted_toast_message_cb(message); } -} \ No newline at end of file +} -- 2.7.4