2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_APPFW_DATA_CONTROL_BULK_H__
18 #define __TIZEN_APPFW_DATA_CONTROL_BULK_H__
20 #include <data_control_types.h>
28 * @file data_control_bulk.h
29 * @brief This is the header file for bulk data feature of the Data Control module. \n
30 * All callbacks are called in the main loop context, unless stated otherwise.
35 * @addtogroup CAPI_DATA_CONTROL_CONSUMER_MODULE
41 * @brief Called when a response is received for a bulk operation from a provider application.
44 * @param[in] request_id The request ID
45 * @param[in] provider The provider handle. @a provider is valid only inside this function. \n
46 * @a provider should not be destroyed.
47 * @param[in] bulk_results The result data for each insert request. @a bulk_results is valid only inside this function. \n
48 * @a bulk_results should not be freed.
49 * @param[in] provider_result Set to @c true if the data control provider successfully processed, \n
50 * otherwise set to @c false
51 * @param[in] error The error message from the data control provider. @a error is valid only inside this function. \n
52 * @a error should not be freed.
53 * @param[in] user_data The user data passed from the register function
54 * @see data_control_sql_register_insert_bulk_data_response_cb()
55 * @see data_control_map_register_add_bulk_data_response_cb()
57 typedef void (*data_control_bulk_cb)(int request_id, data_control_h provider, data_control_bulk_result_data_h bulk_results, bool provider_result, const char *error, void *user_data);
61 * @brief Gets the n-th bundle from bulk data.
63 * @remarks The @a data should not be released. \n
64 * It will be released when data_control_bulk_data_destroy() is called.
65 * @param[in] bulk_data The bulk data handle
66 * @param[in] idx The bundle index. Index starts at 0
67 * @param[out] data The n-th bundle.
68 * @return @c 0 on success,
69 * otherwise a negative error value
70 * @retval #DATA_CONTROL_ERROR_NONE Successful
71 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
72 * @see data_control_bulk_data_add()
73 * @see data_control_bulk_data_destroy()
75 int data_control_bulk_data_get_data(data_control_bulk_data_h bulk_data, int idx, bundle **data);
79 * @brief Gets the bulk data bundle count.
81 * @param[in] bulk_data The bulk data handle
82 * @param[out] count The bundle count
83 * @return @c 0 on success,
84 * otherwise a negative error value
85 * @retval #DATA_CONTROL_ERROR_NONE Successful
86 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
88 int data_control_bulk_data_get_count(data_control_bulk_data_h bulk_data, int *count);
92 * @brief Adds a bundle to bulk data.
94 * @remarks The order in which bundles are added is preserved. Bundle indexes start from 0.
95 * @param[in] bulk_data The bulk data handle
96 * @param[in] data The bundle
97 * @return @c 0 on success,
98 * otherwise a negative error value
99 * @retval #DATA_CONTROL_ERROR_NONE Successful
100 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
101 * @retval #DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
103 int data_control_bulk_data_add(data_control_bulk_data_h bulk_data, bundle *data);
107 * @brief Creates bulk data.
109 * @remarks The @a bulk_data should be released using data_control_bulk_data_destroy().
110 * @param[out] bulk_data The bulk data handle
111 * @return @c 0 on success,
112 * otherwise a negative error value
113 * @retval #DATA_CONTROL_ERROR_NONE Successful
114 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
115 * @retval #DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
117 int data_control_bulk_data_create(data_control_bulk_data_h *bulk_data);
121 * @brief Destroys bulk data.
123 * @param[in] bulk_data The bulk data handle
124 * @return @c 0 on success,
125 * otherwise a negative error value
126 * @retval #DATA_CONTROL_ERROR_NONE Successful
127 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
129 int data_control_bulk_data_destroy(data_control_bulk_data_h bulk_data);
133 * @brief Gets the n-th bundle from bulk result data.
135 * @remarks The @a data should not be released. \n
136 * It will be released when data_control_bulk_result_data_destroy() is called.
137 * @param[in] result_data The bulk result data handle
138 * @param[in] idx The bundle index. Index starts at 0
139 * @param[out] data The n-th bundle
140 * @param[out] result Bulk operation result. Possible values and their meaning are defined by the developer.
141 * @return @c 0 on success,
142 * otherwise a negative error value
143 * @retval #DATA_CONTROL_ERROR_NONE Successful
144 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
145 * @see data_control_bulk_result_data_add()
146 * @see data_control_bulk_result_data_destroy()
148 int data_control_bulk_result_data_get_result_data(data_control_bulk_result_data_h result_data, int idx, bundle **data, int *result);
152 * @brief Gets the bulk result data bundle count.
154 * @param[in] result_data The bulk result data handle
155 * @param[out] count The bundle count
156 * @return @c 0 on success,
157 * otherwise a negative error value
158 * @retval #DATA_CONTROL_ERROR_NONE Successful
159 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
161 int data_control_bulk_result_data_get_count(data_control_bulk_result_data_h result_data, int *count);
165 * @brief Adds bulk data.
167 * @remarks The order in which bundles are added is preserved. Bundle indexes start from 0.
168 * @param[in] result_data The bulk result data handle
169 * @param[in] data The bundle
170 * @param[in] result Bulk operation result. Possible values and their meaning are defined by the developer.
171 * @return @c 0 on success,
172 * otherwise a negative error value
173 * @retval #DATA_CONTROL_ERROR_NONE Successful
174 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
175 * @retval #DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
176 * @see data_control_bulk_result_data_get_result_data()
178 int data_control_bulk_result_data_add(data_control_bulk_result_data_h result_data, bundle *data, int result);
182 * @brief Creates bulk result data.
184 * @remarks The @a result_data should be released using data_control_bulk_result_data_destroy().
185 * @param[out] result_data The bulk result data handle
186 * @return @c 0 on success,
187 * otherwise a negative error value
188 * @retval #DATA_CONTROL_ERROR_NONE Successful
189 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
190 * @retval #DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
192 int data_control_bulk_result_data_create(data_control_bulk_result_data_h *result_data);
196 * @brief Destroys bulk result data.
198 * @param[in] result_data The bulk result data handle
199 * @return @c 0 on success,
200 * otherwise a negative error value
201 * @retval #DATA_CONTROL_ERROR_NONE Successful
202 * @retval #DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
204 int data_control_bulk_result_data_destroy(data_control_bulk_result_data_h result_data);
216 #endif /* __TIZEN_APPFW_DATA_CONTROL_BULK_H__ */