Add internal get select page info API for c# API 97/110797/11 accepted/tizen/3.0/common/20170210.071230 accepted/tizen/3.0/ivi/20170210.002014 accepted/tizen/3.0/mobile/20170210.001912 accepted/tizen/3.0/tv/20170210.001943 accepted/tizen/3.0/wearable/20170210.001954 submit/tizen_3.0/20170208.110217
authorHyunho Kang <hhstark.kang@samsung.com>
Wed, 18 Jan 2017 05:42:56 +0000 (14:42 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 7 Feb 2017 01:16:31 +0000 (10:16 +0900)
This API is made for C# API. C# API can control selected page in
proivder's callback. This API provide request page info to the
provider application so that provider application can manage
which page should be sent to the consumer.

- datacontrol_provider_get_select_page_info

Change-Id: I6d958ddcc83c947c44934e87c28e53a056fb7b47
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
include/data-control-provider.h
src/data-control-provider.c

index 732309391f96693481ac045abb1ea46f3cbca75f..2e69e00f11532cb6723f7e19472a81aad8a92dd9 100755 (executable)
@@ -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
index 9f6c518cafbd5678848a5bc220a80dc868775e66..bc6d8c9109fae3d57cd4e8fa7a2c040f9c260b82 100755 (executable)
@@ -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;