Release version 0.4.19
[platform/core/api/notification.git] / include / notification_ongoing.h
1 /*
2  * Copyright (c) 2000 - 2017 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 /**
78  * @brief Updates progress.
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  * @param[in] caller_app_id
81  * @param[in] priv_id
82  * @param[in] progress
83  * @return #NOTIFICATION_ERROR_NONE on success,
84  *         otherwise any other value on failure
85  * @retval #NOTIFICATION_ERROR_NONE         Success
86  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
87  * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
88  */
89 int notification_ongoing_update_progress(const char *caller_app_id,
90                                         int priv_id, double progress);
91
92 /**
93  * @brief Updates size.
94  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
95  * @param[in] caller_app_id
96  * @param[in] priv_id
97  * @param[in] size
98  * @return #NOTIFICATION_ERROR_NONE on success,
99  *         otherwise any other value on failure
100  * @retval #NOTIFICATION_ERROR_NONE         Success
101  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
102  * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
103  */
104 int notification_ongoing_update_size(const char *caller_app_id,
105                                 int priv_id, double size);
106
107 /**
108  * @brief Updates content.
109  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
110  * @param[in] caller_app_id
111  * @param[in] priv_id
112  * @param[in] content
113  * @return #NOTIFICATION_ERROR_NONE on success,
114  *         otherwise any other value on failure
115  * @retval #NOTIFICATION_ERROR_NONE         Success
116  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
117  * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus
118  */
119 int notification_ongoing_update_content(const char *caller_app_id,
120                                 int priv_id, const char *content);
121
122 /**
123  * @}
124  */
125
126 #ifdef __cplusplus
127 }
128 #endif /* __cplusplus */
129 #endif /* __NOTIFICATION_ONGOING_H__ */
130