diff options
Diffstat (limited to 'notification/include')
22 files changed, 7270 insertions, 0 deletions
diff --git a/notification/include/notification.h b/notification/include/notification.h new file mode 100644 index 0000000..cb45eed --- /dev/null +++ b/notification/include/notification.h @@ -0,0 +1,1865 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_H__ +#define __NOTIFICATION_H__ + +#include <time.h> +#include <bundle.h> +#include <app_control.h> + +#include <notification_error.h> +#include <notification_type.h> +#include <notification_status.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @file notification.h + * @brief This file contains the notification API. + */ + + +/** + * @addtogroup NOTIFICATION_MODULE + * @{ + */ + + +/** + * @brief Sets an absolute path for an image file to display on the notification view. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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_create() + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path); + + +/** + * @brief Gets the absolute path of an image file. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 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_create() + * @par Sample code: + * @code +#include <notification.h> + +{ + char *image_path = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path); + + +/** + * @brief Sets a timestamp. + * @details If input_time is @c 0, time information is taken from the current time. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @param[in] noti The notification handle + * @param[in] input_time The input time. If you want the time stamp to not be shown, set this as NOTIFICATION_DO_NOT_SHOW_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(). + * @see notification_create() + * @see NOTIFICATION_DO_NOT_SHOW_TIME_STAMP + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_time(noti, time(NULL)); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_time(notification_h noti, time_t input_time); + + +/** + * @brief Gets a timestamp. + * @details If ret_time is @c 0, time information is not set before. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_time(noti, &ret_time); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_time(notification_h noti, time_t *ret_time); + + +/** + * @brief Gets an insertion timestamp of the notification. + * @details If ret_time is @c 0, this notification data is not inserted before. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_insert_time(noti, &ret_time); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_insert_time(notification_h noti, time_t *ret_time); + + +/** + * @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. + * + * Note that You can display the translated contents according to the language of the system. + * The application must supply a String KEY as the fourth argument to support localization. + * If the language on the system changes, the contents of the notification are also translated. + * + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, + "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_text(notification_h noti, notification_text_type_e type, + const char *text, const char *key, int args_type, ...); + + +/** + * @brief Gets the text from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + char *text = NULL; + + noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_text(notification_h noti, notification_text_type_e type, char **text); + + +/** + * @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 @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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(). + */ +int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time); + + +/** + * @brief Gets the timestamp from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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(). + */ +int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time); + + +/** + * @brief Sets the sound type for the notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path); + + +/** + * @brief Gets the sound type from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE; + + noti_err = notification_get_sound(noti, &type, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path); + + +/** + * @brief Sets the vibration type for the notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path); + + +/** + * @brief Gets the vibrate type from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE; + + noti_err = notification_get_vibration(noti, &type, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path); + + +/** + * @brief Sets the LED displaying option. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_led(noti, NOTIFICATION_LED_OP_ON, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb); + + +/** + * @brief Gets the LED displaying option from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + notification_led_type_e type = NOTIFICATION_LED_OP_OFF; + + noti_err = notification_get_led(noti, &type, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb); + + +/** + * @brief Sets the time period of flashing the LED. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_set_led_time_period(noti, 100, 100); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms); + + +/** + * @brief Gets the time period of flashing the LED from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + int led_on_ms = 0; + int led_off_ms = 0; + + noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms); + + +/** + * @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 @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + app_control_h app_control = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + // Do something + + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); + + // Do something + + noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + app_control_destroy(app_control); + notification_free(noti); + return; + } + + app_control_destroy(app_control); +} + * @endcode + */ +int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option); + + +/** + * @brief Gets the launch option from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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> + +{ + app_control_h app_control = NULL; + app_control_create(&app_control); + + // Do something + + noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option); + + +/** + * @brief Sets the handler for a specific event. + * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle. \n + * Setting event handler of a button means that the notification will show the button. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti The notification handle + * @param[in] event_type Event type + * @param[in] event_handler App control handle + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_event_type_e + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + app_control_h app_control = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + // Do something + + app_control_create(&app_control); + app_control_set_app_id(app_control, "org.tizen.app"); + + // Do something + + noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + app_control_destroy(app_control); + notification_free(noti); + return; + } + + app_control_destroy(app_control); +} + * @endcode + */ +int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler); + + +/** + * @brief Gets the event handler of a specific event. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @remarks You must release @a app_control using app_control_destroy(). + * @param[in] noti The notification handle + * @param[in] event_type Launching option type + * @param[out] event_handler The handler of App Control + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_event_type_e + * @par Sample code: + * @code +#include <notification.h> + +{ + app_control_h app_control = NULL; + app_control_create(&app_control); + + // Do something + + noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler); + + +/** + * @brief Sets the property of the notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_property(notification_h noti, int flags); + + +/** + * @brief Gets the property of the notification from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + int flags = 0; + + noti_err = notification_get_property(noti, &flags); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_property(notification_h noti, int *flags); + + +/** + * @brief Sets applications to display the notification. + * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | + NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_display_applist(notification_h noti, int applist); + + +/** + * @brief Gets the application list displaying the notification from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + int applist = 0; + + noti_err = notification_get_display_applist(noti, &applist); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_display_applist(notification_h noti, int *applist); + + +/** + * @brief Sets the initial size for the ongoing type. + * @details After notification_post() call, the size is not updated. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_size(noti, 0.0); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_size(notification_h noti, double size); + + +/** + * @brief Gets the progress size. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + double size = 0.0; + + noti_err = notification_get_size(noti, &size); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_size(notification_h noti, double *size); + + +/** + * @brief Sets the initial progress for the ongoing type. + * @details After the notification_post() call, the progress is not updated. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_progress(noti, 0.0); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_progress(notification_h noti, double percentage); + + +/** + * @brief Gets the progress from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + double percentage = 0.0; + + noti_err = notification_get_progress(noti, &percentage); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_progress(notification_h noti, double *percentage); + + +/** + * @brief Sets the layout of the notification view. + * @details Caller can set displaying layout of notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + */ +int notification_set_layout(notification_h noti, notification_ly_type_e layout); + + +/** + * @brief Gets the layout of the notification view from the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + */ +int notification_get_layout(notification_h noti, notification_ly_type_e *layout); + + +/** + * @brief Gets the type of a notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_type_e type; + + noti_err = notification_get_type(noti, &type); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_type(notification_h noti, notification_type_e *type); + + +/** + * @brief Updates notification data. + * @details The updated notification will appear in the notification area. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_update(NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_update(notification_h noti); + + +/** + * @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 @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + // Do something + + noti_err = notification_delete(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_delete(notification_h noti); + + +/** + * @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 even if device is restarted. + * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + * @exception #NOTIFICATION_ERROR_IO_ERROR I/O error + * @see #notification_type_e + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + // Do something + +} + * @endcode + */ +notification_h notification_create(notification_type_e type); + + +/** + * @brief Creates a notification clone. + * @details Newly created notification handle is returned. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI); + notification_h clone = NULL; + + notification_clone(noti, &clone); + + // Do something + +} + * @endcode + */ +int notification_clone(notification_h noti, notification_h *clone); + + +/** + * @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 @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + // Do something + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_free(notification_h noti); + + +/** + * @brief Sets the tag of the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + * @see notification_get_tag() + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + // Do something + + noti_err = notification_set_tag(noti, tag); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_tag(notification_h noti, const char *tag); + + +/** + * @brief Gets the tag of the notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + * @see notification_set_tag() + * @par Sample code: + * @code +#include <notification.h> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + const char *tag = NULL; + + // Do something + + noti_err = notification_get_tag(noti, &tag); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_tag(notification_h noti, const char **tag); + + +/** + * @brief Loads a notification from the notification's database with the tag. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + + noti = notification_load_by_tag(tag); + if (noti == NULL) + return; + + // Do something + +} + * @endcode + */ +notification_h notification_load_by_tag(const char *tag); + + +/** + * @brief Deletes all notifications of the given type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + + noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_delete_all(notification_type_e type); + + +/** + * @brief Posts a notification. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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; + + noti_err = notification_post(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_post(notification_h noti); + + +/** + * @brief Gets the package name of the notification. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti Notification handle + * @param[out] pkgname The package name of the notification + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise a negative error value + * @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; + + // Do something + + noti_err = notification_get_pkgname(noti, &pkgname); + + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_pkgname(notification_h noti, char **pkgname); + + +/** + * @brief Adds a button on the notification. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti Notification handle + * @param[in] button_index Button index + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise a negative error value + * @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; + + // Do something + + noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1); + + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_add_button(notification_h noti, notification_button_index_e button_index); + + +/** + * @brief Removes a button on the notification. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti Notification handle + * @param[in] button_index Button index + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise a negative error value + * @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; + + // Do something + + noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1); + + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_remove_button(notification_h noti, notification_button_index_e button_index); + + +/** + * @brief Sets the 'auto remove' option of the active notification. + * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @remarks When 'auto_remove' is set as false, the active notification will not be removed + * as long as the user removes the active notification or the app which posted the active notification removes the active notification. + * @param[in] noti Notification handle + * @param[in] auto_remove Auto remove option + * @return #NOTIFICATION_ERROR_NONE On success, + * other value if failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_h + * @see #notification_get_auto_remove + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + // Do something + + noti_err = notification_set_auto_remove(noti, false); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_set_auto_remove(notification_h noti, bool auto_remove); + + +/** + * @brief Gets the 'auto remove' option of the active notification. + * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti Notification handle + * @param[out] auto_remove Auto remove option + * @return #NOTIFICATION_ERROR_NONE On success, other value on failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_h + * @see #notification_get_auto_remove + * @par Sample code: + * @code +#include <notification.h> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + bool auto_remove; + + // Do something + + noti_err = notification_get_auto_remove(noti, &auto_remove); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_auto_remove(notification_h noti, bool *auto_remove); + + +/** + * @brief Saves a notification template to the notification database. + * @details An application can save the created notification as a template for later reuse. + * If the template has the same name as a saved one, the saved template will be overwritten. + * A saved template can be loaded only by the application which saved it. + * All templates are removed when the application package is uninstalled. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks The number of templates is limited to 10. + * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned. + * @param[in] noti Notification handle + * @param[in] template_name Template name + * @return #NOTIFICATION_ERROR_NONE On success, other value on failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied + * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded + * @see #notification_h + * @see notification_create_from_template() + * @par Sample code: + * @code +#include <notification.h> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + // add the content you want to use for the template. + + noti_err = notification_save_as_template(noti, "CALL_ACCEPT"); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_save_as_template(notification_h noti, const char *template_name); + + +/** + * @brief Loads a notification template from the notification database. + * @details An application can load a saved template and post it. + * An application can load only templates that it has saved. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks The returned handle should be destroyed using notification_free(). + * The specific error code can be obtained using get_last_result(). + * Error codes are described in the Exception section. + * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB. + * @param[in] template_name Template name + * @return Notification handle on success, NULL on 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 + * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query + * @see #notification_h + * @see notification_save_as_template() + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + + noti = notification_create_from_template("CALL_ACCEPT"); + if (noti == NULL) + return; + +} + * @endcode + */ +notification_h notification_create_from_template(const char *template_name); + + +/** + * @brief Gets notification block state. + * @details The user can set the notification block state in settings. + * The block state indicates whether or not notifications can be posted. + * Additionally only notifications to the notification panel are + * allowed in "Do not disturb mode". Sound, Vibrate and + * Active/Instant notifications are blocked. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[out] state Notification block state + * @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_OUT_OF_MEMORY out of memory + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @see #notification_block_state_e + * @par Sample code: + * @code +#include <notification.h> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_block_state_e state; + + // Do something + + noti_err = notification_get_noti_block_state(&state); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + * @endcode + */ +int notification_get_noti_block_state(notification_block_state_e *state); + + +/** + * @brief Sets a text input box to reply directly on the notification. + * @details When you add a text input to the active notification, the notification UI will show a text input with a button. + * So, the user can enter any text and press the button to confirm the text as a input. + * You can edit some UI component that is related to the text input. + * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type. + * You also can edit button for the text input. + * For setting just a text to the button, you can set the text using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON type. + * If you want to show image button, you can set an image for the button using notification_set_image() with #NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON type. + * + * Note that you should set an app_control for handling the event for user input using notification_set_event_handler(). + * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input. + * You can get the text the user enters in the app_control handle that is passed as a result of the event. + * The app_control will contain APP_CONTROL_DATA_TEXT key, so you can get the text using app_control_get_extra_data() using APP_CONTROL_DATA_TEXT key. + * The value will contain the text user enters. + * + * Note that you are able to make the switching button to the text input box. + * You have to set the app_control which you will set in a text input box to the switching button. + * Refer to the second sample code. + * @since_tizen 3.0 + * @param[in] noti Notification handle + * @param[in] text_input_max_length The maximum value which can be inputted + * @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> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; + app_control = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_text_input(noti, 160); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, + "Text message", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, + "SEND", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + // Do something + + noti_err = app_control_create(&app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = app_control_set_app_id(app_control, appid); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = notification_set_event_handler(noti, + NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = app_control_destroy(app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = notification_post(noti); + if(noti_err != NOTIFICATION_ERROR_NONE) + return; + +} + + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + notification_h noti = NULL; + app_control = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_text_input(noti, 160); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, + "Text message", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, + "SEND", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_text(notification, + NOTIFICATION_TEXT_TYPE_BUTTON_1, + "reply", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_display_applist(noti, + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + // Do something + + noti_err = app_control_create(&app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = app_control_set_app_id(app_control, appid); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = notification_set_event_handler(notification, + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_event_handler(noti, + NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, + app_control); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = app_control_destroy(app_control); + if (noti_err != APP_CONTROL_ERROR_NONE) + return; + + noti_err = notification_post(noti); + if(noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_set_text_input(notification_h noti, int text_input_max_length); + + +/** + * @brief Sets the image height for the extended notification. + * @details The image is shown under the notification's text. The application can set the image height. + * The image is modified to fit into the height set by this function. + * The image can be scaled down and/or cropped. + * If @a height is 0, the default value is used. The default height depends on the screen size. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[in] height The image height + * @return #NOTIFICATION_ERROR_NONE On success, + * otherwise a negative error value + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see notification_get_extension_image_size() + * @par Sample code: + * @code +#include <notification.h> + +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) + return; + + noti_err = notification_set_text(noti, + NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION, + "message", + NULL, + NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_image(noti, + NOTIFICATION_IMAGE_TYPE_EXTENTION, + image_path); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + noti_err = notification_set_extension_image_size(noti, 20); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; + + // Do something +} + * @endcode + */ +int notification_set_extension_image_size(notification_h noti, int height); + + +/** + * @brief Gets the image height for the extended notification. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[out] height The image height + * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see notification_set_extension_image_size() + * @par Sample code: + * @code +#include <notification.h> + +{ + int noti_err = NOTIFICATION_ERROR_NONE; + int height; + + // Do something + + noti_err = notification_get_extension_image_size(noti, &height); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_get_extension_image_size(notification_h noti, int *height); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_H__ */ + diff --git a/notification/include/notification_db.h b/notification/include/notification_db.h new file mode 100644 index 0000000..219e507 --- /dev/null +++ b/notification/include/notification_db.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_DB_H__ +#define __NOTIFICATION_DB_H__ + +#include <bundle.h> +#include <sqlite3.h> +#include <tzplatform_config.h> + +#define DBPATH tzplatform_mkpath(TZ_SYS_DB, ".notification.db") +#define NOTIFICATION_QUERY_MAX 4096 +#define NOTIFICATION_EMPTY_STR "" +#define NOTIFICATION_CHECK_STR(p) ((p) ? (p) : NOTIFICATION_EMPTY_STR) + +sqlite3 *notification_db_open(); +int notification_db_close(sqlite3 **db); +int notification_db_exec(sqlite3 *db, const char *query, int *num_changes); +char *notification_db_column_text(sqlite3_stmt *stmt, int col); +bundle *notification_db_column_bundle(sqlite3_stmt *stmt, int col); +int notification_db_init(); + +#endif /* __NOTIFICATION_DB_H__ */ + diff --git a/notification/include/notification_debug.h b/notification/include/notification_debug.h new file mode 100644 index 0000000..f3f0514 --- /dev/null +++ b/notification/include/notification_debug.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_DEBUG_H__ +#define __NOTIFICATION_DEBUG_H__ + +#define LOG_TAG "NOTIFICATION" +#include <dlog.h> + +#ifndef EXPORT_API +#define EXPORT_API __attribute__ ((visibility("default"))) +#endif + +#ifndef _DLOG_H_ +#include <stdio.h> + +#define DBG(fmt , args...) \ + do { \ + printf("[D][%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define INFO(fmt , args...) \ + do { \ + printf("[I][%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define WARN(fmt , args...) \ + do { \ + printf("[W][%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define ERR(fmt , args...) \ + do { \ + printf("[E][%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#else /* _DLOG_H_ */ + +#define DBG(fmt , args...) \ + do { \ + SECURE_LOGD("[%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define INFO(fmt , args...) \ + do { \ + SECURE_LOGI("[%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define WARN(fmt , args...) \ + do { \ + SECURE_LOGW("[%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#define ERR(fmt , args...) \ + do { \ + SECURE_LOGE("[%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ + } while (0) + +#endif /* _DLOG_H_ */ + +#endif /* __NOTIFICATION_DEBUG_H__ */ + diff --git a/notification/include/notification_error.h b/notification/include/notification_error.h new file mode 100644 index 0000000..91f768d --- /dev/null +++ b/notification/include/notification_error.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_ERROR_H__ +#define __NOTIFICATION_ERROR_H__ + + +#include <tizen.h> + + +/** + * @file notification_error.h + */ + + +/** + * @addtogroup NOTIFICATION_MODULE + * @{ + */ + + +/** + * @brief Enumeration for notification errors. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_error { + 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_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented (@b Since: @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */ + 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 response from notification service */ + NOTIFICATION_ERROR_MAX_EXCEEDED = TIZEN_ERROR_NOTIFICATION | 0x06, /**< Max notification count exceeded (@b Since: 3.0) */ +} notification_error_e; + + +/** + * @} + */ + + +#endif /* __NOTIFICATION_ERROR_H__ */ + diff --git a/notification/include/notification_group.h b/notification/include/notification_group.h new file mode 100644 index 0000000..27c326a --- /dev/null +++ b/notification/include/notification_group.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_GROUP_H__ +#define __NOTIFICATION_GROUP_H__ + +#include <notification.h> + +NOTIFICATION_DEPRECATED_API int notification_group_set_title( + const char *app_id, int group_id, const char *title, + const char *loc_title, + notification_count_display_type_e count_display); + +NOTIFICATION_DEPRECATED_API int notification_group_get_title( + const char *app_id, int group_id, char **ret_title, + char **ret_loc_title, + notification_count_display_type_e *count_display); + +NOTIFICATION_DEPRECATED_API int notification_group_set_content( + const char *app_id, int group_id, const char *content, + const char *loc_content, + notification_count_display_type_e count_display); + +NOTIFICATION_DEPRECATED_API int notification_group_get_content( + const char *app_id, int group_id, char **ret_content, + char **ret_loc_content, + notification_count_display_type_e *count_display); + +NOTIFICATION_DEPRECATED_API int notification_group_set_badge( + const char *app_id, int group_id, int count); + +NOTIFICATION_DEPRECATED_API int notification_group_get_badge( + const char *app_id, int group_id, int *count); + +#endif /* __NOTIFICATION_GROUP_H__ */ + diff --git a/notification/include/notification_internal.h b/notification/include/notification_internal.h new file mode 100644 index 0000000..194405d --- /dev/null +++ b/notification/include/notification_internal.h @@ -0,0 +1,1506 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_INTERNAL_H__ +#define __NOTIFICATION_INTERNAL_H__ +#include <glib.h> +#include <sys/types.h> + +#include <notification_error.h> +#include <notification_type.h> +#include <notification_list.h> +#include <notification_type_internal.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup NOTIFICATION_INTERNAL + * @{ + */ + +#define NOTIFICATION_ERROR (notification_error_quark()) + +GQuark notification_error_quark(void); + +/** + * @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_register_detailed_changed_cb() + */ +int notification_resister_changed_cb( + void (*changed_cb)(void *data, notification_type_e type), + void *user_data); +int notification_resister_changed_cb_for_uid( + void (*changed_cb)(void *data, notification_type_e type), + void *user_data, uid_t uid); + +/** + * @brief This function will be removed. + * @see notification_unregister_detailed_changed_cb() + */ +int notification_unresister_changed_cb( + void (*changed_cb)(void *data, notification_type_e type)); +int notification_unresister_changed_cb_for_uid( + void (*changed_cb)(void *data, notification_type_e type), uid_t uid); + +/** + * @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. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_internal.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. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_internal.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. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_internal.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() + */ +int notification_set_icon(notification_h noti, const char *icon_path) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_get_image() + */ +int notification_get_icon(notification_h noti, char **icon_path) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_set_text() + */ +int notification_set_title(notification_h noti, const char *title, const char *loc_title) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_get_text() + */ +int notification_get_title(notification_h noti, char **title, char **loc_title) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_set_text() + */ +int notification_set_content(notification_h noti, const char *content, const char *loc_content) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_get_text() + */ +int notification_get_content(notification_h noti, char **content, char **loc_content) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be removed. + * @see notification_set_execute_option() + */ +int notification_set_application(notification_h noti, const char *app_id) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be removed. + * @see notification_get_execute_option() + */ +int notification_get_application(notification_h noti, char **app_id) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_set_execute_option() + */ +int notification_set_args(notification_h noti, bundle *args, bundle *group_args) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_get_execute_option() + */ +int notification_get_args(notification_h noti, bundle **args, bundle **group_args) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function is deprecated. + * @see notification_get_grouping_list() + */ +int notification_get_grouping_list(notification_type_e type, int count, notification_list_h *list) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_delete_by_priv_id() + */ +int notification_delete_group_by_group_id(const char *app_id, notification_type_e type, int group_id) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_delete_by_priv_id() + */ +int notification_delete_group_by_priv_id(const char *app_id, notification_type_e type, int priv_id) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + */ +int notifiation_clear(notification_type_e type) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + */ +int notification_get_count(notification_type_e type, const char *app_id, int group_id, int priv_id, int *count) NOTIFICATION_DEPRECATED_API; + +/** + * @internal + * @brief Gets the numbers of all notifications. + * @since tizen 4.0 + * @param[in] type The type of notification + * @param[out] count The numbers of all notifications + * @return #NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error + * @retval #NOTIFICATION_ERROR_FROM_DB Error from DB + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + */ +int notification_get_all_count(notification_type_e type, int *count); +int notification_get_all_count_for_uid(notification_type_e type, int *count, uid_t uid); + +/** + * @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; + + noti_err = notification_clear(NOTIFICATION_TYPE_NOTI); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_clear(notification_type_e type) NOTIFICATION_DEPRECATED_API; + +/** + * @internal + * @brief This function will be deprecated. + * @return 1 on ready, other value on not ready + */ +int notification_is_service_ready(void) NOTIFICATION_DEPRECATED_API; + +/** + * @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 + */ +int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type, void *data) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_set_app_id() + */ +int notification_set_pkgname(notification_h noti, const char *pkgname) NOTIFICATION_DEPRECATED_API; + +/** + * @internal + * @brief Sets caller's app_id. + * @details caller_app_id is set automatically when notification_create() is called. We do not recommend to use this API. + * @since_tizen 4.0 + * @param[in] noti Notification handle + * @param[in] app_id Caller application id + * @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_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_app_id(noti, "org.tizen.phone"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_app_id(notification_h noti, const char *app_id); + +/** + * @internal + * @brief This function will be deprecated. + * @details If @a app_id is NULL, caller_app_id is set internally. + * @param[in] app_id Caller application ID 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 + */ +int notification_delete_all_by_type(const char *app_id, notification_type_e type) NOTIFICATION_DEPRECATED_API; + +/** + * @internal + * @brief This function will be deprecated. + * @details If @a app_id is NULL, caller_app_id is set internally. + * @param[in] app_id Caller application ID 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; + + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_delete_by_priv_id(const char *app_id, notification_type_e type, int priv_id) NOTIFICATION_DEPRECATED_API; + +/** + * @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; + + ... + + 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 + */ +int notification_set_execute_option(notification_h noti, + notification_execute_type_e type, + const char *text, + const char *key, + bundle *service_handle) NOTIFICATION_DEPRECATED_API; + +/** + * @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 + */ +int notification_get_id(notification_h noti, int *group_id, int *priv_id) NOTIFICATION_DEPRECATED_API; + +/** + * @internal + * @brief Sets priv_id of the notification. + * @since_tizen 4.0 + * @param[in] noti Notification handle + * @param[in] 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 + */ +int notification_set_priv_id(notification_h noti, 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_h notification_load(char *app_id, int priv_id) NOTIFICATION_DEPRECATED_API; + +/** + * @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_h notification_new(notification_type_e type, + int group_id, int priv_id) NOTIFICATION_DEPRECATED_API; + +/** + * @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, + * 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; + 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 + */ +int notification_get_execute_option(notification_h noti, + notification_execute_type_e type, + const char **text, + bundle **service_handle) NOTIFICATION_DEPRECATED_API; + +/** + * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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> +... +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_insert(notification_h noti, int *priv_id); +int notification_insert_for_uid(notification_h noti, int *priv_id, uid_t uid); + +/** + * @internal + * @brief Updates a notification, asynchronously. + * @details The updated notification will appear in the notification area. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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> +... +{ + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_update_async(NULL, result_cb, data); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_update_async(notification_h noti, + void (*result_cb)(int priv_id, int result, void *data), void *user_data); +int notification_update_async_for_uid(notification_h noti, + void (*result_cb)(int priv_id, int result, void *data), void *user_data, uid_t uid); + +/** + * @internal + * @brief Registers a callback for all notification events. + * @details The registered callback could be called for all notification events. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_register_detailed_changed_cb(app_changed_cb, user_data); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +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); +int notification_register_detailed_changed_cb_for_uid( + void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), + void *user_data, uid_t uid); + +/** + * @internal + * @brief Unregisters a callback for all notification events. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_register_detailed_changed_cb(app_changed_cb, user_data); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +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); +int notification_unregister_detailed_changed_cb_for_uid( + void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), + void *user_data, uid_t uid); + +/** + * @brief Sets the default button to display highlight on the notification. + * @since_tizen 3.0 + * @remarks If you want to default button is off, you set that index is zero + * @param[in] noti The notification handle + * @param[in] index The notification button index + * @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_button_index_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if(noti == NULL) { + return; + } + + noti_err = notification_set_default_button(noti, NOTIFICATION_BUTTON_1); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + +} + * @endcode + */ +int notification_set_default_button(notification_h noti, + notification_button_index_e index); + +/** + * @brief Gets the default button to display highlight on the notification. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] index The notification button index + * @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_button_index_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_button_index_e index; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if(noti == NULL) { + return; + } + + noti_err = notification_set_default_button(noti, &index); + if(noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... +} + * @endcode + */ +int notification_get_default_button(notification_h noti, + notification_button_index_e *index); + +/** + * @brief Gets the notification ongoing value type. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] type The notification ongoing value 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 + * @pre Notification handle should be created by notification_create(). + * @see #notification_ongoing_value_type_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_ongoing_value_type_e type; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_ongoing_value_type(noti, &type); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_ongoing_value_type(notification_h noti, + notification_ongoing_value_type_e *type); + +/** + * @brief Sets the notification ongoing value type. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[in] type The notification ongoing value 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 + * @pre Notification handle should be created by notification_create(). + * @see #notification_ongoing_value_type_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_ongoing_value_type_e type; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + type = NOTIFICATION_ONGOING_VALUE_TYPE_TIME; + + noti_err = notification_set_ongoing_value_type(noti, type); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_ongoing_value_type(notification_h noti, + notification_ongoing_value_type_e type); + +/** + * @brief Gets the notification ongoing time when ongoint type value is set #NOTIFICATION_ONGOING_VALUE_TYPE_TIME. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] current The ongoing current time + * @param[out] duration The ongoing duration 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_ongoing_value_type_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + int current; + int duration; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_ongoing_time(noti, ¤t, &duration); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_ongoing_time(notification_h noti, int *current, int *duration); + +/** + * @brief Sets the notification ongoing time when ongoint type value is set #NOTIFICATION_ONGOING_VALUE_TYPE_TIME. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[in] current The ongoing current time + * @param[in] duration The ongoing duration 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_ongoing_value_type_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + int current; + int duration; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + current = 0; + duration = 30; + + noti_err = notification_set_ongoing_time(noti, current, duration) + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_ongoing_time(notification_h noti, int current, int duration); + +/** + * @brief Gets timeout value in second when the notification can be hidden from the viewer. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] timeout The timeout time(sec) + * @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_event_type_extension_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + int timeout; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_hide_timeout(noti, &timeout) + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_hide_timeout(notification_h noti, int *timeout); + +/** + * @brief Sets timeout value in second when the notification can be hidden from the viewer. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[in] timeout The timeout time(sec) + * @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_event_type_extension_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_hide_timeout(noti, 10) + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_hide_timeout(notification_h noti, int timeout); + +/** + * @brief Gets timeout value in second when the notification can be deleted from the viewer. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] timeout The timeout time(sec) + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + int timeout; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_delete_timeout(noti, &timeout) + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_get_delete_timeout(notification_h noti, int *timeout); + +/** + * @brief Sets timeout value in second when the notification can be deleted from the viewer. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[in] timeout The timeout time(sec) + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_delete_timeout(noti, 10) + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_delete_timeout(notification_h noti, int timeout); + +typedef void (*event_handler_cb)(notification_h noti, int event_type, void *userdata); + +/** + * @brief Posts a notification with event handler callback. + * @details The registered callback could be called when take notification event + * and the callback is automatically deleted when notification you posted is deleted. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks Providing one event callback for each notification handle and distinguish the event by parameter. + * @param[in] noti The notification handle + * @param[in] cb The event handler callback function + * @param[in] userdata 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_IO_ERROR I/O Error + * @retval #NOTIFICATION_PERMISSION_DENIED Permission denied + * @pre Notification handle should be created by notification_create(). + * @par Sample code: + * @code +#include <notification.h> + +static void event_callback(notification_h noti, int event_type, void *userdata) +{ + ... +} + +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_post_with_event_cb(noti, event_callback, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + + notification_free(noti); +} + * @endcode + */ +int notification_post_with_event_cb(notification_h noti, event_handler_cb cb, void *userdata); +int notification_post_with_event_cb_for_uid(notification_h noti, + event_handler_cb cb, void *userdata, uid_t uid); + +/** + * @brief Sends a event type to an application that posted notification. + * @details Sends occured event from viewer application to an application. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti The notification handle + * @param[in] event_type The event 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 + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error + * @retval #NOTIFICATION_PERMISSION_DENIED Permission denied + * @see #notification_event_type_e + * @see #notification_event_type_extension_e + * @par Sample code: + * @code +#include <notification.h> +... +{ + int noti_err; + int event_type; + + ... + + event_type = NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER; + + noti_err = notification_send_event(noti, event_type); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_send_event(notification_h noti, int event_type); +int notification_send_event_by_priv_id(int priv_id, int event_type); + +/** + * @brief Gets the event flag. + * @details When you create a notification handle, a default value of event flag is false. + * The flag automatically set true when post a notification using notification_post_with_event_cb(). + * The viewer application for showing the notifications can use this API to check if it needs to call + * notification_send_event() to sends event of notification for making the callback of the processes + * that have posted notification to be called. Call notification_send_event() + * when the notification_get_event_flag() tells that the @event_flag is true. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] event_flag The event flag + * @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; + int noti_err; + bool event_flag; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_event_flag(noti, &event_flag); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + + notification_free(noti); +} + * @endcode + */ +int notification_get_event_flag(notification_h noti, bool *event_flag); + +/** + * @brief Gets whether sending event is available. + * @details If the application is terminated, registered callback isn't called + * for event sent by other process. So you need to check whether the + * callback can be called before sending event. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] available The value whether sending event is available + * @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_IO_ERROR I/O Error + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @see #notification_send_event() + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err; + bool available; + + ... + + noti_err = notification_check_event_receiver_available(noti, &available); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + + notification_free(noti); +} + * @endcode + */ +int notification_check_event_receiver_available(notification_h noti, bool *available); + +/** + * @brief This function translate localized texts. + * @since_tizen 3.0 + * @param[in] noti The notification handle that is created by notification_create() + * @return #NOTIFICATION_ERROR_NONE if success, other value if failure + * @see notification_create() + */ +int notification_translate_localized_text(notification_h noti); + +/** + * @internal + * @brief Loads a notification template from the applcation id. + * @details An application can load a saved template and post it. + * @since_tizen 3.0 + * @privilege %http://tizen.org/privilege/notification + * @remarks The returned handle should be destroyed using notification_free(). + * The specific error code can be obtained using get_last_result(). + * Error codes are described in the Exception section. + * If an invalid template name or application id is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB. + * @param[in] app_id Application ID + * @param[in] template_name Template name + * @return Notification handle on success, NULL on failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @exception #NOTIFICATION_ERROR_IO_ERROR I/O Error + * @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 + * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query + * @exception #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @see #notification_h + * @see notification_save_as_template() + */ +notification_h notification_create_from_package_template(const char *app_id, + const char *template_name); + +void notification_reset_event_handler_list(void); +int notification_set_uid(notification_h noti, uid_t uid); +int notification_get_uid(notification_h noti, uid_t *uid); +int notification_post_for_uid(notification_h noti, uid_t uid); +int notification_update_for_uid(notification_h noti, uid_t uid); +int notification_delete_for_uid(notification_h noti, uid_t uid); +int notification_delete_all_for_uid(notification_type_e type, uid_t uid); +notification_h notification_load_by_tag_for_uid(const char *tag, uid_t uid); + +/** + * @brief Gets a max length of text input. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[in] Max length of Text input + * @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> +... +{ + int noti_err = NOTIFICATION_ERROR_NONE; + int text_input_max_length; + + noti_err = notification_get_text_input_max_length(noti, &text_input_max_length); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + ... + } + * @endcode + */ +int notification_get_text_input_max_length(notification_h noti, int *text_input_max_length); + +/** + * @brief Sets an extension data. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[in] key The key + * @param[in] value The bundle 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 + */ +int notification_set_extension_data(notification_h noti, const char *key, bundle *value); + +/** + * @brief Gets an extension data. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[in] key The key + * @param[out] value The bundle 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_IO_ERROR IO Error + */ +int notification_get_extension_data(notification_h noti, const char *key, bundle **value); + +/** + * @brief This function will be deprecated. + * @see notification_set_extension_data() + */ +int notification_set_extention_data(notification_h noti, const char *key, bundle *value) NOTIFICATION_DEPRECATED_API; + +/** + * @brief This function will be deprecated. + * @see notification_get_extension_data() + */ +int notification_get_extention_data(notification_h noti, const char *key, bundle **value) NOTIFICATION_DEPRECATED_API; + +/** + * @brief Sets the handler for a specific extension event. + * @details When some extension event occurs on notification, application launched by app_control_send_launch_request with app_control handle. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[in] event_type Event type + * @param[in] event_handler App control handle + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @see #notification_event_type_extension_e + */ +int notification_set_extension_event_handler(notification_h noti, + notification_event_type_extension_e event, + app_control_h event_handler); + +/** + * @brief Gets the handler for a specific extension event. + * @details When extension event occurs on notification, application launched by app_control_send_launch_request with app_control handle. + * @since_tizen 4.0 + * @param[in] noti The notification handle + * @param[in] event Event type + * @param[out] event_handler App control handle + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @see #notification_event_type_extension_e + */ +int notification_get_extension_event_handler(notification_h noti, + notification_event_type_extension_e event, + app_control_h *event_handler); + +/** + * @internal + * @brief Sets the label of caller application. + * @details It recommends for daemons. For an Application, the label is set when notification create. + * @since_tizen 5.0 + * @param[in] noti Notification handle + * @param[in] label Label of Caller application + * @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_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_app_label(noti, "message"); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_app_label(notification_h noti, char *label); + +/** + * @internal + * @brief Gets the label of caller application. + * @details Label may be null if it was not set. + * Do not free @a label. It will be freed when notification_free() is called. + * @since_tizen 5.0 + * @param[in] noti Notification handle + * @param[out] label Label of Caller application + * @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; + char *label = NULL; + + noti_err = notification_get_app_label(noti, &label); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_app_label(notification_h noti, char **label); + +/** + * @ This API is only for App Framework internally. + */ +int notification_set_indirect_request(notification_h noti, pid_t pid, uid_t uid); + +/** + * @internal + * @brief Notification viewer can delete all notifications displayed in the viewer. + * @since_tizen 5.5 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] display_applist Combination value of display list + * @return #NOTIFICATION_ERROR_NONE on success, other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method + * @retval #NOTIFICATION_ERROR_FROM_DB Error from DB query + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @par Sample code: + * @code +#include <notification_internal.h> +... +{ + noti_err = notification_delete_by_display_applist(NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_delete_by_display_applist(int display_applist); +int notification_delete_by_display_applist_for_uid(int display_applist, uid_t uid); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif diff --git a/notification/include/notification_ipc.h b/notification/include/notification_ipc.h new file mode 100644 index 0000000..b88de0a --- /dev/null +++ b/notification/include/notification_ipc.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_IPC_H__ +#define __NOTIFICATION_IPC_H__ + +#include <gio/gio.h> +#include <sys/types.h> + +#include <notification.h> +#include <notification_setting.h> +#include <notification_setting_internal.h> +#include <notification_list.h> + +#ifdef __cplusplus +extern "C" { +#endif + +GVariant *notification_ipc_make_gvariant_from_noti(notification_h noti, bool translate); +int notification_ipc_make_noti_from_gvariant(notification_h noti, + GVariant *variant); + +GVariant *notification_ipc_make_gvariant_from_setting( + struct notification_setting *noti_setting); +int notification_ipc_make_setting_from_gvariant( + struct notification_setting *noti_setting, GVariant *variant); + +GVariant *notification_ipc_make_gvariant_from_system_setting( + struct notification_system_setting *noti_setting); +int notification_ipc_make_system_setting_from_gvariant( + struct notification_system_setting *noti_setting, + GVariant *variant); + +int notification_dbus_init(); +int notification_ipc_monitor_init(uid_t uid); +int notification_ipc_monitor_fini(void); +void notification_ipc_event_monitor_fini(void); + +int notification_ipc_is_master_ready(void); +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_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); +int notification_ipc_request_refresh(uid_t uid); +int notification_ipc_request_delete_multiple(notification_type_e type, + char *app_id, uid_t uid); +int notification_ipc_request_delete_by_display_applist(int display_applist, uid_t uid); +int notification_ipc_request_delete_single(notification_type_e type, + char *app_id, int priv_id, uid_t uid); +int notification_ipc_update_setting(notification_setting_h setting, uid_t uid); +int notification_ipc_update_system_setting( + notification_system_setting_h system_setting, uid_t uid); +int notification_ipc_request_load_noti_by_tag(notification_h noti, + const char *app_id, const char *tag, uid_t uid); +int notification_ipc_request_load_noti_grouping_list(notification_type_e type, + int count, int count_per_page, notification_list_h *list, uid_t uid); +int notification_ipc_request_get_setting_array( + notification_setting_h *setting_array, int *count, uid_t uid); +int notification_ipc_request_get_setting_by_app_id( + const char *app_id, notification_setting_h *setting, uid_t uid); +int notification_ipc_request_load_system_setting( + notification_system_setting_h *setting, uid_t uid); +int notification_ipc_request_get_count(notification_type_e type, + const char *app_id, int group_id, int priv_id, int *count, uid_t uid); +int notification_ipc_request_load_noti_by_priv_id(notification_h noti, + const char *app_id, int priv_id, uid_t uid); +int notification_ipc_request_load_noti_detail_list(const char *app_id, + int group_id, int priv_id, int count, + notification_list_h *list, uid_t uid); +int notification_ipc_request_save_as_template(notification_h noti, const char *template_name); +int notification_ipc_request_create_from_template(notification_h noti, const char *template_name); +int notification_ipc_request_create_from_package_template(notification_h noti, + const char *app_id, const char *template_name); +int notification_ipc_get_noti_block_state(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, + int *allow_to_notify, uid_t uid); +GVariant *notification_ipc_make_gvariant_from_dnd_allow_exception( + struct notification_system_setting_dnd_allow_exception *dnd_allow_exception); +int notification_ipc_make_dnd_allow_exception_from_gvariant( + struct notification_system_setting_dnd_allow_exception *dnd_allow_exception, + GVariant *variant); +int notification_ipc_send_event(notification_h noti, int event_type, int priv_id); +int notification_ipc_check_event_receiver(int priv_id, bool *available); +void notification_ipc_reset_event_handler(int priv_id); +int notification_ipc_request_get_all_count(notification_type_e type, int *count, uid_t uid); + +/* Functions related with socket */ +int notification_ipc_socket_pair(int *fd); +int notification_ipc_socket_get_read_buf_size(int fd, unsigned int *size); +int notification_ipc_socket_get_write_buf_size(int fd, unsigned int *size); +int notification_ipc_socket_write(int fd, const char *buffer, unsigned int nbytes); +int notification_ipc_socket_write_string(int fd, const char *buffer, unsigned int string_len); +int notification_ipc_socket_read(int fd, char *buffer, unsigned int nbytes); +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_IPC_H__ */ + diff --git a/notification/include/notification_list.h b/notification/include/notification_list.h new file mode 100644 index 0000000..a05d61f --- /dev/null +++ b/notification/include/notification_list.h @@ -0,0 +1,454 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_LIST_H__ +#define __NOTIFICATION_LIST_H__ + +#include <sys/types.h> +#include <notification.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file notification_list.h + * @brief This file contains the notification list APIs. + */ + +/** + * @internal + * @addtogroup NOTIFICATION_LIST + * @{ + */ + +/** + * @brief Notification list handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef struct _notification_list *notification_list_h; + + +/** + * @internal + * @brief Returns the notification list handle. + * @details If count is equal to @c -1, all notifications are returned. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] type The notification type + * @param[in] count The returned notification data number + * @param[out] 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 + * @see #notification_list_h + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_list(notification_type_e type, + int count, + notification_list_h *list); + +int notification_get_list_for_uid(notification_type_e type, + int count, + notification_list_h *list, uid_t uid); + +/** + * @internal + * @brief Gets the notification list associated with the partition into pages. + * @since_tizen 4.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] type The notification type + * @param[in] page_number The page number of the value set \n + * It starts from @c 1. + * @param[in] count_per_page The desired maximum count of the data items per page + * The maximum value is 100, If the value is set more than 100, \n + * it is automatically set 100. + * @param[out] 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 + * @see #notification_list_h + */ +int notification_get_list_by_page(notification_type_e type, + int page_number, int count_per_page, notification_list_h *list); + +int notification_get_list_by_page_for_uid(notification_type_e type, + int page_number, int count_per_page, notification_list_h *list, uid_t uid); +/** + * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] app_id The caller application ID + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_detail_list(const char *app_id, + int group_id, + int priv_id, + int count, + notification_list_h *list); + +int notification_get_detail_list_for_uid(const char *app_id, + int group_id, + int priv_id, + int count, + notification_list_h *list, + uid_t uid); + +/** + * @internal + * @brief Frees a notification list. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + ... + + noti_err = notification_free_list(noti_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_free_list(notification_list_h list); + + +/** + * @internal + * @brief Gets the head pointer of the notification list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_list = notification_list_get_head(noti_list); +} + * @endcode + */ +notification_list_h notification_list_get_head(notification_list_h list); + +/** + * @internal + * @brief Gets the tail pointer to the notification list. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_list = notification_list_get_tail(noti_list); +} + * @endcode + */ +notification_list_h notification_list_get_tail(notification_list_h list); + +/** + * @internal + * @brief Gets the previous pointer of the current notification list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_list = notification_list_get_prev(noti_list); +} + * @endcode + */ +notification_list_h notification_list_get_prev(notification_list_h list); + +/** + * @internal + * @brief Gets the next pointer of the current notification list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 +#include <notification.h> +... +{ + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_list = notification_list_get_next(noti_list); +} + * @endcode + */ +notification_list_h notification_list_get_next(notification_list_h list); + +/** + * @internal + * @brief Gets the notification handle that the list has. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti = notification_list_get_data(noti_list); +} + * @endcode + */ +notification_h notification_list_get_data(notification_list_h list); + + +/** + * @internal + * @brief Gets a number of the notification list. + * @since_tizen 3.0 + * @param[in] list Notification list handle + * @return A number of notification list handle on success, 0 on failure + * @exception #NOTIFICATION_ERROR_NONE Success + * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value + * @see #notification_list_h + * @see #notification_h + * @par Sample code: + * @code +include <notification.h> +... +{ + int count = 0; + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + count = notification_list_get_count(noti_list); +} + * @endcode + */ +int notification_list_get_count(notification_list_h list); + +/** + * @internal + * @brief Appends notification data to the notification list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + return; + } + + noti_list = notification_list_append(noti_list, noti); +} + * @endcode + */ +notification_list_h notification_list_append(notification_list_h list, + notification_h noti); + +/** + * @internal + * @brief Removes notification data from the notification list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + notification_list_h noti_list = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + ... + + noti_list = notification_list_remove(noti_list, noti); +} + * @endcode + */ +notification_list_h notification_list_remove(notification_list_h list, + notification_h noti); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_LIST_H__ */ + diff --git a/notification/include/notification_noti.h b/notification/include/notification_noti.h new file mode 100644 index 0000000..4a2807e --- /dev/null +++ b/notification/include/notification_noti.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_NOTI_H__ +#define __NOTIFICATION_NOTI_H__ + +#include <sys/types.h> +#include <glib.h> + +#include <notification.h> +#include <notification_list.h> + +#define TAG_TIME "TIME" +#define TAG_TYPE_INVALID -1 +#define TAG_TYPE_TIME 1 + +struct _notification_deleted_list_info { + int priv_id; + char *app_id; +}; + +typedef struct _notification_deleted_list_info notification_deleted_list_info_s; + +int notification_noti_set_tag(const char *tag, char *value, char *buf, int buf_len); + +char *notification_noti_strip_tag(const char *tagged_str); + +int notification_noti_get_tag_type(const char *tagged_str); + +int notification_noti_insert(notification_h noti); + +int notification_noti_update(notification_h noti); + +int notification_noti_delete_all(notification_type_e type, const char *app_id, + int *deleted_num, int **deleted_list, uid_t uid); + +int notification_noti_get_by_priv_id(notification_h noti, int priv_id); +int notification_noti_get_by_tag(notification_h noti, char *app_id, char* tag, uid_t uid); + +int notification_noti_delete_by_priv_id(const char *app_id, int priv_id); +int notification_noti_delete_by_priv_id_get_changes(const char *app_id, int priv_id, + int *num_changes, uid_t uid); + +int notification_noti_delete_by_display_applist(int display_applist, + int *deleted_num, + notification_deleted_list_info_s **deleted_list, + uid_t uid); + +int notification_noti_get_count(notification_type_e type, + const char *app_id, + int group_id, int priv_id, + int *count, uid_t uid); + +int notification_noti_get_all_count(notification_type_e type, int *count, uid_t uid); + +int notification_noti_get_grouping_list(notification_type_e type, + int page_number, + int count_per_page, + notification_list_h *list, + int *list_count, + uid_t uid); + +int notification_noti_get_detail_list(const char *app_id, + int group_id, + int priv_id, int count, + notification_list_h *list, + uid_t uid); + +int notification_noti_check_tag(notification_h noti); +int notification_noti_check_count_for_template(notification_h noti, int *count); + +int notification_noti_add_template(notification_h noti, char *template_name); +int notification_noti_get_package_template(notification_h noti, char *app_id, char *template_name); +int notification_noti_delete_template(const char *pkg_id); + +void notification_noti_init_data(void); +int notification_noti_check_limit(notification_h noti, uid_t uid, GList **list); + +#endif /* __NOTIFICATION_NOTI_H__ */ + diff --git a/notification/include/notification_ongoing.h b/notification/include/notification_ongoing.h new file mode 100644 index 0000000..fa6e95a --- /dev/null +++ b/notification/include/notification_ongoing.h @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_ONGOING_H__ +#define __NOTIFICATION_ONGOING_H__ + +#include <notification.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @file notification_ongoing.h + */ + +typedef enum { + ONGOING_TYPE_PROGRESS, + ONGOING_TYPE_SIZE, + ONGOING_TYPE_CONTENT, +} ongoing_type_e; + +struct ongoing_info_s { + char *pkgname; + int priv_id; + ongoing_type_e type; + double progress; + double size; + char *content; +}; + +/** + * @internal + * @brief Called when a notification ongoing data is updated. + * @since_tizen 3.0 + * @param[in] info The ongoing information handle + * @param[in] data The user data + * @pre notification_ongoing_update_cb_set() used to register this callback. + * @see notification_ongoing_update_cb_set() +*/ +typedef void (*notification_ongoing_update_cb)(struct ongoing_info_s *info, void *data); + +/** + * @internal + * @brief Registers a callback to receive the ongoing progress, size ,content. + * @since_tizen 3.0 + * @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_ongoing_update_cb_set(notification_ongoing_update_cb callback, void *user_data); + +/** + * @internal + * @brief Unregisters a callback to receive. + * @since_tizen 3.0 + * @retval #NOTIFICATION_ERROR_NONE Success + */ +int notification_ongoing_update_cb_unset(void); + +/** + * @brief Updates progress. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @param[in] caller_app_id + * @param[in] priv_id + * @param[in] progress + * @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_FROM_DBUS Error from DBus + */ +int notification_ongoing_update_progress(const char *caller_app_id, + int priv_id, double progress); + +/** + * @brief Updates size. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @param[in] caller_app_id + * @param[in] priv_id + * @param[in] size + * @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_FROM_DBUS Error from DBus + */ +int notification_ongoing_update_size(const char *caller_app_id, + int priv_id, double size); + +/** + * @brief Updates content. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @param[in] caller_app_id + * @param[in] priv_id + * @param[in] content + * @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_FROM_DBUS Error from DBus + */ +int notification_ongoing_update_content(const char *caller_app_id, + int priv_id, const char *content); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __NOTIFICATION_ONGOING_H__ */ + diff --git a/notification/include/notification_ongoing_flag.h b/notification/include/notification_ongoing_flag.h new file mode 100644 index 0000000..e7238a4 --- /dev/null +++ b/notification/include/notification_ongoing_flag.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_ONGOING_FLAG_H__ +#define __NOTIFICATION_ONGOING_FLAG_H__ + +#include <notification.h> + +/** + * @brief Sets the ongoing flag of the notification + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti The notification handle + * @param[in] ongoing_flag The ongoing flag + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_ongoing_flag(noti, true); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag); + +/** + * @brief Gets the ongoing flag of the notification + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] noti The notification handle + * @param[out] ongoing_flag The ongoing flag + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + bool ongoing_flag = 0; + + noti_err = notification_get_ongoing_flag(noti, &ongoing_flag); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_ongoing_flag(notification_h noti, bool *ongoing_flag); + +#endif /* __NOTIFICATION_ONGOING_H__ */ + diff --git a/notification/include/notification_private.h b/notification/include/notification_private.h new file mode 100644 index 0000000..a9ce8ed --- /dev/null +++ b/notification/include/notification_private.h @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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__ +#include <sys/types.h> +#include <notification_internal.h> + +#ifndef EXPORT_API +#define EXPORT_API __attribute__ ((visibility("default"))) +#endif + +#define SAFE_STRDUP(s) ((s) ? strdup(s) : NULL) +#define SAFE_FREE(s) \ + do { \ + if (s) { \ + free(s); \ + s = NULL; \ + } \ + } while (0) + +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 *pkg_id; + char *caller_app_id; /* Caller App ID */ + char *launch_app_id; /* Launch App ID */ + 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; + + bundle *b_event_handler[NOTIFICATION_EVENT_TYPE_MAX+1]; + + 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 */ + bundle *b_priv_image_path; /* resource path for image */ + + notification_sound_type_e sound_type; + char *sound_path; + char *priv_sound_path; /* resource path for sound */ + notification_vibration_type_e vibration_type; + char *vibration_path; + char *priv_vibration_path; /* resource path for vibration */ + 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_label; + char *temp_title; + char *temp_content; + char *tag; + bool ongoing_flag; + int ongoing_value_type; + int ongoing_current; /* Ongoing current time */ + int ongoing_duration; /* Ongoing duration time */ + bool auto_remove; + notification_button_index_e default_button_index; + int hide_timeout; /* Time for hide in banner */ + int delete_timeout; /* Time for delete in view notification */ + int text_input_max_length; + bool event_flag; + bool is_translation; + int extension_image_size; + + uid_t uid; +}; + +typedef enum notification_data_type { + NOTIFICATION_DATA_TYPE_NOTI_TYPE = 1, + NOTIFICATION_DATA_TYPE_LAYOUT, + NOTIFICATION_DATA_TYPE_GROUP_ID, + NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID, + NOTIFICATION_DATA_TYPE_PRIV_ID, + NOTIFICATION_DATA_TYPE_PKG_ID, + NOTIFICATION_DATA_TYPE_CALLER_APP_ID, + NOTIFICATION_DATA_TYPE_LAUNCH_APP_ID, + NOTIFICATION_DATA_TYPE_ARGS, + NOTIFICATION_DATA_TYPE_GROUP_ARGS, + NOTIFICATION_DATA_TYPE_EXECUTE_OPTION, + NOTIFICATION_DATA_TYPE_SERVICE_RESPONDING, + NOTIFICATION_DATA_TYPE_SERVICE_SINGLE_LAUNCH, + NOTIFICATION_DATA_TYPE_SERVICE_MULTI_LAUNCH, + NOTIFICATION_DATA_TYPE_BUTTON1_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON2_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON3_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON4_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON5_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON6_EVENT, + NOTIFICATION_DATA_TYPE_ICON_EVENT, + NOTIFICATION_DATA_TYPE_THUMBNAIL_EVENT, + NOTIFICATION_DATA_TYPE_TEXT_INPUT_BUTTON_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON7_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON8_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON9_EVENT, + NOTIFICATION_DATA_TYPE_BUTTON10_EVENT, + NOTIFICATION_DATA_TYPE_DOMAIN, + NOTIFICATION_DATA_TYPE_DIR, + NOTIFICATION_DATA_TYPE_TEXT, + NOTIFICATION_DATA_TYPE_KEY, + NOTIFICATION_DATA_TYPE_FORMAT_ARGS, + NOTIFICATION_DATA_TYPE_NUM_FORMAT_ARGS, + NOTIFICATION_DATA_TYPE_IMAGE_PATH, + NOTIFICATION_DATA_TYPE_PRIV_IMAGE_PATH, + NOTIFICATION_DATA_TYPE_SOUND_TYPE, + NOTIFICATION_DATA_TYPE_SOUND_PATH, + NOTIFICATION_DATA_TYPE_PRIV_SOUND_PATH, + NOTIFICATION_DATA_TYPE_VIBRATION_TYPE, + NOTIFICATION_DATA_TYPE_VIBRATION_PATH, + NOTIFICATION_DATA_TYPE_PRIV_VIBRATION_PATH, + NOTIFICATION_DATA_TYPE_LED_OPERATION, + NOTIFICATION_DATA_TYPE_LED_ARGB, + NOTIFICATION_DATA_TYPE_LED_ON_MS, + NOTIFICATION_DATA_TYPE_LED_OFF_MS, + NOTIFICATION_DATA_TYPE_TIME, + NOTIFICATION_DATA_TYPE_INSERT_TIME, + NOTIFICATION_DATA_TYPE_FLAGS_FOR_PROPERTY, + NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST, + NOTIFICATION_DATA_TYPE_PROGRESS_SIZE, + NOTIFICATION_DATA_TYPE_PROGRESS_PERCENTAGE, + NOTIFICATION_DATA_TYPE_APP_ICON_PATH, + NOTIFICATION_DATA_TYPE_APP_LABEL, + NOTIFICATION_DATA_TYPE_TEMP_TITLE, + NOTIFICATION_DATA_TYPE_TEMP_CONTENT, + NOTIFICATION_DATA_TYPE_TAG, + NOTIFICATION_DATA_TYPE_ONGOING_FLAG, + NOTIFICATION_DATA_TYPE_ONGOING_VALUE_TYPE, + NOTIFICATION_DATA_TYPE_ONGOING_CURRENT, + NOTIFICATION_DATA_TYPE_ONGOING_DURATION, + NOTIFICATION_DATA_TYPE_AUTO_REMOVE, + NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, + NOTIFICATION_DATA_TYPE_HIDE_TIMEOUT, + NOTIFICATION_DATA_TYPE_DELETE_TIMEOUT, + NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, + NOTIFICATION_DATA_TYPE_EVENT_FLAG, + NOTIFICATION_DATA_TYPE_TRANSLATION, + NOTIFICATION_DATA_TYPE_EXTENSION_IMAGE_SIZE, + NOTIFICATION_DATA_TYPE_UID, +} notification_data_type_e; + +void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, uid_t uid); +void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid); +void notification_call_event_handler_cb(notification_h noti, int event_type); +void notification_delete_event_handler_cb(int priv_id); +char *notification_get_app_id_by_pid(int pid); + +#endif /* __NOTIFICATION_PRIVATE_H__ */ + diff --git a/notification/include/notification_setting.h b/notification/include/notification_setting.h new file mode 100644 index 0000000..9186cd6 --- /dev/null +++ b/notification/include/notification_setting.h @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_SETTING_H__ +#define __NOTIFICATION_SETTING_H__ + +#include <stdbool.h> +#include <sys/types.h> + +#include "notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct notification_setting *notification_setting_h; + +/** + * @internal + * @brief Gets setting handle of current process. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[out] setting The setting 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_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Already exist private ID + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + + noti_err = notification_setting_get_setting(&setting); + if (noti_err != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_setting_get_setting(notification_setting_h *setting); + +/** + * @internal + * @brief Gets value which whether information on the notification view is visible. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[out] value The visibility_class 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_setting.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_get_visibility_class(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_visibility_class(notification_setting_h setting, int *value); + +/** + * @internal + * @brief Sets value which whether information on the notification view is visible. + * @details After notification_setting_update_setting() call, the visibility_class value is not updated. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[in] value The visibility_class 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_setting.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_set_visibility_class(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_set_visibility_class(notification_setting_h setting, int value); + +/** + * @internal + * @brief Updates the notification setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] setting The notification setting 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_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_update_setting(setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_update_setting(notification_setting_h setting); + +/** + * @internal + * @brief Frees the internal structure data of a notification setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting 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 + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_free_notification(setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + return 0; + +} + * @endcode + */ +int notification_setting_free_notification(notification_setting_h setting); + +/** + * @internal + * @brief Refreshs the setting table of current user. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] uid User 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_FROM_DB Error from DB query + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int ret; + + ret = notification_setting_refresh_setting_table(uid); + if (ret = NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_setting_refresh_setting_table(uid_t uid); + +/** + * @internal + * @brief Initializes the system setting table of the current user. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @param[in] uid User 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_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Already exist private ID + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int ret; + + ret = notification_system_setting_init_system_setting_table(uid); + if (ret != NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_system_setting_init_system_setting_table(uid_t uid); + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_SETTING_H__ */ + diff --git a/notification/include/notification_setting_internal.h b/notification/include/notification_setting_internal.h new file mode 100644 index 0000000..951d4d3 --- /dev/null +++ b/notification/include/notification_setting_internal.h @@ -0,0 +1,1493 @@ +/* + * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_SETTING_INTERNAL_H__ +#define __NOTIFICATION_SETTING_INTERNAL_H__ + +#include <sys/types.h> +#include <stdbool.h> +#include <glib.h> +#include "notification.h" +#include "notification_setting.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct notification_system_setting *notification_system_setting_h; +typedef struct notification_system_setting_dnd_allow_exception *dnd_allow_exception_h; + +/** + * @brief The prototype of handler that 'Do not disturb' mode set schdule changed alarm. + * @since_tizen 3.0 + */ +typedef void (*dnd_changed_cb)(void *user_data, int do_not_disturb); + +/** + * @brief Enumeration for Week Flag, the days of the week. + * @since_tizen 3.0 + */ +typedef enum { + DND_SCHEDULE_WEEK_FLAG_SUNDAY = 0x01, /**< Sunday */ + DND_SCHEDULE_WEEK_FLAG_MONDAY = 0x02, /**< Monday */ + DND_SCHEDULE_WEEK_FLAG_TUESDAY = 0x04, /**< Tuesday */ + DND_SCHEDULE_WEEK_FLAG_WEDNESDAY = 0x08, /**< Wednesday */ + DND_SCHEDULE_WEEK_FLAG_THURSDAY = 0x10, /**< Thursday */ + DND_SCHEDULE_WEEK_FLAG_FRIDAY = 0x20, /**< Friday */ + DND_SCHEDULE_WEEK_FLAG_SATURDAY = 0x40, /**< Saturday */ + DND_SCHEDULE_WEEK_FLAG_ALL = DND_SCHEDULE_WEEK_FLAG_SUNDAY| + DND_SCHEDULE_WEEK_FLAG_MONDAY | + DND_SCHEDULE_WEEK_FLAG_TUESDAY | + DND_SCHEDULE_WEEK_FLAG_WEDNESDAY | + DND_SCHEDULE_WEEK_FLAG_THURSDAY | + DND_SCHEDULE_WEEK_FLAG_FRIDAY | + DND_SCHEDULE_WEEK_FLAG_SATURDAY +} dnd_schedule_week_flag_e; + +/** + * @brief Enumeration for lock screen content. + * @since_tizen 3.0 + */ +typedef enum lock_screen_content_level { + SHOW_ALL_CONTENT = 0, /**< Show all*/ + HIDE_SENSITIVE_CONTENT, /**< Hide sensitive */ + DO_NOT_SHOW_NOTIFICATIONS, /**< Do not Showw */ +} lock_screen_content_level_e; + +/** + * @brief Enumeration for do_not_disturb allow exception type. + * @since_tizen 3.0 + */ +typedef enum dnd_allow_exception_type { + NOTIFICATION_DND_ALLOWED_CALLS = 0, /**< Call */ + /* possible to add */ +} dnd_allow_exception_type_e; + +/** + * @brief Enumeration for allowed_calls. + * @since_tizen 3.0 + */ +typedef enum notification_dnd_allowed_calls { + NOTIFICATION_DND_ALLOWED_CALLS_EVERYONE = 0, /**< Everyone */ + NOTIFICATION_DND_ALLOWED_CALLS_CONTACT, /**< Contact */ + NOTIFICATION_DND_ALLOWED_CALLS_FAVORITE, /**< Favorite */ + NOTIFICATION_DND_ALLOWED_CALLS_NOBODY, /**< Nobody */ +} notification_dnd_allowed_calls_e; + +/* Application setting */ +struct notification_setting { + char *package_name; + char *app_id; + bool allow_to_notify; + bool do_not_disturb_except; + bool pop_up_notification; + int visibility_class; + lock_screen_content_level_e lock_screen_content_level; + bool app_disabled; +}; + +/* System setting */ +struct notification_system_setting { + bool do_not_disturb; + int visibility_class; + bool dnd_schedule_enabled; + int dnd_schedule_day; + int dnd_start_hour; + int dnd_start_min; + int dnd_end_hour; + int dnd_end_min; + lock_screen_content_level_e lock_screen_content_level; + GList *dnd_allow_exceptions; +}; + +/* dnd_allow_exception */ +struct notification_system_setting_dnd_allow_exception { + int type; + int value; +}; + +/** + * @internal + * @brief Gets the array of notification setting. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[out] setting_array The array of notification setting + * @param[out] count The count of array + * @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_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No reponse from notification service + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par Sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + int count = 0; + notification_setting_h setting; + + noti_err = notification_setting_get_setting_array(&setting, &count); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + ... + + notification_setting_free_notification(setting); +} + * @endcode + */ + +int notification_setting_get_setting_array(notification_setting_h *setting_array, int *count); +int notification_setting_get_setting_array_for_uid(notification_setting_h *setting_array, int *count, uid_t uid); + +/** + * @internal + * @brief Gets notification setting by package name. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] package_name The package_name + * @param[out] setting The notification setting + * @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_IO_ERROR I/O error I/O error + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No reponse from notification service + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + + noti_err = notification_setting_get_setting_by_package_name(PACKAGE_NAME, &setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_setting_by_package_name(const char *package_name, notification_setting_h *setting); +int notification_setting_get_setting_by_appid_for_uid(const char *app_id, notification_setting_h *setting, uid_t uid); + +/** + * @internal + * @brief Gets package name from notification setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[out] value The package name + * @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_NOT_EXIST_ID Already exist private ID + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + char *package_name = NULL; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_get_package_name(setting, &package_name); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_package_name(notification_setting_h setting, char **value); + +/** + * @internal + * @brief Gets application id from notification setting handle. + * @since_tizen 3.0 + * @param[in] setting The notification setting handle + * @param[out] app_id The application 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_NOT_EXIST_ID Already exist private ID + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + char *app_id = NULL; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_get_appid(setting, &app_id); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_appid(notification_setting_h setting, char **app_id); + +/** + * @internal + * @brief Gets value which whether allow notification from individual applications. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[out] value The value which whether allow to notification + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_get_allow_to_notify(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_allow_to_notify(notification_setting_h setting, bool *value); + +/** + * @internal + * @brief Sets value which whether allow notification from individual applications. + * @details After notification_setting_update_setting() call, the allow_to_notify is updated. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[in] value The value whether allow to notification + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_set_allow_to_notify(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_set_allow_to_notify(notification_setting_h setting, bool value); + +/** + * @internal + * @brief Gets value which whether do not disturb notification from notification setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[out] value The value which whether do not disturb notification or not + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + noti_err = notification_setting_get_do_not_disturb_except(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_do_not_disturb_except(notification_setting_h setting, bool *value); + +/** + * @internal + * @brief Sets value which whether do not disturb notification or not. + * @details After notification_setting_update_setting() call, the do_not_disturb value is updated. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] setting The notification setting handle + * @param[in] value The value which do not disturb notification or not + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_set_do_not_disturb_except(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_set_do_not_disturb_except(notification_setting_h setting, bool value); + +/** + * @internal + * @brief Gets value whether Pop up notification is allowed or not. + * @since_tizen 3.0 + * @param[in] setting The notification setting handle + * @param[in] value The 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_get_pop_up_notification(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_pop_up_notification(notification_setting_h setting, bool *value); + +/** + * @internal + * @brief Sets value which Pop up notification allow or block. + * @details After notification_setting_update_setting() call, the pop_up_notification value is updated. + * @since_tizen 3.0 + * @param[in] setting The notification setting handle + * @param[in] value The 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_get_pop_up_notification(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_set_pop_up_notification(notification_setting_h setting, bool value); + +/** + * @internal + * @brief Gets displaying level that notification's information on lock screen from individual application. + * @since_tizen 3.0 + * @param[in] setting The notification setting handle + * @param[out] level The displaying level of notification's information on lock screen + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #lock_screen_content_level_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + lock_screen_content_level_e level; + + ... + + noti_err = notification_setting_get_lock_screen_content(setting, &level); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_get_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e *level); + +/** + * @internal + * @brief Sets displaying level that notification's information on lock screen from individual application. + * @details After notification_setting_update_setting() call, the lock_screen_content_level value is updated. + * @since_tizen 3.0 + * @param[in] setting The notification setting handle + * @param[out] level The displaying level of notification's information on lock screen + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #lock_screen_content_level_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + lock_screen_content_level_e level; + + ... + + level = SHOW_ALL_CONTENT; // or HIDE_SENSITIVE_CONTENT or DO_NOT_SHOW_NOTIFICATIONS; + + noti_err = notification_setting_get_lock_screen_content(setting, level); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_setting_free_notification(setting); + + return 0; + +} + * @endcode + */ +int notification_setting_set_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e level); + +/** + * @internal + * @brief Gets The value that determines whether the app is disabled. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] setting The notification system setting handle + * @param[out] value The value that determines whether the app is disabled + * @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_setting_internal.h> +{ + int err = 0; + bool value = true; + notification_system_setting_h setting = NULL; + + err = notification_setting_get_setting(&setting); + if (err != NOTIFICATION_ERROR_NONE) + return; + + err = notification_setting_get_app_disabled(setting, &value); + if (err != NOTIFICATION_ERROR_NONE) + return; + + return 0; +} + * @endcode + */ +int notification_setting_get_app_disabled(notification_setting_h setting, bool *value); + +/** + * @internal + * @brief Gets the notification system setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] system_setting The notification system setting 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_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_load_system_setting(&setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_load_system_setting(notification_system_setting_h *system_setting); +int notification_system_setting_load_system_setting_for_uid(notification_system_setting_h *system_setting, uid_t uid); + +/** + * @internal + * @brief Updates the notification system handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] system_setting The notification system setting 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 + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_update_system_setting(setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_update_system_setting(notification_system_setting_h system_setting); +int notification_system_setting_update_system_setting_for_uid(notification_system_setting_h system_setting, uid_t uid); + +/** + * @internal + * @brief Frees the internal structure data of a notification system setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] system_setting The notification system setting 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 + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_free_system_setting(setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + return 0; + +} + * @endcode + */ +int notification_system_setting_free_system_setting(notification_system_setting_h system_setting); + +/** + * @internal + * @brief Gets value which whether do not disturb notification from notification system setting handle. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] system_setting The notification system setting handle + * @param[out] value The value which whether do not disturb notification or not + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_get_do_not_disturb_except(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_get_do_not_disturb(notification_system_setting_h system_setting, bool *value); + +/** + * @internal + * @brief Sets value which whether do not disturb notification or not. + * @details After notification_system_setting_update_system_setting() call, the do_not_disturb value is not updated. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] system_setting The notification system setting handle + * @param[in] value The value which do not disturb notification or not + * @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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_set_do_not_disturb_except(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_set_do_not_disturb(notification_system_setting_h system_setting, bool value); + +/** + * @internal + * @brief Gets value which whether information on the notification view is visible. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] system_setting The notification system setting handle + * @param[out] value The visibility_class 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_get_visibility_class(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_get_visibility_class(notification_system_setting_h system_setting, int *value); + +/** + * @internal + * @brief Sets value which whether information on the notification view is visible. + * @details After notification_system_setting_update_system_setting() call, the visibility_class value is not updated. + * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif + * @param[in] system_setting The notification setting handle + * @param[in] value The visibility_class 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_setting_set_visibility_class(setting, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_set_visibility_class(notification_system_setting_h system_setting, int value); + +/** + * @internal + * @brief Gets value which whether 'Do not disturb' mode is enable or not. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[out] enabled The dnd_schedule_enabled 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_dnd_schedule_get_enabled(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_get_enabled(notification_system_setting_h system_setting, bool *enabled); + +/** + * @internal + * @brief Sets value which whether 'Do not disturb' mode is enable or not. + * @details After notification_system_setting_update_system_setting() call, the 'Do not disturb' mode is not updated. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[in] enabled The dnd_schedule_enabled 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_setting_internal.h> +... +{ + int noti_err = 0; + bool value; + notification_system_setting_h setting = NULL; + + ... + + value = true; // or false + + noti_err = notification_system_setting_dnd_schedule_set_enabled(setting, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_set_enabled(notification_system_setting_h system_setting, bool enabled); + +/** + * @internal + * @brief Gets days of the week that 'Do not disturb' mode is enable. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[out] day The days of the week that enable 'Do not disturb' mode + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #dnd_schedule_week_flag_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + int day; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_dnd_schedule_get_day(setting, &day); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_get_day(notification_system_setting_h system_setting, int *day); + +/** + * @internal + * @brief Sets days of the week that 'Do not disturb' mode is enable. + * @details After notification_system_setting_update_system_setting() call, the days not updated. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[in] day The days of the week that enable 'Do not disturb' mode + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #dnd_schedule_week_flag_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + int day; + notification_system_setting_h setting = NULL; + + ... + + day = DND_SCHEDULE_WEEK_FLAG_SUNDAY; + + noti_err = notification_system_setting_dnd_schedule_set_day(setting, day); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_set_day(notification_system_setting_h system_setting, int day); + +/** + * @internal + * @brief Gets time that 'Do not disturb' mode is started. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[out] hour The hour that 'Do not disturb' mode is started + * @param[out] min The min that 'Do not disturb' mode is started + * @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_setting_internal.h> +... +{ + int noti_err = 0; + int hour; + int min; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_dnd_schedule_get_start_time(setting, &hour, &min); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_get_start_time(notification_system_setting_h system_setting, int *hour, int *min); + +/** + * @internal + * @brief Sets time that 'Do not disturb' mode is started. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[in] hour The hour that 'Do not disturb' mode is startd + * @param[in] min The min that 'Do not disturb' mode is started + * @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_setting_internal.h> +... +{ + int noti_err = 0; + int hour; + int min; + notification_setting_h setting = NULL; + + ... + + hour = START_HOUR; // 0 ~ 23 + min = START_MIN // 0 ~ 59 + + noti_err = notification_system_setting_dnd_schedule_set_start_time(setting, hour, min); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_set_start_time(notification_system_setting_h system_setting, int hour, int min); + +/** + * @internal + * @brief Gets time that 'Do not disturb' mode is ended. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[out] hour The hour that 'Do not disturb' mode is ended + * @param[out] min The min that 'Do not disturb' mode is ended + * @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_setting_internal.h> +... +{ + int noti_err = 0; + int hour; + int min; + notification_system_setting_h setting = NULL; + + ... + + noti_err = notification_system_setting_dnd_schedule_get_end_time(setting, &hour, &min); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_get_end_time(notification_system_setting_h system_setting, int *hour, int *min); + +/** + * @internal + * @brief Sets time that 'Do not disturb' mode is ended. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[in] hour The hour that 'Do not disturb' mode is ended + * @param[in] min The min that 'Do not disturb' mode is ended + * @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_setting_internal.h> +... +{ + int noti_err = 0; + int hour; + int min; + notification_system_setting_h setting = NULL; + + ... + + hour = START_HOUR; // 0 ~ 23 + min = START_MIN // 0 ~ 59 + + noti_err = notification_system_setting_dnd_schedule_set_end_time(setting, hour, min); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_dnd_schedule_set_end_time(notification_system_setting_h system_setting, int hour, int min); + +/** + * @internal + * @brief Gets displaying level that notification's information on lock screen. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[out] level The displaying level of notification's information on lock screen + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #lock_screen_content_level_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_setting_h setting = NULL; + lock_screen_content_level_e level; + + ... + + noti_err = notification_system_setting_get_lock_screen_content(setting, &level); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_get_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e *level); + +/* + * @internal + * @brief Sets displaying level that notification's information on lock screen. + * @since_tizen 3.0 + * @param[in] system_setting The notification system setting handle + * @param[in] level The displaying level of notification's information on lock screen + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #lock_screen_content_level_e + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + notification_system_setting_h setting = NULL; + lock_screen_content_level_e level; + + ... + + level = SHOW_ALL_CONTENT; // or HIDE_SENSITIVE_CONTENT or DO_NOT_SHOW_NOTIFICATIONS; + + noti_err = notification_system_setting_set_lock_screen_content(setting, &level); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * + */ +int notification_system_setting_set_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e level); + +/** + * @internal + * @brief Gets a value of the do_not_disturb allow exceptions. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] system_setting The notification system setting handle + * @param[in] type The exceptional item of do_not_distrub + * @param[out] value The value of the exceptional item + * @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_setting_internal.h> +... +{ + int noti_err = 0; + int value; + notification_system_setting_h setting = NULL; + ... + noti_err = notification_system_setting_load_system_setting(&setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_system_setting_get_dnd_allow_exceptions(setting, ALLOWED_CALLS, &value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + ... + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_get_dnd_allow_exceptions(notification_system_setting_h system_setting, dnd_allow_exception_type_e type, int *value); + +/** + * @internal + * @brief Sets a value of the do_not_disturb allow exceptions. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] system_setting The notification system setting handle + * @param[in] type The exceptional item of do_not_distrub + * @param[in] value The value of the exceptional item + * @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_OUT_OF_MEMORY out of memory + * @par sample code: + * @code +#include <notification_setting_internal.h> +... +{ + int noti_err = 0; + int value = 0; + notification_system_setting_h setting = NULL; + ... + noti_err = notification_system_setting_load_system_setting(&setting); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + noti_err = notification_system_setting_set_dnd_allow_exceptions(setting, ALLOWED_CALLS, value); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + ... + notification_system_setting_free_system_setting(setting); + + return 0; + +} + * @endcode + */ +int notification_system_setting_set_dnd_allow_exceptions(notification_system_setting_h system_setting, dnd_allow_exception_type_e type, int value); + +/** + * @internal + * @brief Registers a callback for turn on/off 'Do not disturb' mode by user_data + * or 'Do not disturb' mode setting schedule is start or end. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] callback 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_IO_ERROR I/O Error + * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory + * @par sample code: + * @code +#include <notification_setting_internal.h> +... + +static void changed_cb(void *user_data, int do_not_disturb) +{ + ... +} + +... +{ + int noti_err = 0; + + ... + + noti_err = notification_register_system_setting_dnd_changed_cb(changed_cb, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + return 0; + +} + * @endcode + */ +int notification_register_system_setting_dnd_changed_cb(dnd_changed_cb callback, void *user_data); +int notification_register_system_setting_dnd_changed_cb_for_uid(dnd_changed_cb callback, void *user_data, uid_t uid); + +/** + * @internal + * @brief Unregisters a callback for turn on/off 'Do not disturb' mode by user_data + * or 'Do not disturb' mode setting schedule is start or end. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] callback 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 + * @par sample code: + * @code +#include <notification_setting_internal.h> +... + +static void changed_cb(void *user_data, int do_not_disturb) +{ + ... +} + +... +{ + int noti_err = 0; + + ... + + noti_err = notification_unregister_system_setting_dnd_changed_cb(changed_cb); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } + + return 0; +} + * @endcode + */ +int notification_unregister_system_setting_dnd_changed_cb(dnd_changed_cb callback); +int notification_unregister_system_setting_dnd_changed_cb_for_uid(dnd_changed_cb callback, uid_t uid); + +/** + * @internal + * @brief Updates the notification setting if the pacakge is installed or updated. + * @since_tizen 3.0 + * @param[in] package_name + * @param[in] uid User 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_FROM_DB Error from DB query + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int ret; + + ret = notification_setting_insert_package_for_uid(pkg_name, uid); + if (ret = NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_setting_insert_package_for_uid(const char *package_name, uid_t uid); + +/** + * @internal + * @brief Deletes the notification setting if the pacakge is uninstalled. + * @since_tizen 3.0 + * @param[in] package_name + * @param[in] uid User 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_FROM_DB Error from DB query + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int ret; + + ret = notification_setting_delete_package_for_uid(pkg_name, uid); + if (ret = NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_setting_delete_package_for_uid(const char *package_name, uid_t uid); + +/** + * @internal + * @brief Updates the notification setting. + * @since_tizen 3.0 + * @param[in] setting Notification setting handle + * @param[in] uid User 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_OUT_OF_MEMORY Out of memory + * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error + * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service + * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied + * @par sample code: + * @code +#include <notification_setting.h> +... +{ + int ret; + notification_setting_h setting; + + // Get setting data + + // Update setting data + + ret = notification_setting_update_setting_for_uid(setting, uid); + if (ret = NOTIFICATION_ERROR_NONE) + return; +} + * @endcode + */ +int notification_setting_update_setting_for_uid(notification_setting_h setting, uid_t uid); + +/* OLD IMPLEMENTATION */ +int notification_setting_property_set(const char *pkgname, const char *property, const char *value) NOTIFICATION_DEPRECATED_API; +int notification_setting_property_get(const char *pkgname, const char *property, char **value) NOTIFICATION_DEPRECATED_API; + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_SETTING_INTERNAL_H__ */ + diff --git a/notification/include/notification_setting_service.h b/notification/include/notification_setting_service.h new file mode 100644 index 0000000..f5a1947 --- /dev/null +++ b/notification/include/notification_setting_service.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_SETTING_SERVICE_H__ +#define __NOTIFICATION_SETTING_SERVICE_H__ + +#include <sys/types.h> +#include <notification.h> + +#ifdef __cplusplus +extern "C" { +#endif + +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); + +int notification_setting_db_update(const char *package_name, const char *app_id, int allow_to_notify, int do_not_disturb_except, int visibility_class, + int pop_up_notification, int lock_screen_content_level, uid_t uid); +int notification_setting_db_update_system_setting(int do_not_disturb, int visibility_class, + int dnd_schedule_enabled, int dnd_schedule_day, + int dnd_start_hour, int dnd_start_min, + int dnd_end_hour, int dnd_end_min, + int lock_screen_content_level, uid_t uid); +int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid); + +int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_setting_h *setting, uid_t uid); +int noti_setting_get_setting_array(notification_setting_h *setting_array, int *count, uid_t uid); +int noti_system_setting_load_system_setting(notification_system_setting_h *system_setting, uid_t uid); +int noti_system_setting_get_do_not_disturb(int *do_not_disturb, uid_t uid); +int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *count); +int notification_get_dnd_and_allow_to_notify(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid); +int notification_system_setting_load_dnd_allow_exception(dnd_allow_exception_h *dnd_allow_exception, int *count, uid_t uid); +int notification_system_setting_update_dnd_allow_exception(int type, int value, uid_t uid); +int notification_setting_db_update_app_disabled(const char *app_id, bool value, uid_t uid); +int notification_setting_db_update_pkg_disabled(const char *pkg_id, bool value, uid_t uid); + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_SETTING_SERVICE_H__ */ + diff --git a/notification/include/notification_shared_file.h b/notification/include/notification_shared_file.h new file mode 100644 index 0000000..97c7511 --- /dev/null +++ b/notification/include/notification_shared_file.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_SHARED_FILE_H__ +#define __NOTIFICATION_SHARED_FILE_H__ + +#include "notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int notification_copy_private_file(const char* src_path, const char* dst_path); +char *notification_check_file_path_is_private(const char *pkg_id, const char *file_path); +int notification_set_private_sharing(notification_h noti, uid_t uid); +void notification_remove_private_sharing(const char *src_app_id, int priv_id, uid_t uid); +void notification_add_private_sharing_target_id(pid_t pid, const char *sender, uid_t uid); +void notification_remove_private_sharing_target_id(const char *sender, uid_t uid); +void notification_calibrate_private_sharing(notification_h updated_noti, notification_h source_noti); +bool notification_validate_private_sharing(notification_h updated_noti); + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_SHARED_FILE_H__ */ diff --git a/notification/include/notification_status.h b/notification/include/notification_status.h new file mode 100644 index 0000000..b8ff7d1 --- /dev/null +++ b/notification/include/notification_status.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_STATUS_DEF_H__ +#define __NOTIFICATION_STATUS_DEF_H__ + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + * @file notification_status.h + */ + + +/** + * @addtogroup NOTIFICATION_STATUS + * @{ + */ + + +/** + * @brief Shows a toast popup window with given message. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + * @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 + * @see #notification_error_e + */ +int notification_status_message_post(const char *message); + + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __NOTIFICATION_STATUS_DEF_H__ */ + diff --git a/notification/include/notification_status_internal.h b/notification/include/notification_status_internal.h new file mode 100644 index 0000000..a70fa2e --- /dev/null +++ b/notification/include/notification_status_internal.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_STATUS_INTERNAL_DEF_H__ +#define __NOTIFICATION_STATUS_INTERNAL_DEF_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @file notification_status_internal.h + */ + +/** + * @addtogroup NOTIFICATION_STATUS + * @{ + */ + +/** + * @internal + * @brief Unregisters a callback for all notification events. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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_register_detailed_changed_cb(app_changed_cb, user_data); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +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); + +/** + * @internal + * @brief Called when a new message is posted. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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() +*/ +typedef void (*notification_status_message_cb)(const char *message, void *data); + +/** + * @internal + * @brief Registers a callback to receive a message. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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); + +/** + * @internal + * @brief Unregisters a callback to receive a message. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __NOTIFICATION_STATUS_INTERNAL_DEF_H__ */ + diff --git a/notification/include/notification_text_domain.h b/notification/include/notification_text_domain.h new file mode 100644 index 0000000..f8c36d8 --- /dev/null +++ b/notification/include/notification_text_domain.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_TEXT_DOMAIN_H__ +#define __NOTIFICATION_TEXT_DOMAIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Sets the text domain to localize the notification. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_set_text_domain(notification_h noti, + const char *domain, + const char *dir); + +/** + * @brief Gets the text domain from the notification handle. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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; + int noti_err = NOTIFICATION_ERROR_NONE; + char *domain = NULL; + char *dir = NULL; + + noti_err = notification_get_text_domain(noti, &domain, &dir); + if (noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_text_domain(notification_h noti, + char **domain, + char **dir); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __NOTIFICATION_TEXT_DOMAIN_H__ */ + diff --git a/notification/include/notification_type.h b/notification/include/notification_type.h new file mode 100644 index 0000000..bb0d580 --- /dev/null +++ b/notification/include/notification_type.h @@ -0,0 +1,403 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_TYPE_H__ +#define __NOTIFICATION_TYPE_H__ + + +#ifdef __cplusplus +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 type definitions and enumerations for Notification API. + */ + + +/** + * @addtogroup NOTIFICATION_MODULE + * @{ + */ +#define NOTIFICATION_DO_NOT_SHOW_TIME_STAMP -1 /**< Do not show time stamp on the notification. Could be passed as a argument of notification_set_time() */ + + +/** + * @brief Enumeration for notification layout type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_ly_type { + NOTIFICATION_LY_NONE = 0, /**< Default */ + NOTIFICATION_LY_NOTI_EVENT_SINGLE, /**< Layout for notification. Used to inform single event */ + NOTIFICATION_LY_NOTI_EVENT_MULTIPLE, /**< Layout for notification. Used to inform multiple event */ + NOTIFICATION_LY_NOTI_THUMBNAIL, /**< Layout for notification. Used to display images */ + NOTIFICATION_LY_ONGOING_EVENT, /**< Layout for ongoing notification. Used to display text message. + * notifications with NOTIFICATION_LY_ONGOING_EVENT can not be protected from + * removing by user since tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ + NOTIFICATION_LY_ONGOING_PROGRESS, /**< Layout for ongoing notification. Used to display progress */ + NOTIFICATION_LY_EXTENSION, /**< Layout for extended notification (Since 4.0) */ +} notification_ly_type_e; + + +/** + * @brief Enumeration for notification launch option type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_launch_option_type { + NOTIFICATION_LAUNCH_OPTION_APP_CONTROL = 1, /**< Launching with app control */ +} notification_launch_option_type; + + +/** + * @brief Enumeration for event type on notification. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + */ +typedef enum _notification_event_type { + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 = 0, /**< Event type : Click on button 1 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2 = 1, /**< Event type : Click on button 2 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3 = 2, /**< Event type : Click on button 3 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_4 = 3, /**< Event type : Click on button 4 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_5 = 4, /**< Event type : Click on button 5 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_6 = 5, /**< Event type : Click on button 6 */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_ICON = 6, /**< Event type : Click on icon */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_THUMBNAIL = 7, /**< Event type : Click on thumbnail */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON = 8, /**< Event type : Click on text_input button(Since 3.0) */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_7, /**< Event type : Click on button 7 (Since 5.0) */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_8, /**< Event type : Click on button 8 (Since 5.0) */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_9, /**< Event type : Click on button 9 (Since 5.0) */ + NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_10, /**< Event type : Click on button 10 (Since 5.0) */ +} notification_event_type_e; + + +/** + * @brief Enumeration for notification sound type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_sound_type { + NOTIFICATION_SOUND_TYPE_NONE = -1, /**< Default value. no sound */ + NOTIFICATION_SOUND_TYPE_DEFAULT = 0, /**< Default sound */ + NOTIFICATION_SOUND_TYPE_USER_DATA, /**< User sound data */ +} notification_sound_type_e; + + +/** + * @brief Enumeration for notification vibration type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_vibration_type { + NOTIFICATION_VIBRATION_TYPE_NONE = -1, /**< Default value. No vibration */ + NOTIFICATION_VIBRATION_TYPE_DEFAULT = 0, /**< Default vibrate pattern */ + NOTIFICATION_VIBRATION_TYPE_USER_DATA, /**< User vibration data */ +} notification_vibration_type_e; + + +/** + * @brief Enumeration for notification LED operation. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +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_CUSTOM_COLOR, /**< Turn on the LED with custom color */ +} notification_led_op_e; + + +/** + * @deprecated Deprecated since 2.3.1 + * @brief Enumeration for setting display type of count. + * @since_tizen 2.3 + */ +typedef enum _notification_count_display_type { + 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_e; + + +/** + * @brief Enumeration for button. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + */ +typedef enum _notification_button_index { + NOTIFICATION_BUTTON_1 = 1, /**< button 1 */ + NOTIFICATION_BUTTON_2 = 2, /**< button 2 */ + NOTIFICATION_BUTTON_3 = 3, /**< button 3 */ + NOTIFICATION_BUTTON_4 = 4, /**< button 4 */ + NOTIFICATION_BUTTON_5 = 5, /**< button 5 */ + NOTIFICATION_BUTTON_6 = 6, /**< button 6 */ + NOTIFICATION_BUTTON_7 = 10, /**< button 7 (Since 5.0) */ + NOTIFICATION_BUTTON_8 = 11, /**< button 8 (Since 5.0) */ + NOTIFICATION_BUTTON_9 = 12, /**< button 9 (Since 5.0) */ + NOTIFICATION_BUTTON_10 = 13, /**< button 10 (Since 5.0) */ +} notification_button_index_e; + + +/** + * @brief Enumeration for notification text type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_text_type { + NOTIFICATION_TEXT_TYPE_NONE = -1, /**< None */ + NOTIFICATION_TEXT_TYPE_TITLE = 0, /**< Title */ + NOTIFICATION_TEXT_TYPE_CONTENT, /**< Content */ + 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 */ + NOTIFICATION_TEXT_TYPE_INFO_1, /**< Box contents 1 */ + NOTIFICATION_TEXT_TYPE_INFO_SUB_1, /**< Box contents 1-1 */ + NOTIFICATION_TEXT_TYPE_INFO_2, /**< Box contents 2 */ + NOTIFICATION_TEXT_TYPE_INFO_SUB_2, /**< Box contents 2-1 */ + NOTIFICATION_TEXT_TYPE_INFO_3, /**< Box contents 3 */ + NOTIFICATION_TEXT_TYPE_INFO_SUB_3, /**< Box contents 3-1 */ + NOTIFICATION_TEXT_TYPE_GROUP_TITLE, /**< Group title */ + NOTIFICATION_TEXT_TYPE_GROUP_CONTENT, /**< Group content */ + NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, /**< Group content for content display option is off of the Settings */ + NOTIFICATION_TEXT_TYPE_BUTTON_1, /**< Text on button 1 */ + NOTIFICATION_TEXT_TYPE_BUTTON_2, /**< Text on button 2 */ + NOTIFICATION_TEXT_TYPE_BUTTON_3, /**< Text on button 3 */ + NOTIFICATION_TEXT_TYPE_BUTTON_4, /**< Text on button 4 */ + NOTIFICATION_TEXT_TYPE_BUTTON_5, /**< Text on button 5 */ + NOTIFICATION_TEXT_TYPE_BUTTON_6, /**< Text on button 6 */ + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER, /**< Guide text on the message reply box(Since 3.0) */ + NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON, /**< Text on button the on message reply box(Since 3.0) */ + NOTIFICATION_TEXT_TYPE_CONTENT_EXTENSION, /**< Content for extended notification (Since 4.0) */ + NOTIFICATION_TEXT_TYPE_BUTTON_7, /**< Text on button 7 (Since 5.0) */ + NOTIFICATION_TEXT_TYPE_BUTTON_8, /**< Text on button 8 (Since 5.0) */ + NOTIFICATION_TEXT_TYPE_BUTTON_9, /**< Text on button 9 (Since 5.0) */ + NOTIFICATION_TEXT_TYPE_BUTTON_10, /**< Text on button 10 (Since 5.0) */ +} notification_text_type_e; + + +/** + * @brief Enumeration for image type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_image_type { + NOTIFICATION_IMAGE_TYPE_NONE = -1, /**< None */ + NOTIFICATION_IMAGE_TYPE_ICON = 0, /**< Icon */ + NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, /**< Indicator icon */ + NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, /**< Lock screen icon */ + NOTIFICATION_IMAGE_TYPE_THUMBNAIL, /**< Thumbnail */ + NOTIFICATION_IMAGE_TYPE_THUMBNAIL_FOR_LOCK, /**< Lock screen thumbnail */ + NOTIFICATION_IMAGE_TYPE_ICON_SUB, /**< Icon */ + NOTIFICATION_IMAGE_TYPE_BACKGROUND, /**< image displayed on background */ + NOTIFICATION_IMAGE_TYPE_LIST_1, /**< Image for thumbnail list */ + NOTIFICATION_IMAGE_TYPE_LIST_2, /**< Image for thumbnail list */ + NOTIFICATION_IMAGE_TYPE_LIST_3, /**< Image for thumbnail list */ + NOTIFICATION_IMAGE_TYPE_LIST_4, /**< Image for thumbnail list */ + NOTIFICATION_IMAGE_TYPE_LIST_5, /**< Image for thumbnail list */ + NOTIFICATION_IMAGE_TYPE_BUTTON_1, /**< Image for button 1 */ + NOTIFICATION_IMAGE_TYPE_BUTTON_2, /**< Image for button 2 */ + NOTIFICATION_IMAGE_TYPE_BUTTON_3, /**< Image for button 3 */ + NOTIFICATION_IMAGE_TYPE_BUTTON_4, /**< Image for button 4 */ + NOTIFICATION_IMAGE_TYPE_BUTTON_5, /**< Image for button 5 */ + NOTIFICATION_IMAGE_TYPE_BUTTON_6, /**< Image for button 6 */ + NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON, /**< Image for message reply(Since 3.0) */ + NOTIFICATION_IMAGE_TYPE_EXTENSION, /**< Image for extended notification (Since 4.0) */ + NOTIFICATION_IMAGE_TYPE_BUTTON_7, /**< Image for button 7 (Since 5.0) */ + NOTIFICATION_IMAGE_TYPE_BUTTON_8, /**< Image for button 8 (Since 5.0) */ + NOTIFICATION_IMAGE_TYPE_BUTTON_9, /**< Image for button 9 (Since 5.0) */ + NOTIFICATION_IMAGE_TYPE_BUTTON_10, /**< Image for button 10 (Since 5.0) */ +} notification_image_type_e; + + +/** + * @brief Enumeration for application execution type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_execute_type { + NOTIFICATION_EXECUTE_TYPE_NONE = -1, /**< No operation */ + NOTIFICATION_EXECUTE_TYPE_RESPONDING = 0, /**< Responding action*/ + NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, /**< Launching when notification data is single */ + NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, /**< Launching when notification data is grouping(multi) */ +} notification_execute_type_e; + + +/** + * @brief Enumeration for notification type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_type { + NOTIFICATION_TYPE_NONE = -1, /**< None */ + NOTIFICATION_TYPE_NOTI = 0, /**< Notification type */ + NOTIFICATION_TYPE_ONGOING, /**< Ongoing type */ +} notification_type_e; + + +/** + * @brief Enumeration for Group ID. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +enum _notification_group_id { + NOTIFICATION_GROUP_ID_NONE = -1, /**< Not Grouping */ + NOTIFICATION_GROUP_ID_DEFAULT = 0, /**< Notification that has same title is grouping */ +}; + + +/** + * @brief Enumeration for Private ID. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +enum _notification_priv_id { + NOTIFICATION_PRIV_ID_NONE = -1, /**< Internally set priv_id */ +}; + + +/** + * @brief Enumeration for notification property. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +enum _notification_property { + NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE = 0x00000001, /**< Display only SIM card inserted */ + NOTIFICATION_PROP_DISABLE_APP_LAUNCH = 0x00000002, /**< Disable application launch when it selected */ + NOTIFICATION_PROP_DISABLE_AUTO_DELETE = 0x00000004, /**< Disable auto delete when it selected */ + NOTIFICATION_PROP_LAUNCH_UG = 0x00000008, /**< Notification Tray should launch application using appsvc API (Deprecated since 2.3.1) */ + NOTIFICATION_PROP_DISABLE_TICKERNOTI = 0x00000010, /**< Use notification_set_display_applist API (Deprecated since 2.3.1) */ + NOTIFICATION_PROP_PERMANENT_DISPLAY = 0x00000020, /**< The notification will not be removed (Deprecated since 2.3.1) */ + NOTIFICATION_PROP_DISABLE_UPDATE_ON_INSERT = 0x00000040, /**< Disable update when it inserted. */ + NOTIFICATION_PROP_DISABLE_UPDATE_ON_DELETE = 0x00000080, /**< Disable update when it deleted. */ + NOTIFICATION_PROP_VOLATILE_DISPLAY = 0x00000100, /**< Deleted when device is rebooted eventhough NOTIFICATION_TYPE_NOTI type */ +}; + + +/** + * @brief Enumeration for display application list. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +enum _notification_display_applist { + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY = 0x00000001, /**< Notification Tray(Quickpanel) */ + NOTIFICATION_DISPLAY_APP_TICKER = 0x00000002, /**< Ticker notification */ + NOTIFICATION_DISPLAY_APP_LOCK = 0x00000004, /**< Lock screen */ + NOTIFICATION_DISPLAY_APP_INDICATOR = 0x00000008, /**< Indicator */ + NOTIFICATION_DISPLAY_APP_ACTIVE = 0x00000010, /**< Active notification */ + NOTIFICATION_DISPLAY_APP_ALL = 0x0000000f, /**< All display application except active notification*/ +}; + + +/** + * @brief Enumeration for notification operation code. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_op_type { + 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 Since 2.3.1) */ + NOTIFICATION_OP_SERVICE_READY, /**< Notification service is ready */ +} notification_op_type_e; + + +/** + * @brief Enumeration for notification operation data code. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_op_data_type { + 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_type_e; + + +/** + * @brief Enumeration for notification count position in the text. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notifcation_count_pos_type { + NOTIFICATION_COUNT_POS_NONE = -1, /**< Count data is not displaying in the text */ + NOTIFICATION_COUNT_POS_LEFT = 0, /**< Count data is displaying at the left of the text */ + NOTIFICATION_COUNT_POS_IN, /**< Count data is displaying in the text */ + NOTIFICATION_COUNT_POS_RIGHT, /**< Count data is displaying at the right of the text */ +} notification_count_pos_type_e; + + +/** + * @brief Enumeration for notification variable parameter type. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef enum _notification_variable_type { + NOTIFICATION_VARIABLE_TYPE_NONE = -1, /**< Variable parameter type is NONE */ + NOTIFICATION_VARIABLE_TYPE_INT = 0, /**< Variable parameter type is int */ + NOTIFICATION_VARIABLE_TYPE_DOUBLE, /**< Variable parameter type is double */ + NOTIFICATION_VARIABLE_TYPE_STRING, /**< Variable parameter type is string */ + NOTIFICATION_VARIABLE_TYPE_COUNT, /**< Variable parameter type is count */ +} notification_variable_type_e; + + +/** + * @brief Notification handle. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef struct _notification *notification_h; + + +/** + * @brief The structure for notification operation. + * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif + */ +typedef struct _notification_op { + 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; + + +/** + * @brief Enumeration for permission. + * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + */ +typedef enum notification_permission_type { + NOTIFICATION_PERMISSION_TYPE_NONE = 0, /**< None */ + NOTIFICATION_PERMISSION_TYPE_DELETE = 1, /**< Delete */ + NOTIFICATION_PERMISSION_TYPE_UPDATE = 2, /**< Update */ +} notification_permission_type_e; + +/** + * @brief Enumeration for notification block state. + * @since_tizen 3.0 + */ +typedef enum notification_block_state { + NOTIFICATION_BLOCK_STATE_ALLOWED = 0, /**< The app is allowed to post notifications */ + NOTIFICATION_BLOCK_STATE_BLOCKED, /**< The app is not allowed to post any notifications */ + NOTIFICATION_BLOCK_STATE_DO_NOT_DISTURB /**< User set do not disturb mode */ +} notification_block_state_e; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_TYPE_H__ */ + diff --git a/notification/include/notification_type_internal.h b/notification/include/notification_type_internal.h new file mode 100644 index 0000000..cd93858 --- /dev/null +++ b/notification/include/notification_type_internal.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_TYPE_INTERNAL_H__ +#define __NOTIFICATION_TYPE_INTERNAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup NOTIFICATION_INTERNAL + * @{ + */ + +#define NOTIFICATION_GLOBAL_UID -1 +#define NOTIFICATION_DISPLAY_APP_HEADS_UP NOTIFICATION_DISPLAY_APP_ACTIVE /* To avoid build error */ + +#define NOTIFICATION_LY_MAX NOTIFICATION_LY_EXTENSION +#define NOTIFICATION_EVENT_TYPE_MAX NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_10 +#define NOTIFICATION_SOUND_TYPE_MAX NOTIFICATION_SOUND_TYPE_USER_DATA +#define NOTIFICATION_VIBRATION_TYPE_MAX NOTIFICATION_VIBRATION_TYPE_USER_DATA +#define NOTIFICATION_LED_OP_MAX NOTIFICATION_LED_OP_ON_CUSTOM_COLOR +#define NOTIFICATION_COUNT_DISPLAY_TYPE_MAX NOTIFICATION_COUNT_DISPLAY_TYPE_RIGHT +#define NOTIFICATION_TEXT_TYPE_MAX NOTIFICATION_TEXT_TYPE_BUTTON_10 +#define NOTIFICATION_IMAGE_TYPE_MAX NOTIFICATION_IMAGE_TYPE_BUTTON_10 +#define NOTIFICATION_EXECUTE_TYPE_MAX NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH +#define NOTIFICATION_TYPE_MAX NOTIFICATION_TYPE_ONGOING +#define NOTIFICATION_OP_DATA_MAX NOTIFICATION_OP_DATA_EXTRA_INFO_2 +#define NOTIFICATION_COUNT_POS_MAX NOTIFICATION_COUNT_POS_RIGHT +#define NOTIFICATION_VARIABLE_TYPE_MAX NOTIFICATION_VARIABLE_TYPE_COUNT + +/** + * @brief Enumeration for notification resource path type. + * @since_tizen 3.0 + */ +typedef enum _notification_res_path_type { + NOTIFICATION_RES_PATH_TYPE_SOUND = NOTIFICATION_IMAGE_TYPE_MAX + 1, /**< Sound */ + NOTIFICATION_RES_PATH_TYPE_VIBRATION, /**< Vibration */ +} notification_res_path_type_e; + +/** + * @brief Enumeration for notification ongoing value type. + * @since_tizen 3.0 + */ +typedef enum _notification_ongoing_value_type { + NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT = 0, /**< Percent */ + NOTIFICATION_ONGOING_VALUE_TYPE_TIME, /**< Time */ +} notification_ongoing_value_type_e; + +/** + * @brief Enumeration for extension event type on notification. + * @since_tizen 3.0 + * @see #notification_event_type_e + */ +typedef enum _notification_event_type_extension { + NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER = 100, /**< Hidden by user */ + NOTIFICATION_EVENT_TYPE_HIDDEN_BY_TIMEOUT = 101, /**< Hidden by timeout */ + NOTIFICATION_EVENT_TYPE_HIDDEN_BY_EXTERNAL = 102, /**< Hidden by external */ + NOTIFICATION_EVENT_TYPE_PRESSED = 200, /**< Pressed by user */ + NOTIFICATION_EVENT_TYPE_DELETED = 201, /**< Deleted by user */ +} notification_event_type_extension_e; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* __NOTIFICATION_TYPE_INTERNAL_H__ */ diff --git a/notification/include/notification_viewer.h b/notification/include/notification_viewer.h new file mode 100644 index 0000000..f4b9609 --- /dev/null +++ b/notification/include/notification_viewer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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_VIEWER_H__ +#define __NOTIFICATION_VIEWER_H__ + +int notification_get_default_viewer(const char *path, char **default_viewer); +int notification_launch_default_viewer(const char *default_viewer, int priv_id, + notification_op_type_e status, uid_t uid); + +#endif /* __NOTIFICATION_VIEWER_H__ */ |