summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/data-control-provider.h19
-rwxr-xr-xsrc/data-control-provider.c29
2 files changed, 48 insertions, 0 deletions
diff --git a/include/data-control-provider.h b/include/data-control-provider.h
index 7323093..2e69e00 100755
--- a/include/data-control-provider.h
+++ b/include/data-control-provider.h
@@ -422,6 +422,25 @@ EXPORT_API int datacontrol_provider_send_select_result_without_data(int request_
EXPORT_API int datacontrol_provider_write_socket(int fd, void *buffer, unsigned int nbytes,
unsigned int *bytes_write);
+/**
+ * @brief Gets select request page info.
+ * @details This API is made for C# API. C# API can control selected page in proivder's callback. \n
+ * This API provide request page info to the provider application so that provider application \n
+ * can manage which page should be sent to the consumer.
+ *
+ * @param[in] request_id The request ID
+ * @param[out] page_num The requested page number
+ * @param[out] count_per_page The requested count per page
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #DATACONTROL_ERROR_NONE Successful
+ * @retval #DATACONTROL_ERROR_IO_ERROR I/O error
+ * @retval #DATACONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+EXPORT_API int datacontrol_provider_get_select_page_info(int request_id, int *page_num, int *count_per_page);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/data-control-provider.c b/src/data-control-provider.c
index 9f6c518..bc6d8c9 100755
--- a/src/data-control-provider.c
+++ b/src/data-control-provider.c
@@ -1841,6 +1841,35 @@ int datacontrol_provider_send_select_result_without_data(int request_id, int *fd
return ret;
}
+int datacontrol_provider_get_select_page_info(int request_id, int *page_num, int *count_per_page)
+{
+ bundle *b;
+ const char *page_num_str;
+ const char *count_per_page_str;
+
+ if (__request_table == NULL) {
+ LOGE("__request_table is NULL");
+ return DATACONTROL_ERROR_IO_ERROR;
+ }
+
+ b = g_hash_table_lookup(__request_table, &request_id);
+ if (!b) {
+ LOGE("No data for the request id: %d", request_id);
+ return DATACONTROL_ERROR_INVALID_PARAMETER;
+ }
+
+ page_num_str = bundle_get_val(b, RESULT_PAGE_NUMBER);
+ count_per_page_str = bundle_get_val(b, MAX_COUNT_PER_PAGE);
+ if (page_num_str == NULL || count_per_page_str == NULL) {
+ LOGE("No page data for the request id: %d, ", request_id);
+ return DATACONTROL_ERROR_INVALID_PARAMETER;
+ }
+ *page_num = _get_int_from_str(page_num_str);
+ *count_per_page = _get_int_from_str(count_per_page_str);
+
+ return DATACONTROL_ERROR_NONE;
+}
+
int datacontrol_provider_send_bulk_insert_result(int request_id, data_control_bulk_result_data_h bulk_result_data)
{
int ret;