2 * Copyright (c) 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.
25 * Widget information handle.
27 typedef struct aul_widget_info_s *aul_widget_info_h;
31 * Called to get the widget information
32 * @param[in] info The handle of the widget information
33 * @param[in] user_data The user data passed from the foreach function
35 * @pre aul_widget_info_foreach() will invoke this callback.
36 * @see aul_widget_info_foreach()
38 typedef void (*aul_widget_info_cb)(aul_widget_info_h info, void *user_data);
42 * Retrieves all widget information of running widget applications.
44 * @privilege %http://tizen.org/privilege/internal/default/platform
45 * @param[in] callback The callback function to invoke
46 * @param[in] user_data The user data to be passed to the callback function
47 * @return @c 0 on success,
48 * otherwise a negative error value
49 * @post This function invokes aul_widget_info_cb() for each widget information.
50 * @see aul_widget_info_cb()
52 int aul_widget_info_foreach(aul_widget_info_cb callback, void *user_data);
53 int aul_widget_info_foreach_for_uid(aul_widget_info_cb callback,
54 void *user_data, uid_t uid);
58 * Gets the process ID with the given handle.
59 * @param[in] info The handle of the widget information
60 * @param[out] pid The process ID
61 * @return @c 0 on success,
62 * otherwise a negative error value
64 int aul_widget_info_get_pid(aul_widget_info_h info, pid_t *pid);
68 * Gets the surface ID with the given handle.
69 * @param[in] info The handle of the widget information
70 * @param[out] surf The surface ID
71 * @return @c 0 on success,
72 * otherwise a negative error value
74 int aul_widget_info_get_surface_id(aul_widget_info_h info, unsigned int *surf);
78 * Gets the widget ID with the given handle.
79 * @param[in] info The handle of the widget information
80 * @param[out] widget_id The widget ID
81 * @return @c 0 on success,
82 * otherwise a negative error value
83 * @remarks The @a widget_id must be released using free().
85 int aul_widget_info_get_widget_id(aul_widget_info_h info, char **widget_id);
89 * Gets the widget instance ID with the given handle.
90 * @param[in] info The handle of the widget information
91 * @param[out] instance_id The widget instance ID
92 * @return @c 0 on success,
93 * otherwise a negative error value
94 * @remarks The @a instance_id must be released using free().
96 int aul_widget_info_get_instance_id(aul_widget_info_h info, char **instance_id);
100 * Gets the application ID with the given handle.
101 * @param[in] info The handle of the widget information
102 * @param[out] app_id The application ID
103 * @return @c 0 on success,
104 * otherwise a negative error value
105 * @remarks The @a app_id must be released using free().
107 int aul_widget_info_get_app_id(aul_widget_info_h info, char **app_id);
111 * Gets the package ID with the given handle.
112 * @param[in] info The handle of the widget information
113 * @param[out] package_id The package ID
114 * @return @c 0 on success,
115 * otherwise a negative error value
116 * @remarks The @a app_id must be released using free().
118 int aul_widget_info_get_package_id(aul_widget_info_h info, char **package_id);
122 * Gets the path with the given handle.
123 * @param[in] info The handle of the widget information
124 * @param[out] app_path The path of the widget application
125 * @return @c 0 on success,
126 * otherwise a negative error value
127 * @remarks The @a app_id must be released using free().
129 int aul_widget_info_get_app_path(aul_widget_info_h info, char **app_path);
134 * @param[in] widget_id The widget app id
135 * @param[in] status The widget app status
136 * @return @c 0 on success,
137 * otherwise a negative error value
139 int aul_widget_instance_change_status(const char *widget_id, const char *status);
144 * @param[in] tag The log tag
145 * @param[in] format The log foramt
146 * @return @c 0 on success,
147 * otherwise a negative error value
149 int aul_widget_write_log(const char *tag, const char *format, ...);
151 int aul_widget_service_set_disable(const char *widget_id, bool is_disable);
154 * @brief Called when the widget event is delivered.
157 * @param[in] event_name The event name
158 * @param[in] event_data The event data
159 * @param[in] user_data The user data passed from the registration function
161 * @see aul_widget_set_event_cb()
163 typedef void (*aul_widget_event_cb)(const char *event_name, bundle *event_data,
167 * @brief Definition for AUL widget event: Saves image.
170 #define AUL_WIDGET_EVENT_SAVE_IMAGE "save.image"
173 * @brief Registers the event callback function.
176 * @param[in] callback The callback function
177 * @param[in] user_data The user data to be passed to the callback function
178 * @return @c 0 on success,
179 * otherwise a negative error value
181 * @see aul_widget_event_cb()
182 * @see aul_widget_unset_event_cb()
184 int aul_widget_set_event_cb(aul_widget_event_cb callback, void *user_data);
187 * @brief Unregisters the event callback function.
190 * @return @c 0 on success,
191 * otherwise a negative error value
193 * @see aul_widget_set_event_cb()
195 int aul_widget_unset_event_cb(void);
198 * @brief Sends the widget event.
200 * @privlevel platform
201 * @privilege %http://tizen.org/privilege/internal/default/platform
203 * @param[in] event_name The event name
204 * @param[in] event_data The event data
205 * @return @c 0 on success,
206 * otherwise a negative error value
208 * @see aul_widget_set_event_cb()
210 int aul_widget_send_event(const char *event_name, bundle *event_data);
213 int aul_widget_send_status_to_service(const char *class_id,
214 const char *instance_id, const char *sender_pkgid, int status);
216 int aul_widget_send_status_to_viewer(const char *class_id,
217 const char *instance_id, const char *viewer_endpoint,
218 int status, int err, bundle *extra);