summaryrefslogtreecommitdiff
path: root/include/app_control_internal.h
blob: 54502c29993e41a7db804032dc85aeb69d480a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
#define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__

#include <bundle.h>

#include <app_control.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file app_control_internal.h
 */

/**
 * @addtogroup CAPI_APP_CONTROL_MODULE
 * @{
 */

/**
 * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
 * @details If a sub-app is terminated, framework will connect the previous app with the next app.
 *          By default, this flag is 'false'
 */
#define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"

/**
 * @brief Definition for app_control data: The flag for attaching app.
 * @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.
 *          By default, this flag is 'false'
 */
#define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"

/**
 * @brief Definition for app_control data : The flag for supporting recycling processes.
 * @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.
 *
 */
#define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"

/**
 * @brief Replaces all data in the app_control with the bundle
 *
 * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
 * @param [in] app_control The app_control handle
 * @param [in] data The bundle handle
 * @return 0 on success, otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @see	app_control_export_as_bundle()
 * @code
 *
 * #include <bundle.h>
 * #include <app_control.h>
 *
 * app_control_h app_control = NULL;
 * app_control_create(&app_control);
 * app_control_import_from_bundle(app_control, b);
 *
 * @endcode
 *
 */
int app_control_import_from_bundle(app_control_h app_control, bundle *data);

/**
 * @brief Returns a new bundle containing all data contained int the app_control
 *
 * @remarks The @a data must be released with bundle_free() by you.
 * @param [in] app_control The app_control handle
 * @param [out] data The bundle handle
 * @return 0 on success, otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @see	app_control_import_from_bundle()
 * @code
 *
 * #include <bundle.h>
 * #include <app_control.h>
 *
 * bundle* b = NULL;
 * app_control_export_as_bundle(app_control, &b);
 *
 * @endcode
 */
int app_control_export_as_bundle(app_control_h app_control, bundle **data);

int app_control_create_request(bundle *data, app_control_h *app_control);

int app_control_create_event(bundle *data, app_control_h *app_control);

int app_control_to_bundle(app_control_h app_control, bundle **data);

/**
 * @brief Sets the window ID of the application.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @param[in] app_control The app_control handle
 * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
 * @see app_control_get_window()
 */
int app_control_set_window(app_control_h app_control, unsigned int id);

/**
 * @brief Gets the window ID of the application.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @param[in] app_control The app_control handle
 * @param[out] id The window ID of the caller application
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
 * @see app_control_set_app_id()
 */
int app_control_get_window(app_control_h app_control, unsigned int *id);

/**
 * @brief Requests the specified callee window to be transient for the caller window.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
 * @param[in] app_control The app_control handle
 * @param[in] callee_id The callee window ID
 * @param[in] cbfunc The callback function to be called when the transient is requested
 * @param[in] data A data pointer to pass to the callback function
 * @return @c 0 on success,
 *         otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 */
int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */