Fix sample codes for notification_set/get_led
[platform/core/api/notification.git] / include / notification_ongoing.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_ONGOING_H__
18 #define __NOTIFICATION_ONGOING_H__
19
20 #include <notification.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 /**
27  * @file notification_ongoing.h
28  */
29
30 typedef enum {
31         ONGOING_TYPE_PROGRESS,
32         ONGOING_TYPE_SIZE,
33         ONGOING_TYPE_CONTENT,
34 } ongoing_type_e;
35
36 struct ongoing_info_s {
37         char *pkgname;
38         int priv_id;
39         ongoing_type_e type;
40         double progress;
41         double size;
42         char *content;
43 };
44
45 /**
46  * @internal
47  * @brief Called when a notification ongoing data is updated.
48  * @since_tizen 3.0
49  * @param[in] info    The ongoing information handle
50  * @param[in] data    The user data
51  * @pre notification_ongoing_update_cb_set() used to register this callback.
52  * @see notification_ongoing_update_cb_set()
53 */
54 typedef void (*notification_ongoing_update_cb)(struct ongoing_info_s *info, void *data);
55
56 /**
57  * @internal
58  * @brief Registers a callback to receive the ongoing progress, size ,content.
59  * @since_tizen 3.0
60  * @param[in] callback The callback function
61  * @param[in] data     The user_data
62  * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
63  * @retval #NOTIFICATION_ERROR_NONE Success
64  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
65  * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
66  */
67 int notification_ongoing_update_cb_set(notification_ongoing_update_cb callback, void *user_data);
68
69 /**
70  * @internal
71  * @brief Unregisters a callback to receive.
72  * @since_tizen 3.0
73  * @retval #NOTIFICATION_ERROR_NONE Success
74  */
75 int notification_ongoing_update_cb_unset(void);
76
77 int notification_ongoing_update_progress(const char *caller_pkgname,
78                                                           int priv_id,
79                                                           double progress);
80
81 int notification_ongoing_update_size(const char *caller_pkgname,
82                                                       int priv_id, double size);
83
84 int notification_ongoing_update_content(const char *caller_pkgname,
85                                                       int priv_id, const char *content);
86
87 /**
88  * @}
89  */
90
91 #ifdef __cplusplus
92 }
93 #endif /* __cplusplus */
94 #endif /* __NOTIFICATION_ONGOING_H__ */
95