Move function definition to aul header
[platform/core/appfw/aul-1.git] / include / aul_app_group.h
1 /*
2  * Copyright (c) 2019 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 __AUL_APP_GROUP_H__
18 #define __AUL_APP_GROUP_H__
19
20 #include <stdbool.h>
21 #include <sys/types.h>
22 #include <unistd.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @brief The AUL application group information handle.
30  * @since_tizen 5.5
31  */
32 typedef struct aul_app_group_info_s *aul_app_group_info_h;
33
34 typedef void (*aul_app_group_leader_id_cb)(const char *leader_id, void* user_data);
35
36 typedef void (*aul_app_group_info_cb)(aul_app_group_info_h info, void *user_data);
37
38 /**
39  * @brief Gets the ID.
40  * @since_tizen 5.5
41  * @remarks You should not release @a appid by using free().
42  *
43  * @param[in]   h               The app group info handle
44  * @param[out]  id              The ID
45  * @return      @c 0 on success,
46  *              otherwise a negative error value
47  *
48  * @remarks This function is only for App Framework internally.
49  */
50 int aul_app_group_info_get_id(aul_app_group_info_h h, const char **id);
51
52 /**
53  * @brief Gets the process ID.
54  * @since_tizen 5.5
55  *
56  * @param[in]   h               The app group info handle
57  * @param[out]  pid             The process ID
58  * @return      @c 0 on success,
59  *              otherwise a negative error value
60  *
61  * @remarks This function is only for App Framework internally.
62  */
63 int aul_app_group_info_get_pid(aul_app_group_info_h h, pid_t *pid);
64
65 /**
66  * @brief Gets the application ID.
67  * @since_tizen 5.5
68  * @remarks You should not release @a appid by using free().
69  *
70  * @param[in]   h               The app group info handle
71  * @param[out]  appid           The application ID
72  * @return      @c 0 on success,
73  *              otherwise a negative error value
74  *
75  * @remarks This function is only for App Framework internally.
76  */
77 int aul_app_group_info_get_appid(aul_app_group_info_h h, const char **appid);
78
79 /**
80  * @brief Gets the package ID.
81  * @since_tizen 5.5
82  * @remarks You should not release @a appid by using free().
83  *
84  * @param[in]   h               The app group info handle
85  * @param[out]  pkgid           The package ID
86  * @return      @c 0 on success,
87  *              otherwise a negative error value
88  *
89  * @remarks This function is only for App Framework internally.
90  */
91 int aul_app_group_info_get_pkgid(aul_app_group_info_h h, const char **pkgid);
92
93 /**
94  * @brief Gets the window ID.
95  * @since_tizen 5.5
96  *
97  * @param[in]   h               The app group info handle
98  * @param[out]  wid             The window ID
99  * @return      @c 0 on success,
100  *              otherwise a negative error value
101  *
102  * @remarks This function is only for App Framework internally.
103  */
104 int aul_app_group_info_get_window(aul_app_group_info_h h, int *wid);
105
106 /**
107  * @brief Gets the flag that the group is running foreground.
108  * @since_tizen 5.5
109  *
110  * @param[in]   h               The app group info handle
111  * @param[out]  fg_flag         The flag of the foreground
112  * @return      @c 0 on success,
113  *              otherwise a negative error value
114  *
115  * @remarks This function is only for App Framework internally.
116  */
117 int aul_app_group_info_get_fg_flag(aul_app_group_info_h h, bool *fg_flag);
118
119 /**
120  * @brief Gets the status of the instance.
121  * @since_tizen 5.5
122  *
123  * @param[in]   h               The app group info handle
124  * @param[out]  status          The status
125  * @return      @c 0 on success,
126  *              otherwise a negative error value
127  *
128  * @remarks This function is only for App Framework internally.
129  */
130 int aul_app_group_info_get_status(aul_app_group_info_h h, int *status);
131
132 /**
133  * @brief Retrieves the leader instances.
134  * @since_tizen 5.5
135  *
136  * @param[in]   callback        The callback function
137  * @param[in]   user_data       The user data to be passed the callback function
138  * @return      @c 0 on success,
139  *              otherwise a negative error value
140  *
141  * @remarks This function is only for App Framework internally.
142  */
143 int aul_app_group_foreach_leader_ids(aul_app_group_leader_id_cb callback,
144                 void *user_data);
145
146 /**
147  * @brief Retrieves the group instances.
148  * @since_tizen 5.5
149  *
150  * @param[in]   leader_id       The leader ID of the app group.
151  * @param[in]   callback        The callback function
152  * @param[in]   user_data       The user data to be passed the callback function
153  * @return      @c 0 on success,
154  *              otherwise a negative error value
155  *
156  * @remarks This function is only for App Framework internally.
157  */
158 int aul_app_group_foreach_group_info(const char *leader_id,
159                 aul_app_group_info_cb callback, void *user_data);
160
161 /**
162  * @brief Retrieves the idle instances.
163  * @since_tizen 5.5
164  *
165  * @param[in]   callback        The callback function
166  * @param[in]   user_data       The user data to be passed the callback function
167  * @return      @c 0 on success,
168  *              otherwise a negative error value
169  *
170  * @remarks This function is only for App Framework internally.
171  */
172 int aul_app_group_foreach_idle_info(aul_app_group_info_cb callback,
173                 void *user_data);
174
175 /**
176  * @brief Sets the window.
177  * @since_tizen 5.5
178  *
179  * @param[in]   id              The instance ID
180  * @param[in]   wid             The window(surface) ID
181  * @return      @c 0 on success,
182  *              otherwise a negative error value
183  *
184  * @remarks This function is only for App Framework internally.
185  */
186 int aul_app_group_set_window_v2(const char *id, int wid);
187
188 /**
189  * @brief Lowers the window.
190  * @since_tizen 5.5
191  *
192  * @param[in]   id              The instance ID
193  * @param[out]  exit            The flag if it's 'true', the instance should be terminated
194  * @return      @c 0 on success,
195  *              otherwise a negative error value
196  *
197  * @remarks This function is only for App Framework internally.
198  */
199 int aul_app_group_lower_v2(const char *id, bool *exit);
200
201 /**
202  * @brief Adds a new app group to the app group.
203  * @details A new app group will be added using the given window ID.
204  * @since_tizen 6.0
205  *
206  * @param[in]   wid             The window(surface) ID
207  * @return      @c 0 on success,
208  *              otherwise a negatvie error value
209  *
210  * @remarks This function is only for App Framework internally.
211  */
212 int aul_app_group_add(int wid);
213
214 /**
215  * @brief Removes the app group using the given window ID.
216  * @since_tizen 6.0
217  *
218  * @param[in]   wid             The window(surface) ID
219  * @return      @c 0 on success,
220  *              otherwise a negative error value
221  *
222  * @remarks This function is only for App Framework internally.
223  */
224 int aul_app_group_remove(int wid);
225
226 #ifdef __cplusplus
227 }
228 #endif
229
230 #endif /* __AUL_APP_GROUP_H__ */