Add new api for direct reply
[platform/core/api/notification.git] / include / notification_internal.h
1 /*
2  * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __NOTIFICATION_INTERNAL_H__
18 #define __NOTIFICATION_INTERNAL_H__
19 #include <glib.h>
20 #include <sys/types.h>
21
22 #include <notification_error.h>
23 #include <notification_type.h>
24 #include <notification_list.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @addtogroup NOTIFICATION_INTERNAL
32  * @{
33  */
34 #define NOTIFICATION_GLOBAL_UID -1
35 #define NOTIFICATION_DISPLAY_APP_HEADS_UP NOTIFICATION_DISPLAY_APP_ACTIVE /* To avoid build error */
36 #define NOTIFICATION_ERROR (notification_error_quark())
37
38 /**
39  * @brief Enumeration for notification ongoing value type.
40  * @since_tizen 3.0
41  */
42 typedef enum _notification_ongoing_value_type {
43         NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT = 0,
44         NOTIFICATION_ONGOING_VALUE_TYPE_TIME,
45 } notification_ongoing_value_type_e;
46
47 /**
48  * @brief Enumeration for extension event type on notification.
49  * @since_tizen 3.0
50  * @see #notification_event_type_e
51  */
52 typedef enum _notification_event_type_extension {
53         NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER = 100,
54         NOTIFICATION_EVENT_TYPE_HIDDEN_BY_TIMEOUT = 101,
55 } notification_event_type_extension_e;
56
57 GQuark notification_error_quark(void);
58
59 /**
60  * @brief This function add deferred task. the registered task will be executed when notification service become ready
61  * @param[in] deferred_task_cb The callback function
62  * @param[in] user_data The user data to be passed to the callback function
63  * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
64  * @see #notification_error_e
65  * @see notification_is_service_ready()
66  */
67 int notification_add_deferred_task(
68                 void (*deferred_task_cb)(void *data), void *user_data);
69
70 /**
71  * @brief This function remove deferred task.
72  * @param[in] deferred_task_cb The callback function
73  * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
74  * @see #notification_error_e
75  * @see notification_is_service_ready()
76  */
77 int notification_del_deferred_task(
78                 void (*deferred_task_cb)(void *data));
79
80
81 /**
82  * @brief This function will be removed.
83  * @see notification_unresister_changed_cb()
84  */
85 int
86 notification_resister_changed_cb(
87         void (*changed_cb)(void *data, notification_type_e type),
88         void *user_data);
89
90 int
91 notification_resister_changed_cb_for_uid(
92         void (*changed_cb)(void *data, notification_type_e type),
93         void *user_data, uid_t uid);
94 /**
95  * @brief This function will be removed.
96  * @see notification_resister_changed_cb()
97  */
98 int
99 notification_unresister_changed_cb(
100         void (*changed_cb)(void *data, notification_type_e type));
101 int
102 notification_unresister_changed_cb_for_uid(
103         void (*changed_cb)(void *data, notification_type_e type), uid_t uid);
104
105 /**
106  * @brief Updates the progress of the inserted notification. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
107  * @details The Notification view on the notification area could be updated.
108  * @param[in] noti Notification handle or NULL if priv_id is valid
109  * @param[in] priv_id Private ID
110  * @param[in] progress Percentage value of progressive data
111  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
112  * @retval NOTIFICATION_ERROR_NONE Success
113  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
114  * @par Sample code:
115  * @code
116 #include <notification.h>
117 ...
118  {
119         int noti_err = NOTIFICATION_ERROR_NONE;
120
121         noti_err  = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
122         if (noti_err != NOTIFICATION_ERROR_NONE) {
123                 return;
124         }
125 }
126  * @endcode
127  */
128 int notification_update_progress(notification_h noti,
129                                                   int priv_id,
130                                                   double progress);
131
132 /**
133  * @brief Updates the size of inserted notification data. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
134  * @details Notification view on notification area could be updated.
135  * @param[in] noti Notification handle or NULL if priv_id is valid
136  * @param[in] priv_id Private ID
137  * @param[in] size Bytes of progressive data
138  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
139  * @retval NOTIFICATION_ERROR_NONE Success
140  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
141  * @par Sample code:
142  * @code
143 #include <notification.h>
144 ...
145  {
146         int noti_err = NOTIFICATION_ERROR_NONE;
147
148         noti_err  = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
149         if (noti_err != NOTIFICATION_ERROR_NONE) {
150                 return;
151         }
152 }
153  * @endcode
154  */
155 int notification_update_size(notification_h noti,
156                                               int priv_id, double size);
157
158 /**
159  * @brief Updates the content of the inserted notification data. This is only for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
160  * @details Notification view on notification area could be updated.
161  * @param[in] noti Notification handle or NULL if priv_id is valid
162  * @param[in] priv_id Private ID
163  * @param[in] content Text to update
164  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
165  * @retval NOTIFICATION_ERROR_NONE Success
166  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
167  * @par Sample code:
168  * @code
169 #include <notification.h>
170 ...
171  {
172         int noti_err = NOTIFICATION_ERROR_NONE;
173
174         noti_err  = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string");
175         if (noti_err != NOTIFICATION_ERROR_NONE) {
176                 return;
177         }
178 }
179  * @endcode
180  */
181 int notification_update_content(notification_h noti,
182                                                          int priv_id,
183                                                          const char *content);
184
185 /**
186  * @brief This function will be deprecated.
187  * @see notification_set_image()
188  *
189  */
190 NOTIFICATION_DEPRECATED_API int notification_set_icon(notification_h noti,
191                                            const char *icon_path);
192
193 /**
194  * @brief This function will be deprecated.
195  * @see notification_get_image()
196  *
197  */
198 NOTIFICATION_DEPRECATED_API int notification_get_icon(notification_h noti,
199                                            char **icon_path);
200
201 /**
202  * @brief This function will be deprecated.
203  * @see notification_set_text()
204  *
205  */
206 NOTIFICATION_DEPRECATED_API int notification_set_title(notification_h noti,
207                                             const char *title,
208                                             const char *loc_title);
209
210 /**
211  * @brief This function will be deprecated.
212  * @see notification_get_text()
213  *
214  */
215 NOTIFICATION_DEPRECATED_API int notification_get_title(notification_h noti,
216                                             char **title,
217                                             char **loc_title);
218
219 /**
220  * @brief This function will be deprecated.
221  * @see notification_set_text()
222  *
223  */
224 NOTIFICATION_DEPRECATED_API int notification_set_content(notification_h noti,
225                                               const char *content,
226                                               const char *loc_content);
227
228 /**
229  * @brief This function will be deprecated.
230  * @see notification_get_text()
231  *
232  */
233 NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti,
234                                               char **content,
235                                               char **loc_content);
236
237 /**
238  * @brief This function will be removed.
239  * @see notification_set_execute_option()
240  *
241  */
242 NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
243
244 /**
245  * @brief This function will be removed.
246  * @see notification_get_execute_option()
247  *
248  */
249 NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname);      /* Do not use this */
250
251 /**
252  * @brief This function will be deprecated.
253  * @see notification_set_execute_option()
254  *
255  */
256 NOTIFICATION_DEPRECATED_API int notification_set_args(notification_h noti, bundle *args, bundle *group_args);   /* Do not use this */
257
258 /**
259  * @brief This function will be deprecated.
260  * @see notification_get_execute_option()
261  *
262  */
263 NOTIFICATION_DEPRECATED_API int notification_get_args(notification_h noti, bundle **args, bundle **group_args); /* Do not use this */
264
265 /**
266  * @brief This function is deprecated.
267  * @see notification_get_grouping_list()
268  *
269  */
270 NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type_e type,
271                                                     int count,
272                                                     notification_list_h *list);
273
274 /**
275  * @brief This function will be deprecated.
276  * @see notification_delete_by_priv_id()
277  *
278  */
279 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname,
280                                                            notification_type_e type,
281                                                            int group_id);
282
283 /**
284  * @brief This function will be deprecated.
285  * @see notification_delete_by_priv_id()
286  *
287  */
288 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname,
289                                                           notification_type_e type,
290                                                           int priv_id);
291 /**
292  * @brief This function will be deprecated.
293  *
294  */
295 NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type,
296                                             const char *pkgname,
297                                             int group_id, int priv_id,
298                                             int *count);
299
300 /**
301  * @brief This function will be deprecated.
302  *
303  */
304 NOTIFICATION_DEPRECATED_API int notifiation_clear(notification_type_e type);
305
306 /**
307  * @internal
308  * @brief This function will be deprecated.
309  * @details Use only for the notification tray's clear button operation.
310  * @param[in] type Notification type
311  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
312  * @retval NOTIFICATION_ERROR_NONE Success
313  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
314  * @see #notification_type_e
315  * @par Sample code:
316  * @code
317 #include <notification.h>
318 ...
319  {
320         int noti_err = NOTIFICATION_ERROR_NONE;
321
322         noti_err  = notification_clear(NOTIFICATION_TYPE_NOTI);
323         if (noti_err != NOTIFICATION_ERROR_NONE) {
324                 return;
325         }
326 }
327  * @endcode
328  */
329 NOTIFICATION_DEPRECATED_API int notification_clear(notification_type_e type);
330
331 /**
332  * @internal
333  * @brief This function will be deprecated.
334  * @return 1 on ready, other value on not ready
335  */
336 NOTIFICATION_DEPRECATED_API int notification_is_service_ready(void);
337
338 /**
339  * @internal
340  * @brief This function will be deprecated.
341  * @param[in] list Notification list handle
342  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
343  * @retval NOTIFICATION_ERROR_NONE Success
344  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
345  * @pre notification_get_grouping_list() or notification_get_detail_list().
346  * @see #notification_op
347  */
348 NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_op,
349                                                        notification_op_data_type_e type,
350                                                        void *data);
351
352 /**
353  * @internal
354  * @brief This function will be deprecated.
355  * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API.
356  * @param[in] noti Notification handle
357  * @param[in] pkgname Caller package name
358  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
359  * @retval NOTIFICATION_ERROR_NONE Success
360  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
361  * @par Sample code:
362  * @code
363 #include <notification.h>
364 ...
365 {
366         notification_h noti = NULL;
367         int noti_err = NOTIFICATION_ERROR_NONE;
368
369         noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
370         if (noti == NULL) {
371                 return;
372         }
373
374         noti_err  = notification_set_pkgname(noti, "org.tizen.phone");
375         if (noti_err != NOTIFICATION_ERROR_NONE) {
376                 notification_free(noti);
377                 return;
378         }
379 }
380  * @endcode
381  */
382 NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti,
383                                               const char *pkgname);
384
385 /**
386  * @internal
387  * @brief This function will be deprecated.
388  * @details If @a pkgname is NULL, caller_pkgname is set internally.
389  * @param[in] pkgname Caller application package name or NULL
390  * @param[in] type Notification type
391  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
392  * @retval NOTIFICATION_ERROR_NONE Success
393  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
394  * @par Sample code:
395  * @code
396 #include <notification.h>
397 ...
398  {
399         int noti_err = NOTIFICATION_ERROR_NONE;
400
401         noti_err  = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
402         if (noti_err != NOTIFICATION_ERROR_NONE) {
403                 return;
404         }
405 }
406  * @endcode
407  */
408 NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname,
409                                                      notification_type_e type);
410
411 /**
412  * @internal
413  * @brief This function will be deprecated.
414  * @details If @a pkgname is NULL, caller_pkgname is set internally.
415  * @param[in] pkgname Caller application package name or NULL
416  * @param[in] type Notification type
417  * @param[in] priv_id Priv ID
418  * @return NOTIFICATION_ERROR_NONE if success, other value if failure
419  * @retval NOTIFICATION_ERROR_NONE Success
420  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
421  * @par Sample code:
422  * @code
423 #include <notification.h>
424 ...
425  {
426         int noti_err = NOTIFICATION_ERROR_NONE;
427
428         noti_err  = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
429         if (noti_err != NOTIFICATION_ERROR_NONE) {
430                 return;
431         }
432 }
433  * @endcode
434  */
435 NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname,
436                                                     notification_type_e type,
437                                                     int priv_id);
438
439 /**
440  * @internal
441  * @brief This function will be deprecated.
442  * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
443  * @param[in] noti Notification handle
444  * @param[in] type Notification execute type
445  * @param[in] text Basic text for button
446  * @param[in] key Value for localized text
447  * @param[in] service_handle Appsvc bundle data
448  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
449  * @retval NOTIFICATION_ERROR_NONE Success
450  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
451  * @par Sample code:
452  * @code
453 #include <notification.h>
454 ...
455 {
456         notification_h noti = NULL;
457         int noti_err = NOTIFICATION_ERROR_NONE;
458         bundle *b = NULL;
459
460         ...
461
462         b = bundle_create();
463         appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
464         appsvc_set_uri(b,"http://www.samsung.com");
465
466         noti_err  = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
467         if (noti_err != NOTIFICATION_ERROR_NONE) {
468                 notification_free(noti);
469                 return;
470         }
471
472         bundle_free(b);
473 }
474  * @endcode
475  */
476 NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti,
477                                                      notification_execute_type_e type,
478                                                      const char *text,
479                                                      const char *key,
480                                                      bundle *service_handle);
481
482 /**
483  * @internal
484  * @brief This function will be deprecated.
485  * @remarks ID is valid only after inserting the notification.
486  * @param[in] noti Notification handle
487  * @param[out] group_id Group ID
488  * @param[out] priv_id Private ID
489  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
490  * @retval NOTIFICATION_ERROR_NONE Success
491  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
492  * @par Sample code:
493  * @code
494 #include <notification.h>
495  ...
496   {
497          int noti_err = NOTIFICATION_ERROR_NONE;
498          int group_id, priv_id;
499
500          noti_err  = notification_get_id(noti, &group_id, &priv_id);
501          if (noti_err != NOTIFICATION_ERROR_NONE) {
502                  return;
503          }
504  }
505  * @endcode
506  */
507 NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti,
508                                          int *group_id, int *priv_id);
509
510 /**
511  * @internal
512  * @brief This function will be deprecated.
513  * @param[in] type Notification type
514  * @param[in] group_id Group ID
515  * @param[in] priv_id Priv ID
516  * @return Notification handle(#notification_h) on success, NULL on failure
517  * @retval #notification_h Success
518  * @retval NULL Failure
519  * @see #notification_type_e
520  * @see #notification_h
521  * @par Sample code:
522  * @code
523 #include <notification.h>
524 ...
525 {
526         notification_h noti = NULL;
527
528         noti = notification_load("org.tizen.app", priv_id);
529         if (noti == NULL) {
530                 return;
531         }
532         ...
533 }
534  * @endcode
535  */
536 NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname,
537                                 int priv_id);
538
539 /**
540  * @internal
541  * @brief This function will be deprecated.
542  * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
543  * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
544  * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
545  * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT,
546  * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number.
547  * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
548  * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
549  * @param[in] type Notification type
550  * @param[in] group_id Group ID
551  * @param[in] priv_id Priv ID
552  * @return Notification handle(#notification_h) on success, NULL on failure
553  * @retval #notification_h Success
554  * @retval NULL Failure
555  * @see #notification_type_e
556  * @see #notification_h
557  * @par Sample code:
558  * @code
559 #include <notification.h>
560 ...
561 {
562         notification_h noti = NULL;
563
564         noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
565         if (noti == NULL) {
566                 return;
567         }
568         ...
569 }
570  * @endcode
571  */
572 NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id,
573                                 int priv_id);
574
575 /**
576  * @internal
577  * @brief This function will be deprecated.
578  * @param[in] noti Notification handle
579  * @param[in] type Notification execute type
580  * @param[out] text Text for button
581  * @param[out] service_handle Appsvc bundle data
582  * @return NOTIFICATION_ERROR_NONE on success, other value on failure
583  * @retval NOTIFICATION_ERROR_NONE Success
584  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
585  * @par Sample code:
586  * @code
587 #include <notification.h>
588 ...
589 {
590         notification_h noti = NULL;
591         int noti_err = NOTIFICATION_ERROR_NONE;
592         bundle *b = NULL;
593
594         ...
595
596         noti_err  = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
597         if (noti_err != NOTIFICATION_ERROR_NONE) {
598                 notification_free(noti);
599                 return;
600         }
601 }
602  * @endcode
603  */
604 NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti,
605                                                      notification_execute_type_e type,
606                                                      const char **text,
607                                                      bundle **service_handle);
608
609 /**
610  * @internal
611  * @brief Inserts a notification.
612  * @details The notification will be inserted to the database and then it will appear in the notification area.
613  *          When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
614  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
615  * @privlevel public
616  * @privilege %http://tizen.org/privilege/notification
617  * @param[in]  noti    The notification handle
618  * @param[out] priv_id The private ID
619  * @return #NOTIFICATION_ERROR_NONE on success,
620  *         otherwise any other value on failure
621  * @retval #NOTIFICATION_ERROR_NONE         Success
622  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
623  * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
624  * @pre Notification handle should be created by notification_create().
625  * @post notification_free().
626  * @par Sample code:
627  * @code
628 #include <notification.h>
629 ...
630  {
631         int noti_err = NOTIFICATION_ERROR_NONE;
632
633         noti_err  = notification_insert(noti, NULL);
634         if (noti_err != NOTIFICATION_ERROR_NONE) {
635                 return;
636         }
637 }
638  * @endcode
639  */
640 int notification_insert(notification_h noti,
641                 int *priv_id);
642
643 int notification_insert_for_uid(notification_h noti,
644                 int *priv_id, uid_t uid);
645
646 /**
647  * @internal
648  * @brief Updates a notification, asynchronously.
649  * @details The updated notification will appear in the notification area.
650  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
651  * @privlevel public
652  * @privilege %http://tizen.org/privilege/notification
653  * @remarks This function updates the notification asynchronously.
654  * @param[in] noti      The notification handle that is created by notification_create()
655  * @param[in] result_cb The callback called when an update completed
656  * @param[in] user_data The user data which you want to use in callback
657  * @return #NOTIFICATION_ERROR_NONE on success,
658  *         otherwise any other value on failure
659  * @retval #NOTIFICATION_ERROR_NONE         Success
660  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
661  * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
662  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
663  * @par Sample code:
664  * @code
665 #include <notification.h>
666 ...
667  {
668         int noti_err = NOTIFICATION_ERROR_NONE;
669
670         noti_err  = notification_update_async(NULL, result_cb, data);
671         if (noti_err != NOTIFICATION_ERROR_NONE) {
672                 return;
673         }
674 }
675  * @endcode
676  */
677 int notification_update_async(notification_h noti,
678                 void (*result_cb)(int priv_id, int result, void *data), void *user_data);
679 int notification_update_async_for_uid(notification_h noti,
680                 void (*result_cb)(int priv_id, int result, void *data), void *user_data, uid_t uid);
681
682 /**
683  * @internal
684  * @brief Registers a callback for all notification events.
685  * @details The registered callback could be called for all notification events.
686  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
687  * @privlevel public
688  * @privilege %http://tizen.org/privilege/notification
689  * @param[in] changed_cb The callback function
690  * @param[in] user_data  The user data
691  * @return #NOTIFICATION_ERROR_NONE on success,
692  *         otherwise any other value on failure
693  * @retval #NOTIFICATION_ERROR_NONE         Success
694  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
695  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
696  * @see notification_unregister_detailed_changed_cb()
697  * @par Sample code:
698  * @code
699 #include <notification.h>
700 ...
701 {
702         noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
703         if (noti_err != NOTIFICATION_ERROR_NONE) {
704                 return;
705         }
706 }
707  * @endcode
708  */
709 int notification_register_detailed_changed_cb(
710                 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
711                 void *user_data);
712 int notification_register_detailed_changed_cb_for_uid(
713                 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
714                 void *user_data, uid_t uid);
715
716 /**
717  * @internal
718  * @brief Unregisters a callback for all notification events.
719  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
720  * @privlevel public
721  * @privilege %http://tizen.org/privilege/notification
722  * @param[in] changed_cb The callback function
723  * @return #NOTIFICATION_ERROR_NONE on success,
724  *         otherwise any other value on failure
725  * @retval #NOTIFICATION_ERROR_NONE         Success
726  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
727  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
728  * @see notification_register_detailed_changed_cb()
729  * @par Sample code:
730  * @code
731 #include <notification.h>
732 ...
733 {
734         noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
735         if (noti_err != NOTIFICATION_ERROR_NONE) {
736                 return;
737         }
738 }
739  * @endcode
740  */
741 int notification_unregister_detailed_changed_cb(
742                 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
743                 void *user_data);
744 int notification_unregister_detailed_changed_cb_for_uid(
745                 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
746                 void *user_data, uid_t uid);
747 /**
748  * @brief Sets the default button to display highlight on the notification.
749  * @since_tizen 3.0
750  * @remarks If you want to default button is off, you set that index is zero
751  * @param[in] noti       The notification handle
752  * @param[in] index      The notification button index
753  * @return #NOTIFICATION_ERROR_NONE on success,
754  *         otherwise any other value on failure
755  * @retval #NOTIFICATION_ERROR_NONE         Success
756  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
757  * @pre Notification handle should be created by notification_create().
758  * @see #notification_button_index_e
759  * @par Sample code:
760  * @code
761 #include <notification.h>
762 ...
763 {
764         notification_h noti = NULL;
765         int noti_err = NOTIFICATION_ERROR_NONE;
766
767         noti = notification_create(NOTIFICATION_TYPE_NOTI);
768         if(noti == NULL) {
769                 return;
770         }
771
772         noti_err  = notification_set_default_button(noti, NOTIFICATION_BUTTON_1);
773         if(noti_err != NOTIFICATION_ERROR_NONE) {
774                 notification_free(noti);
775                 return;
776         }
777
778         ...
779
780 }
781  * @endcode
782  */
783 int notification_set_default_button(notification_h noti, notification_button_index_e index);
784
785 /**
786  * @brief Gets the default button to display highlight on the notification.
787  * @since_tizen 3.0
788  * @param[in] noti       The notification handle
789  * @param[out] index     The notification button index
790  * @return #NOTIFICATION_ERROR_NONE on success,
791  *         otherwise any other value on failure
792  * @retval #NOTIFICATION_ERROR_NONE         Success
793  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
794  * @pre Notification handle should be created by notification_create().
795  * @see #notification_button_index_e
796  * @par Sample code:
797  * @code
798 #include <notification.h>
799 ...
800 {
801         notification_h noti = NULL;
802         notification_button_index_e index;
803         int noti_err = NOTIFICATION_ERROR_NONE;
804
805         noti = notification_create(NOTIFICATION_TYPE_NOTI);
806         if(noti == NULL) {
807                 return;
808         }
809
810         noti_err  = notification_set_default_button(noti, &index);
811         if(noti_err != NOTIFICATION_ERROR_NONE) {
812                 notification_free(noti);
813                 return;
814         }
815
816         ...
817
818 }
819  * @endcode
820  */
821 int notification_get_default_button(notification_h noti, notification_button_index_e *index);
822
823 /**
824  * @brief Gets the notification ongoing value type.
825  * @since_tizen 3.0
826  * @param[in] noti      The notification handle
827  * @param[out] type     The notification ongoing value type
828  * @return #NOTIFICATION_ERROR_NONE on success,
829  *         otherwise any other value on failure
830  * @retval #NOTIFICATION_ERROR_NONE         Success
831  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
832  * @pre Notification handle should be created by notification_create().
833  * @see #notification_ongoing_value_type_e
834  * @par Sample code:
835  * @code
836 #include <notification.h>
837 ...
838 {
839         notification_h noti = NULL;
840         notification_ongoing_value_type_e type;
841         int noti_err = NOTIFICATION_ERROR_NONE;
842
843         noti = notification_create(NOTIFICATION_TYPE_NOTI);
844         if (noti == NULL) {
845                 return;
846         }
847
848         noti_err  = notification_get_ongoing_value_type(noti, &type);
849         if (noti_err != NOTIFICATION_ERROR_NONE) {
850                 notification_free(noti);
851                 return;
852         }
853 }
854  * @endcode
855  */
856 int notification_get_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e *type);
857
858 /**
859  * @brief Sets the notification ongoing value type.
860  * @since_tizen 3.0
861  * @param[in] noti      The notification handle
862  * @param[in] type      The notification ongoing value type
863  * @return #NOTIFICATION_ERROR_NONE on success,
864  *         otherwise any other value on failure
865  * @retval #NOTIFICATION_ERROR_NONE         Success
866  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
867  * @pre Notification handle should be created by notification_create().
868  * @see #notification_ongoing_value_type_e
869  * @par Sample code:
870  * @code
871 #include <notification.h>
872 ...
873 {
874         notification_h noti = NULL;
875         notification_ongoing_value_type_e type;
876         int noti_err = NOTIFICATION_ERROR_NONE;
877
878         noti = notification_create(NOTIFICATION_TYPE_NOTI);
879         if (noti == NULL) {
880                 return;
881         }
882
883         type = NOTIFICATION_ONGOING_VALUE_TYPE_TIME;
884
885         noti_err  = notification_set_ongoing_value_type(noti, type);
886         if (noti_err != NOTIFICATION_ERROR_NONE) {
887                 notification_free(noti);
888                 return;
889         }
890 }
891  * @endcode
892  */
893 int notification_set_ongoing_value_type(notification_h noti, notification_ongoing_value_type_e type);
894
895 /**
896  * @brief Gets the notification ongoing time when ongoint type value is set NOTIFICATION_ONGOING_VALUE_TYPE_TIME.
897  * @since_tizen 3.0
898  * @param[in] noti      The notification handle
899  * @param[out] current  The ongoing current time
900  * @param[out] duration The ongoing duration time
901  * @return #NOTIFICATION_ERROR_NONE on success,
902  *         otherwise any other value on failure
903  * @retval #NOTIFICATION_ERROR_NONE         Success
904  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
905  * @pre Notification handle should be created by notification_create().
906  * @see #notification_ongoing_value_type_e
907  * @par Sample code:
908  * @code
909 #include <notification.h>
910 ...
911 {
912         notification_h noti = NULL;
913         int noti_err = NOTIFICATION_ERROR_NONE;
914         int current;
915         int duration;
916
917         noti = notification_create(NOTIFICATION_TYPE_NOTI);
918         if (noti == NULL) {
919                 return;
920         }
921
922         noti_err  = notification_get_ongoing_time(noti, &current, &duration);
923         if (noti_err != NOTIFICATION_ERROR_NONE) {
924                 notification_free(noti);
925                 return;
926         }
927 }
928  * @endcode
929  */
930 int notification_get_ongoing_time(notification_h noti, int *current, int *duration);
931
932 /**
933  * @brief Sets the notification ongoing time when ongoint type value is set NOTIFICATION_ONGOING_VALUE_TYPE_TIME.
934  * @since_tizen 3.0
935  * @param[in] noti      The notification handle
936  * @param[in] current   The ongoing current time
937  * @param[in] duration  The ongoing duration time
938  * @return #NOTIFICATION_ERROR_NONE on success,
939  *         otherwise any other value on failure
940  * @retval #NOTIFICATION_ERROR_NONE         Success
941  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
942  * @pre Notification handle should be created by notification_create().
943  * @see #notification_ongoing_value_type_e
944  * @par Sample code:
945  * @code
946 #include <notification.h>
947 ...
948 {
949         notification_h noti = NULL;
950         int noti_err = NOTIFICATION_ERROR_NONE;
951         int current;
952         int duration;
953
954         noti = notification_create(NOTIFICATION_TYPE_NOTI);
955         if (noti == NULL) {
956                 return;
957         }
958
959         current = 0;
960         duration = 30;
961
962         noti_err  = notification_set_ongoing_time(noti, current, duration)
963         if (noti_err != NOTIFICATION_ERROR_NONE) {
964                 notification_free(noti);
965                 return;
966         }
967 }
968  * @endcode
969  */
970 int notification_set_ongoing_time(notification_h noti, int current, int duration);
971
972 /**
973  * @brief Gets the time that notification is hidden.
974  * @since_tizen 3.0
975  * @param[in] noti      The notification handle
976  * @param[out] timeout  The timeout time
977  * @return #NOTIFICATION_ERROR_NONE on success,
978  *         otherwise any other value on failure
979  * @retval #NOTIFICATION_ERROR_NONE         Success
980  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
981  * @pre Notification handle should be created by notification_create().
982  * @see #notification_event_type_extension_e
983  * @par Sample code:
984  * @code
985 #include <notification.h>
986 ...
987 {
988         notification_h noti = NULL;
989         int noti_err = NOTIFICATION_ERROR_NONE;
990         int timeout;
991
992         noti = notification_create(NOTIFICATION_TYPE_NOTI);
993         if (noti == NULL) {
994                 return;
995         }
996
997         noti_err  = notification_get_hide_timeout(noti, &timeout)
998         if (noti_err != NOTIFICATION_ERROR_NONE) {
999                 notification_free(noti);
1000                 return;
1001         }
1002 }
1003  * @endcode
1004  */
1005 int notification_get_hide_timeout(notification_h noti, int *timeout);
1006
1007 /**
1008  * @brief Sets the time that notification is hidden.
1009  * @since_tizen 3.0
1010  * @param[in] noti      The notification handle
1011  * @param[in] timeout   The timeout time
1012  * @return #NOTIFICATION_ERROR_NONE on success,
1013  *         otherwise any other value on failure
1014  * @retval #NOTIFICATION_ERROR_NONE         Success
1015  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1016  * @pre Notification handle should be created by notification_create().
1017  * @see #notification_event_type_extension_e
1018  * @par Sample code:
1019  * @code
1020 #include <notification.h>
1021 ...
1022 {
1023         notification_h noti = NULL;
1024         int noti_err = NOTIFICATION_ERROR_NONE;
1025
1026         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1027         if (noti == NULL) {
1028                 return;
1029         }
1030
1031         noti_err  = notification_set_hide_timeout(noti, 10)
1032         if (noti_err != NOTIFICATION_ERROR_NONE) {
1033                 notification_free(noti);
1034                 return;
1035         }
1036 }
1037  * @endcode
1038  */
1039 int notification_set_hide_timeout(notification_h noti, int timeout);
1040
1041 /**
1042  * @brief This function translate localized texts
1043  * @param[in] noti The notification handle that is created by notification_create()
1044  * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1045  * @see notification_create()
1046  */
1047 int notification_translate_localized_text(notification_h noti);
1048 int notification_set_uid(notification_h noti, uid_t uid);
1049 int notification_get_uid(notification_h noti, uid_t *uid);
1050 int notification_post_for_uid(notification_h noti, uid_t uid);
1051 int notification_update_for_uid(notification_h noti, uid_t uid);
1052 int notification_delete_for_uid(notification_h noti, uid_t uid);
1053 int notification_delete_all_for_uid(notification_type_e type, uid_t uid);
1054 notification_h notification_load_by_tag_for_uid(const char *tag, uid_t uid);
1055 notification_h notification_create_from_package_template(const char *pkgname,
1056                                         const char *template_name);
1057 /**
1058  * @brief Gets a max length of text input.
1059  * @since_tizen 3.0
1060  * @return #NOTIFICATION_ERROR_NONE on success,
1061  *         otherwise any other value on failure
1062  * @retval #NOTIFICATION_ERROR_NONE     Success
1063  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER        Invalid parameter
1064  * @par Sample code:
1065  * @code
1066 #include <notification.h>
1067 ...
1068 {
1069         int noti_err = NOTIFICATION_ERROR_NONE;
1070         int text_input_max_length;
1071
1072         noti_err = notification_get_text_input_max_length(noti, &text_input_max_length);
1073         if (noti_err != NOTIFICATION_ERROR_NONE) {
1074                 return;
1075         }
1076         ...
1077  }
1078  * @endcode
1079  */
1080 int notification_get_text_input_max_length(notification_h noti, int *text_input_max_length);
1081
1082 /**
1083  * @}
1084  */
1085 #ifdef __cplusplus
1086 }
1087 #endif
1088 #endif