2 * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __NOTIFICATION_LIST_H__
18 #define __NOTIFICATION_LIST_H__
20 #include <sys/types.h>
21 #include <notification.h>
28 * @file notification_list.h
29 * @brief This file contains the notification list APIs.
34 * @addtogroup NOTIFICATION_LIST
39 * @brief Notification list handle.
40 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
42 typedef struct _notification_list *notification_list_h;
47 * @brief Returns the notification list handle.
48 * @details If count is equal to @c -1, all notifications are returned.
49 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
51 * @privilege %http://tizen.org/privilege/notification
52 * @param[in] type The notification type
53 * @param[in] count The returned notification data number
54 * @param[out] list The notification list handle
55 * @return #NOTIFICATION_ERROR_NONE on success,
56 * otherwise any other value on failure
57 * @retval #NOTIFICATION_ERROR_NONE Success
58 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
59 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
60 * @see #notification_list_h
63 #include <notification.h>
66 notification_list_h noti_list = NULL;
67 int noti_err = NOTIFICATION_ERROR_NONE;
69 noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
70 if (noti_err != NOTIFICATION_ERROR_NONE) {
76 int notification_get_list(notification_type_e type,
78 notification_list_h *list);
80 int notification_get_list_for_uid(notification_type_e type,
82 notification_list_h *list, uid_t uid);
86 * @brief Gets the notification list associated with the partition into pages.
89 * @privilege %http://tizen.org/privilege/notification
90 * @param[in] type The notification type
91 * @param[in] page_number The page number of the value set \n
92 * It starts from @c 1.
93 * @param[in] count_per_page The desired maximum count of the data items per page
94 * The maximum value is 100, If the value is set more than 100, \n
95 * it is automatically set 100.
96 * @param[out] list The notification list handle
97 * @return #NOTIFICATION_ERROR_NONE on success,
98 * otherwise any other value on failure
99 * @retval #NOTIFICATION_ERROR_NONE Success
100 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
101 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
102 * @see #notification_list_h
104 int notification_get_list_by_page(notification_type_e type,
105 int page_number, int count_per_page, notification_list_h *list);
107 int notification_get_list_by_page_for_uid(notification_type_e type,
108 int page_number, int count_per_page, notification_list_h *list, uid_t uid);
111 * @brief Returns the notification detail list handle of grouping data.
112 * @details If count is equal to c -1, all notifications are returned.
113 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
115 * @privilege %http://tizen.org/privilege/notification
116 * @param[in] app_id The caller application ID
117 * @param[in] group_id The group ID
118 * @param[in] priv_id The private ID
119 * @param[in] count The returned notification data number
120 * @param[out] list The notification list handle
121 * @return #NOTIFICATION_ERROR_NONE if success,
122 * other value if failure
123 * @retval #NOTIFICATION_ERROR_NONE Success
124 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
125 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
126 * @see #notification_list_h
129 #include <notification.h>
132 notification_list_h noti_list = NULL;
133 int noti_err = NOTIFICATION_ERROR_NONE;
135 noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list);
136 if (noti_err != NOTIFICATION_ERROR_NONE) {
142 int notification_get_detail_list(const char *app_id,
146 notification_list_h *list);
148 int notification_get_detail_list_for_uid(const char *app_id,
152 notification_list_h *list,
157 * @brief Frees a notification list.
158 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
160 * @privilege %http://tizen.org/privilege/notification
161 * @param[in] list The notification list handle
162 * @return #NOTIFICATION_ERROR_NONE on success,
163 * otherwise any other value on failure
164 * @retval #NOTIFICATION_ERROR_NONE Success
165 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
166 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
167 * @pre notification_get_grouping_list() or notification_get_detail_list().
168 * @see #notification_list_h
171 #include <notification.h>
174 notification_list_h noti_list = NULL;
175 int noti_err = NOTIFICATION_ERROR_NONE;
179 noti_err = notification_free_list(noti_list);
180 if (noti_err != NOTIFICATION_ERROR_NONE) {
186 int notification_free_list(notification_list_h list);
191 * @brief Gets the head pointer of the notification list.
192 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
193 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
194 * @param[in] list Notification list handle
195 * @return Notification list handle on success, NULL on failure
196 * @retval #notification_list_h Success
197 * @retval NULL Failure
198 * @exception #NOTIFICATION_ERROR_NONE Success
199 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
200 * @see #notification_list_h
203 #include <notification.h>
206 notification_list_h noti_list = NULL;
207 int noti_err = NOTIFICATION_ERROR_NONE;
209 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
210 if (noti_err != NOTIFICATION_ERROR_NONE) {
214 noti_list = notification_list_get_head(noti_list);
218 notification_list_h notification_list_get_head(notification_list_h list);
222 * @brief Gets the tail pointer to the notification list.
223 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
224 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
225 * @param[in] list Notification list handle
226 * @return Notification list handle on success, NULL on failure
227 * @retval #notification_list_h Success
228 * @retval NULL Failure
229 * @exception #NOTIFICATION_ERROR_NONE Success
230 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
231 * @see #notification_list_h
234 #include <notification.h>
237 notification_list_h noti_list = NULL;
238 int noti_err = NOTIFICATION_ERROR_NONE;
240 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
241 if (noti_err != NOTIFICATION_ERROR_NONE) {
245 noti_list = notification_list_get_tail(noti_list);
249 notification_list_h notification_list_get_tail(notification_list_h list);
253 * @brief Gets the previous pointer of the current notification list.
254 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
255 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
256 * @param[in] list Notification list handle
257 * @return Notification list handle on success, NULL on failure
258 * @retval #notification_list_h Success
259 * @retval NULL Failure
260 * @exception #NOTIFICATION_ERROR_NONE Success
261 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
262 * @see #notification_list_h
265 #include <notification.h>
268 notification_list_h noti_list = NULL;
269 int noti_err = NOTIFICATION_ERROR_NONE;
271 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
272 if (noti_err != NOTIFICATION_ERROR_NONE) {
276 noti_list = notification_list_get_prev(noti_list);
280 notification_list_h notification_list_get_prev(notification_list_h list);
284 * @brief Gets the next pointer of the current notification list.
285 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
286 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
287 * @param[in] list Notification list handle
288 * @return Notification list handle on success, NULL on failure
289 * @retval #notification_list_h Success
290 * @retval NULL Failure
291 * @exception #NOTIFICATION_ERROR_NONE Success
292 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
293 * @see #notification_list_h
296 #include <notification.h>
299 notification_list_h noti_list = NULL;
300 int noti_err = NOTIFICATION_ERROR_NONE;
302 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
303 if (noti_err != NOTIFICATION_ERROR_NONE) {
307 noti_list = notification_list_get_next(noti_list);
311 notification_list_h notification_list_get_next(notification_list_h list);
315 * @brief Gets the notification handle that the list has.
316 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
317 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
318 * @param[in] list Notification list handle
319 * @return Notification handle on success, NULL on failure
320 * @retval #notification_h Success
321 * @retval NULL Failure
322 * @exception #NOTIFICATION_ERROR_NONE Success
323 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
324 * @see #notification_list_h
325 * @see #notification_h
328 #include <notification.h>
331 notification_h noti = NULL;
332 notification_list_h noti_list = NULL;
333 int noti_err = NOTIFICATION_ERROR_NONE;
335 noti_err = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
336 if (noti_err != NOTIFICATION_ERROR_NONE) {
340 noti = notification_list_get_data(noti_list);
344 notification_h notification_list_get_data(notification_list_h list);
349 * @brief Gets a number of the notification list.
351 * @param[in] list Notification list handle
352 * @return A number of notification list handle on success, 0 on failure
353 * @exception #NOTIFICATION_ERROR_NONE Success
354 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
355 * @see #notification_list_h
356 * @see #notification_h
359 include <notification.h>
363 notification_list_h noti_list = NULL;
364 int noti_err = NOTIFICATION_ERROR_NONE;
366 noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list);
367 if (noti_err != NOTIFICATION_ERROR_NONE) {
371 count = notification_list_get_count(noti_list);
375 int notification_list_get_count(notification_list_h list);
379 * @brief Appends notification data to the notification list.
380 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
381 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
382 * @param[in] list Notification list handle
383 * @param[in] noti Notification handle
384 * @return Notification handle on success, NULL on failure
385 * @retval #notification_h Success
386 * @retval NULL Failure
387 * @exception #NOTIFICATION_ERROR_NONE Success
388 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
389 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
390 * @see #notification_list_h
391 * @see #notification_h
394 #include <notification.h>
397 notification_h noti = NULL;
398 notification_list_h noti_list = NULL;
399 int noti_err = NOTIFICATION_ERROR_NONE;
401 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
406 noti_list = notification_list_append(noti_list, noti);
410 notification_list_h notification_list_append(notification_list_h list,
411 notification_h noti);
415 * @brief Removes notification data from the notification list.
416 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
417 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
418 * @param[in] list The notification list handle
419 * @param[in] noti The notification handle
420 * @return Notification handle on success,
421 * otherwise @c NULL on failure
422 * @retval #notification_h Success
423 * @retval NULL Failure
424 * @exception #NOTIFICATION_ERROR_NONE Success
425 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
426 * @see #notification_list_h
427 * @see #notification_h
430 #include <notification.h>
433 notification_h noti = NULL;
434 notification_list_h noti_list = NULL;
435 int noti_err = NOTIFICATION_ERROR_NONE;
439 noti_list = notification_list_remove(noti_list, noti);
443 notification_list_h notification_list_remove(notification_list_h list,
444 notification_h noti);
453 #endif /* __NOTIFICATION_LIST_H__ */