Adjust coding rules
[platform/core/api/application.git] / include / app_control_internal.h
1 /*
2  * Copyright (c) 2014 - 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 __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
18 #define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
19
20 #include <bundle.h>
21
22 #include <app_control.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @file app_control_internal.h
30  */
31
32 /**
33  * @addtogroup CAPI_APP_CONTROL_MODULE
34  * @{
35  */
36
37 /**
38  * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
39  * @details If a sub-app is terminated, framework will connect the previous app with the next app.
40  *          By default, this flag is 'false'
41  */
42 #define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"
43
44 /**
45  * @brief Definition for app_control data: The flag for attaching app.
46  * @details If this flag is set, callee app will be attached to caller app for a while and it will be detached when callee app is lowered.
47  *          By default, this flag is 'false'
48  */
49 #define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"
50
51 /**
52  * @brief Definition for app_control data : The flag for supporting recycling processes.
53  * @details By default, this flag is 'false'. Once it is set to 'true', launched sub-app process will be reused even if it was lowered later.
54  *
55  */
56 #define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"
57
58 /**
59  * @brief Replaces all data in the app_control with the bundle
60  *
61  * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
62  * @param [in] app_control The app_control handle
63  * @param [in] data The bundle handle
64  * @return 0 on success, otherwise a negative error value.
65  * @retval #APP_CONTROL_ERROR_NONE Successful
66  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
67  * @see app_control_export_as_bundle()
68  * @code
69  *
70  * #include <bundle.h>
71  * #include <app_control.h>
72  *
73  * app_control_h app_control = NULL;
74  * app_control_create(&app_control);
75  * app_control_import_from_bundle(app_control, b);
76  *
77  * @endcode
78  *
79  */
80 int app_control_import_from_bundle(app_control_h app_control, bundle *data);
81
82 /**
83  * @brief Returns a new bundle containing all data contained int the app_control
84  *
85  * @remarks The @a data must be released with bundle_free() by you.
86  * @param [in] app_control The app_control handle
87  * @param [out] data The bundle handle
88  * @return 0 on success, otherwise a negative error value.
89  * @retval #APP_CONTROL_ERROR_NONE Successful
90  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
91  * @see app_control_import_from_bundle()
92  * @code
93  *
94  * #include <bundle.h>
95  * #include <app_control.h>
96  *
97  * bundle* b = NULL;
98  * app_control_export_as_bundle(app_control, &b);
99  *
100  * @endcode
101  */
102 int app_control_export_as_bundle(app_control_h app_control, bundle **data);
103
104 int app_control_create_request(bundle *data, app_control_h *app_control);
105
106 int app_control_create_event(bundle *data, app_control_h *app_control);
107
108 int app_control_to_bundle(app_control_h app_control, bundle **data);
109
110 /**
111  * @brief Sets the window ID of the application.
112  *
113  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
114  * @param[in] app_control The app_control handle
115  * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
116  * @return @c 0 on success,
117  *         otherwise a negative error value
118  * @retval #APP_CONTROL_ERROR_NONE Successful
119  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
120  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
121  * @see app_control_get_window()
122  */
123 int app_control_set_window(app_control_h app_control, unsigned int id);
124
125 /**
126  * @brief Gets the window ID of the application.
127  *
128  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
129  * @param[in] app_control The app_control handle
130  * @param[out] id The window ID of the caller application
131  * @return @c 0 on success,
132  *         otherwise a negative error value
133  * @retval #APP_CONTROL_ERROR_NONE Successful
134  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
135  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
136  * @see app_control_set_app_id()
137  */
138 int app_control_get_window(app_control_h app_control, unsigned int *id);
139
140 /**
141  * @brief Requests the specified callee window to be transient for the caller window.
142  *
143  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
144  * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
145  * @param[in] app_control The app_control handle
146  * @param[in] callee_id The callee window ID
147  * @param[in] cbfunc The callback function to be called when the transient is requested
148  * @param[in] data A data pointer to pass to the callback function
149  * @return @c 0 on success,
150  *         otherwise a negative error value.
151  * @retval #APP_CONTROL_ERROR_NONE Successful
152  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
153  */
154 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
155
156 /**
157  * @}
158  */
159
160 #ifdef __cplusplus
161 }
162 #endif
163
164 #endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */
165