Add new functions to handling running components
[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 /**
35  * @brief Gets the ID.
36  * @since_tizen 5.5
37  * @remarks You should not release @a appid by using free().
38  *
39  * @param[in]   h               The app group info handle
40  * @param[out]  id              The ID
41  * @return      @c 0 on success,
42  *              otherwise a negative error value
43  *
44  * @remarks This function is only for App Framework internally.
45  */
46 int aul_app_group_info_get_id(aul_app_group_info_h h, const char **id);
47
48 /**
49  * @brief Gets the process ID.
50  * @since_tizen 5.5
51  *
52  * @param[in]   h               The app group info handle
53  * @param[out]  pid             The process ID
54  * @return      @c 0 on success,
55  *              otherwise a negative error value
56  *
57  * @remarks This function is only for App Framework internally.
58  */
59 int aul_app_group_info_get_pid(aul_app_group_info_h h, pid_t *pid);
60
61 /**
62  * @brief Gets the application ID.
63  * @since_tizen 5.5
64  * @remarks You should not release @a appid by using free().
65  *
66  * @param[in]   h               The app group info handle
67  * @param[out]  appid           The application ID
68  * @return      @c 0 on success,
69  *              otherwise a negative error value
70  *
71  * @remarks This function is only for App Framework internally.
72  */
73 int aul_app_group_info_get_appid(aul_app_group_info_h h, const char **appid);
74
75 /**
76  * @brief Gets the package ID.
77  * @since_tizen 5.5
78  * @remarks You should not release @a appid by using free().
79  *
80  * @param[in]   h               The app group info handle
81  * @param[out]  pkgid           The package ID
82  * @return      @c 0 on success,
83  *              otherwise a negative error value
84  *
85  * @remarks This function is only for App Framework internally.
86  */
87 int aul_app_group_info_get_pkgid(aul_app_group_info_h h, const char **pkgid);
88
89 /**
90  * @brief Gets the window ID.
91  * @since_tizen 5.5
92  *
93  * @param[in]   h               The app group info handle
94  * @param[out]  wid             The window ID
95  * @return      @c 0 on success,
96  *              otherwise a negative error value
97  *
98  * @remarks This function is only for App Framework internally.
99  */
100 int aul_app_group_info_get_window(aul_app_group_info_h h, int *wid);
101
102 /**
103  * @brief Gets the flag that the group is running foreground.
104  * @since_tizen 5.5
105  *
106  * @param[in]   h               The app group info handle
107  * @param[out]  fg_flag         The flag of the foreground
108  * @return      @c 0 on success,
109  *              otherwise a negative error value
110  *
111  * @remarks This function is only for App Framework internally.
112  */
113 int aul_app_group_info_get_fg_flag(aul_app_group_info_h h, bool *fg_flag);
114
115 /**
116  * @brief Gets the status of the instance.
117  * @since_tizen 5.5
118  *
119  * @param[in]   h               The app group info handle
120  * @param[out]  status          The status
121  * @return      @c 0 on success,
122  *              otherwise a negative error value
123  *
124  * @remarks This function is only for App Framework internally.
125  */
126 int aul_app_group_info_get_status(aul_app_group_info_h h, int *status);
127
128 /**
129  * @brief Retrieves the leader instances.
130  * @since_tizen 5.5
131  *
132  * @param[in]   callback        The callback function
133  * @param[in]   user_data       The user data to be passed the callback function
134  * @return      @c 0 on success,
135  *              otherwise a negative error value
136  *
137  * @remarks This function is only for App Framework internally.
138  */
139 int aul_app_group_foreach_leader_ids(void (*callback)(const char *, void *),
140                 void *user_data);
141
142 /**
143  * @brief Retrieves the group instances.
144  * @since_tizen 5.5
145  *
146  * @param[in]   leader_id       The leader ID of the app group.
147  * @param[in]   callback        The callback function
148  * @param[in]   user_data       The user data to be passed the callback function
149  * @return      @c 0 on success,
150  *              otherwise a negative error value
151  *
152  * @remarks This function is only for App Framework internally.
153  */
154 int aul_app_group_foreach_group_info(const char *leader_id,
155                 void (*callback)(aul_app_group_info_h, void *),
156                 void *user_data);
157
158 /**
159  * @brief Retrieves the idle instances.
160  * @since_tizen 5.5
161  *
162  * @param[in]   callback        The callback function
163  * @param[in]   user_data       The user data to be passed the callback function
164  * @return      @c 0 on success,
165  *              otherwise a negative error value
166  *
167  * @remarks This function is only for App Framework internally.
168  */
169 int aul_app_group_foreach_idle_info(
170                 void (*callback)(aul_app_group_info_h, void *),
171                 void *user_data);
172
173 /**
174  * @brief Sets the window.
175  * @since_tizen 5.5
176  *
177  * @param[in]   id              The instance ID
178  * @param[in]   wid             The window(surface) ID
179  * @return      @c 0 on success,
180  *              otherwise a negative error value
181  *
182  * @remarks This function is only for App Framework internally.
183  */
184 int aul_app_group_set_window_v2(const char *id, int wid);
185
186 /**
187  * @brief Lowers the window.
188  * @since_tizen 5.5
189  *
190  * @param[in]   id              The instance ID
191  * @param[out]  exit            The flag if it's 'true', the instance should be terminated
192  * @return      @c 0 on success,
193  *              otherwise a negative error value
194  *
195  * @remarks This function is only for App Framework internally.
196  */
197 int aul_app_group_lower_v2(const char *id, bool *exit);
198
199 #ifdef __cplusplus
200 }
201 #endif
202
203 #endif /* __AUL_APP_GROUP_H__ */