diff options
30 files changed, 3430 insertions, 1936 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 883e6df..b406607 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,9 @@ SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") SET(ICONDIR "${PREFIX}/share/${PROJECT_NAME}") +SET(RESDIR "${PREFIX}/share/${PROJECT_NAME}") SET(DBDIR "/opt/dbspace") +SET(IMGDIR "${RESDIR}/images") SET(DBFILE ".notification.db") SET(MAJOR_VER 0) SET(VERSION ${MAJOR_VER}.1.0) @@ -23,11 +25,11 @@ SET(SRCS ./src/notification_setting.c) SET(HEADERS-DEVEL ./include/notification.h + ./include/notification_internal.h ./include/notification_error.h ./include/notification_type.h ./include/notification_list.h - ./include/notification_status.h - ./include/notification_setting.h) + ./include/notification_status.h) SET(HEADERS-SERVICE-DEVEL ./include/notification_ipc.h @@ -49,6 +51,12 @@ pkg_check_modules(pkgs REQUIRED dbus-1 dbus-glib-1 com-core + capi-appfw-application + capi-appfw-package-manager + edbus + elementary + ecore + eina ) FOREACH(flag ${pkgs_CFLAGS}) @@ -64,6 +72,7 @@ ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"") ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"") ADD_DEFINITIONS("-DDBFILE=\"${DBFILE}\"") +ADD_DEFINITIONS("-DIMGDIR=\"${IMGDIR}\"") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJOR_VER}) @@ -74,6 +83,8 @@ CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png") + FOREACH(hfile ${HEADERS-DEVEL}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) ENDFOREACH(hfile) diff --git a/TC/testcase/utc_notification.c b/TC/testcase/utc_notification.c index 1e3c0b1..527a11f 100755 --- a/TC/testcase/utc_notification.c +++ b/TC/testcase/utc_notification.c @@ -79,6 +79,10 @@ static void utc_notification_set_application_n(void); static void utc_notification_set_application_p(void); static void utc_notification_get_application_n(void); static void utc_notification_get_application_p(void); +static void utc_notification_set_launch_option_n(void); +static void utc_notification_set_launch_option_p(void); +static void utc_notification_get_launch_option_n(void); +static void utc_notification_get_launch_option_p(void); static void utc_notification_set_execute_option_n(void); static void utc_notification_set_execute_option_p(void); static void utc_notification_get_execute_option_n(void); @@ -113,8 +117,8 @@ static void utc_notification_get_type_n(void); static void utc_notification_get_type_p(void); static void utc_notification_insert_n(void); static void utc_notification_insert_p(void); -static void utc_notifiation_clear_n(void); -static void utc_notifiation_clear_p(void); +static void utc_notification_clear_n(void); +static void utc_notification_clear_p(void); static void utc_notification_update_n(void); static void utc_notification_update_p(void); static void utc_notification_delete_all_by_type_n(void); @@ -160,10 +164,10 @@ static void utc_notification_free_list_p(void); static void utc_notification_op_get_data_n(void); static void utc_notification_op_get_data_p(void); static void utc_notification_is_service_ready_p(void); -static void utc_notification_add_deffered_task_n(void); -static void utc_notification_add_deffered_task_p(void); -static void utc_notification_del_deffered_task_n(void); -static void utc_notification_del_deffered_task_p(void); +static void utc_notification_add_deferred_task_n(void); +static void utc_notification_add_deferred_task_p(void); +static void utc_notification_del_deferred_task_n(void); +static void utc_notification_del_deferred_task_p(void); void (*tet_startup)(void) = startup; void (*tet_cleanup)(void) = cleanup; @@ -215,6 +219,10 @@ struct tet_testlist tet_testlist[] = { {utc_notification_set_application_p, POSITIVE_TC_IDX}, {utc_notification_get_application_n, NEGATIVE_TC_IDX}, {utc_notification_get_application_p, POSITIVE_TC_IDX}, + {utc_notification_set_launch_option_n, NEGATIVE_TC_IDX}, + {utc_notification_set_launch_option_p, POSITIVE_TC_IDX}, + {utc_notification_get_launch_option_n, NEGATIVE_TC_IDX}, + {utc_notification_get_launch_option_p, POSITIVE_TC_IDX}, {utc_notification_set_execute_option_n, NEGATIVE_TC_IDX}, {utc_notification_set_execute_option_p, POSITIVE_TC_IDX}, {utc_notification_get_execute_option_n, NEGATIVE_TC_IDX}, @@ -249,8 +257,8 @@ struct tet_testlist tet_testlist[] = { {utc_notification_get_type_p, POSITIVE_TC_IDX}, {utc_notification_insert_n, NEGATIVE_TC_IDX}, {utc_notification_insert_p, POSITIVE_TC_IDX}, - {utc_notifiation_clear_n, NEGATIVE_TC_IDX}, - {utc_notifiation_clear_p, POSITIVE_TC_IDX}, + {utc_notification_clear_n, NEGATIVE_TC_IDX}, + {utc_notification_clear_p, POSITIVE_TC_IDX}, {utc_notification_update_n, NEGATIVE_TC_IDX}, {utc_notification_update_p, POSITIVE_TC_IDX}, {utc_notification_delete_all_by_type_n, NEGATIVE_TC_IDX}, @@ -296,17 +304,17 @@ struct tet_testlist tet_testlist[] = { {utc_notification_op_get_data_n, NEGATIVE_TC_IDX}, {utc_notification_op_get_data_p, POSITIVE_TC_IDX}, {utc_notification_is_service_ready_p, POSITIVE_TC_IDX}, - {utc_notification_add_deffered_task_n, NEGATIVE_TC_IDX}, - {utc_notification_add_deffered_task_p, POSITIVE_TC_IDX}, - {utc_notification_del_deffered_task_n, NEGATIVE_TC_IDX}, - {utc_notification_del_deffered_task_p, POSITIVE_TC_IDX}, + {utc_notification_add_deferred_task_n, NEGATIVE_TC_IDX}, + {utc_notification_add_deferred_task_p, POSITIVE_TC_IDX}, + {utc_notification_del_deferred_task_n, NEGATIVE_TC_IDX}, + {utc_notification_del_deferred_task_p, POSITIVE_TC_IDX}, { NULL, 0 }, }; static void startup(void) { /* start of TC */ - notifiation_clear(NOTIFICATION_TYPE_NONE); + notification_clear(NOTIFICATION_TYPE_NONE); tet_printf("\n TC start"); } @@ -1006,6 +1014,77 @@ static void utc_notification_get_application_p(void) } /** + * @brief Negative test case of notification_set_launch() + */ +static void utc_notification_set_launch_option_n(void) +{ + int ret = 0; + + ret = notification_set_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL); + + dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA, + "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); +} + +/** + * @brief Positive test case of notification_set_launch_option() + */ +static void utc_notification_set_launch_option_p(void) +{ + int ret = 0; + notification_h notification = NULL; + app_control_h app_control = NULL; + bundle *b = NULL; + + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); + /*Invalid parameter test*/ + notification = notification_create(NOTIFICATION_TYPE_NOTI); + ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control); + app_control_destroy(app_control); + + dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_NONE, + "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); +} + +/** + * @brief Negative test case of notification_get_launch_option() + */ +static void utc_notification_get_launch_option_n(void) +{ + int ret = 0; + app_control_h app_control = NULL; + + ret = notification_get_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL); + + dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA, + "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); +} + +/** + * @brief Positive test case of notification_get_launch_option() + */ +static void utc_notification_get_launch_option_p(void) +{ + int ret = 0; + notification_h notification = NULL; + app_control_h app_control = NULL; + + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); + notification = notification_create(NOTIFICATION_TYPE_NOTI); + ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control); + app_control_destroy(app_control); + app_control = NULL; + + ret = notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, &app_control); + notification_free(notification); + + dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_NONE, + "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); +} + +/** * @brief Negative test case of notification_set_execute_option() */ static void utc_notification_set_execute_option_n(void) @@ -1515,26 +1594,26 @@ static void utc_notification_insert_p(void) } /** - * @brief Negative test case of notifiation_clear() + * @brief Negative test case of notification_clear() */ -static void utc_notifiation_clear_n(void) +static void utc_notification_clear_n(void) { int ret = 0; - ret = notifiation_clear(NOTIFICATION_TYPE_MAX); - dts_check_eq("notifiation_clear", ret, NOTIFICATION_ERROR_NONE, + ret = notification_clear(NOTIFICATION_TYPE_MAX); + dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE, "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); } /** - * @brief Positive test case of notifiation_clear() + * @brief Positive test case of notification_clear() */ -static void utc_notifiation_clear_p(void) +static void utc_notification_clear_p(void) { int ret = 0; - ret = notifiation_clear(NOTIFICATION_TYPE_NOTI); - dts_check_eq("notifiation_clear", ret, NOTIFICATION_ERROR_NONE, + ret = notification_clear(NOTIFICATION_TYPE_NOTI); + dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE, "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); } @@ -2240,51 +2319,51 @@ static void utc_notification_is_service_ready_p(void) } /** - * @brief Negative test case of notification_add_deffered_task() + * @brief Negative test case of notification_add_deferred_task() */ -static void utc_notification_add_deffered_task_n(void) +static void utc_notification_add_deferred_task_n(void) { int ret = 0; - ret = notification_add_deffered_task(NULL, NULL); - dts_check_eq("notification_add_deffered_task", ret, NOTIFICATION_ERROR_INVALID_DATA, + ret = notification_add_deferred_task(NULL, NULL); + dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA, "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); } /** - * @brief Positive test case of notification_add_deffered_task() + * @brief Positive test case of notification_add_deferred_task() */ -static void utc_notification_add_deffered_task_p(void) +static void utc_notification_add_deferred_task_p(void) { int ret = 0; - ret = notification_add_deffered_task(_deffered_job_cb, NULL); - notification_del_deffered_task(_deffered_job_cb); - dts_check_eq("notification_add_deffered_task", ret, NOTIFICATION_ERROR_NONE, + ret = notification_add_deferred_task(_deffered_job_cb, NULL); + notification_del_deferred_task(_deffered_job_cb); + dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_NONE, "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); } /** - * @brief Negative test case of notification_del_deffered_task() + * @brief Negative test case of notification_del_deferred_task() */ -static void utc_notification_del_deffered_task_n(void) +static void utc_notification_del_deferred_task_n(void) { int ret = 0; - ret = notification_del_deffered_task(NULL); - dts_check_eq("notification_del_deffered_task", ret, NOTIFICATION_ERROR_INVALID_DATA, + ret = notification_del_deferred_task(NULL); + dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA, "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); } /** - * @brief Positive test case of notification_del_deffered_task() + * @brief Positive test case of notification_del_deferred_task() */ -static void utc_notification_del_deffered_task_p(void) +static void utc_notification_del_deferred_task_p(void) { int ret = 0; - ret = notification_add_deffered_task(_deffered_job_cb, NULL); - ret = notification_del_deffered_task(_deffered_job_cb); - dts_check_eq("notification_del_deffered_task", ret, NOTIFICATION_ERROR_NONE, + ret = notification_add_deferred_task(_deffered_job_cb, NULL); + ret = notification_del_deferred_task(_deffered_job_cb); + dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_NONE, "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); } diff --git a/TC/testcase/utc_notification_list.c b/TC/testcase/utc_notification_list.c index 9f95065..32ac3da 100755 --- a/TC/testcase/utc_notification_list.c +++ b/TC/testcase/utc_notification_list.c @@ -72,7 +72,7 @@ struct tet_testlist tet_testlist[] = { static void startup(void) { /* start of TC */ - notifiation_clear(NOTIFICATION_TYPE_NONE); + notification_clear(NOTIFICATION_TYPE_NONE); tet_printf("\n TC start"); } diff --git a/TC/testcase/utc_notification_setting.c b/TC/testcase/utc_notification_setting.c index 54e40b5..8dc13db 100755 --- a/TC/testcase/utc_notification_setting.c +++ b/TC/testcase/utc_notification_setting.c @@ -52,7 +52,7 @@ struct tet_testlist tet_testlist[] = { static void startup(void) { /* start of TC */ - notifiation_clear(NOTIFICATION_TYPE_NONE); + notification_clear(NOTIFICATION_TYPE_NONE); tet_printf("\n TC start"); } diff --git a/TC/testcase/utc_notification_status.c b/TC/testcase/utc_notification_status.c index a1f0882..0ff9a63 100755 --- a/TC/testcase/utc_notification_status.c +++ b/TC/testcase/utc_notification_status.c @@ -54,7 +54,7 @@ struct tet_testlist tet_testlist[] = { static void startup(void) { /* start of TC */ - notifiation_clear(NOTIFICATION_TYPE_NONE); + notification_clear(NOTIFICATION_TYPE_NONE); tet_printf("\n TC start"); } diff --git a/doc/notification_doc.h b/doc/notification_doc.h index a767e1b..2dac2af 100755 --- a/doc/notification_doc.h +++ b/doc/notification_doc.h @@ -21,44 +21,41 @@ /** * - * @ingroup NOTIFICATION_LIBRARY - * @defgroup NOTIFICATION_MODULE notification APIs + * @defgroup NOTIFICATION_MODULE Notification + * @ingroup CAPI_APPLICATION_FRAMEWORK * @brief Notification APIs * * @section NOTIFICATION_MODULE_HEADER Required Header * \#include <notification.h> * @section NOTIFICATION_MODULE_OVERVIEW Overview - * It provides functions for creating and inserting and updating notification. + * A notification is a message that is displayed on the notification area or the on-going area. + * It is created to notify information to the user through the application. + * This API provides functions for creating and inserting and updating notification. * - * @ingroup NOTIFICATION_LIBRARY - * @defgroup NOTIFICATION_LIST notification list APIs + */ + +/** + * @internal + * @defgroup NOTIFICATION_LIST Notification List + * @ingroup NOTIFICATION_MODULE * @brief linked list of notification data * * @section NOTIFICATION_LIST_MODULE_HEADER Required Header - * \#include <notification_list.h> + * \#include <notification.h> * @section NOTIFICATION_LIST_MODULE_OVERVIEW Overview - * It provides functions for handling + * It provides functions for handling notification list. * - * @ingroup NOTIFICATION_LIBRARY - * @defgroup NOTIFICATION_STATUS notification status APIs + */ + +/** + * @defgroup NOTIFICATION_STATUS Notification Status + * @ingroup NOTIFICATION_MODULE * @brief APIs displaying plain text message on the indicator area * * @section NOTIFICATION_STATUS_MODULE_HEADER Required Header - * \#include <notification_status.h> + * \#include <notification.h> * @section NOTIFICATION_STATUS_MODULE_OVERVIEW Overview * Notification status APIs * - * @ingroup NOTIFICATION_LIBRARY - * @defgroup NOTIFICATION_TYPE notification type - * @brief Type for notification APIs - * - * @section NOTIFICATION_TYPE_MODULE_HEADER Required Header - * \#include <notification_type.h> - * @section NOTIFICATION_TYPE_MODULE_OVERVIEW Overview - * Type defines and enumerations for Notification APIs - * - * @ingroup NOTIFICATION_LIBRARY - * @defgroup NOTIFICATION_DEPRECATED deprecated APIs - * @brief deprecated APIs - * */ + diff --git a/include/notification.h b/include/notification.h index 8340a85..97627e0 100755 --- a/include/notification.h +++ b/include/notification.h @@ -29,7 +29,6 @@ #include <notification_type.h> #include <notification_list.h> #include <notification_status.h> -#include <notification_setting.h> #ifdef __cplusplus extern "C" { @@ -37,7 +36,7 @@ extern "C" { /** * @file notification.h - * @brief This file contains the notification APIs + * @brief This file contains the notification API. */ /** @@ -46,28 +45,27 @@ extern "C" { */ /** - * @brief Set absolute path for image file to display on notification view - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification image type - * @param[in] image_path image file full path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre Notification handle should be created by notification_new() - * @post + * @brief Sets an absolute path for an image file to display on the notification view. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification image type + * @param[in] image_path The image file full path + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). * @see #notification_image_type_e - * @see notification_new() + * @see notification_create() * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -80,31 +78,30 @@ extern "C" { } * @endcode */ -notification_error_e notification_set_image(notification_h noti, +int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path); /** - * @brief Get absolute path for image file - * @details - * @remarks Do not free image_path. It will be freed when notification_free() or notification_free_list(). - * @param[in] noti notification handle - * @param[in] type notification image type + * @brief Gets the absolute path of an image file. + * @since_tizen 2.3 + * @remarks Do not free @a image_path. It will be freed when notification_free() is called. + * @param[in] noti Notification handle + * @param[in] type Notification image type * @param[out] image_path image file full path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre Notification handle should be created by notification_new() - * @post + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). * @see #notification_image_type_e - * @see notification_new() + * @see notification_create() * @par Sample code: * @code #include <notification.h> ... { char *image_path = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -113,31 +110,31 @@ notification_error_e notification_set_image(notification_h noti, } * @endcode */ -notification_error_e notification_get_image(notification_h noti, +int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path); /** - * @brief Set a timestamp - * @details If input_time is 0, time information is set by current time. - * @remarks - * @param[in] noti notification handle - * @param[in] input_time input time - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre Notification handle should be created by notification_new() - * @post - * @see notification_new() + * @brief Sets a timestamp. + * @details If input_time is @c 0, time information is taken from the current time. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] input_time The input time + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). + * @see notification_create() * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -150,28 +147,28 @@ notification_error_e notification_get_image(notification_h noti, } * @endcode */ -notification_error_e notification_set_time(notification_h noti, +int notification_set_time(notification_h noti, time_t input_time); /** - * @brief Get a timestamp - * @details If ret_time is 0, time information is not set before. - * @remarks - * @param[in] noti notification handle - * @param[out] ret_time return time value - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre Notification handle should be created by notification_new() - * @post - * @see notification_new() + * @brief Gets a timestamp. + * @details If ret_time is @c 0, time information is not set before. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] ret_time The return time value + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). + * @see notification_create() * @par Sample code: * @code #include <notification.h> ... { time_t ret_time; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_time(noti, &ret_time); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -180,28 +177,26 @@ notification_error_e notification_set_time(notification_h noti, } * @endcode */ -notification_error_e notification_get_time(notification_h noti, +int notification_get_time(notification_h noti, time_t * ret_time); /** - * @brief Get timestamp that the notification is inserted - * @details If ret_time is 0, this notification data is not inserted before. - * @remarks - * @param[in] noti notification handle - * @param[out] ret_time return time value - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Gets an insertion timestamp of the notification. + * @details If ret_time is @c 0, this notification data is not inserted before. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] ret_time The return time value + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { time_t ret_time; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_insert_time(noti, &ret_time); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -210,41 +205,40 @@ notification_error_e notification_get_time(notification_h noti, } * @endcode */ -notification_error_e notification_get_insert_time(notification_h noti, +int notification_get_insert_time(notification_h noti, time_t * ret_time); /** - * @brief Set text to display on the notification view - * @details Set title, content string. If text is formated data(only support %d, %f, %s), type - value pair should be set. - * If %d, type NOTIFICATION_VARIABLE_TYPE_INT and value is integer value. - * If %f, type NOTIFICATION_VARIABLE_TYPE_DOUBLE and value is double value. - * If %s, type NOTIFICATION_VARIABLE_TYPE_STRING and value is character string. - * If type is NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text. - * If value is NOTIFICATION_COUNT_POS_LEFT, count is displaying at the left of the text. - * If value is NOTIFICATION_COUNT_POS_IN, count is displaying in the text that text has %d format. - * If value is NOTIFICATION_COUNT_POS_RIGHT, count is displaying at the right of the text. - * Variable parameter should be terminated NOTIFICATION_VARIABLE_TYPE_NONE. - * @remarks - * @param[in] noti notification handle - * @param[in] type notification text type - * @param[in] text basic text - * @param[in] key text key for localization - * @param[in] args_type variable parameter that type - value pair. - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre notification handle should be created by notification_new(). - * @post - * @see + * @brief Sets the text to display on the notification view. + * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set. + * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer. + * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double. + * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string. + * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text. + * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text. + * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format. + * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text. + * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification text type + * @param[in] text The basic text + * @param[in] key The text key for localization + * @param[in] args_type The variable parameter that type - value pair + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre notification handle should be created by notification_create(). * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -257,32 +251,29 @@ notification_error_e notification_get_insert_time(notification_h noti, } * @endcode */ -notification_error_e notification_set_text(notification_h noti, +int notification_set_text(notification_h noti, notification_text_type_e type, const char *text, const char *key, int args_type, ...); /** - * @brief Get the text from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification text type. - * @param[out] text text - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Gets the text from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification text type + * @param[out] text The notification text + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; char *text = NULL; noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); @@ -292,66 +283,61 @@ notification_error_e notification_set_text(notification_h noti, } * @endcode */ -notification_error_e notification_get_text(notification_h noti, +int notification_get_text(notification_h noti, notification_text_type_e type, char **text); /** - * @brief Set a timestamp to display on the notification view - * @details the timestamp will be converted to formatted string and it will be displayed on the setted text area - * @remarks - * @param[in] noti notification handle - * @param[in] type notification text type - * @param[in] time time stamp - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre notification handle should be created by notification_new(). - * @post - * @see + * @brief Sets the timestamp to display on the notification view. + * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification text type + * @param[in] time The timestamp + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). */ -notification_error_e notification_set_time_to_text(notification_h noti, notification_text_type_e type, +int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time); /** - * @brief Get a timestamp from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification text type - * @param[in] time pointer of time stamp - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre notification handle should be created by notification_new(). - * @post - * @see + * @brief Gets the timestamp from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification text type + * @param[in] time The pointer of time stamp + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). */ -notification_error_e notification_get_time_from_text(notification_h noti, notification_text_type_e type, +int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time); /** - * @brief Set text domain to localize the notification - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] domain text domain - * @param[in] dir text dir - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @internal + * @brief Sets the text domain to localize the notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] domain The text domain + * @param[in] dir The text dir + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -364,30 +350,29 @@ notification_error_e notification_get_time_from_text(notification_h noti, notifi } * @endcode */ -notification_error_e notification_set_text_domain(notification_h noti, +int notification_set_text_domain(notification_h noti, const char *domain, const char *dir); /** - * @brief Get text domain from the notification handle - * @details - * @remarks Do not free returned domain and dir. These are freed when notification_free or notification_free_list. - * @param[in] noti notification handle - * @param[out] domain domain - * @param[out] dir locale dir - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @internal + * @brief Gets the text domain from the notification handle. + * @since_tizen 2.3 + * @remarks Do not free returned domain and dir. They are freed when notification_free() or notification_free_list() is called. + * @param[in] noti The notification handle + * @param[out] domain The domain + * @param[out] dir The locale dir + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; char *domain = NULL; char *dir = NULL; @@ -398,30 +383,27 @@ notification_error_e notification_set_text_domain(notification_h noti, } * @endcode */ -notification_error_e notification_get_text_domain(notification_h noti, +int notification_get_text_domain(notification_h noti, char **domain, char **dir); /** - * @brief Set sound option for the notification - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification sound type - * @param[in] path user sound file path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Sets the sound type for the notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification sound type + * @param[in] path The user sound file path + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -430,30 +412,27 @@ notification_error_e notification_get_text_domain(notification_h noti, } * @endcode */ -notification_error_e notification_set_sound(notification_h noti, +int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path); /** - * @brief Get sound option from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] type notification sound type - * @param[out] path user sound file path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Gets the sound type from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] type The notification sound type + * @param[out] path The user sound file path + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE; noti_err = notification_get_sound(noti, &type, NULL); @@ -463,30 +442,27 @@ notification_error_e notification_set_sound(notification_h noti, } * @endcode */ -notification_error_e notification_get_sound(notification_h noti, +int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path); /** - * @brief Set vibrate option for the notification - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification vibration type - * @param[in] path user vibration file path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Sets the vibration type for the notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type The notification vibration type + * @param[in] path The user vibration file path + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -495,30 +471,27 @@ notification_error_e notification_get_sound(notification_h noti, } * @endcode */ -notification_error_e notification_set_vibration(notification_h noti, +int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path); /** - * @brief Get vibrate option from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] type notification sound type - * @param[out] path user vibration file path - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see - * @par Sample code: - * @code + * @brief Gets the vibrate type from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] type The notification sound type + * @param[out] path The user vibration file path + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE; noti_err = notification_get_vibration(noti, &type, NULL); @@ -528,30 +501,27 @@ notification_error_e notification_set_vibration(notification_h noti, } * @endcode */ -notification_error_e notification_get_vibration(notification_h noti, +int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path); /** - * @brief Set option of displaying the LED - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] operation led notification operation - * @param[in] led_argb notification led color - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Sets the LED displaying option. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] operation The LED notification operation + * @param[in] led_argb The notification led color + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -560,30 +530,27 @@ notification_error_e notification_get_vibration(notification_h noti, } * @endcode */ -notification_error_e notification_set_led(notification_h noti, +int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb); /** - * @brief Get option of displaying the LED from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] operation led notification operation - * @param[out] led_argb notification led color - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see - * @par Sample code: - * @code + * @brief Gets the LED displaying option from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] operation The LED notification operation + * @param[out] led_argb The notification LED color + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE; noti_err = notification_get_led(noti, &type, NULL); @@ -593,30 +560,27 @@ notification_error_e notification_set_led(notification_h noti, } * @endcode */ -notification_error_e notification_get_led(notification_h noti, +int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb); /** - * @brief Set time period of flashing the LED - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] on_ms time for turning on the LED - * @param[in] off_ms time for turning on the LED - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Sets the time period of flashing the LED. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] on_ms The time for turning on the LED + * @param[in] off_ms The time for turning off the LED + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_set_led_time_period(noti, 100, 100); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -625,29 +589,26 @@ notification_error_e notification_get_led(notification_h noti, } * @endcode */ -notification_error_e notification_set_led_time_period(notification_h noti, +int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms); /** - * @brief Get time period of flashing the LED from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] on_ms time for turning on the LED - * @param[out] off_ms time for turning on the LED - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see - * @par Sample code: - * @code + * @brief Gets the time period of flashing the LED from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] on_ms The time for turning on the LED + * @param[out] off_ms The time for turning on the LED + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; int led_on_ms = 0; int led_off_ms = 0; @@ -658,81 +619,71 @@ notification_error_e notification_set_led_time_period(notification_h noti, } * @endcode */ -notification_error_e notification_get_led_time_period(notification_h noti, +int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms); /** - * @brief Set execution option for a notification - * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle. - * @remarks - * @param[in] noti notification handle - * @param[in] type notification execute type - * @param[in] text basic text for button - * @param[in] key value for localizaed text - * @param[in] service_handle appsvc bundle data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Sets the launch option for a notification. + * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] type Launching option type + * @param[in] option 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 * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - bundle *b = NULL; + app_control_h app_control = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; ... - b = bundle_create(); - appsvc_set_operation(b, APPSVC_OPERATION_VIEW); - appsvc_set_uri(b,"http://www.samsung.com"); + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); - noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b); + ... + + noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control); if(noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); return; } - bundle_free(b); + app_control_destroy(app_control); } * @endcode */ -notification_error_e notification_set_execute_option(notification_h noti, - notification_execute_type_e type, - const char *text, - const char *key, - bundle *service_handle); +int notification_set_launch_option(notification_h noti, + notification_launch_option_type type, void *option); /** - * @brief Get execution option from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] type notification execute type - * @param[out] text text for button - * @param[out] service_handle appsvc bundle data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Gets the launch option from the notification handle. + * @since_tizen 2.3 + * @remarks You must release @a app_control using app_control_destroy(). + * @param[in] noti The notification handle + * @param[in] 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 * @par Sample code: * @code #include <notification.h> ... { - notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - bundle *b = NULL; + app_control_h app_control = NULL; + app_control_create(&app_control); ... - noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b); + noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control); if(noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); return; @@ -740,33 +691,28 @@ notification_error_e notification_set_execute_option(notification_h noti, } * @endcode */ -notification_error_e notification_get_execute_option(notification_h noti, - notification_execute_type_e type, - const char **text, - bundle **service_handle); +int notification_get_launch_option(notification_h noti, + notification_launch_option_type type, void *option); /** - * @brief Set the property of the notification - * @details - * @remarks - * @param[in] noti notification handle - * @param[in] flags property with | operation - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Sets the property of the notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] flags The property with | operation + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; bundle *b = NULL; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -779,28 +725,25 @@ notification_error_e notification_get_execute_option(notification_h noti, } * @endcode */ -notification_error_e notification_set_property(notification_h noti, +int notification_set_property(notification_h noti, int flags); /** - * @brief Get the property of the notification from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] flags notification property - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Gets the property of the notification from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] flags The notification property + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; int flags = 0; noti_err = notification_get_property(noti, &flags); @@ -810,31 +753,29 @@ notification_error_e notification_set_property(notification_h noti, } * @endcode */ -notification_error_e notification_get_property(notification_h noti, +int notification_get_property(notification_h noti, int *flags); /** - * @brief Set applications to display the notification + * @brief Sets applications to display the notification. * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API. - * @remarks - * @param[in] noti notification handle - * @param[in] applist with | operation - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] applist The with | operation + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; bundle *b = NULL; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -848,28 +789,25 @@ notification_error_e notification_get_property(notification_h noti, } * @endcode */ -notification_error_e notification_set_display_applist(notification_h noti, +int notification_set_display_applist(notification_h noti, int applist); /** - * @brief Get application list to display the notification from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] applist display application list. - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Gets the application list displaying the notification from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] applist The display application list + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; int applist = 0; noti_err = notification_get_display_applist(noti, &applist); @@ -879,30 +817,28 @@ notification_error_e notification_set_display_applist(notification_h noti, } * @endcode */ -notification_error_e notification_get_display_applist(notification_h noti, +int notification_get_display_applist(notification_h noti, int *applist); /** - * @brief Set initial size for ongoing type. - * @details After notification_insert, it does not upate size. If you want to update size, please call notification_update_size(). - * @remarks - * @param[in] noti notification handle - * @param[in] size double type size. - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Sets the initial size for the ongoing type. + * @details After notification_post() call, the size is not updated. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] size The double type size + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -915,28 +851,25 @@ notification_error_e notification_get_display_applist(notification_h noti, } * @endcode */ -notification_error_e notification_set_size(notification_h noti, +int notification_set_size(notification_h noti, double size); /** - * @brief Get progress size. - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] size progress size - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Gets the progress size. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] size The progress size + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; double size = 0.0; noti_err = notification_get_size(noti, &size); @@ -946,30 +879,28 @@ notification_error_e notification_set_size(notification_h noti, } * @endcode */ -notification_error_e notification_get_size(notification_h noti, +int notification_get_size(notification_h noti, double *size); /** - * @brief Set initial progress for ongoing type. - * @details After notification_insert, it does not upate progress. If you want to update progress, please call notification_update_progress(). - * @remarks - * @param[in] noti notification handle - * @param[in] percentage progress percentage - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Sets the initial progress for the ongoing type. + * @details After the notification_post() call, the progress is not updated. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] percentage The progress percentage + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -982,28 +913,26 @@ notification_error_e notification_get_size(notification_h noti, } * @endcode */ -notification_error_e notification_set_progress(notification_h noti, +int notification_set_progress(notification_h noti, double percentage); /** - * @brief Get progress from the notification handle - * @details - * @remarks At the end of the operation, progress should be 1.0 - * @param[in] noti notification handle - * @param[out] percentage progress percentage - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see + * @brief Gets the progress from the notification handle. + * @since_tizen 2.3 + * @remarks At the end of the operation, the progress should be @c 1.0. + * @param[in] noti The notification handle + * @param[out] percentage The progress percentage + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; double percentage = 0.0; noti_err = notification_get_progress(noti, &percentage); @@ -1013,157 +942,53 @@ notification_error_e notification_set_progress(notification_h noti, } * @endcode */ -notification_error_e notification_get_progress(notification_h noti, +int notification_get_progress(notification_h noti, double *percentage); /** - * @brief Set the package name of caller - * @details caller_pkgname is set automatically when notification_new. We are not recommend to use this API. - * @remarks - * @param[in] noti notification handle - * @param[in] pkgname caller package name - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see - * @par Sample code: - * @code -#include <notification.h> -... -{ - notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); - if(noti == NULL) { - return; - } - - noti_err = notification_set_pkgname(noti, "com.samsung.phone"); - if(noti_err != NOTIFICATION_ERROR_NONE) { - notification_free(noti); - return; - } -} - * @endcode - */ -notification_error_e notification_set_pkgname(notification_h noti, - const char *pkgname); - -/** - * @brief Get the package name of caller from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] pkgname caller package name - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see - * @par Sample code: - * @code -#include <notification.h> -... -{ - notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - char *pkgname = NULL; - - noti_err = notification_get_pkgname(noti, &pkgname); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_get_pkgname(notification_h noti, - char **pkgname); - -/** - * @brief Set the layout of the notification view - * @details caller can set displaying layout of notification - * @remarks - * @param[in] noti notification handle - * @param[in] type of layout - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post + * @brief Sets the layout of the notification view. + * @details Caller can set displaying layout of notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[in] layout The type of layout + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_ly_type_e */ -notification_error_e notification_set_layout(notification_h noti, +int notification_set_layout(notification_h noti, notification_ly_type_e layout); /** - * @brief Get the layout of the notification view from the notification handle - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] type of layout - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post + * @brief Gets the layout of the notification view from the notification handle. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] layout The type of layout + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_ly_type_e */ -notification_error_e notification_get_layout(notification_h noti, +int notification_get_layout(notification_h noti, notification_ly_type_e *layout); /** - * @brief Get Group ID and Private ID - * @details - * @remarks ID is valid only after inserting the notification - * @param[in] noti notification handle - * @param[out] group_id Group ID - * @param[out] priv_id Private ID - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see - * @par Sample code: - * @code -#include <notification.h> - ... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - int group_id, priv_id; - - noti_err = notification_get_id(noti, &group_id, &priv_id); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } - } - * @endcode - */ -notification_error_e notification_get_id(notification_h noti, - int *group_id, int *priv_id); - -/** - * @brief Get the type of notification - * @details - * @remarks - * @param[in] noti notification handle - * @param[out] type notification type - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide parameter - * @pre - * @post - * @see + * @brief Gets the type of a notification. + * @since_tizen 2.3 + * @param[in] noti The notification handle + * @param[out] type The notification type + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @par Sample code: * @code #include <notification.h> ... { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; notification_type_e type; noti_err = notification_get_type(noti, &type); @@ -1173,28 +998,32 @@ notification_error_e notification_get_id(notification_h noti, } * @endcode */ -notification_error_e notification_get_type(notification_h noti, +int notification_get_type(notification_h noti, notification_type_e * type); /** - * @brief Insert a notification - * @details A notification will be inserted to DB and then it will be appeared on the notification area - * When notification_new() call, if priv_id is NOTIFICATION_PRIV_ID_NONE, priv_id is return internally set priv_id. - * @remarks - * @param[in] noti notification handle - * @param[out] priv_id private ID - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre notification_new() - * @post notification_free() - * @see #notification_h + * @internal + * @brief Inserts a notification. + * @details The notification will be inserted to the database and then it will appear in the notification area. + * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti The notification handle + * @param[out] priv_id The private ID + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @pre Notification handle should be created by notification_create(). + * @post notification_free(). * @par Sample code: * @code #include <notification.h> ... { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_insert(noti, NULL); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -1203,27 +1032,28 @@ notification_error_e notification_get_type(notification_h noti, } * @endcode */ -notification_error_e notification_insert(notification_h noti, +int notification_insert(notification_h noti, int *priv_id); /** - * @brief Update notification data. - * @details The updated notification will be appeared on the notification area - * @remarks - * @param[in] noti notification handle that is created by notification_new(). - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @retval NOTIFICATION_ERROR_NOT_EXIST_ID - not exist priv id - * @pre - * @post - * @see #notification_h + * @brief Updates notification data. + * @details The updated notification will appear in the notification area. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti The notification handle that is created by notification_create() + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @par Sample code: * @code #include <notification.h> ... { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_update(NULL); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -1232,28 +1062,31 @@ notification_error_e notification_insert(notification_h noti, } * @endcode */ -notification_error_e notification_update(notification_h noti); - -/** - * @brief Update a notification - * @details The updated notification will be appeared on the notification area - * @remarks This function update a notification in async manner - * @param[in] noti notification handle that is created by notification_new(). - * @param[in] result_cb callback called when update completed - * @param[in] user_data user data which you want to use in callback - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @retval NOTIFICATION_ERROR_NOT_EXIST_ID - not exist priv id - * @pre - * @post - * @see #notification_h +int notification_update(notification_h noti); + +/** + * @internal + * @brief Updates a notification, asynchronously. + * @details The updated notification will appear in the notification area. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks This function updates the notification asynchronously. + * @param[in] noti The notification handle that is created by notification_create() + * @param[in] result_cb The callback called when an update completed + * @param[in] user_data The user data which you want to use in callback + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @par Sample code: * @code #include <notification.h> ... { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_update_async(NULL, result_cb, data); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -1262,114 +1095,28 @@ notification_error_e notification_update(notification_h noti); } * @endcode */ -notification_error_e notification_update_async(notification_h noti, +int notification_update_async(notification_h noti, void (*result_cb)(int priv_id, int result, void *data), void *user_data); /** - * @brief This function clear all notification of type. - * @details Not recommand API. Only for notification tray's clear button operation. - * @remarks - * @param[in] type notification type - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see #notification_type_e - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notifiation_clear(NOTIFICATION_TYPE_NOTI); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notifiation_clear(notification_type_e type); - -/** - * @brief Delete all the notifications of the type. - * @details If pkgname is NULL, caller_pkgname is set internally. - * @remarks - * @param[in] pkgname caller application package name or NULL - * @param[in] type notification type - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_delete_all_by_type(const char *pkgname, - notification_type_e type); - -/** - * @brief Delete a notification by priv_id. - * @details If pkgname is NULL, caller_pkgname is set internally. - * @remarks - * @param[in] pkgname caller application package name or NULL - * @param[in] type notification type - * @param[in] priv_id priv ID - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_delete_by_priv_id(const char *pkgname, - notification_type_e type, - int priv_id); - -/** - * @brief Delete a notification with the given handle - * @details notification_delete() remove notification data from DB and notification_free release menory of notification data. - * @remarks - * @param[in] noti notification handle - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @see #notification_h + * @brief Deletes a notification with the given handle. + * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti The notification handle + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @par Sample code: * @code #include <notification.h> ... { notificaton_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; ... @@ -1381,149 +1128,24 @@ notification_error_e notification_delete_by_priv_id(const char *pkgname, } * @endcode */ -notification_error_e notification_delete(notification_h noti); - -/** - * @brief Update progress of inserted notification. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING) - * @details notification view on notification area could be updated - * @remarks - * @param[in] noti notification handle or NULL if priv_id is valid - * @param[in] priv_id private ID - * @param[in] progress % value of progressive data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_update_progress(notification_h noti, - int priv_id, - double progress); - -/** - * @brief Update size of inserted notification data. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING) - * @details notification view on notification area could be updated - * @remarks - * @param[in] noti notification handle or NULL if priv_id is valid - * @param[in] priv_id private ID - * @param[in] size bytes of progressive data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_update_size(notification_h noti, - int priv_id, double size); +int notification_delete(notification_h noti); /** - * @brief Update content of inserted notification data. Only for the ongoing notification(NOTIFICATION_TYPE_ONGOING) - * @details notification view on notification area could be updated - * @remarks - * @param[in] noti notification handle or NULL if priv_id is valid - * @param[in] priv_id private ID - * @param[in] content text to update - * @return NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - Invalide input value - * @pre - * @post - * @par Sample code: - * @code -#include <notification.h> -... - { - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string"); - if(noti_err != NOTIFICATION_ERROR_NONE) { - return; - } -} - * @endcode - */ -notification_error_e notification_update_content(notification_h noti, - int priv_id, - const char *content); - -/** - * @brief Create internal structure data and return notification handle. + * @brief Creates internal structure data and returns a notification handle. * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING. - * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted. + * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted. * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted. - * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouping. #NOTIFICATION_GROUP_ID_DEFAULT, - * notification data is grouping with same title. Positive number ( > 0 ) is grouping with same number. - * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call. - * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package. - * @remarks - * @param[in] type notification type - * @param[in] group_id Group ID - * @param[in] priv_id Priv ID - * @return notification handle(#notification_h) if success, NULL if failure. - * @retval #notification_h - success - * @retval NULL - failure - * @pre - * @post + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] type The notification type + * @return Notification handle(notification_h) on success, + * otherwise @c NULL on failure + * @retval notification_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory * @see #notification_type_e - * @see #notification_h - * @par Sample code: - * @code -#include <notification.h> -... -{ - notification_h noti = NULL; - - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); - if(noti == NULL) { - return; - } - ... -} - * @endcode - */ -notification_h notification_new(notification_type_e type, int group_id, - int priv_id); - -/** - * @brief This function create internal structure data and return notification handle. - * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING. - * #NOTIFICATION_TYPE_NOTI is remaining notification data evenif device is restarted. - * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted. - * @remarks - * @param[in] type notification type - * @return notification handle(#notification_h) if success, NULL if failure. - * @retval #notification_h - success - * @retval NULL - failure - * @pre - * @post - * @see #notification_type_e - * @see #notification_h * @par Sample code: * @code #include <notification.h> @@ -1542,56 +1164,23 @@ notification_h notification_new(notification_type_e type, int group_id, notification_h notification_create(notification_type_e type); /** - * @brief load a notification from the notification DB with private id - * @details - * @remarks - * @param[in] type notification type - * @param[in] group_id Group ID - * @param[in] priv_id Priv ID - * @return notification handle(#notification_h) if success, NULL if failure. - * @retval #notification_h - success - * @retval NULL - failure - * @pre - * @post - * @see #notification_type_e - * @see #notification_h - * @par Sample code: - * @code -#include <notification.h> -... -{ - notification_h noti = NULL; - - noti = notification_load("org.tizen.app", priv_id); - if(noti == NULL) { - return; - } - ... -} - * @endcode - */ -notification_h notification_load(char *pkgname, - int priv_id); - -/** - * @brief Create a notification clone + * @brief Creates a notification clone. * @details Newly created notification handle is returned. - * @remarks This clone notification handle should be call notification_free(). - * @param[in] noti notification handle - * @param[out] clone newly created notification handle that has same with input noti. - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post + * @since_tizen 2.3 + * @remarks This cloned notification handle should be freed using notification_free(). + * @param[in] noti The notification handle + * @param[out] clone The newly created notification handle that has same with input @a noti + * @return #NOTIFICATION_ERROR_NONE if success, + * otherwise any other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @see #notification_type_e - * @see #notification_h * @par Sample code: * @code #include <notification.h> ... { - notification_h noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI); notification_h clone = NULL; notification_clone(noti, &clone); @@ -1599,28 +1188,27 @@ notification_h notification_load(char *pkgname, } * @endcode */ -notification_error_e notification_clone(notification_h noti, notification_h *clone); +int notification_clone(notification_h noti, notification_h *clone); /** - * @brief Free internal structure data of notification handle. - * @details Internal data of notification handle is released. Notification data that inserted is not deleted. - * @remarks - * @param[in] noti notification handle - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre notification_new() - * @post - * @see #notification_h + * @brief Frees the internal structure data of a notification handle. + * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted. + * @since_tizen 2.3 + * @param[in] noti The notification 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 + * @pre Notification handle should be created by notification_create(). * @par Sample code: * @code #include <notification.h> ... { notification_h noti = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if(noti == NULL) { return; } @@ -1633,29 +1221,33 @@ notification_error_e notification_clone(notification_h noti, notification_h *clo } * @endcode */ -notification_error_e notification_free(notification_h noti); +int notification_free(notification_h noti); /** * @} */ /** + * @internal * @addtogroup NOTIFICATION_LIST * @{ */ /** - * @brief This function return notification list handle. - * @details If count is -1, all of notification list is returned. - * @remarks - * @param[in] type notification type - * @param[in] count returned notification data number - * @param[out] NOTIFICATION_ERROR_NONE if success, other value if failure. - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post + * @internal + * @brief Returns the notification list handle. + * @details If count is equal to @c -1, all notifications are returned. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] type The notification type + * @param[in] count The returned notification data number + * @param[out] #NOTIFICATION_ERROR_NONE on success, other value on failure + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @see #notification_list_h * @par Sample code: * @code @@ -1663,7 +1255,7 @@ notification_error_e notification_free(notification_h noti); ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -1672,33 +1264,27 @@ notification_error_e notification_free(notification_h noti); } * @endcode */ -notification_error_e notification_get_list(notification_type_e type, +int notification_get_list(notification_type_e type, int count, notification_list_h * list); /** - * @brief This function will be deprecated. - * @see notification_get_grouping_list() - * - */ -notification_error_e notification_get_grouping_list(notification_type_e type, - int count, - notification_list_h *list); - -/** - * @brief This function return notification detail list handle of grouping data. - * @details If count is -1, all of notification list is returned. - * @remarks - * @param[in] pkgname caller application package name - * @param[in] group_id group id - * @param[in] priv_id private id - * @param[in] count returned notification data number - * @param[out] list notification list handle - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post + * @internal + * @brief Returns the notification detail list handle of grouping data. + * @details If count is equal to c -1, all notifications are returned. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] pkgname The caller application package name + * @param[in] group_id The group ID + * @param[in] priv_id The private ID + * @param[in] count The returned notification data number + * @param[out] list The notification list handle + * @return #NOTIFICATION_ERROR_NONE if success, + * other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @see #notification_list_h * @par Sample code: * @code @@ -1706,7 +1292,7 @@ notification_error_e notification_get_grouping_list(notification_type_e type, ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -1715,22 +1301,25 @@ notification_error_e notification_get_grouping_list(notification_type_e type, } * @endcode */ -notification_error_e notification_get_detail_list(const char *pkgname, +int notification_get_detail_list(const char *pkgname, int group_id, int priv_id, int count, notification_list_h *list); /** - * @brief Free notification list - * @details - * @remarks - * @param[in] list notification list handle - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre notification_get_grouping_list() or notification_get_detail_list () - * @post + * @internal + * @brief Frees a notification list. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] list The notification list 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 + * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @pre notification_get_grouping_list() or notification_get_detail_list(). * @see #notification_list_h * @par Sample code: * @code @@ -1738,7 +1327,7 @@ notification_error_e notification_get_detail_list(const char *pkgname, ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; ... @@ -1749,265 +1338,224 @@ notification_error_e notification_get_detail_list(const char *pkgname, } * @endcode */ -notification_error_e notification_free_list(notification_list_h list); +int notification_free_list(notification_list_h list); /** * @} */ /** - * @brief Register a callback for all notification events - * @details The registered callback could be called for all notification events - * @remarks - * @param[in] changed_cb callback function - * @param[in] user_data user data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre notification_new() - * @post - * @see notification_unresister_changed_cb() + * @addtogroup NOTIFICATION_MODULE + * @{ + */ + +/** + * @internal + * @brief Registers a callback for all notification events. + * @details The registered callback could be called for all notification events. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] changed_cb The callback function + * @param[in] user_data The user data + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @see notification_unregister_detailed_changed_cb() * @par Sample code: * @code #include <notification.h> ... { - noti_err = notification_resister_changed_cb(app_changed_cb, user_data); + noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } } * @endcode */ -notification_error_e -notification_resister_changed_cb( - void (*changed_cb)(void *data, notification_type_e type), - void *user_data); +int notification_register_detailed_changed_cb( + void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), + void *user_data); /** - * @brief Unregister a callback for all notification events - * @details - * @remarks - * @param[in] changed_cb callback function - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post - * @see notification_resister_changed_cb() + * @internal + * @brief Unregisters a callback for all notification events. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] changed_cb The callback function + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @see notification_register_detailed_changed_cb() * @par Sample code: * @code #include <notification.h> ... { - noti_err = notification_unresister_changed_cb(app_changed_cb); + noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } } * @endcode */ -notification_error_e -notification_unresister_changed_cb( - void (*changed_cb)(void *data, notification_type_e type)); +int notification_unregister_detailed_changed_cb( + void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), + void *user_data); /** - * @brief Register a callback for all notification events - * @details The registered callback could be called for all notification events - * @remarks - * @param[in] changed_cb callback function - * @param[in] user_data user data - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post - * @see notification_unregister_detailed_changed_cb() + * @brief Sets the tag of the notification handle. + * @since_tizen 2.3 + * @param[in] noti Notification handle + * @param[in] tag tag for loading notification handle + * @return #NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @see notification_get_tag() * @par Sample code: * @code #include <notification.h> ... { - noti_err = notification_resister_changed_cb(app_changed_cb, user_data); + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if(noti == NULL) { + return; + } + ... + + noti_err = notification_set_tag(noti, tag); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } } * @endcode */ -notification_error_e -notification_register_detailed_changed_cb( - void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), - void *user_data); +int notification_set_tag(notification_h noti, const char *tag); /** - * @brief Unregister a callback for all notification events - * @details - * @remarks - * @param[in] changed_cb callback function - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre - * @post - * @see notification_register_detailed_changed_cb() + * @brief Gets the tag of the notification handle. + * @since_tizen 2.3 + * @param[in] noti Notification handle + * @param[out] tag tag for loading notification handle + * @return #NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @see notification_set_tag() * @par Sample code: * @code #include <notification.h> ... { - noti_err = notification_unresister_changed_cb(app_changed_cb); + int noti_err = NOTIFICATION_ERROR_NONE; + const char *tag = NULL; + + ... + + noti_err = notification_get_tag(noti, &tag); if(noti_err != NOTIFICATION_ERROR_NONE) { return; } } * @endcode */ -notification_error_e -notification_unregister_detailed_changed_cb( - void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), - void *user_data); - -/** - * @brief Get the information of notification event - * @details - * @remarks - * @param[in] list notification list handle - * @return NOTIFICATION_ERROR_NONE if success, other value if failure. - * @retval NOTIFICATION_ERROR_NONE - success - * @retval NOTIFICATION_ERROR_INVALID_DATA - invalid parameter - * @pre notification_get_grouping_list() or notification_get_detail_list () - * @post - * @see #notification_op - */ -notification_error_e notification_op_get_data(notification_op *noti_op, - notification_op_data_type_e type, - void *data); - -/** - * @} - */ - -void notification_call_changed_cb(notification_op *op_list, int op_num); - -int notification_is_service_ready(void); - -notification_error_e notification_add_deffered_task( - void (*deffered_task_cb)(void *data), void *user_data); - -notification_error_e notification_del_deffered_task( - void (*deffered_task_cb)(void *data)); - -/** - * @addtogroup NOTIFICATION_DEPRECATED - * @{ - */ - -/** - * @brief This function will be deprecated. - * @see notification_set_image() - * - */ -notification_error_e notification_set_icon(notification_h noti, - const char *icon_path); - -/** - * @brief This function will be deprecated. - * @see notification_get_image() - * - */ -notification_error_e notification_get_icon(notification_h noti, - char **icon_path); - -/** - * @brief This function will be deprecated. - * @see notification_set_text() - * - */ -notification_error_e notification_set_title(notification_h noti, - const char *title, - const char *loc_title); - -/** - * @brief This function will be deprecated. - * @see notification_get_text() - * - */ -notification_error_e notification_get_title(notification_h noti, - char **title, - char **loc_title); - -/** - * @brief This function will be deprecated. - * @see notification_set_text() - * - */ -notification_error_e notification_set_content(notification_h noti, - const char *content, - const char *loc_content); - -/** - * @brief This function will be deprecated. - * @see notification_get_text() - * - */ -notification_error_e notification_get_content(notification_h noti, - char **content, - char **loc_content); - -/** - * @brief This function will be deprecated. - * @see notification_set_execute_option() - * - */ -notification_error_e notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */ +int notification_get_tag(notification_h noti, const char **tag); + +/** + * @brief Loads a notification from the notification's database with the tag. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] tag tag for loading notification handle + * @return Notification handle(notification_h) on success, NULL on failure + * @retval notification_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory + * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @see #notification_type_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; -/** - * @brief This function will be deprecated. - * @see notification_get_execute_option() - * + noti = notification_load_by_tag(tag); + if(noti == NULL) { + return; + } + ... +} + * @endcode */ -notification_error_e notification_get_application(notification_h noti, char **pkgname); /* Do not use this */ +notification_h notification_load_by_tag(const char *tag); /** - * @brief This function will be deprecated. - * @see notification_set_execute_option() - * - */ -notification_error_e notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */ + * @brief Deletes all notifications of the given type. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] type Notification type + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; -/** - * @brief This function will be deprecated. - * @see notification_get_execute_option() - * + noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode */ -notification_error_e notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */ +int notification_delete_all(notification_type_e type); /** - * @brief This function will be deprecated. - * @see notification_delete_by_priv_id() - * - */ -notification_error_e notification_delete_group_by_group_id(const char *pkgname, - notification_type_e type, - int group_id); + * @brief Posts a notification. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti Notification handle + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @pre Notification handle should be created by notification_create(). + * @post notification_free(). + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; -/** - * @brief This function will be deprecated. - * @see notification_delete_by_priv_id() - * - */ -notification_error_e notification_delete_group_by_priv_id(const char *pkgname, - notification_type_e type, - int priv_id); -/** - * @brief This function will be deprecated. - * + noti_err = notification_post(noti); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode */ -notification_error_e notification_get_count(notification_type_e type, - const char *pkgname, - int group_id, int priv_id, - int *count); +int notification_post(notification_h noti); /** * @} diff --git a/include/notification_error.h b/include/notification_error.h index 62ac6e9..1179838 100755 --- a/include/notification_error.h +++ b/include/notification_error.h @@ -22,25 +22,32 @@ #ifndef __NOTIFICATION_ERROR_H__ #define __NOTIFICATION_ERROR_H__ +#include <tizen.h> + +/** + * @file notification_error.h + */ + /** - * @addtogroup NOTIFICATION_TYPE + * @addtogroup NOTIFICATION_MODULE * @{ */ /** - * @breief Enumeration for notification error + * @brief Enumeration for notification errors. + * @since_tizen 2.3 */ typedef enum _notification_error { - NOTIFICATION_ERROR_NONE = 0, /**< Success */ - NOTIFICATION_ERROR_INVALID_DATA = -1, /**< Invalid parameter */ - NOTIFICATION_ERROR_NO_MEMORY = -2, /**< No memory */ - NOTIFICATION_ERROR_FROM_DB = -3, /**< Error from DB query */ - NOTIFICATION_ERROR_ALREADY_EXIST_ID = -4, /**< Already exist private ID */ - NOTIFICATION_ERROR_FROM_DBUS = -5, /**< Error from DBus */ - NOTIFICATION_ERROR_NOT_EXIST_ID = -6, /**< Not exist private ID */ - NOTIFICATION_ERROR_IO = -7, /**< disk i/o error */ - NOTIFICATION_ERROR_SERVICE_NOT_READY = -8, /**< no reponse from master */ - NOTIFICATION_ERROR_PERMISSION_DENIED = -9, /**< Permission denied */ + NOTIFICATION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */ + NOTIFICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + NOTIFICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< out of memory */ + NOTIFICATION_ERROR_IO_ERROR= TIZEN_ERROR_IO_ERROR, /**< I/O error */ + NOTIFICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + NOTIFICATION_ERROR_FROM_DB = TIZEN_ERROR_NOTIFICATION | 0x01, /**< Error from DB query */ + NOTIFICATION_ERROR_ALREADY_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x02, /**< Already exist private ID */ + 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_e; /** diff --git a/include/notification_group.h b/include/notification_group.h index 5c79232..2bff013 100755 --- a/include/notification_group.h +++ b/include/notification_group.h @@ -24,34 +24,34 @@ #include <notification.h> -notification_error_e notification_group_set_title(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_set_title(const char *pkgname, int group_id, const char *title, const char *loc_title, notification_count_display_type_e count_display); -notification_error_e notification_group_get_title(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_get_title(const char *pkgname, int group_id, char **ret_title, char **ret_loc_title, notification_count_display_type_e *count_display); -notification_error_e notification_group_set_content(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_set_content(const char *pkgname, int group_id, const char *content, const char *loc_content, notification_count_display_type_e count_display); -notification_error_e notification_group_get_content(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_get_content(const char *pkgname, int group_id, char **ret_content, char **ret_loc_content, notification_count_display_type_e *count_display); -notification_error_e notification_group_set_badge(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_set_badge(const char *pkgname, int group_id, int count); -notification_error_e notification_group_get_badge(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_group_get_badge(const char *pkgname, int group_id, int *count); #endif /* __NOTIFICATION_GROUP_H__ */ diff --git a/include/notification_internal.h b/include/notification_internal.h index 83805bd..77030c5 100755 --- a/include/notification_internal.h +++ b/include/notification_internal.h @@ -22,60 +22,621 @@ #ifndef __NOTIFICATION_INTERNAL_H__ #define __NOTIFICATION_INTERNAL_H__ -#ifndef EXPORT_API -#define EXPORT_API __attribute__ ((visibility("default"))) +#include <notification_error.h> +#include <notification_type.h> +#include <notification_list.h> + +#ifdef __cplusplus +extern "C" { #endif -struct _notification { - notification_type_e type; - notification_ly_type_e layout; +/** + * @addtogroup NOTIFICATION_INTERNAL + * @{ + */ + +/** + * @brief This function add deferred task. the registered task will be executed when notification service become ready + * @param[in] deferred_task_cb The callback function + * @param[in] user_data The user data to be passed to the callback function + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @see #notification_error_e + * @see notification_is_service_ready() + */ +int notification_add_deferred_task( + void (*deferred_task_cb)(void *data), void *user_data); + +/** + * @brief This function remove deferred task. + * @param[in] deferred_task_cb The callback function + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @see #notification_error_e + * @see notification_is_service_ready() + */ +int notification_del_deferred_task( + void (*deferred_task_cb)(void *data)); + +/** + * @brief This function will be removed. + * @see notification_unresister_changed_cb() + */ +int +notification_resister_changed_cb( + void (*changed_cb)(void *data, notification_type_e type), + void *user_data); + +/** + * @brief This function will be removed. + * @see notification_resister_changed_cb() + */ +int +notification_unresister_changed_cb( + void (*changed_cb)(void *data, notification_type_e type)); + +/** + * @brief Updates the progress of the inserted notification. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING). + * @details The Notification view on the notification area could be updated. + * @param[in] noti Notification handle or NULL if priv_id is valid + * @param[in] priv_id Private ID + * @param[in] progress Percentage value of progressive data + * @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> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_update_progress(notification_h noti, + int priv_id, + double progress); + +/** + * @brief Updates the size of inserted notification data. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING). + * @details Notification view on notification area could be updated. + * @param[in] noti Notification handle or NULL if priv_id is valid + * @param[in] priv_id Private ID + * @param[in] size Bytes of progressive data + * @return NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_update_size(notification_h noti, + int priv_id, double size); + +/** + * @brief Updates the content of the inserted notification data. This is only for the ongoing notification (NOTIFICATION_TYPE_ONGOING). + * @details Notification view on notification area could be updated. + * @param[in] noti Notification handle or NULL if priv_id is valid + * @param[in] priv_id Private ID + * @param[in] content Text to update + * @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> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string"); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_update_content(notification_h noti, + int priv_id, + const char *content); + +/** + * @brief This function will be deprecated. + * @see notification_set_image() + * + */ +NOTIFICATION_DEPRECATED_API int notification_set_icon(notification_h noti, + const char *icon_path); + +/** + * @brief This function will be deprecated. + * @see notification_get_image() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_icon(notification_h noti, + char **icon_path); + +/** + * @brief This function will be deprecated. + * @see notification_set_text() + * + */ +NOTIFICATION_DEPRECATED_API int notification_set_title(notification_h noti, + const char *title, + const char *loc_title); + +/** + * @brief This function will be deprecated. + * @see notification_get_text() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_title(notification_h noti, + char **title, + char **loc_title); + +/** + * @brief This function will be deprecated. + * @see notification_set_text() + * + */ +NOTIFICATION_DEPRECATED_API int notification_set_content(notification_h noti, + const char *content, + const char *loc_content); + +/** + * @brief This function will be deprecated. + * @see notification_get_text() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti, + char **content, + char **loc_content); + +/** + * @brief This function will be removed. + * @see notification_set_execute_option() + * + */ +NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */ + +/** + * @brief This function will be removed. + * @see notification_get_execute_option() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname); /* Do not use this */ + +/** + * @brief This function will be deprecated. + * @see notification_set_execute_option() + * + */ +NOTIFICATION_DEPRECATED_API int notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */ + +/** + * @brief This function will be deprecated. + * @see notification_get_execute_option() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */ + +/** + * @brief This function is deprecated. + * @see notification_get_grouping_list() + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type_e type, + int count, + notification_list_h *list); - int group_id; /* Group ID */ - int internal_group_id; /* Internal Group ID */ - int priv_id; /* Private ID */ +/** + * @brief This function will be deprecated. + * @see notification_delete_by_priv_id() + * + */ +NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname, + notification_type_e type, + int group_id); - char *caller_pkgname; /* Caller App package name */ - char *launch_pkgname; /* Launch App package name. It will be from appsvc_set_pkgname */ - bundle *args; /* Will be removed. */ - bundle *group_args; /* Will be removed. */ +/** + * @brief This function will be deprecated. + * @see notification_delete_by_priv_id() + * + */ +NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname, + notification_type_e type, + int priv_id); +/** + * @brief This function will be deprecated. + * + */ +NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type, + const char *pkgname, + int group_id, int priv_id, + int *count); - bundle *b_execute_option; - bundle *b_service_responding; - bundle *b_service_single_launch; - bundle *b_service_multi_launch; +/** + * @brief This function will be deprecated. + * + */ +NOTIFICATION_DEPRECATED_API int notifiation_clear(notification_type_e type); - char *domain; /* Text domain for localization */ - char *dir; /* Text dir for localization */ +/** + * @internal + * @brief This function will be deprecated. + * @details Use only for the notification tray's clear button operation. + * @param[in] type Notification type + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @see #notification_type_e + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; - bundle *b_text; /* basic text */ - bundle *b_key; /* key for localized text */ - bundle *b_format_args; /* args type and value for format string */ - int num_format_args; /* number of format string args */ + noti_err = notification_clear(NOTIFICATION_TYPE_NOTI); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_clear(notification_type_e type); - bundle *b_image_path; /* image path */ +/** + * @internal + * @brief This function will be deprecated. + * @return 1 on ready, other value on not ready + */ +NOTIFICATION_DEPRECATED_API int notification_is_service_ready(void); - notification_sound_type_e sound_type; - char *sound_path; - notification_vibration_type_e vibration_type; - char *vibration_path; - notification_led_op_e led_operation; - int led_argb; - int led_on_ms; - int led_off_ms; +/** + * @internal + * @brief This function will be deprecated. + * @param[in] list Notification list handle + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre notification_get_grouping_list() or notification_get_detail_list(). + * @see #notification_op + */ +NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_op, + notification_op_data_type_e type, + void *data); + +/** + * @internal + * @brief This function will be deprecated. + * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API. + * @param[in] noti Notification handle + * @param[in] 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> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + if(noti == NULL) { + return; + } + + noti_err = notification_set_pkgname(noti, "org.tizen.phone"); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti, + const char *pkgname); + +/** + * @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> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + char *pkgname = NULL; - time_t time; /* time set by application */ - time_t insert_time; /* insert time */ + 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 + * @return NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname, + notification_type_e type); + +/** + * @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 + * @param[in] priv_id Priv ID + * @return NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @par Sample code: + * @code +#include <notification.h> +... + { + int noti_err = NOTIFICATION_ERROR_NONE; - int flags_for_property; /* property NOTIFICATION_PROP_XXX */ - int display_applist; /* display app list NOTIFICATION_DISPLAY_APP_XXX */ + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname, + notification_type_e type, + int priv_id); - double progress_size; /* size of progress */ - double progress_percentage; /* percentage of progress */ +/** + * @internal + * @brief This function will be deprecated. + * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle. + * @param[in] noti Notification handle + * @param[in] type Notification execute type + * @param[in] text Basic text for button + * @param[in] key Value for localized text + * @param[in] service_handle Appsvc bundle data + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; - char *app_icon_path; /* Temporary stored app icon path from AIL */ - char *app_name; /* Temporary stored app name from AIL */ - char *temp_title; - char *temp_content; -}; + ... -#endif /* __NOTIFICATION_INTERNAL_H__ */ + b = bundle_create(); + appsvc_set_operation(b, APPSVC_OPERATION_VIEW); + appsvc_set_uri(b,"http://www.samsung.com"); + + noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + bundle_free(b); +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti, + notification_execute_type_e type, + const char *text, + const char *key, + bundle *service_handle); + +/** + * @internal + * @brief This function will be deprecated. + * @remarks ID is valid only after inserting the notification. + * @param[in] noti Notification handle + * @param[out] group_id Group ID + * @param[out] priv_id Private ID + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code +#include <notification.h> + ... + { + int noti_err = NOTIFICATION_ERROR_NONE; + int group_id, priv_id; + + noti_err = notification_get_id(noti, &group_id, &priv_id); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + } + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti, + int *group_id, int *priv_id); + +/** + * @internal + * @brief This function will be deprecated. + * @param[in] type Notification type + * @param[in] group_id Group ID + * @param[in] priv_id Priv ID + * @return Notification handle(#notification_h) on success, NULL on failure + * @retval #notification_h Success + * @retval NULL Failure + * @see #notification_type_e + * @see #notification_h + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + + noti = notification_load("org.tizen.app", priv_id); + if(noti == NULL) { + return; + } + ... +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname, + int priv_id); + +/** + * @internal + * @brief This function will be deprecated. + * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING. + * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted. + * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted. + * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT, + * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number. + * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call. + * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package. + * @param[in] type Notification type + * @param[in] group_id Group ID + * @param[in] priv_id Priv ID + * @return Notification handle(#notification_h) on success, NULL on failure + * @retval #notification_h Success + * @retval NULL Failure + * @see #notification_type_e + * @see #notification_h + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + + noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + if(noti == NULL) { + return; + } + ... +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id, + int priv_id); + +/** + * @internal + * @brief This function will be deprecated. + * @param[in] noti Notification handle + * @param[in] type Notification execute type + * @param[out] text Text for button + * @param[out] service_handle Appsvc bundle data + * @return NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + ... + + noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti, + notification_execute_type_e type, + const char **text, + bundle **service_handle); + +/** + * @internal + * @brief This function sets notification property for designated package. + * @since_tizen 2.3 + * @privlevel public + * @privilege http://tizen.org/privilege/core/notification + * @param[in] pkgname The name of designated package + * @param[in] property name + * @param[in] property value + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @see #notification_error_e + */ +int notification_setting_property_set(const char *pkgname, const char *property, const char *value); + +/** + * @internal + * @brief This function gets notification property for designated package. + * @since_tizen 2.3 + * @privlevel public + * @privilege http://tizen.org/privilege/core/notification + * @param[in] pkgname The name of designated package + * @param[in] property name + * @param[in] pointer which can save the getting value + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @see #notification + */ +int notification_setting_property_get(const char *pkgname, const char *property, char **value); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/notification_ipc.h b/include/notification_ipc.h index e70a26f..0eb7827 100755 --- a/include/notification_ipc.h +++ b/include/notification_ipc.h @@ -33,26 +33,30 @@ extern "C" { struct packet; -notification_error_e notification_ipc_monitor_init(void); -notification_error_e notification_ipc_monitor_fini(void); +int notification_ipc_monitor_init(void); +int notification_ipc_monitor_fini(void); -notification_error_e notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet); +int notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet); struct packet *notification_ipc_make_packet_from_noti(notification_h noti, const char *command, int packet_type); +struct packet *notification_ipc_make_reply_packet_from_noti(notification_h noti, struct packet *packet); -notification_error_e notification_ipc_request_insert(notification_h noti, int *priv_id); -notification_error_e notification_ipc_request_update(notification_h noti); -notification_error_e notification_ipc_request_update_async(notification_h noti, + +int notification_ipc_request_insert(notification_h noti, int *priv_id); +int notification_ipc_request_update(notification_h noti); +int notification_ipc_request_update_async(notification_h noti, void (*result_cb)(int priv_id, int result, void *data), void *user_data); -notification_error_e notification_ipc_request_refresh(void); -notification_error_e notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id); -notification_error_e notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname); +int notification_ipc_request_refresh(void); +int notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id); +int notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname); int notification_ipc_is_master_ready(void); -notification_error_e notification_ipc_add_deffered_task(void (*deffered_task_cb)(void *data), void *user_data); -notification_error_e notification_ipc_del_deffered_task(void (*deffered_task_cb)(void *data)); +int notification_ipc_add_deffered_task(void (*deferred_task_cb)(void *data), void *user_data); +int notification_ipc_del_deffered_task(void (*deferred_task_cb)(void *data)); + +int notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value); +int notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value); -notification_error_e notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value); -notification_error_e notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value); +int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *pkgname, const char *tag); #ifdef __cplusplus } diff --git a/include/notification_list.h b/include/notification_list.h index d33a40a..2985af8 100755 --- a/include/notification_list.h +++ b/include/notification_list.h @@ -29,30 +29,33 @@ extern "C" { #endif /** - * @file notification.h - * @brief This file contains the notification list APIs + * @file notification_list.h + * @brief This file contains the notification list APIs. */ /** + * @internal * @addtogroup NOTIFICATION_LIST * @{ */ /** - * @breief Notification list handle + * @brief Notification list handle. + * @since_tizen 2.3 */ typedef struct _notification_list *notification_list_h; /** - * @brief This function get head pointer of the notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @return notification list handle if success, NULL if failure. - * @retval notification list handle(#notification_list_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Gets the head pointer of the notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @return Notification list handle on success, NULL on failure + * @retval #notification_list_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @par Sample code: * @code @@ -60,7 +63,7 @@ typedef struct _notification_list *notification_list_h; ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -74,15 +77,16 @@ typedef struct _notification_list *notification_list_h; notification_list_h notification_list_get_head(notification_list_h list); /** - * @brief This function get tail pointer of the notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @return notification list handle if success, NULL if failure. - * @retval notification list handle(#notification_list_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Gets the tail pointer to the notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @return Notification list handle on success, NULL on failure + * @retval #notification_list_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @par Sample code: * @code @@ -90,7 +94,7 @@ notification_list_h notification_list_get_head(notification_list_h list); ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -104,15 +108,16 @@ notification_list_h notification_list_get_head(notification_list_h list); notification_list_h notification_list_get_tail(notification_list_h list); /** - * @brief This function get previous pointer of the current notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @return notification list handle if success, NULL if failure. - * @retval notification list handle(#notification_list_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Gets the previous pointer of the current notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @return Notification list handle on success, NULL on failure + * @retval #notification_list_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @par Sample code: * @code @@ -120,7 +125,7 @@ notification_list_h notification_list_get_tail(notification_list_h list); ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -134,15 +139,16 @@ notification_list_h notification_list_get_tail(notification_list_h list); notification_list_h notification_list_get_prev(notification_list_h list); /** - * @brief This function get next pointer of the current notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @return notification list handle if success, NULL if failure. - * @retval notification list handle(#notification_list_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Gets the next pointer of the current notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @return Notification list handle on success, NULL on failure + * @retval #notification_list_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @par Sample code: * @code @@ -150,7 +156,7 @@ notification_list_h notification_list_get_prev(notification_list_h list); ... { notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -164,15 +170,16 @@ notification_list_h notification_list_get_prev(notification_list_h list); notification_list_h notification_list_get_next(notification_list_h list); /** - * @brief This function get notification handle that list has. - * @details - * @remarks - * @param[in] list notification list handle - * @return notification handle if success, NULL if failure. - * @retval notification handle(#notification_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Gets the notification handle that the list has. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @return Notification handle on success, NULL on failure + * @retval #notification_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @see #notification_h * @par Sample code: @@ -182,7 +189,7 @@ notification_list_h notification_list_get_next(notification_list_h list); { notification_h noti = NULL; notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); if(noti_err != NOTIFICATION_ERROR_NONE) { @@ -196,16 +203,18 @@ notification_list_h notification_list_get_next(notification_list_h list); notification_h notification_list_get_data(notification_list_h list); /** - * @brief This function append notification data in notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @param[in] noti notification handle - * @return notification handle if success, NULL if failure. - * @retval notification handle(#notification_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Appends notification data to the notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list Notification list handle + * @param[in] noti Notification handle + * @return Notification handle on success, NULL on failure + * @retval #notification_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory * @see #notification_list_h * @see #notification_h * @par Sample code: @@ -215,7 +224,7 @@ notification_h notification_list_get_data(notification_list_h list); { notification_h noti = NULL; notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); if(noti == NULL) { @@ -230,16 +239,18 @@ notification_list_h notification_list_append(notification_list_h list, notification_h noti); /** - * @brief This function remove notification data from notification list. - * @details - * @remarks - * @param[in] list notification list handle - * @param[in] noti notification handle - * @return notification handle if success, NULL if failure. - * @retval notification handle(#notification_h) - success - * @retval NULL - failure - * @pre - * @post + * @internal + * @brief Removes notification data from the notification list. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] list The notification list handle + * @param[in] noti The notification handle + * @return Notification handle on success, + * otherwise @c NULL on failure + * @retval #notification_h Success + * @retval NULL Failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @see #notification_list_h * @see #notification_h * @par Sample code: @@ -249,7 +260,7 @@ notification_list_h notification_list_append(notification_list_h list, { notification_h noti = NULL; notification_list_h noti_list = NULL; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; ... diff --git a/include/notification_noti.h b/include/notification_noti.h index 5aad159..733acff 100755 --- a/include/notification_noti.h +++ b/include/notification_noti.h @@ -46,22 +46,25 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, int notification_noti_delete_group_by_priv_id(const char *pkgname, int priv_id); int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id); +int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag); int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id); int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes); -notification_error_e notification_noti_get_count(notification_type_e type, +int notification_noti_get_count(notification_type_e type, const char *pkgname, int group_id, int priv_id, int *count); -notification_error_e notification_noti_get_grouping_list(notification_type_e type, +int notification_noti_get_grouping_list(notification_type_e type, int count, notification_list_h *list); -notification_error_e notification_noti_get_detail_list(const char *pkgname, +int notification_noti_get_detail_list(const char *pkgname, int group_id, int priv_id, int count, notification_list_h *list); +int notification_noti_check_tag(notification_h noti); + #endif /* __NOTIFICATION_NOTI_H__ */ diff --git a/include/notification_ongoing.h b/include/notification_ongoing.h index 39f7c96..5fb4141 100755 --- a/include/notification_ongoing.h +++ b/include/notification_ongoing.h @@ -23,14 +23,14 @@ #define __NOTIFICATION_ONGOING_H__ #include <notification.h> -notification_error_e notification_ongoing_update_progress(const char *caller_pkgname, +int notification_ongoing_update_progress(const char *caller_pkgname, int priv_id, double progress); -notification_error_e notification_ongoing_update_size(const char *caller_pkgname, +int notification_ongoing_update_size(const char *caller_pkgname, int priv_id, double size); -notification_error_e notification_ongoing_update_content(const char *caller_pkgname, +int notification_ongoing_update_content(const char *caller_pkgname, int priv_id, const char *content); #endif /* __NOTIFICATION_ONGOING_H__ */ diff --git a/include/notification_private.h b/include/notification_private.h new file mode 100755 index 0000000..a5c7cb0 --- /dev/null +++ b/include/notification_private.h @@ -0,0 +1,84 @@ +/* + * libnotification + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com> + * + * 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 __NOTIFICATION_PRIVATE_H__ +#define __NOTIFICATION_PRIVATE_H__ + +#ifndef EXPORT_API +#define EXPORT_API __attribute__ ((visibility("default"))) +#endif + +struct _notification { + notification_type_e type; + notification_ly_type_e layout; + + int group_id; /* Group ID */ + int internal_group_id; /* Internal Group ID */ + int priv_id; /* Private ID */ + + char *caller_pkgname; /* Caller App package name */ + char *launch_pkgname; /* Launch App package name. It will be from appsvc_set_pkgname */ + bundle *args; /* Will be removed. */ + bundle *group_args; /* Will be removed. */ + + bundle *b_execute_option; + bundle *b_service_responding; + bundle *b_service_single_launch; + bundle *b_service_multi_launch; + + char *domain; /* Text domain for localization */ + char *dir; /* Text dir for localization */ + + bundle *b_text; /* basic text */ + bundle *b_key; /* key for localized text */ + bundle *b_format_args; /* args type and value for format string */ + int num_format_args; /* number of format string args */ + + bundle *b_image_path; /* image path */ + + notification_sound_type_e sound_type; + char *sound_path; + notification_vibration_type_e vibration_type; + char *vibration_path; + notification_led_op_e led_operation; + int led_argb; + int led_on_ms; + int led_off_ms; + + time_t time; /* time set by application */ + time_t insert_time; /* insert time */ + + int flags_for_property; /* property NOTIFICATION_PROP_XXX */ + int display_applist; /* display app list NOTIFICATION_DISPLAY_APP_XXX */ + + double progress_size; /* size of progress */ + double progress_percentage; /* percentage of progress */ + + char *app_icon_path; /* Temporary stored app icon path from AIL */ + char *app_name; /* Temporary stored app name from AIL */ + char *temp_title; + char *temp_content; + char *tag; +}; + +void notification_call_changed_cb(notification_op *op_list, int op_num); + +#endif /* __NOTIFICATION_PRIVATE_H__ */ diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h index 6d157c4..789d60e 100755 --- a/include/notification_setting_service.h +++ b/include/notification_setting_service.h @@ -28,8 +28,8 @@ extern "C" { #endif -notification_error_e notification_setting_db_set(const char *pkgname, const char *property, const char *value); -notification_error_e notification_setting_db_get(const char *pkgname, const char *property, char **value); +int notification_setting_db_set(const char *pkgname, const char *property, const char *value); +int notification_setting_db_get(const char *pkgname, const char *property, char **value); #ifdef __cplusplus } diff --git a/include/notification_status.h b/include/notification_status.h index 2a05f48..2d1a8a4 100755 --- a/include/notification_status.h +++ b/include/notification_status.h @@ -27,38 +27,61 @@ extern "C" { #endif /* __cplusplus */ /** -* @brief Called when new message is posted -* @param[in] message The message posted -* @param[in] data user data -* @pre notification_status_monitor_message_cb_set() used to register this callback -* @see notification_status_monitor_message_cb_set() -*/ -typedef void (*notification_status_message_cb)(const char *message, void *data); + * @file notification_status.h + */ /** -* @brief register callback for receiving message -* @param[in] callback The callback function -* @param[in] data user_data -*/ -int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data); + * @addtogroup NOTIFICATION_STATUS + * @{ + */ /** -* @brief unregister callback for receiving message -* @param[in] callback The callback function -* @param[in] data user_data + * @internal + * @brief Called when a new message is posted. + * @since_tizen 2.3 + * @param[in] message The message posted + * @param[in] data The user data + * @pre notification_status_monitor_message_cb_set() used to register this callback. + * @see notification_status_monitor_message_cb_set() */ -int notification_status_monitor_message_cb_unset(void); +typedef void (*notification_status_message_cb)(const char *message, void *data); /** - * @addtogroup NOTIFICATION_STATUS - * @{ + * @internal + * @brief Registers a callback to receive a message. + * @since_tizen 2.3 + * @param[in] callback The callback function + * @param[in] data The user_data + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus */ +int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data); /** - * @brief This function send string(message) to notification status monitor - * @details Send the message to notification status monitor. - * @param[in] message messages you want to post + * @internal + * @brief Unregisters a callback to receive a message. + * @since_tizen 2.3 + * @param[in] callback The callback function + * @param[in] data The user_data * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @retval #NOTIFICATION_ERROR_NONE Success + */ +int notification_status_monitor_message_cb_unset(void); + +/** + * @brief Sends a string (message) to the notification status monitor. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] message The messages to be posted + + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @see #notification_error_e */ int notification_status_message_post(const char *message); diff --git a/include/notification_type.h b/include/notification_type.h index cee8a52..1fcd343 100755 --- a/include/notification_type.h +++ b/include/notification_type.h @@ -26,42 +26,63 @@ extern "C" { #endif +#ifndef NOTIFICATION_DEPRECATED_API +#if 0//__GNUC__ +#define NOTIFICATION_DEPRECATED_API __attribute__((deprecated)) +#else +#define NOTIFICATION_DEPRECATED_API +#endif +#endif + /** * @file notification_type.h - * @brief This file contains defines and enumerations for Notification APIs + * @brief This file contains type definitions and enumerations for Notification API. */ /** - * @addtogroup NOTIFICATION_TYPE + * @addtogroup NOTIFICATION_MODULE * @{ */ /** - * @brief Enumeration for notification layout type + * @brief Enumeration for notification layout type. + * @since_tizen 2.3 */ typedef enum _notification_ly_type { NOTIFICATION_LY_NONE = 0, + /**< Default */ NOTIFICATION_LY_NOTI_EVENT_SINGLE, - /**< layout for notification. used to inform single event*/ + /**< Layout for notification. Used to inform single event*/ NOTIFICATION_LY_NOTI_EVENT_MULTIPLE, - /**< layout for notification. used to inform multiple event*/ + /**< Layout for notification. Used to inform multiple event*/ NOTIFICATION_LY_NOTI_THUMBNAIL, - /**< layout for notification. used to display images*/ + /**< Layout for notification. Used to display images*/ NOTIFICATION_LY_ONGOING_EVENT, - /**< layout for ongoing notification. used to display text message*/ + /**< Layout for ongoing notification. Used to display text message*/ NOTIFICATION_LY_ONGOING_PROGRESS, - /**< layout for ongoing notification. used to display progress*/ + /**< Layout for ongoing notification. Used to display progress*/ NOTIFICATION_LY_MAX, + /**< TBD */ } notification_ly_type_e; /** + * @brief Enumeration for notification lauch option type. + * @since_tizen 2.3 + */ +typedef enum _notification_launch_option_type { + NOTIFICATION_LAUNCH_OPTION_APP_CONTROL = 1, + /**< launching with app control */ +} notification_launch_option_type; + +/** * @brief Enumeration for notification sound type. + * @since_tizen 2.3 */ typedef enum _notification_sound_type { NOTIFICATION_SOUND_TYPE_NONE = -1, /**< Default value. no sound */ NOTIFICATION_SOUND_TYPE_DEFAULT = 0, - /**< default sound */ + /**< Default sound */ NOTIFICATION_SOUND_TYPE_USER_DATA, /**< User sound data */ NOTIFICATION_SOUND_TYPE_MAX, @@ -70,41 +91,45 @@ typedef enum _notification_sound_type { /** * @brief Enumeration for notification vibration type. + * @since_tizen 2.3 */ typedef enum _notification_vibration_type { NOTIFICATION_VIBRATION_TYPE_NONE = -1, - /**< Default value. no vibration */ - NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0,/**< default vibrate pattern */ + /**< Default value. No vibration */ + NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0,/**< Default vibrate pattern */ NOTIFICATION_VIBRATION_TYPE_USER_DATA, /**< User vibration data */ NOTIFICATION_VIBRATION_TYPE_MAX,/**< Max flag */ } notification_vibration_type_e; /** - * @brief Enumeration for notification led operation. + * @brief Enumeration for notification LED operation. + * @since_tizen 2.3 */ typedef enum _notification_led_op { NOTIFICATION_LED_OP_OFF = -1, /**< Default value. Disable the LED notification */ - NOTIFICATION_LED_OP_ON = 0,/**< turn on the LED with default color */ + NOTIFICATION_LED_OP_ON = 0,/**< Turn on the LED with default color */ NOTIFICATION_LED_OP_ON_CUSTOM_COLOR, - /**< turn on the LED with custom color */ + /**< Turn on the LED with custom color */ NOTIFICATION_LED_OP_MAX,/**< Max flag */ } notification_led_op_e; /** - * @brief Will be deprecated. + * @brief This will be deprecated. + * @since_tizen 2.3 */ typedef enum _notification_count_display_type { - NOTIFICATION_COUNT_DISPLAY_TYPE_NONE = -1, - NOTIFICATION_COUNT_DISPLAY_TYPE_LEFT = 0, - NOTIFICATION_COUNT_DISPLAY_TYPE_IN, - NOTIFICATION_COUNT_DISPLAY_TYPE_RIGHT, - NOTIFICATION_COUNT_DISPLAY_TYPE_MAX, + NOTIFICATION_COUNT_DISPLAY_TYPE_NONE = -1, /**< None */ + NOTIFICATION_COUNT_DISPLAY_TYPE_LEFT = 0, /**< The number is placed to left */ + NOTIFICATION_COUNT_DISPLAY_TYPE_IN, /**< The number is placed to center */ + NOTIFICATION_COUNT_DISPLAY_TYPE_RIGHT, /**< The number is placed to right */ + NOTIFICATION_COUNT_DISPLAY_TYPE_MAX, /**< Max flag */ } notification_count_display_type_e; /** * @brief Enumeration for notification text type. + * @since_tizen 2.3 */ typedef enum _notification_text_type { NOTIFICATION_TEXT_TYPE_NONE = -1, @@ -116,19 +141,19 @@ typedef enum _notification_text_type { NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, /**< Content for content display option is off of the Settings */ NOTIFICATION_TEXT_TYPE_EVENT_COUNT, - /**< text to display event count */ + /**< Text to display event count */ NOTIFICATION_TEXT_TYPE_INFO_1, - /**< box contents 1 */ + /**< Box contents 1 */ NOTIFICATION_TEXT_TYPE_INFO_SUB_1, - /**< box contents 1-1 */ + /**< Box contents 1-1 */ NOTIFICATION_TEXT_TYPE_INFO_2, - /**< box contents 2 */ + /**< Box contents 2 */ NOTIFICATION_TEXT_TYPE_INFO_SUB_2, - /**< box contents 2-1 */ + /**< Box contents 2-1 */ NOTIFICATION_TEXT_TYPE_INFO_3, - /**< box contents 3 */ + /**< Box contents 3 */ NOTIFICATION_TEXT_TYPE_INFO_SUB_3, - /**< box contents 3-1 */ + /**< Box contents 3-1 */ NOTIFICATION_TEXT_TYPE_GROUP_TITLE, /**< Group title */ NOTIFICATION_TEXT_TYPE_GROUP_CONTENT, @@ -140,7 +165,8 @@ typedef enum _notification_text_type { } notification_text_type_e; /** - * @brief Enumeration for image text type. + * @brief Enumeration for image type. + * @since_tizen 2.3 */ typedef enum _notification_image_type { NOTIFICATION_IMAGE_TYPE_NONE = -1, @@ -160,15 +186,15 @@ typedef enum _notification_image_type { NOTIFICATION_IMAGE_TYPE_BACKGROUND, /**< image displayed on background */ NOTIFICATION_IMAGE_TYPE_LIST_1, - /**< image for thumbnail list */ + /**< Image for thumbnail list */ NOTIFICATION_IMAGE_TYPE_LIST_2, - /**< image for thumbnail list */ + /**< Image for thumbnail list */ NOTIFICATION_IMAGE_TYPE_LIST_3, - /**< image for thumbnail list */ + /**< Image for thumbnail list */ NOTIFICATION_IMAGE_TYPE_LIST_4, - /**< image for thumbnail list */ + /**< Image for thumbnail list */ NOTIFICATION_IMAGE_TYPE_LIST_5, - /**< image for thumbnail list */ + /**< Image for thumbnail list */ NOTIFICATION_IMAGE_TYPE_MAX, /**< Max flag */ } notification_image_type_e; @@ -183,6 +209,7 @@ typedef enum _notification_image_type { /** * @brief Enumeration for application execution type. + * @since_tizen 2.3 */ typedef enum _notification_execute_type { NOTIFICATION_EXECUTE_TYPE_NONE = -1, @@ -198,6 +225,7 @@ typedef enum _notification_execute_type { /** * @brief Enumeration for notification type. + * @since_tizen 2.3 */ typedef enum _notification_type { NOTIFICATION_TYPE_NONE = -1, @@ -212,6 +240,7 @@ typedef enum _notification_type { /** * @brief Enumeration for Group ID. + * @since_tizen 2.3 */ enum _notification_group_id { NOTIFICATION_GROUP_ID_NONE = -1,/**< Not Grouping */ @@ -221,6 +250,7 @@ enum _notification_group_id { /** * @brief Enumeration for Private ID. + * @since_tizen 2.3 */ enum _notification_priv_id { NOTIFICATION_PRIV_ID_NONE = -1, @@ -228,7 +258,8 @@ enum _notification_priv_id { }; /** - * @brief Enumeration for notification property + * @brief Enumeration for notification property. + * @since_tizen 2.3 */ enum _notification_property { NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE = 0x00000001, @@ -249,7 +280,8 @@ enum _notification_property { }; /** - * @brief Enumeration for display application list + * @brief Enumeration for display application list. + * @since_tizen 2.3 */ enum _notificaton_display_applist { NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY = 0x00000001,/**< Notification Tray(Quickpanel) */ @@ -263,37 +295,36 @@ enum _notificaton_display_applist { }; /** - * @} - */ - -/** - * @brief Enumeration for notification operation code + * @brief Enumeration for notification operation code. + * @since_tizen 2.3 */ typedef enum _notification_op_type { - NOTIFICATION_OP_NONE = 0, - NOTIFICATION_OP_INSERT = 1, - NOTIFICATION_OP_UPDATE, - NOTIFICATION_OP_DELETE, - NOTIFICATION_OP_DELETE_ALL, - NOTIFICATION_OP_REFRESH, - NOTIFICATION_OP_SERVICE_READY, + NOTIFICATION_OP_NONE = 0, /**< Default */ + NOTIFICATION_OP_INSERT = 1, /**< Notification inserted */ + NOTIFICATION_OP_UPDATE, /**< Notification updated */ + NOTIFICATION_OP_DELETE, /**< Notification deleted */ + NOTIFICATION_OP_DELETE_ALL, /**< Notifications deleted */ + NOTIFICATION_OP_REFRESH, /**< Deprecated */ + NOTIFICATION_OP_SERVICE_READY, /**< Notification service is ready */ } notification_op_type_e; /** * @brief Enumeration for notification operation data code + * @since_tizen 2.3 */ typedef enum _notification_op_data_type { - NOTIFICATION_OP_DATA_MIN = 0, - NOTIFICATION_OP_DATA_TYPE, - NOTIFICATION_OP_DATA_PRIV_ID, - NOTIFICATION_OP_DATA_NOTI, - NOTIFICATION_OP_DATA_EXTRA_INFO_1, - NOTIFICATION_OP_DATA_EXTRA_INFO_2, - NOTIFICATION_OP_DATA_MAX, + NOTIFICATION_OP_DATA_MIN = 0, /**< Default */ + NOTIFICATION_OP_DATA_TYPE, /**< Operation type */ + NOTIFICATION_OP_DATA_PRIV_ID, /**< Private ID */ + NOTIFICATION_OP_DATA_NOTI, /**< Notification handler */ + NOTIFICATION_OP_DATA_EXTRA_INFO_1, /**< Reserved */ + NOTIFICATION_OP_DATA_EXTRA_INFO_2, /**< Reserved */ + NOTIFICATION_OP_DATA_MAX, /**< Max flag */ } notification_op_data_type_e; /** * @brief Enumeration for notification count position in the text. + * @since_tizen 2.3 */ typedef enum _notifcation_count_pos_type { NOTIFICATION_COUNT_POS_NONE = -1, @@ -308,7 +339,8 @@ typedef enum _notifcation_count_pos_type { } notification_count_pos_type_e; /** - * @brief Enumeration for notification variable parameter type + * @brief Enumeration for notification variable parameter type. + * @since_tizen 2.3 */ typedef enum _notification_variable_type { NOTIFICATION_VARIABLE_TYPE_NONE = -1, @@ -326,21 +358,27 @@ typedef enum _notification_variable_type { } notification_variable_type_e; /** - * @brief Notification handle + * @brief Notification handle. + * @since_tizen 2.3 */ typedef struct _notification *notification_h; /** - * @brief Notification operation handle + * @brief The structure for notification operation. + * @since_tizen 2.3 */ typedef struct _notification_op { - notification_op_type_e type; - int priv_id; - int extra_info_1; - int extra_info_2; - notification_h noti; + notification_op_type_e type; /**< Notification operation type */ + int priv_id; /**< private ID */ + int extra_info_1; /**< Reserved */ + int extra_info_2; /**< Reserved */ + notification_h noti; /**< Notification handler */ } notification_op; +/** + * @} + */ + #ifdef __cplusplus } #endif diff --git a/notification.pc.in b/notification.pc.in index e17e700..15e8662 100644..100755 --- a/notification.pc.in +++ b/notification.pc.in @@ -6,6 +6,6 @@ includedir=@INCLUDEDIR@ Name: notification Description: Notification Library Version: @VERSION@ -Requires: bundle +Requires: bundle capi-base-common Libs: -L${libdir} -lnotification Cflags: -I${includedir} diff --git a/packaging/notification.spec b/packaging/notification.spec index 7b7a80f..888d6e5 100755 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -2,13 +2,11 @@ Name: notification Summary: notification library Version: 0.2.23 Release: 1 -VCS: magnolia/apps/home/notification#submit/trunk/20130307.012707-68-g5bef86b93a87ef36d33d10c74659843704924231 Group: TBD -License: TBD +License: Apache Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(db-util) -BuildRequires: pkgconfig(heynoti) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(dbus-1) @@ -18,12 +16,17 @@ BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(com-core) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(edbus) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(eina) BuildRequires: cmake Requires(post): /sbin/ldconfig Requires(post): /usr/bin/sqlite3 requires(postun): /sbin/ldconfig -Requires: notification-parser %description Client/Server library for sending notifications. @@ -95,6 +98,7 @@ then title_key TEXT, b_text TEXT, b_key TEXT, + tag TEXT, b_format_args TEXT, num_format_args INTEGER default 0, text_domain TEXT, @@ -184,11 +188,11 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f $SMAC %files devel %defattr(-,root,root,-) %{_includedir}/notification/notification.h +%{_includedir}/notification/notification_internal.h %{_includedir}/notification/notification_error.h %{_includedir}/notification/notification_type.h %{_includedir}/notification/notification_list.h %{_includedir}/notification/notification_status.h -%{_includedir}/notification/notification_setting.h %{_libdir}/pkgconfig/notification.pc %files service-devel diff --git a/src/notification.c b/src/notification.c index a6dff07..1ec0a8e 100755 --- a/src/notification.c +++ b/src/notification.c @@ -28,20 +28,24 @@ #include <dbus/dbus.h> #include <dbus/dbus-glib-lowlevel.h> +#include <app.h> +#include <app_control_internal.h> #include <aul.h> #include <ail.h> #include <appsvc.h> +#include <tizen.h> #include <vconf-keys.h> #include <vconf.h> #include <notification.h> #include <notification_list.h> #include <notification_debug.h> -#include <notification_internal.h> +#include <notification_private.h> #include <notification_noti.h> #include <notification_ongoing.h> #include <notification_group.h> #include <notification_ipc.h> +#include <notification_internal.h> typedef struct _notification_cb_list notification_cb_list_s; @@ -62,6 +66,8 @@ struct _notification_cb_list { static notification_cb_list_s *g_notification_cb_list = NULL; +static void (*posted_toast_message_cb) (void *data); + #define NOTI_TEXT_RESULT_LEN 2048 #define NOTI_PKGNAME_LEN 512 @@ -122,7 +128,7 @@ static void _notification_get_text_domain(notification_h noti) } } -EXPORT_API notification_error_e notification_set_image(notification_h noti, +EXPORT_API int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path) { @@ -132,13 +138,13 @@ EXPORT_API notification_error_e notification_set_image(notification_h noti, /* Check noti and image_path are valid data */ if (noti == NULL || image_path == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check image type is valid type */ if (type <= NOTIFICATION_IMAGE_TYPE_NONE || type >= NOTIFICATION_IMAGE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check image path bundle is exist */ @@ -175,7 +181,7 @@ EXPORT_API notification_error_e notification_set_image(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_image(notification_h noti, +EXPORT_API int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path) { @@ -185,13 +191,13 @@ EXPORT_API notification_error_e notification_get_image(notification_h noti, /* Check noti and image_path is valid data */ if (noti == NULL || image_path == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check image type is valid data */ if (type <= NOTIFICATION_IMAGE_TYPE_NONE || type >= NOTIFICATION_IMAGE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check image path bundle exist */ @@ -226,12 +232,12 @@ EXPORT_API notification_error_e notification_get_image(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_time(notification_h noti, +EXPORT_API int notification_set_time(notification_h noti, time_t input_time) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (input_time == 0) { @@ -245,12 +251,12 @@ EXPORT_API notification_error_e notification_set_time(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_time(notification_h noti, +EXPORT_API int notification_get_time(notification_h noti, time_t * ret_time) { /* Check noti and time is valid data */ if (noti == NULL || ret_time == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set time infomation */ @@ -259,12 +265,12 @@ EXPORT_API notification_error_e notification_get_time(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_insert_time(notification_h noti, +EXPORT_API int notification_get_insert_time(notification_h noti, time_t * ret_time) { /* Check noti and ret_time is valid data */ if (noti == NULL || ret_time == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set insert time information */ @@ -273,7 +279,7 @@ EXPORT_API notification_error_e notification_get_insert_time(notification_h noti return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_text(notification_h noti, +EXPORT_API int notification_set_text(notification_h noti, notification_text_type_e type, const char *text, const char *key, @@ -286,7 +292,7 @@ EXPORT_API notification_error_e notification_set_text(notification_h noti, va_list var_args; notification_variable_type_e var_type; int num_args = 0; - notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int noti_err = NOTIFICATION_ERROR_NONE; int var_value_int = 0; double var_value_double = 0.0; char *var_value_string = NULL; @@ -295,13 +301,13 @@ EXPORT_API notification_error_e notification_set_text(notification_h noti, /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check text type is valid type */ if (type <= NOTIFICATION_TEXT_TYPE_NONE || type >= NOTIFICATION_TEXT_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check text bundle exist */ @@ -502,7 +508,7 @@ EXPORT_API notification_error_e notification_set_text(notification_h noti, default: NOTIFICATION_ERR("Error. invalid variable type. : %d", var_type); - noti_err = NOTIFICATION_ERROR_INVALID_DATA; + noti_err = NOTIFICATION_ERROR_INVALID_PARAMETER; break; } @@ -532,7 +538,7 @@ EXPORT_API notification_error_e notification_set_text(notification_h noti, return noti_err; } -EXPORT_API notification_error_e notification_get_text(notification_h noti, +EXPORT_API int notification_get_text(notification_h noti, notification_text_type_e type, char **text) { @@ -542,7 +548,7 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, const char *get_str = NULL; const char *get_check_type_str = NULL; notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE; - int display_option_flag = 0; + //int display_option_flag = 0; char *temp_str = NULL; char result_str[NOTI_TEXT_RESULT_LEN] = { 0, }; @@ -554,13 +560,13 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, /* Check noti is valid data */ if (noti == NULL || text == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check text type is valid type */ if (type <= NOTIFICATION_TEXT_TYPE_NONE || type >= NOTIFICATION_TEXT_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check key */ @@ -568,7 +574,7 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, b = noti->b_key; /* Get text domain and dir */ - _notification_get_text_domain(noti); + //_notification_get_text_domain(noti); snprintf(buf_key, sizeof(buf_key), "%d", type); @@ -598,11 +604,11 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, check_type = type; /* Set display option is off type when option is off, type is noti */ - if (get_str != NULL && display_option_flag == 1 + /*if (get_str != NULL && display_option_flag == 1 && noti->type == NOTIFICATION_TYPE_NOTI) { if (type == NOTIFICATION_TEXT_TYPE_CONTENT || type == NOTIFICATION_TEXT_TYPE_GROUP_CONTENT) { - /* Set check_type to option content string */ + // Set check_type to option content string if (type == NOTIFICATION_TEXT_TYPE_CONTENT) { check_type = NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF; @@ -611,11 +617,11 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF; } - /* Check key */ + // Check key if (noti->b_key != NULL) { b = noti->b_key; - /* Get text domain and dir */ + // Get text domain and dir _notification_get_text_domain(noti); snprintf(buf_key, sizeof(buf_key), "%d", @@ -624,13 +630,13 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, ret_val = bundle_get_val(b, buf_key); if (ret_val != NULL && noti->domain != NULL && noti->dir != NULL) { - /* Get application string */ + // Get application string bindtextdomain(noti->domain, noti->dir); get_check_type_str = dgettext(noti->domain, ret_val); } else if (ret_val != NULL) { - /* Get system string */ + // Get system string get_check_type_str = dgettext("sys_string", ret_val); } else { @@ -640,7 +646,7 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, if (get_check_type_str == NULL && noti->b_text != NULL) { b = noti->b_text; - /* Get basic text */ + // Get basic text snprintf(buf_key, sizeof(buf_key), "%d", check_type); @@ -649,14 +655,14 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, } if (get_check_type_str != NULL) { - /* Replace option off type string */ + // Replace option off type string get_str = get_check_type_str; } else { - /* Set default string */ + // Set default string get_str = dgettext("sys_string", "IDS_COM_POP_MISSED_EVENT"); } - } + }*/ if (get_str != NULL) { /* Get number format args */ @@ -813,6 +819,98 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, temp_str++; num_args++; + } else if (*(temp_str + 1) >= '1' && *(temp_str + 1) <= '9') { + if (*(temp_str + 3) == 'd') { + /* Get var Type */ + ret_variable_int = 0; + + snprintf(buf_key, + sizeof(buf_key), + "%dtype%d", check_type, + num_args + *(temp_str + 1) - 49); + ret_val = + bundle_get_val(b, buf_key); + ret_var_type = atoi(ret_val); + if (ret_var_type == + NOTIFICATION_VARIABLE_TYPE_COUNT) + { + /* Get notification count */ + notification_noti_get_count + (noti->type, + noti->caller_pkgname, + noti->group_id, + noti->priv_id, + &ret_variable_int); + } else { + /* Get var Value */ + snprintf(buf_key, + sizeof + (buf_key), + "%dvalue%d", + check_type, + num_args + *(temp_str + 1) - 49); + ret_val = + bundle_get_val(b, + buf_key); + ret_variable_int = + atoi(ret_val); + } + + snprintf(buf_str, + sizeof(buf_str), "%d", + ret_variable_int); + + int src_len = strlen(result_str); + int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1; + + strncat(result_str, buf_str, + max_len); + + temp_str += 3; + } else if (*(temp_str + 3) == 's') { + /* Get var Value */ + snprintf(buf_key, + sizeof(buf_key), + "%dvalue%d", + check_type, num_args + *(temp_str + 1) - 49); + ret_val = + bundle_get_val(b, buf_key); + + snprintf(buf_str, + sizeof(buf_str), "%s", + ret_val); + + int src_len = strlen(result_str); + int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1; + + strncat(result_str, buf_str, + max_len); + + temp_str += 3; + } else if (*(temp_str + 3) == 'f') { + /* Get var Value */ + snprintf(buf_key, + sizeof(buf_key), + "%dvalue%d", + check_type, num_args + *(temp_str + 1) - 49); + ret_val = + bundle_get_val(b, buf_key); + ret_variable_double = + atof(ret_val); + + snprintf(buf_str, + sizeof(buf_str), + "%.2f", + ret_variable_double); + + int src_len = strlen(result_str); + int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1; + + strncat(result_str, buf_str, + max_len); + + temp_str += 3; + } } } @@ -892,13 +990,13 @@ EXPORT_API notification_error_e notification_get_text(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_text_domain(notification_h noti, +EXPORT_API int notification_set_text_domain(notification_h noti, const char *domain, const char *dir) { /* check noti and domain is valid data */ - if (noti == NULL || domain == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + if (noti == NULL || domain == NULL || dir == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check domain */ @@ -920,13 +1018,13 @@ EXPORT_API notification_error_e notification_set_text_domain(notification_h noti return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_text_domain(notification_h noti, +EXPORT_API int notification_get_text_domain(notification_h noti, char **domain, char **dir) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Get domain */ @@ -942,20 +1040,25 @@ EXPORT_API notification_error_e notification_get_text_domain(notification_h noti return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_time_to_text(notification_h noti, notification_text_type_e type, +EXPORT_API int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time) { - notification_error_e ret = NOTIFICATION_ERROR_NONE; + int ret = NOTIFICATION_ERROR_NONE; char buf[256] = { 0, }; char buf_tag[512] = { 0, }; if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (time <= 0) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (type <= NOTIFICATION_TEXT_TYPE_NONE + || type >= NOTIFICATION_TEXT_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } + snprintf(buf, sizeof(buf), "%lu", time); ret = notification_noti_set_tag(TAG_TIME, buf, buf_tag, sizeof(buf_tag)); @@ -966,33 +1069,37 @@ EXPORT_API notification_error_e notification_set_time_to_text(notification_h not return notification_set_text(noti, type, buf_tag, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); } -EXPORT_API notification_error_e notification_get_time_from_text(notification_h noti, notification_text_type_e type, +EXPORT_API int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time) { - notification_error_e ret = NOTIFICATION_ERROR_NONE; + int ret = NOTIFICATION_ERROR_NONE; if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (time == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (type <= NOTIFICATION_TEXT_TYPE_NONE + || type >= NOTIFICATION_TEXT_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } char *ret_text = NULL; ret = notification_get_text(noti, type, &ret_text); if (ret != NOTIFICATION_ERROR_NONE || ret_text == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (notification_noti_get_tag_type(ret_text) == TAG_TYPE_INVALID) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } char *tag_value = NULL; tag_value = notification_noti_strip_tag(ret_text); if (tag_value == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } *time = atol(tag_value); @@ -1001,19 +1108,19 @@ EXPORT_API notification_error_e notification_get_time_from_text(notification_h n return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_sound(notification_h noti, +EXPORT_API int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check type is valid */ if (type < NOTIFICATION_SOUND_TYPE_NONE || type >= NOTIFICATION_SOUND_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save sound type */ @@ -1031,18 +1138,22 @@ EXPORT_API notification_error_e notification_set_sound(notification_h noti, free(noti->sound_path); noti->sound_path = NULL; } + if (type == NOTIFICATION_SOUND_TYPE_USER_DATA) { + noti->sound_type = NOTIFICATION_SOUND_TYPE_DEFAULT; + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } } return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_sound(notification_h noti, +EXPORT_API int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path) { /* check noti and type is valid data */ if (noti == NULL || type == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set sound type */ @@ -1057,19 +1168,19 @@ EXPORT_API notification_error_e notification_get_sound(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_vibration(notification_h noti, +EXPORT_API int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check type is valid */ if (type < NOTIFICATION_VIBRATION_TYPE_NONE || type >= NOTIFICATION_VIBRATION_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save vibration type */ @@ -1087,19 +1198,23 @@ EXPORT_API notification_error_e notification_set_vibration(notification_h noti, free(noti->vibration_path); noti->vibration_path = NULL; } + if (type == NOTIFICATION_VIBRATION_TYPE_USER_DATA) { + noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_DEFAULT; + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } } return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_vibration(notification_h noti, +EXPORT_API int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path) { /* check noti and type is valid data */ if (noti == NULL || type == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set vibration type */ @@ -1114,19 +1229,19 @@ EXPORT_API notification_error_e notification_get_vibration(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_led(notification_h noti, +EXPORT_API int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check operation is valid */ if (operation < NOTIFICATION_LED_OP_OFF || operation >= NOTIFICATION_LED_OP_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save led operation */ @@ -1140,13 +1255,13 @@ EXPORT_API notification_error_e notification_set_led(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_led(notification_h noti, +EXPORT_API int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb) { /* check noti and operation is valid data */ if (noti == NULL || operation == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set led operation */ @@ -1161,12 +1276,12 @@ EXPORT_API notification_error_e notification_get_led(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_led_time_period(notification_h noti, +EXPORT_API int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms) { /* Check noti is valid data */ - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + if (noti == NULL || on_ms < 0 || off_ms < 0) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save led operation */ @@ -1176,12 +1291,12 @@ EXPORT_API notification_error_e notification_set_led_time_period(notification_h return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_led_time_period(notification_h noti, +EXPORT_API int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms) { /* check noti and operation is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (on_ms) @@ -1192,11 +1307,11 @@ EXPORT_API notification_error_e notification_get_led_time_period(notification_h return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_application(notification_h noti, +EXPORT_API int notification_set_application(notification_h noti, const char *pkgname) { if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti->launch_pkgname) { @@ -1208,11 +1323,11 @@ EXPORT_API notification_error_e notification_set_application(notification_h noti return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_application(notification_h noti, +EXPORT_API int notification_get_application(notification_h noti, char **pkgname) { if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti->launch_pkgname) { @@ -1224,7 +1339,80 @@ EXPORT_API notification_error_e notification_get_application(notification_h noti return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_execute_option(notification_h noti, +EXPORT_API int notification_set_launch_option(notification_h noti, + notification_launch_option_type type, void *option) +{ + int ret = 0; + bundle *b = NULL; + app_control_h app_control = option; + + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (app_control == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + if ((ret = app_control_to_bundle(app_control, &b)) == APP_CONTROL_ERROR_NONE) { + return notification_set_execute_option(noti, + NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, + NULL, NULL, + b); + } else { + NOTIFICATION_ERR("Failed to convert appcontrol to bundle:%d", ret); + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } +} + +EXPORT_API int notification_get_launch_option(notification_h noti, + notification_launch_option_type type, void *option) +{ + int ret = 0; + bundle *b = NULL; + app_control_h *app_control = (app_control_h *)option; + app_control_h app_control_new = NULL; + + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (app_control == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + ret = notification_get_execute_option(noti, + NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, + NULL, + &b); + if (ret == NOTIFICATION_ERROR_NONE && b != NULL) { + ret = app_control_create(&app_control_new); + if (ret == APP_CONTROL_ERROR_NONE && app_control_new != NULL) { + ret = app_control_import_from_bundle(app_control_new, b); + if (ret == APP_CONTROL_ERROR_NONE) { + *app_control = app_control_new; + } else { + app_control_destroy(app_control_new); + NOTIFICATION_ERR("Failed to import app control from bundle:%d", ret); + return NOTIFICATION_ERROR_IO_ERROR; + } + } else { + NOTIFICATION_ERR("Failed to create app control:%d", ret); + return NOTIFICATION_ERROR_IO_ERROR; + } + } else { + NOTIFICATION_ERR("Failed to get execute option:%d", ret); + return ret; + } + + return NOTIFICATION_ERROR_NONE; +} + +EXPORT_API int notification_set_execute_option(notification_h noti, notification_execute_type_e type, const char *text, const char *key, @@ -1235,16 +1423,16 @@ EXPORT_API notification_error_e notification_set_execute_option(notification_h n bundle *b = NULL; if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (type <= NOTIFICATION_EXECUTE_TYPE_NONE || type >= NOTIFICATION_EXECUTE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Create execute option bundle if does not exist */ - if (noti->b_execute_option != NULL) { + if (noti->b_execute_option == NULL) { noti->b_execute_option = bundle_create(); } @@ -1326,7 +1514,7 @@ EXPORT_API notification_error_e notification_set_execute_option(notification_h n return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_execute_option(notification_h noti, +EXPORT_API int notification_get_execute_option(notification_h noti, notification_execute_type_e type, const char **text, bundle **service_handle) @@ -1337,12 +1525,12 @@ EXPORT_API notification_error_e notification_get_execute_option(notification_h n bundle *b = NULL; if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (type <= NOTIFICATION_EXECUTE_TYPE_NONE || type >= NOTIFICATION_EXECUTE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } switch (type) { @@ -1354,9 +1542,7 @@ EXPORT_API notification_error_e notification_get_execute_option(notification_h n break; case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH: b = noti->b_service_multi_launch; - break; default: - b = NULL; break; } @@ -1398,21 +1584,6 @@ EXPORT_API notification_error_e notification_get_execute_option(notification_h n } } - switch (type) { - case NOTIFICATION_EXECUTE_TYPE_RESPONDING: - b = noti->b_service_responding; - break; - case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH: - b = noti->b_service_single_launch; - break; - case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH: - b = noti->b_service_multi_launch; - break; - default: - b = NULL; - break; - } - if (service_handle != NULL) { *service_handle = b; } @@ -1420,12 +1591,12 @@ EXPORT_API notification_error_e notification_get_execute_option(notification_h n return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_property(notification_h noti, +EXPORT_API int notification_set_property(notification_h noti, int flags) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set flags */ @@ -1434,12 +1605,12 @@ EXPORT_API notification_error_e notification_set_property(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_property(notification_h noti, +EXPORT_API int notification_get_property(notification_h noti, int *flags) { /* Check noti and flags are valid data */ if (noti == NULL || flags == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set flags */ @@ -1448,12 +1619,12 @@ EXPORT_API notification_error_e notification_get_property(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_display_applist(notification_h noti, +EXPORT_API int notification_set_display_applist(notification_h noti, int applist) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set app list */ @@ -1462,12 +1633,12 @@ EXPORT_API notification_error_e notification_set_display_applist(notification_h return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_display_applist(notification_h noti, +EXPORT_API int notification_get_display_applist(notification_h noti, int *applist) { /* Check noti and applist are valid data */ if (noti == NULL || applist == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set app list */ @@ -1476,12 +1647,12 @@ EXPORT_API notification_error_e notification_get_display_applist(notification_h return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_size(notification_h noti, +EXPORT_API int notification_set_size(notification_h noti, double size) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save progress size */ @@ -1490,12 +1661,12 @@ EXPORT_API notification_error_e notification_set_size(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_size(notification_h noti, +EXPORT_API int notification_get_size(notification_h noti, double *size) { /* Check noti and size is valid data */ if (noti == NULL || size == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set progress size */ @@ -1504,12 +1675,12 @@ EXPORT_API notification_error_e notification_get_size(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_progress(notification_h noti, +EXPORT_API int notification_set_progress(notification_h noti, double percentage) { /* Check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save progress percentage */ @@ -1518,12 +1689,12 @@ EXPORT_API notification_error_e notification_set_progress(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_progress(notification_h noti, +EXPORT_API int notification_get_progress(notification_h noti, double *percentage) { /* Check noti and percentage are valid data */ if (noti == NULL || percentage == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set progress percentage */ @@ -1532,12 +1703,12 @@ EXPORT_API notification_error_e notification_get_progress(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_pkgname(notification_h noti, +EXPORT_API int notification_set_pkgname(notification_h noti, const char *pkgname) { /* check noti and pkgname are valid data */ if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Remove previous caller pkgname */ @@ -1551,12 +1722,12 @@ EXPORT_API notification_error_e notification_set_pkgname(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_pkgname(notification_h noti, +EXPORT_API int notification_get_pkgname(notification_h noti, char **pkgname) { /* Check noti and pkgname are valid data */ if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Get caller pkgname */ @@ -1569,12 +1740,12 @@ EXPORT_API notification_error_e notification_get_pkgname(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_set_layout(notification_h noti, +EXPORT_API int notification_set_layout(notification_h noti, notification_ly_type_e layout) { /* check noti and pkgname are valid data */ if (noti == NULL || (layout < NOTIFICATION_LY_NONE || layout >= NOTIFICATION_LY_MAX)) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } noti->layout = layout; @@ -1582,12 +1753,12 @@ EXPORT_API notification_error_e notification_set_layout(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_layout(notification_h noti, +EXPORT_API int notification_get_layout(notification_h noti, notification_ly_type_e *layout) { /* Check noti and pkgname are valid data */ if (noti == NULL || layout == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } *layout = noti->layout; @@ -1595,12 +1766,12 @@ EXPORT_API notification_error_e notification_get_layout(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_id(notification_h noti, +EXPORT_API int notification_get_id(notification_h noti, int *group_id, int *priv_id) { /* check noti is valid data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check group_id is valid data */ @@ -1622,12 +1793,12 @@ EXPORT_API notification_error_e notification_get_id(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_type(notification_h noti, +EXPORT_API int notification_get_type(notification_h noti, notification_type_e *type) { /* Check noti and type is valid data */ if (noti == NULL || type == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Set noti type */ @@ -1636,7 +1807,36 @@ EXPORT_API notification_error_e notification_get_type(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_insert(notification_h noti, +EXPORT_API int notification_post(notification_h noti) +{ + int ret = 0; + int id = 0; + + /* Check noti is vaild data */ + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + /* Check noti type is valid type */ + if (noti->type <= NOTIFICATION_TYPE_NONE + || noti->type >= NOTIFICATION_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + /* Save insert time */ + noti->insert_time = time(NULL); + + ret = notification_ipc_request_insert(noti, &id); + if (ret != NOTIFICATION_ERROR_NONE) { + return ret; + } + noti->priv_id = id; + NOTIFICATION_DBG("from master:%d", id); + + return NOTIFICATION_ERROR_NONE; +} + +EXPORT_API int notification_insert(notification_h noti, int *priv_id) { int ret = 0; @@ -1644,13 +1844,13 @@ EXPORT_API notification_error_e notification_insert(notification_h noti, /* Check noti is vaild data */ if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Check noti type is valid type */ if (noti->type <= NOTIFICATION_TYPE_NONE || noti->type >= NOTIFICATION_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Save insert time */ @@ -1670,7 +1870,7 @@ EXPORT_API notification_error_e notification_insert(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_update(notification_h noti) +EXPORT_API int notification_update(notification_h noti) { int ret = 0; @@ -1679,53 +1879,85 @@ EXPORT_API notification_error_e notification_update(notification_h noti) /* Update insert time ? */ noti->insert_time = time(NULL); ret = notification_ipc_request_update(noti); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } } else { - ret = notification_ipc_request_refresh(); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } + notification_ipc_request_refresh(); + return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return NOTIFICATION_ERROR_NONE; + return ret; } -EXPORT_API notification_error_e notification_update_async(notification_h noti, +EXPORT_API int notification_update_async(notification_h noti, void (*result_cb)(int priv_id, int result, void *data), void *user_data) { int ret = 0; - /* Check noti is valid data */ - if (noti != NULL) { - /* Update insert time ? */ - noti->insert_time = time(NULL); - ret = notification_ipc_request_update_async(noti, result_cb, user_data); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return NOTIFICATION_ERROR_NONE; + + /* Update insert time ? */ + noti->insert_time = time(NULL); + ret = notification_ipc_request_update_async(noti, result_cb, user_data); + + return ret; } -EXPORT_API notification_error_e notifiation_clear(notification_type_e type) +EXPORT_API int notifiation_clear(notification_type_e type) { int ret = 0; + if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + ret = notification_ipc_request_delete_multiple(type, NULL); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; + + return ret; +} + +EXPORT_API int notification_clear(notification_type_e type) +{ + int ret = 0; + + if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return NOTIFICATION_ERROR_NONE; + ret = notification_ipc_request_delete_multiple(type, NULL); + + return ret; } -EXPORT_API notification_error_e notification_delete_all_by_type(const char *pkgname, +EXPORT_API int notification_delete_all(notification_type_e type) +{ + int ret = 0; + char *caller_pkgname = NULL; + + if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + caller_pkgname = _notification_get_pkgname_by_pid(); + + ret = notification_ipc_request_delete_multiple(type, caller_pkgname); + + if (caller_pkgname) { + free(caller_pkgname); + } + + return ret; +} + +EXPORT_API int notification_delete_all_by_type(const char *pkgname, notification_type_e type) { int ret = 0; char *caller_pkgname = NULL; + if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + if (pkgname == NULL) { caller_pkgname = _notification_get_pkgname_by_pid(); } else { @@ -1733,20 +1965,15 @@ EXPORT_API notification_error_e notification_delete_all_by_type(const char *pkgn } ret = notification_ipc_request_delete_multiple(type, caller_pkgname); - if (ret != NOTIFICATION_ERROR_NONE) { - if (caller_pkgname) { - free(caller_pkgname); - } - return ret; - } if (caller_pkgname) { free(caller_pkgname); } - return NOTIFICATION_ERROR_NONE; + + return ret; } -EXPORT_API notification_error_e notification_delete_by_priv_id(const char *pkgname, +EXPORT_API int notification_delete_by_priv_id(const char *pkgname, notification_type_e type, int priv_id) { @@ -1754,7 +1981,7 @@ EXPORT_API notification_error_e notification_delete_by_priv_id(const char *pkgna char *caller_pkgname = NULL; if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (pkgname == NULL) { @@ -1764,46 +1991,39 @@ EXPORT_API notification_error_e notification_delete_by_priv_id(const char *pkgna } ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id); - if (ret != NOTIFICATION_ERROR_NONE) { - if (caller_pkgname) { - free(caller_pkgname); - } - return ret; - } if (caller_pkgname) { free(caller_pkgname); } + return ret; } -EXPORT_API notification_error_e notification_delete(notification_h noti) +EXPORT_API int notification_delete(notification_h noti) { int ret = 0; if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE, noti->caller_pkgname, noti->priv_id); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } - return NOTIFICATION_ERROR_NONE; + return ret; } -EXPORT_API notification_error_e notification_update_progress(notification_h noti, +EXPORT_API int notification_update_progress(notification_h noti, int priv_id, double progress) { char *caller_pkgname = NULL; int input_priv_id = 0; + int ret = 0; double input_progress = 0.0; if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } else { input_priv_id = noti->priv_id; } @@ -1825,27 +2045,28 @@ EXPORT_API notification_error_e notification_update_progress(notification_h noti input_progress = progress; } - notification_ongoing_update_progress(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id, input_progress); if (caller_pkgname) { free(caller_pkgname); } - return NOTIFICATION_ERROR_NONE; + return ret; } -EXPORT_API notification_error_e notification_update_size(notification_h noti, +EXPORT_API int notification_update_size(notification_h noti, int priv_id, double size) { char *caller_pkgname = NULL; int input_priv_id = 0; + int ret = 0; double input_size = 0.0; if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } else { input_priv_id = noti->priv_id; } @@ -1865,26 +2086,27 @@ EXPORT_API notification_error_e notification_update_size(notification_h noti, input_size = size; } - notification_ongoing_update_size(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_size(caller_pkgname, input_priv_id, input_size); if (caller_pkgname) { free(caller_pkgname); } - return NOTIFICATION_ERROR_NONE; + return ret; } -EXPORT_API notification_error_e notification_update_content(notification_h noti, +EXPORT_API int notification_update_content(notification_h noti, int priv_id, const char *content) { char *caller_pkgname = NULL; int input_priv_id = 0; + int ret = 0; if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } else { input_priv_id = noti->priv_id; } @@ -1898,14 +2120,14 @@ EXPORT_API notification_error_e notification_update_content(notification_h noti, caller_pkgname = strdup(noti->caller_pkgname); } - notification_ongoing_update_content(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_content(caller_pkgname, input_priv_id, content); if (caller_pkgname) { free(caller_pkgname); } - return NOTIFICATION_ERROR_NONE; + return ret; } static notification_h _notification_create(notification_type_e type) @@ -1914,12 +2136,14 @@ static notification_h _notification_create(notification_type_e type) if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { NOTIFICATION_ERR("INVALID TYPE : %d", type); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } noti = (notification_h) calloc(1, sizeof(struct _notification)); if (noti == NULL) { NOTIFICATION_ERR("NO MEMORY : noti == NULL"); + set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } @@ -1941,6 +2165,7 @@ static notification_h _notification_create(notification_type_e type) * \NOTE * Other fields are already initialized with ZERO. */ + set_last_result(NOTIFICATION_ERROR_NONE); return noti; } @@ -1976,19 +2201,62 @@ EXPORT_API notification_h notification_load(char *pkgname, return noti; } -EXPORT_API notification_error_e notification_clone(notification_h noti, notification_h *clone) +EXPORT_API notification_h notification_load_by_tag(const char *tag) +{ + int ret = 0; + notification_h noti = NULL; + char *caller_pkgname = NULL; + + if (tag == NULL) { + NOTIFICATION_ERR("Invalid parameter"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); + return NULL; + } + + caller_pkgname = _notification_get_pkgname_by_pid(); + if (!caller_pkgname) { + NOTIFICATION_ERR("Failed to get a package name"); + set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); + + return NULL; + } + + noti = (notification_h) calloc(1, sizeof(struct _notification)); + if (noti == NULL) { + NOTIFICATION_ERR("Failed to alloc a new notification"); + set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); + free(caller_pkgname); + + return NULL; + } + + ret = notification_ipc_request_load_noti_by_tag(noti, caller_pkgname, tag); + + free(caller_pkgname); + + set_last_result(ret); + + if (ret != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return NULL; + } + + return noti; +} + +EXPORT_API int notification_clone(notification_h noti, notification_h *clone) { notification_h new_noti = NULL; if (noti == NULL || clone == NULL) { NOTIFICATION_ERR("INVALID PARAMETER."); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } new_noti = (notification_h) calloc(1, sizeof(struct _notification)); if (new_noti == NULL) { NOTIFICATION_ERR("NO MEMORY : noti == NULL"); - return NOTIFICATION_ERROR_NO_MEMORY; + return NOTIFICATION_ERROR_OUT_OF_MEMORY; } new_noti->type = noti->type; @@ -2112,10 +2380,10 @@ EXPORT_API notification_error_e notification_clone(notification_h noti, notifica } -EXPORT_API notification_error_e notification_free(notification_h noti) +EXPORT_API int notification_free(notification_h noti) { if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti->caller_pkgname) { @@ -2185,12 +2453,16 @@ EXPORT_API notification_error_e notification_free(notification_h noti) free(noti->temp_content); } + if (noti->tag) { + free(noti->tag); + } + free(noti); return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e +EXPORT_API int notification_resister_changed_cb(void (*changed_cb) (void *data, notification_type_e type), void *user_data) @@ -2199,10 +2471,10 @@ notification_resister_changed_cb(void (*changed_cb) notification_cb_list_s *noti_cb_list = NULL; if (changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } noti_cb_list_new = @@ -2231,7 +2503,7 @@ notification_resister_changed_cb(void (*changed_cb) return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e +EXPORT_API int notification_unresister_changed_cb(void (*changed_cb) (void *data, notification_type_e type)) { @@ -2242,10 +2514,10 @@ notification_unresister_changed_cb(void (*changed_cb) noti_cb_list = g_notification_cb_list; if (changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti_cb_list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } while (noti_cb_list->prev != NULL) { @@ -2281,10 +2553,10 @@ notification_unresister_changed_cb(void (*changed_cb) noti_cb_list = noti_cb_list->next; } while (noti_cb_list != NULL); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } -EXPORT_API notification_error_e +EXPORT_API int notification_register_detailed_changed_cb( void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), void *user_data) @@ -2293,10 +2565,10 @@ notification_register_detailed_changed_cb( notification_cb_list_s *noti_cb_list = NULL; if (detailed_changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } noti_cb_list_new = @@ -2325,7 +2597,7 @@ notification_register_detailed_changed_cb( return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e +EXPORT_API int notification_unregister_detailed_changed_cb( void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), void *user_data) @@ -2337,10 +2609,10 @@ notification_unregister_detailed_changed_cb( noti_cb_list = g_notification_cb_list; if (detailed_changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti_cb_list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } while (noti_cb_list->prev != NULL) { @@ -2376,10 +2648,10 @@ notification_unregister_detailed_changed_cb( noti_cb_list = noti_cb_list->next; } while (noti_cb_list != NULL); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } -EXPORT_API notification_error_e notification_get_count(notification_type_e type, +EXPORT_API int notification_get_count(notification_type_e type, const char *pkgname, int group_id, int priv_id, int *count) @@ -2388,7 +2660,7 @@ EXPORT_API notification_error_e notification_get_count(notification_type_e type, int noti_count = 0; if (count == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = @@ -2403,7 +2675,7 @@ EXPORT_API notification_error_e notification_get_count(notification_type_e type, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_list(notification_type_e type, +EXPORT_API int notification_get_list(notification_type_e type, int count, notification_list_h *list) { @@ -2411,7 +2683,7 @@ EXPORT_API notification_error_e notification_get_list(notification_type_e type, int ret = 0; if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = notification_noti_get_grouping_list(type, count, &get_list); @@ -2424,7 +2696,7 @@ EXPORT_API notification_error_e notification_get_list(notification_type_e type, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e +EXPORT_API int notification_get_grouping_list(notification_type_e type, int count, notification_list_h * list) { @@ -2432,7 +2704,7 @@ notification_get_grouping_list(notification_type_e type, int count, int ret = 0; if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = notification_noti_get_grouping_list(type, count, &get_list); @@ -2445,7 +2717,7 @@ notification_get_grouping_list(notification_type_e type, int count, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_detail_list(const char *pkgname, +EXPORT_API int notification_get_detail_list(const char *pkgname, int group_id, int priv_id, int count, @@ -2455,7 +2727,7 @@ EXPORT_API notification_error_e notification_get_detail_list(const char *pkgname int ret = 0; if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = @@ -2470,13 +2742,13 @@ EXPORT_API notification_error_e notification_get_detail_list(const char *pkgname return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_free_list(notification_list_h list) +EXPORT_API int notification_free_list(notification_list_h list) { notification_list_h cur_list = NULL; notification_h noti = NULL; if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } cur_list = notification_list_get_head(list); @@ -2491,11 +2763,11 @@ EXPORT_API notification_error_e notification_free_list(notification_list_h list) return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type, +EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type, void *data) { if (noti_op == NULL || data == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } switch (type) { @@ -2515,7 +2787,7 @@ EXPORT_API notification_error_e notification_op_get_data(notification_op *noti_o *((int*)data) = noti_op->extra_info_2; break; default: - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; break; } @@ -2525,7 +2797,7 @@ EXPORT_API notification_error_e notification_op_get_data(notification_op *noti_o void notification_call_changed_cb(notification_op *op_list, int op_num) { notification_cb_list_s *noti_cb_list = NULL; - + notification_type_e type = 0; if (g_notification_cb_list == NULL) { return; @@ -2541,14 +2813,16 @@ void notification_call_changed_cb(notification_op *op_list, int op_num) return ; } + notification_get_type(op_list->noti, &type); + while (noti_cb_list != NULL) { if (noti_cb_list->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_list->changed_cb) { noti_cb_list->changed_cb(noti_cb_list->data, - NOTIFICATION_TYPE_NOTI); + type); } if (noti_cb_list->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_list->detailed_changed_cb) { noti_cb_list->detailed_changed_cb(noti_cb_list->data, - NOTIFICATION_TYPE_NOTI, op_list, op_num); + type, op_list, op_num); } noti_cb_list = noti_cb_list->next; @@ -2560,30 +2834,30 @@ EXPORT_API int notification_is_service_ready(void) return notification_ipc_is_master_ready(); } -EXPORT_API notification_error_e -notification_add_deffered_task( - void (*deffered_task_cb)(void *data), void *user_data) +EXPORT_API int +notification_add_deferred_task( + void (*deferred_task_cb)(void *data), void *user_data) { - if (deffered_task_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + if (deferred_task_cb == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return notification_ipc_add_deffered_task(deffered_task_cb, user_data); + return notification_ipc_add_deffered_task(deferred_task_cb, user_data); } -EXPORT_API notification_error_e -notification_del_deffered_task( - void (*deffered_task_cb)(void *data)) +EXPORT_API int +notification_del_deferred_task( + void (*deferred_task_cb)(void *data)) { - if (deffered_task_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + if (deferred_task_cb == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return notification_ipc_del_deffered_task(deffered_task_cb); + return notification_ipc_del_deffered_task(deferred_task_cb); } /* notification_set_icon will be removed */ -EXPORT_API notification_error_e notification_set_icon(notification_h noti, +EXPORT_API int notification_set_icon(notification_h noti, const char *icon_path) { int ret_err = NOTIFICATION_ERROR_NONE; @@ -2596,7 +2870,7 @@ EXPORT_API notification_error_e notification_set_icon(notification_h noti, } /* notification_get_icon will be removed */ -EXPORT_API notification_error_e notification_get_icon(notification_h noti, +EXPORT_API int notification_get_icon(notification_h noti, char **icon_path) { int ret_err = NOTIFICATION_ERROR_NONE; @@ -2615,7 +2889,7 @@ EXPORT_API notification_error_e notification_get_icon(notification_h noti, return ret_err; } -EXPORT_API notification_error_e notification_set_title(notification_h noti, +EXPORT_API int notification_set_title(notification_h noti, const char *title, const char *loc_title) { @@ -2628,7 +2902,7 @@ EXPORT_API notification_error_e notification_set_title(notification_h noti, return noti_err; } -EXPORT_API notification_error_e notification_get_title(notification_h noti, +EXPORT_API int notification_get_title(notification_h noti, char **title, char **loc_title) { @@ -2650,7 +2924,7 @@ EXPORT_API notification_error_e notification_get_title(notification_h noti, return noti_err; } -EXPORT_API notification_error_e notification_set_content(notification_h noti, +EXPORT_API int notification_set_content(notification_h noti, const char *content, const char *loc_content) { @@ -2663,7 +2937,7 @@ EXPORT_API notification_error_e notification_set_content(notification_h noti, return noti_err; } -EXPORT_API notification_error_e notification_get_content(notification_h noti, +EXPORT_API int notification_get_content(notification_h noti, char **content, char **loc_content) { @@ -2701,12 +2975,12 @@ EXPORT_API notification_error_e notification_get_content(notification_h noti, #endif } -EXPORT_API notification_error_e notification_set_args(notification_h noti, +EXPORT_API int notification_set_args(notification_h noti, bundle * args, bundle * group_args) { if (noti == NULL || args == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti->args) { @@ -2727,12 +3001,12 @@ EXPORT_API notification_error_e notification_set_args(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_get_args(notification_h noti, +EXPORT_API int notification_get_args(notification_h noti, bundle ** args, bundle ** group_args) { if (noti == NULL || args == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (noti->args) { @@ -2748,7 +3022,7 @@ EXPORT_API notification_error_e notification_get_args(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_delete_group_by_group_id(const char *pkgname, +EXPORT_API int notification_delete_group_by_group_id(const char *pkgname, notification_type_e type, int group_id) { @@ -2775,7 +3049,7 @@ EXPORT_API notification_error_e notification_delete_group_by_group_id(const char return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_delete_group_by_priv_id(const char *pkgname, +EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname, notification_type_e type, int priv_id) { @@ -2801,3 +3075,52 @@ EXPORT_API notification_error_e notification_delete_group_by_priv_id(const char } return NOTIFICATION_ERROR_NONE; } + +EXPORT_API int notification_set_tag(notification_h noti, const char *tag) +{ + /* Check noti is valid data */ + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + if (tag != NULL) { + /* save input TAG */ + if (noti->tag != NULL) { + free(noti->tag); + } + noti->tag = strdup(tag); + } + + return NOTIFICATION_ERROR_NONE; + +} + +EXPORT_API int notification_get_tag(notification_h noti, const char **tag) +{ + /* Check noti is valid data */ + if (noti == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + /* Set sound type */ + *tag = noti->tag; + return NOTIFICATION_ERROR_NONE; +} + +EXPORT_API int notification_register_toast_message(void (*posted_toast_cb) (void *data)) +{ + if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { + return NOTIFICATION_ERROR_IO_ERROR; + } + + posted_toast_message_cb = posted_toast_cb; + + return NOTIFICATION_ERROR_NONE; +} + +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 diff --git a/src/notification_db.c b/src/notification_db.c index 98346d2..6450641 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -26,19 +26,25 @@ #include <sqlite3.h> #include <db-util.h> +#include <tizen.h> #include <notification_error.h> #include <notification_debug.h> #include <notification_db.h> -sqlite3 *notification_db_open(const char *dbfile) +sqlite3 * notification_db_open(const char *dbfile) { int ret = 0; - sqlite3 *db; + sqlite3 *db =0; ret = db_util_open(dbfile, &db, 0); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("DB open error(%d), %s", ret, dbfile); + if (ret == SQLITE_PERM) { + set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED); + } + else { + set_last_result(NOTIFICATION_ERROR_FROM_DB); + } return NULL; } @@ -50,7 +56,7 @@ int notification_db_close(sqlite3 ** db) int ret = 0; if (db == NULL || *db == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = db_util_close(*db); @@ -70,10 +76,10 @@ int notification_db_exec(sqlite3 * db, const char *query, int *num_changes) sqlite3_stmt *stmt = NULL; if (db == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (query == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); diff --git a/src/notification_group.c b/src/notification_group.c index c217704..439d9c8 100755 --- a/src/notification_group.c +++ b/src/notification_group.c @@ -64,7 +64,7 @@ static int _notification_group_check_data_inserted(const char *pkgname, return NOTIFICATION_ERROR_NONE; } -notification_error_e notification_group_set_badge(const char *pkgname, +int notification_group_set_badge(const char *pkgname, int group_id, int count) { sqlite3 *db; @@ -75,6 +75,9 @@ notification_error_e notification_group_set_badge(const char *pkgname, /* Open DB */ db = notification_db_open(DBPATH); + if (!db) { + return get_last_result(); + } /* Check pkgname & group_id */ ret = _notification_group_check_data_inserted(pkgname, group_id, db); @@ -128,7 +131,7 @@ notification_error_e notification_group_set_badge(const char *pkgname, return result; } -notification_error_e notification_group_get_badge(const char *pkgname, +int notification_group_get_badge(const char *pkgname, int group_id, int *count) { sqlite3 *db; @@ -139,6 +142,9 @@ notification_error_e notification_group_get_badge(const char *pkgname, /* Open DB */ db = notification_db_open(DBPATH); + if (!db) { + return get_last_result(); + } /* Make query */ if (group_id == NOTIFICATION_GROUP_ID_NONE) { diff --git a/src/notification_ipc.c b/src/notification_ipc.c index e6a6fb1..bc2024e 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -33,7 +33,7 @@ #include <notification_ipc.h> #include <notification_db.h> #include <notification_type.h> -#include <notification_internal.h> +#include <notification_private.h> #include <notification_debug.h> #define NOTIFICATION_IPC_TIMEOUT 0.0 @@ -82,11 +82,23 @@ typedef struct _result_cb_item { static task_list *g_task_list; -static notification_error_e notification_ipc_monitor_register(void); -static notification_error_e notification_ipc_monitor_deregister(void); +static int notification_ipc_monitor_register(void); +static int notification_ipc_monitor_deregister(void); static void _do_deffered_task(void); static void _master_started_cb_task(keynode_t *node, void *data); +static inline char *_string_get(char *string) +{ + if (string == NULL) { + return NULL; + } + if (string[0] == '\0') { + return NULL; + } + + return string; +} + /*! * functions to check state of master */ @@ -127,9 +139,9 @@ int notification_ipc_is_master_ready(void) return is_master_started; } -notification_error_e +int notification_ipc_add_deffered_task( - void (*deffered_task_cb)(void *data), + void (*deferred_task_cb)(void *data), void *user_data) { task_list *list = NULL; @@ -139,7 +151,7 @@ notification_ipc_add_deffered_task( (task_list *) malloc(sizeof(task_list)); if (list_new == NULL) { - return NOTIFICATION_ERROR_NO_MEMORY; + return NOTIFICATION_ERROR_OUT_OF_MEMORY; } if (s_info.is_started_cb_set_task == 0) { @@ -150,7 +162,7 @@ notification_ipc_add_deffered_task( list_new->next = NULL; list_new->prev = NULL; - list_new->task_cb = deffered_task_cb; + list_new->task_cb = deferred_task_cb; list_new->data = user_data; if (g_task_list == NULL) { @@ -168,9 +180,9 @@ notification_ipc_add_deffered_task( return NOTIFICATION_ERROR_NONE; } -notification_error_e +int notification_ipc_del_deffered_task( - void (*deffered_task_cb)(void *data)) + void (*deferred_task_cb)(void *data)) { task_list *list_del = NULL; task_list *list_prev = NULL; @@ -179,7 +191,7 @@ notification_ipc_del_deffered_task( list_del = g_task_list; if (list_del == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } while (list_del->prev != NULL) { @@ -187,7 +199,7 @@ notification_ipc_del_deffered_task( } do { - if (list_del->task_cb == deffered_task_cb) { + if (list_del->task_cb == deferred_task_cb) { list_prev = list_del->prev; list_next = list_del->next; @@ -219,7 +231,7 @@ notification_ipc_del_deffered_task( list_del = list_del->next; } while (list_del != NULL); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } static void _do_deffered_task(void) { @@ -347,7 +359,7 @@ static inline bundle *_create_bundle_from_string(unsigned char *string) /*! * functions creating notification packet */ -EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet) +EXPORT_API int notification_ipc_make_noti_from_packet(notification_h noti, const struct packet *packet) { int ret = 0; int type; @@ -388,14 +400,15 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat char *app_name = NULL; char *temp_title = NULL; char *temp_content = NULL; + char *tag = NULL; if (noti == NULL) { NOTIFICATION_ERR("invalid data"); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = packet_get(packet, - "iiiiisssssssssssssisisisiiiiiiiiddssss", + "iiiiisssssssssssssisisisiiiiiiiiddsssss", &type, &layout, &group_id, @@ -433,11 +446,12 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat &app_icon_path, &app_name, &temp_title, - &temp_content); + &temp_content, + &tag); - if (ret != 38) { + if (ret != 39) { NOTIFICATION_ERR("failed to create a noti from packet"); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /*! @@ -485,12 +499,14 @@ EXPORT_API notification_error_e notification_ipc_make_noti_from_packet(notificat noti->display_applist = display_applist; noti->progress_size = progress_size; noti->progress_percentage = progress_percentage; + noti->tag = _dup_string(tag); return NOTIFICATION_ERROR_NONE; } EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h noti, const char *command, int packet_type) { + int b_encode_len = 0; struct packet *result = NULL; char *args = NULL; char *group_args = NULL; @@ -502,7 +518,6 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h char *b_text = NULL; char *b_key = NULL; char *b_format_args = NULL; - int flag_simmode = 0; struct packet *(*func_to_create_packet)(const char *command, const char *fmt, ...); const char *title_key = NULL; char buf_key[32] = { 0, }; @@ -513,45 +528,40 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h } if (noti->group_args) { bundle_encode(noti->group_args, (bundle_raw **) & group_args, - NULL); + &b_encode_len); } if (noti->b_execute_option) { bundle_encode(noti->b_execute_option, - (bundle_raw **) & b_execute_option, NULL); + (bundle_raw **) & b_execute_option, &b_encode_len); } if (noti->b_service_responding) { bundle_encode(noti->b_service_responding, - (bundle_raw **) & b_service_responding, NULL); + (bundle_raw **) & b_service_responding, &b_encode_len); } if (noti->b_service_single_launch) { bundle_encode(noti->b_service_single_launch, - (bundle_raw **) & b_service_single_launch, NULL); + (bundle_raw **) & b_service_single_launch, &b_encode_len); } if (noti->b_service_multi_launch) { bundle_encode(noti->b_service_multi_launch, - (bundle_raw **) & b_service_multi_launch, NULL); + (bundle_raw **) & b_service_multi_launch, &b_encode_len); } if (noti->b_text) { - bundle_encode(noti->b_text, (bundle_raw **) & b_text, NULL); + bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len); } if (noti->b_key) { - bundle_encode(noti->b_key, (bundle_raw **) & b_key, NULL); + bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len); } if (noti->b_format_args) { bundle_encode(noti->b_format_args, - (bundle_raw **) & b_format_args, NULL); + (bundle_raw **) & b_format_args, &b_encode_len); } if (noti->b_image_path) { bundle_encode(noti->b_image_path, - (bundle_raw **) & b_image_path, NULL); - } - - /* Check only simmode property is enable */ - if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE) { - flag_simmode = 1; + (bundle_raw **) & b_image_path, &b_encode_len); } if (noti->b_key != NULL) { @@ -581,7 +591,7 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h } result = func_to_create_packet(command, - "iiiiisssssssssssssisisisiiiiiiiiddssss", + "iiiiisssssssssssssisisisiiiiiiiiddsssss", noti->type, noti->layout, noti->group_id, @@ -619,7 +629,8 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h NOTIFICATION_CHECK_STR(noti->app_icon_path), NOTIFICATION_CHECK_STR(noti->app_name), NOTIFICATION_CHECK_STR(noti->temp_title), - NOTIFICATION_CHECK_STR(noti->temp_content)); + NOTIFICATION_CHECK_STR(noti->temp_content), + NOTIFICATION_CHECK_STR(noti->tag)); out: /* Free decoded data */ @@ -660,6 +671,163 @@ out: return result; } +EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notification_h noti, struct packet *packet) +{ + int b_encode_len = 0; + struct packet *result = NULL; + char *args = NULL; + char *group_args = NULL; + char *b_image_path = NULL; + char *b_execute_option = NULL; + char *b_service_responding = NULL; + char *b_service_single_launch = NULL; + char *b_service_multi_launch = NULL; + char *b_text = NULL; + char *b_key = NULL; + char *b_format_args = NULL; + const char *title_key = NULL; + char buf_key[32] = { 0, }; + + /* Decode bundle to insert DB */ + if (noti->args) { + bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len); + } + if (noti->group_args) { + bundle_encode(noti->group_args, (bundle_raw **) & group_args, + &b_encode_len); + } + + if (noti->b_execute_option) { + bundle_encode(noti->b_execute_option, + (bundle_raw **) & b_execute_option, &b_encode_len); + } + if (noti->b_service_responding) { + bundle_encode(noti->b_service_responding, + (bundle_raw **) & b_service_responding, &b_encode_len); + } + if (noti->b_service_single_launch) { + bundle_encode(noti->b_service_single_launch, + (bundle_raw **) & b_service_single_launch, &b_encode_len); + } + if (noti->b_service_multi_launch) { + bundle_encode(noti->b_service_multi_launch, + (bundle_raw **) & b_service_multi_launch, &b_encode_len); + } + + if (noti->b_text) { + bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len); + } + if (noti->b_key) { + bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len); + } + if (noti->b_format_args) { + bundle_encode(noti->b_format_args, + (bundle_raw **) & b_format_args, &b_encode_len); + } + + if (noti->b_image_path) { + bundle_encode(noti->b_image_path, + (bundle_raw **) & b_image_path, &b_encode_len); + } + + if (noti->b_key != NULL) { + snprintf(buf_key, sizeof(buf_key), "%d", + NOTIFICATION_TEXT_TYPE_TITLE); + + title_key = bundle_get_val(noti->b_key, buf_key); + } + + if (title_key == NULL && noti->b_text != NULL) { + snprintf(buf_key, sizeof(buf_key), "%d", + NOTIFICATION_TEXT_TYPE_TITLE); + + title_key = bundle_get_val(noti->b_text, buf_key); + } + + if (title_key == NULL) { + title_key = noti->caller_pkgname; + } + + result = packet_create_reply(packet, + "iiiiisssssssssssssisisisiiiiiiiiddsssss", + noti->type, + noti->layout, + noti->group_id, + noti->internal_group_id, + noti->priv_id, + NOTIFICATION_CHECK_STR(noti->caller_pkgname), + NOTIFICATION_CHECK_STR(noti->launch_pkgname), + NOTIFICATION_CHECK_STR(args), + NOTIFICATION_CHECK_STR(group_args), + NOTIFICATION_CHECK_STR(b_execute_option), + NOTIFICATION_CHECK_STR(b_service_responding), + NOTIFICATION_CHECK_STR(b_service_single_launch), + NOTIFICATION_CHECK_STR(b_service_multi_launch), + NOTIFICATION_CHECK_STR(noti->domain), + NOTIFICATION_CHECK_STR(noti->dir), + NOTIFICATION_CHECK_STR(b_text), + NOTIFICATION_CHECK_STR(b_key), + NOTIFICATION_CHECK_STR(b_format_args), + noti->num_format_args, + NOTIFICATION_CHECK_STR(b_image_path), + noti->sound_type, + NOTIFICATION_CHECK_STR(noti->sound_path), + noti->vibration_type, + NOTIFICATION_CHECK_STR(noti->vibration_path), + noti->led_operation, + noti->led_argb, + noti->led_on_ms, + noti->led_off_ms, + noti->time, + noti->insert_time, + noti->flags_for_property, + noti->display_applist, + noti->progress_size, + noti->progress_percentage, + NOTIFICATION_CHECK_STR(noti->app_icon_path), + NOTIFICATION_CHECK_STR(noti->app_name), + NOTIFICATION_CHECK_STR(noti->temp_title), + NOTIFICATION_CHECK_STR(noti->temp_content), + NOTIFICATION_CHECK_STR(noti->tag)); + + /* Free decoded data */ + if (args) { + free(args); + } + if (group_args) { + free(group_args); + } + + if (b_execute_option) { + free(b_execute_option); + } + if (b_service_responding) { + free(b_service_responding); + } + if (b_service_single_launch) { + free(b_service_single_launch); + } + if (b_service_multi_launch) { + free(b_service_multi_launch); + } + + if (b_text) { + free(b_text); + } + if (b_key) { + free(b_key); + } + if (b_format_args) { + free(b_format_args); + } + + if (b_image_path) { + free(b_image_path); + } + + return result; +} + /*! * functions to handler services */ @@ -807,10 +975,10 @@ static int _handler_service_register(pid_t pid, int handle, const struct packet if (!packet) { NOTIFICATION_ERR("Packet is not valid\n"); - ret = NOTIFICATION_ERROR_INVALID_DATA; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; } else if (packet_get(packet, "i", &ret) != 1) { NOTIFICATION_ERR("Packet is not valid\n"); - ret = NOTIFICATION_ERROR_INVALID_DATA; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; } else { if (ret == 0) { notification_op *noti_op = notification_ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL); @@ -826,7 +994,7 @@ static int _handler_service_register(pid_t pid, int handle, const struct packet /*! * functions to initialize and register a monitor */ -static notification_error_e notification_ipc_monitor_register(void) +static int notification_ipc_monitor_register(void) { int ret; struct packet *packet; @@ -869,14 +1037,14 @@ static notification_error_e notification_ipc_monitor_register(void) s_info.server_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table); if (s_info.server_fd < 0) { NOTIFICATION_ERR("Failed to make a connection to the master\n"); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } packet = packet_create("service_register", ""); if (!packet) { NOTIFICATION_ERR("Failed to build a packet\n"); com_core_packet_client_fini(s_info.server_fd); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } ret = com_core_packet_async_send(s_info.server_fd, packet, 1.0, _handler_service_register, NULL); @@ -884,8 +1052,8 @@ static notification_error_e notification_ipc_monitor_register(void) packet_destroy(packet); if (ret != 0) { com_core_packet_client_fini(s_info.server_fd); - s_info.server_fd = NOTIFICATION_ERROR_INVALID_DATA; - ret = NOTIFICATION_ERROR_IO; + s_info.server_fd = NOTIFICATION_ERROR_INVALID_PARAMETER; + ret = NOTIFICATION_ERROR_IO_ERROR; } else { ret = NOTIFICATION_ERROR_NONE; } @@ -894,21 +1062,21 @@ static notification_error_e notification_ipc_monitor_register(void) return ret; } -notification_error_e notification_ipc_monitor_deregister(void) +int notification_ipc_monitor_deregister(void) { if (s_info.initialized == 0) { return NOTIFICATION_ERROR_NONE; } com_core_packet_client_fini(s_info.server_fd); - s_info.server_fd = NOTIFICATION_ERROR_INVALID_DATA; + s_info.server_fd = NOTIFICATION_ERROR_INVALID_PARAMETER; s_info.initialized = 0; return NOTIFICATION_ERROR_NONE; } -notification_error_e notification_ipc_monitor_init(void) +int notification_ipc_monitor_init(void) { int ret = NOTIFICATION_ERROR_NONE; @@ -924,7 +1092,7 @@ notification_error_e notification_ipc_monitor_init(void) return ret; } -notification_error_e notification_ipc_monitor_fini(void) +int notification_ipc_monitor_fini(void) { int ret = NOTIFICATION_ERROR_NONE; @@ -941,7 +1109,7 @@ notification_error_e notification_ipc_monitor_fini(void) /*! * functions to request the service */ -notification_error_e notification_ipc_request_insert(notification_h noti, int *priv_id) +int notification_ipc_request_insert(notification_h noti, int *priv_id) { int status = 0; int id = NOTIFICATION_PRIV_ID_NONE; @@ -963,7 +1131,7 @@ notification_error_e notification_ipc_request_insert(notification_h noti, int *p if (packet_get(result, "ii", &status, &id) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } if (status != NOTIFICATION_ERROR_NONE) { @@ -973,7 +1141,12 @@ notification_error_e notification_ipc_request_insert(notification_h noti, int *p packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(insert)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } if (priv_id != NULL) { @@ -983,7 +1156,7 @@ notification_error_e notification_ipc_request_insert(notification_h noti, int *p return NOTIFICATION_ERROR_NONE; } -notification_error_e notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id) +int notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id) { int status = 0; int id = NOTIFICATION_PRIV_ID_NONE; @@ -1000,18 +1173,23 @@ notification_error_e notification_ipc_request_delete_single(notification_type_e if (packet_get(result, "ii", &status, &id) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(delete)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; } -notification_error_e notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname) +int notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname) { int status = 0; int num_deleted = 0; @@ -1028,19 +1206,24 @@ notification_error_e notification_ipc_request_delete_multiple(notification_type_ if (packet_get(result, "ii", &status, &num_deleted) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } NOTIFICATION_ERR("num deleted:%d", num_deleted); packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(delete multiple)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; } -notification_error_e notification_ipc_request_update(notification_h noti) +int notification_ipc_request_update(notification_h noti) { int status = 0; int id = NOTIFICATION_PRIV_ID_NONE; @@ -1057,12 +1240,17 @@ notification_error_e notification_ipc_request_update(notification_h noti) if (packet_get(result, "ii", &status, &id) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(update)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; @@ -1076,7 +1264,7 @@ static int _notification_ipc_update_cb(pid_t pid, int handle, const struct packe if (cb_item == NULL) { NOTIFICATION_ERR("Failed to get a callback item"); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } s_info.server_cl_fd_ref_cnt = (s_info.server_cl_fd_ref_cnt <= 1) ? 0 : s_info.server_cl_fd_ref_cnt - 1; if (s_info.server_cl_fd_ref_cnt <= 0) { @@ -1090,7 +1278,7 @@ static int _notification_ipc_update_cb(pid_t pid, int handle, const struct packe if (packet != NULL) { if (packet_get(packet, "ii", &status, &id) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); - status = NOTIFICATION_ERROR_IO; + status = NOTIFICATION_ERROR_IO_ERROR; } } @@ -1102,7 +1290,7 @@ static int _notification_ipc_update_cb(pid_t pid, int handle, const struct packe return status; } -notification_error_e notification_ipc_request_update_async(notification_h noti, +int notification_ipc_request_update_async(notification_h noti, void (*result_cb)(int priv_id, int result, void *data), void *user_data) { int ret = NOTIFICATION_ERROR_NONE; @@ -1112,13 +1300,13 @@ notification_error_e notification_ipc_request_update_async(notification_h noti, packet = notification_ipc_make_packet_from_noti(noti, "update_noti", 1); if (packet == NULL) { - ret = NOTIFICATION_ERROR_INVALID_DATA; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; goto fail; } cb_item = calloc(1, sizeof(result_cb_item)); if (cb_item == NULL) { - ret = NOTIFICATION_ERROR_NO_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto fail; } @@ -1127,7 +1315,12 @@ notification_error_e notification_ipc_request_update_async(notification_h noti, s_info.server_cl_fd = com_core_packet_client_init(s_info.socket_file, 0, NULL); if (s_info.server_cl_fd < 0) { NOTIFICATION_DBG("Failed to init client: %d", s_info.server_cl_fd); - ret = NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + ret = NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + ret = NOTIFICATION_ERROR_SERVICE_NOT_READY; + } goto fail; } s_info.server_cl_fd_ref_cnt = 1; @@ -1151,7 +1344,7 @@ notification_error_e notification_ipc_request_update_async(notification_h noti, com_core_packet_client_fini(fd_temp); NOTIFICATION_INFO("FD(%d) finalized", fd_temp); } - ret = NOTIFICATION_ERROR_IO; + ret = NOTIFICATION_ERROR_IO_ERROR; goto fail; } else { ret = NOTIFICATION_ERROR_NONE; @@ -1168,7 +1361,7 @@ success: return ret; } -notification_error_e notification_ipc_request_refresh(void) +int notification_ipc_request_refresh(void) { int status = 0; struct packet *packet; @@ -1184,18 +1377,23 @@ notification_error_e notification_ipc_request_refresh(void) if (packet_get(result, "i", &status) != 1) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(refresh)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; } -notification_error_e notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value) +int notification_ipc_noti_setting_property_set(const char *pkgname, const char *property, const char *value) { int status = 0; int ret = 0; @@ -1212,18 +1410,23 @@ notification_error_e notification_ipc_noti_setting_property_set(const char *pkgn if (packet_get(result, "ii", &status, &ret) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(delete)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; } -notification_error_e notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value) +int notification_ipc_noti_setting_property_get(const char *pkgname, const char *property, char **value) { int status = 0; char *ret = NULL; @@ -1240,7 +1443,7 @@ notification_error_e notification_ipc_noti_setting_property_get(const char *pkgn if (packet_get(result, "is", &status, &ret) != 2) { NOTIFICATION_ERR("Failed to get a result packet"); packet_unref(result); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_IO_ERROR; } if (status == NOTIFICATION_ERROR_NONE && ret != NULL) { *value = strdup(ret); @@ -1248,8 +1451,46 @@ notification_error_e notification_ipc_noti_setting_property_get(const char *pkgn packet_unref(result); } else { NOTIFICATION_ERR("failed to receive answer(delete)"); - return NOTIFICATION_ERROR_SERVICE_NOT_READY; + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } } return status; } + +int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *pkgname, const char *tag) +{ + struct packet *packet; + struct packet *result; + + packet = packet_create("load_noti_by_tag", "ss", pkgname, tag); + result = com_core_packet_oneshot_send(NOTIFICATION_ADDR, + packet, + NOTIFICATION_IPC_TIMEOUT); + packet_destroy(packet); + + if (result != NULL) { + if (notification_ipc_make_noti_from_packet(noti, result) != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("Failed to get a result packet"); + packet_unref(result); + return NOTIFICATION_ERROR_IO_ERROR; + } + + packet_unref(result); + } else { + NOTIFICATION_ERR("failed to receive answer(load noti by tag)"); + if (notification_ipc_is_master_ready() == 1) { + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } + else { + return NOTIFICATION_ERROR_SERVICE_NOT_READY; + } + } + + return NOTIFICATION_ERROR_NONE; +} + diff --git a/src/notification_list.c b/src/notification_list.c index b066c74..97d205a 100755 --- a/src/notification_list.c +++ b/src/notification_list.c @@ -21,10 +21,12 @@ #include <stdlib.h> +#include <tizen.h> + #include <notification.h> #include <notification_list.h> #include <notification_debug.h> -#include <notification_internal.h> +#include <notification_private.h> struct _notification_list { notification_list_h prev; @@ -57,6 +59,7 @@ EXPORT_API notification_list_h notification_list_get_head(notification_list_h li if (list == NULL) { NOTIFICATION_ERR("INVALID DATA : list == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -66,6 +69,7 @@ EXPORT_API notification_list_h notification_list_get_head(notification_list_h li cur_list = cur_list->prev; } + set_last_result(NOTIFICATION_ERROR_NONE); return cur_list; } @@ -75,6 +79,7 @@ EXPORT_API notification_list_h notification_list_get_tail(notification_list_h li if (list == NULL) { NOTIFICATION_ERR("INVALID DATA : list == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -84,6 +89,7 @@ EXPORT_API notification_list_h notification_list_get_tail(notification_list_h li cur_list = cur_list->next; } + set_last_result(NOTIFICATION_ERROR_NONE); return cur_list; } @@ -93,11 +99,13 @@ EXPORT_API notification_list_h notification_list_get_prev(notification_list_h li if (list == NULL) { NOTIFICATION_ERR("INVALID DATA : list == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } cur_list = list; + set_last_result(NOTIFICATION_ERROR_NONE); return cur_list->prev; } @@ -107,11 +115,13 @@ EXPORT_API notification_list_h notification_list_get_next(notification_list_h li if (list == NULL) { NOTIFICATION_ERR("INVALID DATA : list == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } cur_list = list; + set_last_result(NOTIFICATION_ERROR_NONE); return cur_list->next; } @@ -121,11 +131,13 @@ EXPORT_API notification_h notification_list_get_data(notification_list_h list) if (list == NULL) { NOTIFICATION_ERR("INVALID DATA : list == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } cur_list = list; + set_last_result(NOTIFICATION_ERROR_NONE); return cur_list->noti; } @@ -137,6 +149,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list if (noti == NULL) { NOTIFICATION_ERR("INVALID DATA : data == NULL"); + set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -146,6 +159,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list new_list = _notification_list_create(); if (new_list == NULL) { NOTIFICATION_ERR("NO MEMORY"); + set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } @@ -157,6 +171,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list cur_list = _notification_list_create(); if (cur_list == NULL) { NOTIFICATION_ERR("NO MEMORY"); + set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } @@ -164,6 +179,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list new_list->noti = noti; } + set_last_result(NOTIFICATION_ERROR_NONE); return new_list; } diff --git a/src/notification_noti.c b/src/notification_noti.c index f47e8cd..8423ba5 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -24,14 +24,19 @@ #include <stdlib.h> #include <vconf.h> +#include <Ecore.h> +#include <Elementary.h> +#include <Eina.h> #include <notification.h> #include <notification_db.h> #include <notification_noti.h> #include <notification_debug.h> -#include <notification_internal.h> +#include <notification_private.h> #define NOTI_BURST_DELETE_UNIT 10 +static Eina_List *toast_list; +static Eina_List *toast_popup; static void __free_and_set(void **target_ptr, void *new_ptr) { if (target_ptr != NULL) { @@ -89,20 +94,25 @@ static int _notification_noti_bind_query_double(sqlite3_stmt * stmt, const char static int _notification_noti_check_priv_id(notification_h noti, sqlite3 * db) { + int result = 0; + int ret = NOTIFICATION_ERROR_NONE; + char *query = NULL; sqlite3_stmt *stmt = NULL; - char query[NOTIFICATION_QUERY_MAX] = { 0, }; - int ret = NOTIFICATION_ERROR_NONE, result = 0; /* Make query to check priv_id exist */ - snprintf(query, sizeof(query), - "select count(*) from noti_list where caller_pkgname = '%s' and priv_id = %d", + query = sqlite3_mprintf("SELECT count(*) FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d", noti->caller_pkgname, noti->priv_id); + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + } ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db)); - return NOTIFICATION_ERROR_FROM_DB; + ret = NOTIFICATION_ERROR_FROM_DB; + goto err; } ret = sqlite3_step(stmt); @@ -116,29 +126,38 @@ static int _notification_noti_check_priv_id(notification_h noti, sqlite3 * db) /* If result > 0, there is priv_id in DB */ if (result > 0) { - return NOTIFICATION_ERROR_ALREADY_EXIST_ID; + ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID; } - return NOTIFICATION_ERROR_NONE; +err: + if (query) { + sqlite3_free(query); + } + + return ret; } static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgname, int priv_id, sqlite3 * db) { + char *query = NULL; sqlite3_stmt *stmt = NULL; - char query[NOTIFICATION_QUERY_MAX] = { 0, }; int ret = NOTIFICATION_ERROR_NONE, result = 0; - snprintf(query, sizeof(query), - "select internal_group_id from noti_list where caller_pkgname = '%s' and priv_id = %d", + query = sqlite3_mprintf("SELECT internal_group_id FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d", pkgname, priv_id); + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + } ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db)); - return NOTIFICATION_ERROR_FROM_DB; + ret = NOTIFICATION_ERROR_FROM_DB; + goto err; } ret = sqlite3_step(stmt); @@ -148,14 +167,25 @@ static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgna result = 0; } - sqlite3_finalize(stmt); +err: + if (stmt) { + sqlite3_finalize(stmt); + } + + if (query) { + sqlite3_free(query); + } + + if (ret != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("failed to internal group ID:%d", ret); + } return result; } -static int _notification_noti_make_query(notification_h noti, char *query, - int query_size) +static int _insertion_query_create(notification_h noti, char **query) { + int b_encode_len = 0; char *args = NULL; char *group_args = NULL; char *b_image_path = NULL; @@ -168,46 +198,50 @@ static int _notification_noti_make_query(notification_h noti, char *query, char *b_format_args = NULL; int flag_simmode = 0; + if (query == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + /* Decode bundle to insert DB */ if (noti->args) { - bundle_encode(noti->args, (bundle_raw **) & args, NULL); + bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len); } if (noti->group_args) { bundle_encode(noti->group_args, (bundle_raw **) & group_args, - NULL); + &b_encode_len); } if (noti->b_execute_option) { bundle_encode(noti->b_execute_option, - (bundle_raw **) & b_execute_option, NULL); + (bundle_raw **) & b_execute_option, &b_encode_len); } if (noti->b_service_responding) { bundle_encode(noti->b_service_responding, - (bundle_raw **) & b_service_responding, NULL); + (bundle_raw **) & b_service_responding, &b_encode_len); } if (noti->b_service_single_launch) { bundle_encode(noti->b_service_single_launch, - (bundle_raw **) & b_service_single_launch, NULL); + (bundle_raw **) & b_service_single_launch, &b_encode_len); } if (noti->b_service_multi_launch) { bundle_encode(noti->b_service_multi_launch, - (bundle_raw **) & b_service_multi_launch, NULL); + (bundle_raw **) & b_service_multi_launch, &b_encode_len); } if (noti->b_text) { - bundle_encode(noti->b_text, (bundle_raw **) & b_text, NULL); + bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len); } if (noti->b_key) { - bundle_encode(noti->b_key, (bundle_raw **) & b_key, NULL); + bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len); } if (noti->b_format_args) { bundle_encode(noti->b_format_args, - (bundle_raw **) & b_format_args, NULL); + (bundle_raw **) & b_format_args, &b_encode_len); } if (noti->b_image_path) { bundle_encode(noti->b_image_path, - (bundle_raw **) & b_image_path, NULL); + (bundle_raw **) & b_image_path, &b_encode_len); } /* Check only simmode property is enable */ @@ -216,14 +250,14 @@ static int _notification_noti_make_query(notification_h noti, char *query, } /* Make query */ - snprintf(query, query_size, "insert into noti_list (" + *query = sqlite3_mprintf("INSERT INTO noti_list (" "type, " "layout, " "caller_pkgname, launch_pkgname, " "image_path, " "group_id, internal_group_id, priv_id, " "title_key, " - "b_text, b_key, b_format_args, num_format_args, " + "b_text, b_key, tag, b_format_args, num_format_args, " "text_domain, text_dir, " "time, insert_time, " "args, group_args, " @@ -238,7 +272,7 @@ static int _notification_noti_make_query(notification_h noti, char *query, "'%s', " "%d, %d, %d, " "$title_key, " - "'%s', '%s', '%s', %d, " + "'%s', '%s', $tag, '%s', %d, " "'%s', '%s', " "%d, %d, " "'%s', '%s', " @@ -307,13 +341,17 @@ static int _notification_noti_make_query(notification_h noti, char *query, free(b_image_path); } + if (*query == NULL) { + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + return NOTIFICATION_ERROR_NONE; } -static int _notification_noti_make_update_query(notification_h noti, char *query, - int query_size) +static int _update_query_create(notification_h noti, char **query) { + int b_encode_len = 0; char *args = NULL; char *group_args = NULL; char *b_image_path = NULL; @@ -326,46 +364,50 @@ static int _notification_noti_make_update_query(notification_h noti, char *query char *b_format_args = NULL; int flag_simmode = 0; + if (query == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + /* Decode bundle to update DB */ if (noti->args) { - bundle_encode(noti->args, (bundle_raw **) & args, NULL); + bundle_encode(noti->args, (bundle_raw **) & args, &b_encode_len); } if (noti->group_args) { bundle_encode(noti->group_args, (bundle_raw **) & group_args, - NULL); + &b_encode_len); } if (noti->b_execute_option) { bundle_encode(noti->b_execute_option, - (bundle_raw **) & b_execute_option, NULL); + (bundle_raw **) & b_execute_option, &b_encode_len); } if (noti->b_service_responding) { bundle_encode(noti->b_service_responding, - (bundle_raw **) & b_service_responding, NULL); + (bundle_raw **) & b_service_responding, &b_encode_len); } if (noti->b_service_single_launch) { bundle_encode(noti->b_service_single_launch, - (bundle_raw **) & b_service_single_launch, NULL); + (bundle_raw **) & b_service_single_launch, &b_encode_len); } if (noti->b_service_multi_launch) { bundle_encode(noti->b_service_multi_launch, - (bundle_raw **) & b_service_multi_launch, NULL); + (bundle_raw **) & b_service_multi_launch, &b_encode_len); } if (noti->b_text) { - bundle_encode(noti->b_text, (bundle_raw **) & b_text, NULL); + bundle_encode(noti->b_text, (bundle_raw **) & b_text, &b_encode_len); } if (noti->b_key) { - bundle_encode(noti->b_key, (bundle_raw **) & b_key, NULL); + bundle_encode(noti->b_key, (bundle_raw **) & b_key, &b_encode_len); } if (noti->b_format_args) { bundle_encode(noti->b_format_args, - (bundle_raw **) & b_format_args, NULL); + (bundle_raw **) & b_format_args, &b_encode_len); } if (noti->b_image_path) { bundle_encode(noti->b_image_path, - (bundle_raw **) & b_image_path, NULL); + (bundle_raw **) & b_image_path, &b_encode_len); } /* Check only simmode property is enable */ @@ -374,12 +416,12 @@ static int _notification_noti_make_update_query(notification_h noti, char *query } /* Make query */ - snprintf(query, query_size, "update noti_list set " + *query = sqlite3_mprintf("UPDATE noti_list SET " "type = %d, " "layout = %d, " "launch_pkgname = '%s', " "image_path = '%s', " - "b_text = '%s', b_key = '%s', " + "b_text = '%s', b_key = '%s', tag = $tag, " "b_format_args = '%s', num_format_args = %d, " "text_domain = '%s', text_dir = '%s', " "time = %d, insert_time = %d, " @@ -455,6 +497,10 @@ static int _notification_noti_make_update_query(notification_h noti, char *query free(b_image_path); } + if (*query == NULL) { + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + return NOTIFICATION_ERROR_NONE; } @@ -473,6 +519,7 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt * stmt, notificat noti->group_id = sqlite3_column_int(stmt, col++); noti->internal_group_id = 0; noti->priv_id = sqlite3_column_int(stmt, col++); + __free_and_set((void **)&(noti->tag), notification_db_column_text(stmt, col++)); noti->b_text = notification_db_column_bundle(stmt, col++); noti->b_key = notification_db_column_bundle(stmt, col++); @@ -534,7 +581,7 @@ int notification_noti_set_tag(const char *tag, char *value, char *buf, int buf_l len_total += (strlen(tag) * 2) + 5 + strlen(value) + 1; if (buf_len <= len_total) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; snprintf(buf, buf_len, "<%s>%s</%s>", tag, value, tag); @@ -586,32 +633,45 @@ int notification_noti_get_tag_type(const char *tagged_str) static int _notification_noti_update_priv_id(sqlite3 * db, int rowid) { - char query[128] = { 0, }; + int ret = NOTIFICATION_ERROR_NONE; + char *query = NULL; if (db == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto err; } - snprintf(query, sizeof(query), "update noti_list set " - "priv_id = %d, internal_group_id = %d where rowid = %d", + query = sqlite3_mprintf("UPDATE noti_list SET " + "priv_id = %d, internal_group_id = %d WHERE rowid = %d", rowid, rowid, rowid); + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + } - return notification_db_exec(db, query, NULL); + ret = notification_db_exec(db, query, NULL); + +err: + if (query) { + sqlite3_free(query); + } + + return ret; } EXPORT_API int notification_noti_insert(notification_h noti) { + int ret = 0; sqlite3 *db = NULL; sqlite3_stmt *stmt = NULL; - char query[NOTIFICATION_QUERY_MAX] = { 0, }; - int ret = 0; + char *query = NULL; char buf_key[32] = { 0, }; const char *title_key = NULL; /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Initialize private ID */ @@ -620,7 +680,7 @@ EXPORT_API int notification_noti_insert(notification_h noti) noti->internal_group_id = NOTIFICATION_GROUP_ID_NONE; /* make query */ - ret = _notification_noti_make_query(noti, query, sizeof(query)); + ret = _insertion_query_create(noti, &query); if (ret != NOTIFICATION_ERROR_NONE) { goto err; } @@ -654,6 +714,11 @@ EXPORT_API int notification_noti_insert(notification_h noti) } /* Bind query */ + ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag); + if (ret != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db)); + goto err; + } ret = _notification_noti_bind_query_text(stmt, "$title_key", title_key); if (ret != NOTIFICATION_ERROR_NONE) { NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db)); @@ -697,30 +762,34 @@ err: notification_db_close(&db); } + if (query) { + sqlite3_free(query); + } + return ret; } int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int priv_id) { + int ret = 0; + char *query = NULL; sqlite3 *db = NULL; sqlite3_stmt *stmt = NULL; - char query[NOTIFICATION_QUERY_MAX] = { 0, }; - int ret = 0; if (priv_id < 0 || noti == NULL) { - ret = NOTIFICATION_ERROR_INVALID_DATA; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; goto err; } /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } char *base_query = "select " "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " - "b_text, b_key, b_format_args, num_format_args, " + "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " @@ -728,10 +797,14 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri "from noti_list "; if (pkgname != NULL) { - snprintf(query, sizeof(query), "%s where caller_pkgname = '%s' and priv_id = %d", + query = sqlite3_mprintf("%s where caller_pkgname = '%s' and priv_id = %d", base_query ,pkgname, priv_id); } else { - snprintf(query, sizeof(query), "%s where priv_id = %d", base_query, priv_id); + query = sqlite3_mprintf("%s where priv_id = %d", base_query, priv_id); + } + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; } ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); @@ -751,6 +824,127 @@ int notification_noti_get_by_priv_id(notification_h noti, char *pkgname, int pri ret = NOTIFICATION_ERROR_FROM_DB; } err: + if (query) { + sqlite3_free(query); + } + + if (stmt) { + sqlite3_finalize(stmt); + } + + /* Close DB */ + if (db != NULL) { + notification_db_close(&db); + } + + return ret; +} + +EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag) +{ + int ret = 0; + char *query = NULL; + sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + + if (tag == NULL || noti == NULL) { + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto err; + } + + /* Open DB */ + db = notification_db_open(DBPATH); + if (!db) { + return get_last_result(); + } + + if (pkgname != NULL) { + ret = sqlite3_prepare_v2(db, "select " + "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "tag, b_text, b_key, b_format_args, num_format_args, " + "text_domain, text_dir, time, insert_time, args, group_args, " + "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " + "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " + "flags_for_property, display_applist, progress_size, progress_percentage " + "from noti_list where caller_pkgname = ? and tag = ?", -1, &stmt, NULL); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + + ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + goto err; + } + + ret = sqlite3_bind_text(stmt, 2, tag, -1, SQLITE_TRANSIENT); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + goto err; + } + } else { + ret = sqlite3_prepare_v2(db, "select " + "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "tag, b_text, b_key, b_format_args, num_format_args, " + "text_domain, text_dir, time, insert_time, args, group_args, " + "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " + "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " + "flags_for_property, display_applist, progress_size, progress_percentage " + "from noti_list where tag = ?", -1, &stmt, NULL); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + + ret = sqlite3_bind_text(stmt, 1, tag, -1, SQLITE_TRANSIENT); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + goto err; + } + } +/* + char *base_query = "select " + "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "tag, b_text, b_key, b_format_args, num_format_args, " + "text_domain, text_dir, time, insert_time, args, group_args, " + "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " + "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " + "flags_for_property, display_applist, progress_size, progress_percentage " + "from noti_list "; + + if (pkgname != NULL) { + query = sqlite3_mprintf("%s where caller_pkgname = '%s' and tag = '%s'", + base_query ,pkgname, tag); + } else { + query = sqlite3_mprintf("%s where tag = '%s'", base_query, tag); + } + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + } + + ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("select Query : %s", query); + NOTIFICATION_ERR("select DB error(%d) : %s", ret, + sqlite3_errmsg(db)); + ret = NOTIFICATION_ERROR_FROM_DB; + goto err; + } +*/ + ret = sqlite3_step(stmt); + if (ret == SQLITE_ROW) { + _notification_noti_populate_from_stmt(stmt, noti); + ret = NOTIFICATION_ERROR_NONE; + } else { + ret = NOTIFICATION_ERROR_FROM_DB; + } +err: + if (query) { + sqlite3_free(query); + } + if (stmt) { sqlite3_finalize(stmt); } @@ -765,15 +959,15 @@ err: EXPORT_API int notification_noti_update(notification_h noti) { + int ret = 0; sqlite3 *db; sqlite3_stmt *stmt = NULL; - char query[NOTIFICATION_QUERY_MAX] = { 0, }; - int ret = 0; + char *query = NULL; /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Check private ID is exist */ @@ -784,7 +978,7 @@ EXPORT_API int notification_noti_update(notification_h noti) } /* make update query */ - ret = _notification_noti_make_update_query(noti, query, sizeof(query)); + ret = _update_query_create(noti, &query); if (ret != NOTIFICATION_ERROR_NONE) { goto err; } @@ -798,6 +992,11 @@ EXPORT_API int notification_noti_update(notification_h noti) goto err; } + ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag); + if (ret != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db)); + goto err; + } ret = _notification_noti_bind_query_double(stmt, "$progress_size",noti->progress_size); if (ret != NOTIFICATION_ERROR_NONE) { NOTIFICATION_ERR("Bind error : %s", sqlite3_errmsg(db)); @@ -825,6 +1024,10 @@ err: notification_db_close(&db); } + if (query) { + sqlite3_free(query); + } + return ret; } @@ -843,7 +1046,7 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } if (pkgname == NULL) { @@ -895,7 +1098,7 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char */ free(*list_deleted_rowid); *list_deleted_rowid = NULL; - ret = NOTIFICATION_ERROR_NO_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } } @@ -977,7 +1180,7 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, /* Check pkgname is valid */ if (pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } snprintf(query_where, sizeof(query_where), @@ -986,7 +1189,7 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } if (num_deleted != NULL) { @@ -1016,7 +1219,7 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, } else { free(*list_deleted_rowid); *list_deleted_rowid = NULL; - ret = NOTIFICATION_ERROR_NO_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } } @@ -1088,13 +1291,13 @@ int notification_noti_delete_group_by_priv_id(const char *pkgname, int priv_id) /* Check pkgname is valid */ if (pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Get internal group id using priv id */ @@ -1124,13 +1327,13 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv /* Check pkgname is valid */ if (pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Make query */ @@ -1157,13 +1360,13 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna /* Check pkgname is valid */ if (pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Make query */ @@ -1186,7 +1389,7 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna return ret; } -notification_error_e notification_noti_get_count(notification_type_e type, +int notification_noti_get_count(notification_type_e type, const char *pkgname, int group_id, int priv_id, int *count) @@ -1207,7 +1410,7 @@ notification_error_e notification_noti_get_count(notification_type_e type, /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Check current sim status */ @@ -1320,7 +1523,7 @@ err: return ret; } -notification_error_e notification_noti_get_grouping_list(notification_type_e type, +int notification_noti_get_grouping_list(notification_type_e type, int count, notification_list_h * list) @@ -1340,7 +1543,7 @@ notification_error_e notification_noti_get_grouping_list(notification_type_e typ /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Check current sim status */ @@ -1349,7 +1552,7 @@ notification_error_e notification_noti_get_grouping_list(notification_type_e typ /* Make query */ snprintf(query_base, sizeof(query_base), "select " "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " - "b_text, b_key, b_format_args, num_format_args, " + "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " @@ -1422,7 +1625,7 @@ err: return ret; } -notification_error_e notification_noti_get_detail_list(const char *pkgname, +int notification_noti_get_detail_list(const char *pkgname, int group_id, int priv_id, int count, notification_list_h *list) @@ -1443,7 +1646,7 @@ notification_error_e notification_noti_get_detail_list(const char *pkgname, /* Open DB */ db = notification_db_open(DBPATH); if (!db) { - return NOTIFICATION_ERROR_FROM_DB; + return get_last_result(); } /* Check current sim status */ @@ -1452,7 +1655,7 @@ notification_error_e notification_noti_get_detail_list(const char *pkgname, /* Make query */ snprintf(query_base, sizeof(query_base), "select " "type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " - "b_text, b_key, b_format_args, num_format_args, " + "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " @@ -1532,3 +1735,205 @@ err: return ret; } + +EXPORT_API int notification_noti_check_tag(notification_h noti) +{ + int result = 0; + int ret = NOTIFICATION_ERROR_NONE; + char *query = NULL; + sqlite3 *db; + sqlite3_stmt *stmt = NULL; + + if (noti->tag == NULL) { + return NOTIFICATION_ERROR_NOT_EXIST_ID; + } + + /* Open DB */ + db = notification_db_open(DBPATH); + if (!db) { + return get_last_result(); + } + + ret = sqlite3_prepare_v2(db, "SELECT priv_id FROM noti_list WHERE caller_pkgname = ? and tag = ?", -1, &stmt, NULL); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + + ret = sqlite3_bind_text(stmt, 1, noti->caller_pkgname, -1, SQLITE_TRANSIENT); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + goto err; + } + + ret = sqlite3_bind_text(stmt, 2, noti->tag, -1, SQLITE_TRANSIENT); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); + goto err; + } + +/* + query = sqlite3_mprintf("select priv_id from noti_list where caller_pkgname = '%s' and tag = '%s'", + noti->caller_pkgname, noti->tag); + if (query == NULL) { + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto err; + } + + ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); + if (ret != SQLITE_OK) { + NOTIFICATION_ERR("Get priv id DB err(%d) : %s", ret, + sqlite3_errmsg(db)); + ret = NOTIFICATION_ERROR_FROM_DB; + goto err; + } +*/ + ret = sqlite3_step(stmt); + if (ret == SQLITE_ROW) { + result = sqlite3_column_int(stmt, 0); + } else { + result = 0; + } + + sqlite3_finalize(stmt); + + /* If result > 0, there is priv_id in DB */ + if (result > 0) { + noti->priv_id = result; + ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID; + } else { + ret = NOTIFICATION_ERROR_NOT_EXIST_ID; + } + +err: + if (query) { + sqlite3_free(query); + } + + return ret; +} + +static void +popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) +{ + Eina_List *list = NULL; + char *msg = NULL; + int count = 0; + + evas_object_del(toast_popup); + toast_popup = NULL; + evas_object_del((Evas_Object *)data); + + count = eina_list_count(toast_list); + + if (count == 1){ + msg = (char *)eina_list_data_get(toast_list); + free(msg); + + eina_list_free(toast_list); + toast_list = NULL; + } else if (count > 1) { + msg = (char *)eina_list_data_get(toast_list); + toast_list = eina_list_remove(toast_list, msg); + free(msg); + _post_toast_message((char *)eina_list_data_get(toast_list)); + } +} + +int _post_toast_message(char *message) +{ + int let = 0; + Evas_Object *toast_window; + Evas *e; + Ecore_Evas *ee; + double scale = elm_config_scale_get(); + + + toast_window = elm_win_add(NULL, "toast", ELM_WIN_BASIC); + + elm_win_alpha_set(toast_window, EINA_TRUE); + elm_win_title_set(toast_window, "toast"); + + elm_win_indicator_mode_set(toast_window, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_type_set(toast_window,ELM_WIN_INDICATOR_TYPE_1); + + //elm_win_autodel_set(toast_win, EINA_TRUE); + if (elm_win_wm_rotation_supported_get(toast_window)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(toast_window, (const int*)(&rots), 4); + } + + e = evas_object_evas_get(toast_window); + ee = ecore_evas_ecore_evas_get(e); + ecore_evas_name_class_set(ee, "TOAST_POPUP", "SYSTEM_POPUP"); + + evas_object_resize(toast_window, (480 * scale), (650 * scale)); + ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(toast_window), 0, 0, (480 * scale), (650 * scale)); + + toast_popup = elm_popup_add(toast_window); + + elm_object_style_set(toast_popup, "toast"); + evas_object_size_hint_weight_set(toast_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_object_part_text_set(toast_popup,"elm.text", message); + + if (eina_list_count(toast_list) != 1) { + elm_popup_timeout_set(toast_popup, 1.0); + } + else { + elm_popup_timeout_set(toast_popup, 3.0); + } + evas_object_smart_callback_add(toast_popup, "timeout", popup_timeout_cb, (void *)toast_window); + + elm_win_prop_focus_skip_set(toast_window, EINA_TRUE); + + evas_object_show(toast_window); + evas_object_show(toast_popup); + + return 0; +} + +EXPORT_API int notification_noti_post_toast_message(const char *message) +{ + int let = 0; + char *msg = NULL; + int count = 0; + + msg = (char *)calloc(strlen(message) + 1, sizeof(char)); + strcpy(msg, message); + +/* + if (eina_list_count(toast_list) == 10) { + toast_list = eina_list_last(toast_list); + eina_list_data_set(toast_list, msg); + toast_list = eina_list_nth_list(toast_list, 0); + } + else { +*/ + + count = eina_list_count(toast_list); + if (count == 0) { + toast_list = eina_list_append(toast_list, msg); + let = _post_toast_message(msg); + } + else if (count == 1) { + if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) { + elm_popup_timeout_set(toast_popup, 3.0); + } + else { + toast_list = eina_list_append(toast_list, msg); + elm_popup_timeout_set(toast_popup, 1.0); + } + } + else if (count >= 2) { + if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) { + free(msg); + return 0; + } + else { + toast_list = eina_list_append(toast_list, msg); + } + } + + return 0; +} diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c index fc6a982..f67665a 100755 --- a/src/notification_ongoing.c +++ b/src/notification_ongoing.c @@ -28,9 +28,9 @@ #include <notification_db.h> #include <notification_debug.h> #include <notification_ongoing.h> -#include <notification_internal.h> +#include <notification_private.h> -notification_error_e notification_ongoing_update_progress(const char *caller_pkgname, +int notification_ongoing_update_progress(const char *caller_pkgname, int priv_id, double progress) { @@ -76,7 +76,7 @@ notification_error_e notification_ongoing_update_progress(const char *caller_pkg return NOTIFICATION_ERROR_FROM_DBUS; } -notification_error_e notification_ongoing_update_size(const char *caller_pkgname, +int notification_ongoing_update_size(const char *caller_pkgname, int priv_id, double size) { DBusConnection *connection = NULL; @@ -121,7 +121,7 @@ notification_error_e notification_ongoing_update_size(const char *caller_pkgname return NOTIFICATION_ERROR_FROM_DBUS; } -notification_error_e notification_ongoing_update_content(const char *caller_pkgname, +int notification_ongoing_update_content(const char *caller_pkgname, int priv_id, const char *content) { DBusConnection *connection = NULL; diff --git a/src/notification_permission.c b/src/notification_permission.c new file mode 100755 index 0000000..c9de272 --- /dev/null +++ b/src/notification_permission.c @@ -0,0 +1,65 @@ +/* + * libnotification + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com> + * + * 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 <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <db-util.h> + +#include <notification.h> +#include <notification_db.h> +#include <notification_noti.h> +#include <notification_debug.h> +#include <notification_ipc.h> +#include <notification_private.h> + +#define NOTIFICATION_DB_ACCESS_READ 0 +#define NOTIFICATION_DB_ACCESS_WRITE 1 + +#if 0 +int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access) { + int ret = 0; + char pkgname[512 + 1] = { 0, }; + bool preload = false; + package_manager_compare_result_type_e compare_result; + + //get pkgname by pid + const char *pkgname = aul_app_get_pkgname_bypid(pid); + ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname)); + if (ret == AUL_R_OK) { + if (strcmp(pkgname, noti_pkgname) == 0) { + return NOTIFICATION_ERROR_NONE; + } + + package_manager_is_preload_package_by_app_id(pkgname, &preload); + if (preload == true) { + return NOTIFICATION_ERROR_NONE; + } + + package_manager_compare_package_cert_info(noti_pkgname, &compare_result); + if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH ) { + return NOTIFICATION_ERROR_NONE; + } + } + + return NOTIFICATION_ERROR_PERMISSION_DENIED; +} +#endif
\ No newline at end of file diff --git a/src/notification_setting.c b/src/notification_setting.c index 77f7713..6e532c0 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -29,12 +29,13 @@ #include <notification_noti.h> #include <notification_debug.h> #include <notification_ipc.h> -#include <notification_setting.h> -#include <notification_internal.h> +#include <notification_private.h> #define NOTIFICATION_SETTING_DB "notification_setting" #define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db" +typedef struct _notification_setting_h notification_setting_h; + struct _notification_setting_h { char *appid; char *notification; @@ -108,7 +109,7 @@ static const char *_get_prop_default_value(const char *property) } #endif -static notification_error_e _is_record_exist(const char *pkgname, sqlite3 *db) +static int _is_record_exist(const char *pkgname, sqlite3 *db) { sqlite3_stmt *stmt = NULL; int count = 0; @@ -117,10 +118,10 @@ static notification_error_e _is_record_exist(const char *pkgname, sqlite3 *db) int sqlret; if (!pkgname) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!db) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %s WHERE " \ "appid = %Q", @@ -128,7 +129,7 @@ static notification_error_e _is_record_exist(const char *pkgname, sqlite3 *db) if (!sqlbuf) { NOTIFICATION_ERR("fail to alloc sql query"); - return NOTIFICATION_ERROR_NO_MEMORY; + return NOTIFICATION_ERROR_OUT_OF_MEMORY; } sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL); @@ -160,27 +161,27 @@ free_and_return: return result; } -EXPORT_API notification_error_e notification_setting_db_set(const char *pkgname, const char *property, const char *value) +EXPORT_API int notification_setting_db_set(const char *pkgname, const char *property, const char *value) { - notification_error_e ret = NOTIFICATION_ERROR_NONE; - notification_error_e result = NOTIFICATION_ERROR_NONE; + int ret = NOTIFICATION_ERROR_NONE; + int result = NOTIFICATION_ERROR_NONE; sqlite3 *db = NULL; char *sqlbuf = NULL; int sqlret; const char *column = NULL; if (!pkgname) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!property) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!value) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; column = _get_prop_column(property); if (!column) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0); if (sqlret != SQLITE_OK || !db) { @@ -199,7 +200,7 @@ EXPORT_API notification_error_e notification_setting_db_set(const char *pkgname, NOTIFICATION_SETTING_DB, column, value, pkgname); if (!sqlbuf) { NOTIFICATION_ERR("fail to alloc query"); - result = NOTIFICATION_ERROR_NO_MEMORY; + result = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto return_close_db; } @@ -217,10 +218,10 @@ return_close_db: return result; } -EXPORT_API notification_error_e notification_setting_db_get(const char *pkgname, const char *property, char **value) +EXPORT_API int notification_setting_db_get(const char *pkgname, const char *property, char **value) { - notification_error_e ret = NOTIFICATION_ERROR_NONE; - notification_error_e result = NOTIFICATION_ERROR_NONE; + int ret = NOTIFICATION_ERROR_NONE; + int result = NOTIFICATION_ERROR_NONE; sqlite3 *db = NULL; char *sqlbuf = NULL; sqlite3_stmt *stmt = NULL; @@ -228,17 +229,17 @@ EXPORT_API notification_error_e notification_setting_db_get(const char *pkgname, const char *column = NULL; if (!pkgname) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!property) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!value) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; column = _get_prop_column(property); if (!column) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; sqlret = db_util_open(NOTIFICATION_SETTING_DB_PATH, &db, 0); if (sqlret != SQLITE_OK || !db) { @@ -257,7 +258,7 @@ EXPORT_API notification_error_e notification_setting_db_get(const char *pkgname, column, NOTIFICATION_SETTING_DB, pkgname); if (!sqlbuf) { NOTIFICATION_ERR("fail to alloc query"); - result = NOTIFICATION_ERROR_NO_MEMORY; + result = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto return_close_db; } @@ -280,7 +281,7 @@ EXPORT_API notification_error_e notification_setting_db_get(const char *pkgname, *value = get_data; } else { NOTIFICATION_ERR("fail to alloc query"); - result = NOTIFICATION_ERROR_NO_MEMORY; + result = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto return_close_db; } } @@ -299,18 +300,18 @@ return_close_db: return result; } -EXPORT_API notification_error_e notification_setting_property_set(const char *pkgname, const char *property, const char *value) +EXPORT_API int notification_setting_property_set(const char *pkgname, const char *property, const char *value) { int ret = 0; if (!pkgname) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!property) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!value) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; ret = notification_ipc_noti_setting_property_set(pkgname, property, value); if (ret != NOTIFICATION_ERROR_NONE) { @@ -320,18 +321,18 @@ EXPORT_API notification_error_e notification_setting_property_set(const char *pk return NOTIFICATION_ERROR_NONE; } -EXPORT_API notification_error_e notification_setting_property_get(const char *pkgname, const char *property, char **value) +EXPORT_API int notification_setting_property_get(const char *pkgname, const char *property, char **value) { int ret = 0; if (!pkgname) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!property) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; if (!value) - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; ret = notification_ipc_noti_setting_property_get(pkgname, property, value); if (ret != NOTIFICATION_ERROR_NONE) { diff --git a/src/notification_status.c b/src/notification_status.c index b7b0e27..5071851 100755 --- a/src/notification_status.c +++ b/src/notification_status.c @@ -25,97 +25,149 @@ #include <string.h> #include <errno.h> #include <vconf.h> +#include <E_DBus.h> #include <notification.h> #include <notification_db.h> #include <notification_noti.h> #include <notification_debug.h> -#include <notification_internal.h> +#include <notification_private.h> #include <notification_status.h> -#define NOTIFICATION_STATUS_MESSAGE_KEY "memory/private/libstatus/message" +#define PATH_NAME "/Org/Tizen/System/Notification/Status_message" +#define INTERFACE_NAME "org.tizen.system.notification.status_message" +#define MEMBER_NAME "status_message" struct _message_cb_data { notification_status_message_cb callback; void *data; + E_DBus_Connection *dbus_connection; + E_DBus_Signal_Handler *dbus_hdlr; }; static struct _message_cb_data md; -static void __notification_status_message_change_cb(keynode_t *node, void *user_data) +static void __notification_status_message_dbus_callback(void *data, DBusMessage *msg) { - int type; + int ret = 0; + DBusError err; char *message = NULL; - if (!node) { - NOTIFICATION_ERR("key node is NULL"); + if(data==NULL||msg==NULL) + { + NOTIFICATION_ERR("message is NULL"); return; } - if (!md.callback) - return; - - type = vconf_keynode_get_type(node); - if (type != VCONF_TYPE_STRING) { - NOTIFICATION_ERR("invail node type : %d", type); + dbus_error_init(&err); + ret = dbus_message_get_args(msg, &err, + DBUS_TYPE_STRING, &message, + DBUS_TYPE_INVALID); + if(ret == 0) + { + NOTIFICATION_ERR("dbus_message_get_args error"); return; } - message = vconf_keynode_get_str(node); - if (!message) { - NOTIFICATION_ERR("fail to get message"); + if (dbus_error_is_set(&err)) { + NOTIFICATION_ERR("Dbus err: %s", err.message); + dbus_error_free(&err); return; } + /*if (!md.callback) + return; if (strlen(message) <= 0){ - NOTIFICATION_DBG("message has only NULL"); + NOTIFICATION_ERR("message has only NULL"); return; } - md.callback(message, md.data); + md.callback(message, md.data);*/ + + notification_noti_post_toast_message(message); } EXPORT_API int notification_status_message_post(const char *message) { - int ret = 0; + DBusConnection *connection = NULL; + DBusMessage *signal = NULL; + DBusError err; + dbus_bool_t ret; if (!message) { NOTIFICATION_ERR("message is NULL"); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (strlen(message) <= 0) { NOTIFICATION_ERR("message has only NULL"); - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } + dbus_error_init(&err); + connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (!connection) { + NOTIFICATION_ERR("Fail to dbus_bus_get"); + return NOTIFICATION_ERROR_FROM_DBUS; + } - ret = vconf_set_str(NOTIFICATION_STATUS_MESSAGE_KEY, message); + signal = + dbus_message_new_signal(PATH_NAME, INTERFACE_NAME, + MEMBER_NAME); + if (!signal) { + NOTIFICATION_ERR("Fail to dbus_message_new_signal"); + return NOTIFICATION_ERROR_FROM_DBUS; + } + + ret = dbus_message_append_args(signal, + DBUS_TYPE_STRING, &message, + DBUS_TYPE_INVALID); if (ret) { - NOTIFICATION_ERR("fail to set message [%s]", message); - return NOTIFICATION_ERROR_IO; + ret = dbus_connection_send(connection, signal, NULL); + + if (ret) { + dbus_connection_flush(connection); + } } + dbus_message_unref(signal); + dbus_connection_unref(connection); + return NOTIFICATION_ERROR_NONE; } EXPORT_API int notification_status_monitor_message_cb_set(notification_status_message_cb callback, void *user_data) { - int ret = 0; if (!callback) - return NOTIFICATION_ERROR_INVALID_DATA; - - ret = vconf_notify_key_changed(NOTIFICATION_STATUS_MESSAGE_KEY, - __notification_status_message_change_cb, NULL); - if (ret && errno != EALREADY) { - NOTIFICATION_ERR("fail to set message cb"); - return NOTIFICATION_ERROR_IO; + return NOTIFICATION_ERROR_INVALID_PARAMETER; + E_DBus_Connection *dbus_connection; + E_DBus_Signal_Handler *dbus_handler_size = NULL; + + e_dbus_init(); + dbus_connection = e_dbus_bus_get(DBUS_BUS_SYSTEM); + if (dbus_connection == NULL) { + NOTIFICATION_ERR("noti register : failed to get dbus bus"); + return NOTIFICATION_ERROR_FROM_DBUS; } + dbus_handler_size = + e_dbus_signal_handler_add(dbus_connection, NULL, + PATH_NAME, + INTERFACE_NAME, MEMBER_NAME, + __notification_status_message_dbus_callback, + user_data); + if (dbus_handler_size == NULL) + { + NOTIFICATION_ERR("fail to add size signal"); + return NOTIFICATION_ERROR_FROM_DBUS; + } + md.callback = callback; md.data = user_data; + md.dbus_connection = dbus_connection; + md.dbus_hdlr = dbus_handler_size; return NOTIFICATION_ERROR_NONE; } @@ -123,8 +175,17 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca EXPORT_API int notification_status_monitor_message_cb_unset(void) { - vconf_ignore_key_changed(NOTIFICATION_STATUS_MESSAGE_KEY, - __notification_status_message_change_cb); + if (md.dbus_hdlr != NULL) { + e_dbus_signal_handler_del(md.dbus_connection, + md.dbus_hdlr); + md.dbus_hdlr = NULL; + } + if (md.dbus_connection != NULL) { + e_dbus_connection_close(md.dbus_connection); + md.dbus_connection = NULL; + e_dbus_shutdown(); + } + md.callback = NULL; md.data = NULL; |