Merge "add new resource management API" into tizen
[platform/core/api/application.git] / include / app_control_internal.h
1 /*
2  * Copyright (c) 2014 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 Replaces all data in the app_control with the bundle
39  *
40  * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
41  * @param [in] app_control The app_control handle
42  * @param [in] data The bundle handle
43  * @return 0 on success, otherwise a negative error value.
44  * @retval #APP_CONTROL_ERROR_NONE Successful
45  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
46  * @see app_control_export_as_bundle()
47  * @code
48  *
49  * #include <bundle.h>
50  * #include <app_control.h>
51  *
52  * app_control_h app_control = NULL;
53  * app_control_create(&app_control);
54  * app_control_import_from_bundle(app_control, b);
55  *
56  * @endcode
57  *
58  */
59 int app_control_import_from_bundle(app_control_h app_control, bundle *data);
60
61 /**
62  * @brief Returns a new bundle containing all data contained int the app_control
63  *
64  * @remarks The @a data must be released with bundle_free() by you.
65  * @param [in] app_control The app_control handle
66  * @param [out] data The bundle handle
67  * @return 0 on success, otherwise a negative error value.
68  * @retval #APP_CONTROL_ERROR_NONE Successful
69  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
70  * @see app_control_import_from_bundle()
71  * @code
72  *
73  * #include <bundle.h>
74  * #include <app_control.h>
75  *
76  * bundle* b = NULL;
77  * app_control_export_as_bundle(app_control, &b);
78  *
79  * @endcode
80  */
81 int app_control_export_as_bundle(app_control_h app_control, bundle **data);
82
83 int app_control_create_request(bundle *data, app_control_h *app_control);
84
85 int app_control_create_event(bundle *data, app_control_h *app_control);
86
87 int app_control_to_bundle(app_control_h app_control, bundle **data);
88
89 /**
90  * @brief Sets the window ID of the application.
91  *
92  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
93  * @param[in] app_control The app_control handle
94  * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
95  * @return @c 0 on success,
96  *         otherwise a negative error value
97  * @retval #APP_CONTROL_ERROR_NONE Successful
98  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
99  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
100  * @see app_control_get_window()
101  */
102 int app_control_set_window(app_control_h app_control, unsigned int id);
103
104 /**
105  * @brief Gets the window ID of the application.
106  *
107  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
108  * @param[in] app_control The app_control handle
109  * @param[out] id The window ID of the caller application
110  * @return @c 0 on success,
111  *         otherwise a negative error value
112  * @retval #APP_CONTROL_ERROR_NONE Successful
113  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
114  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
115  * @see app_control_set_app_id()
116  */
117 int app_control_get_window(app_control_h app_control, unsigned int *id);
118
119 /**
120  * @brief Requests the specified callee window to be transient for the caller window.
121  *
122  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
123  * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
124  * @param[in] app_control The app_control handle
125  * @param[in] callee_id The callee window ID
126  * @param[in] cbfunc The callback function to be called when the transient is requested
127  * @param[in] data A data pointer to pass to the callback function
128  * @return @c 0 on success,
129  *         otherwise a negative error value.
130  * @retval #APP_CONTROL_ERROR_NONE Successful
131  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
132  */
133 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
134
135 /**
136  * @}
137  */
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */