mtp_error_e mtp_gdbus_manager_delete_object(int mtp_device, int object_handle);
mtp_error_e mtp_gdbus_manager_get_object(int mtp_device,
int object_handle, char *dest_path);
+mtp_error_e mtp_gdbus_manager_get_partial_object(int mtp_device,
+ int object_handle, char *dest_path, int offset, int max_bytes, int *actual_written);
mtp_error_e mtp_gdbus_manager_get_thumbnail(int mtp_device,
int object_handle, char *dest_path);
mtp_error_e mtp_gdbus_manager_add_event_cb(mtp_event_cb callback, void *user_data);
int mtp_delete_object(mtp_device_h mtp_device, mtp_object_h object_handle);
int mtp_deviceinfo_get_bus_location(mtp_device_h mtp_device, int *bus_locaton);
int mtp_deviceinfo_get_device_number(mtp_device_h mtp_device, int *device_number);
+int mtp_get_partial_object(int mtp_device, int object_handle, char *dest_path, int offset, int max_bytes, int *actual_written);
#ifdef __cplusplus
}
/* LCOV_EXCL_STOP */
}
+int mtp_get_partial_object(int mtp_device, int object_handle, char *dest_path, int offset, int max_bytes, int *actual_written)
+{
+ int ret = MTP_ERROR_NONE;
+
+ _BEGIN();
+
+ /* precondition check start */
+
+ CHECK_SUPPORTED();
+ CHECK_INIT();
+ CHECK_ACTIVATED();
+ cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER);
+ cond_expr_ret(offset < 0, MTP_ERROR_INVALID_PARAMETER);
+ cond_expr_ret(max_bytes < 0, MTP_ERROR_INVALID_PARAMETER);
+
+ /* LCOV_EXCL_START */
+ cond_expr_ret(dest_path == NULL, MTP_ERROR_INVALID_PARAMETER);
+
+ /* precondition check end */
+
+ ret = mtp_gdbus_manager_get_partial_object(mtp_device, object_handle, dest_path, offset, max_bytes, actual_written);
+
+ _END();
+
+ return ret;
+ /* LCOV_EXCL_STOP */
+}
+
int mtp_get_thumbnail(int mtp_device, int object_handle, char *dest_path)
{
int ret = MTP_ERROR_NONE;
return result;
}
+mtp_error_e mtp_gdbus_manager_get_partial_object(int mtp_device,
+ int object_handle, char *dest_path, int offset, int max_bytes, int *actual_written)
+{
+ mtp_error_e result = MTP_ERROR_NONE;
+ GError *error = NULL;
+
+ if (manager_proxy == NULL)
+ return MTP_ERROR_NOT_COMM_INITIALIZED;
+
+ if (mtp_gdbuslib_manager_call_get_partial_object_sync(
+ manager_proxy,
+ mtp_device,
+ object_handle,
+ dest_path,
+ offset,
+ max_bytes,
+ actual_written,
+ &result,
+ NULL,
+ &error) == FALSE) {
+ result = MTP_ERROR_COMM_ERROR;
+
+ g_error_free(error);
+ }
+
+ return result;
+}
+
mtp_error_e mtp_gdbus_manager_get_thumbnail(int mtp_device,
int object_handle, char *dest_path)
{
<arg type="i" name="result" direction="out" />
</method>
+ <method name="GetPartialObject">
+ <arg type="i" name="mtp_device" direction="in" />
+ <arg type="i" name="object_handle" direction="in" />
+ <arg type="s" name="dest_path" direction="in" />
+ <arg type="i" name="offset" direction="in" />
+ <arg type="i" name="max_bytes" direction="in" />
+ <arg type="i" name="actual_written" direction="out" />
+ <arg type="i" name="result" direction="out" />
+ </method>
+
<method name="GetThumbnail">
<arg type="i" name="mtp_device" direction="in" />
<arg type="i" name="object_handle" direction="in" />
#include <mtp_internal.h>
#define BUFFER_LEN 100
-#define TEST_CASE_MAX 38
+#define TEST_CASE_MAX 39
#define TEST_LIST_MAX 20
#define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
return ret;
}
+int manager_test_get_partial_object(void)
+{
+ int ret = 0;
+ int i;
+ int input_int = 0;
+ mtp_filetype_e filetype = MTP_FILETYPE_JPEG;
+ char *filename = NULL;
+ char filepath[100] = {0,};
+ int list_max = 0;
+ int actual_written;
+
+ BEGIN();
+
+ TC_PRT("total object_num[%d]", obj_count);
+
+ list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX;
+
+ for (i = 0; i < list_max; i++) {
+ ret = mtp_objectinfo_get_file_name(mtp_device, mtp_objects[i], &filename);
+ ret = mtp_objectinfo_get_file_type(mtp_device, mtp_objects[i], &filetype);
+ TC_PRT("ret[%d]: object id[%d] - filename[%s], filetype[%s]",
+ ret, mtp_objects[i], filename, test_filetype_to_string(filetype));
+ }
+
+ if (!test_get_user_int("==> Input Object ID :", &input_int)) {
+ TC_PRT("Invalid Input !!![%d]", input_int);
+ END();
+ return -1;
+ }
+
+ snprintf(filepath, 100, "/tmp/JpegObject_%d.jpg", input_int);
+ TC_PRT("filepath[%s]", filepath);
+
+ ret = mtp_get_partial_object(mtp_device, input_int, filepath, 0, 250000, &actual_written);
+ TC_PRT("ret[%d]: input id[%d], actual written bytes[%d]", ret, input_int, actual_written);
+
+ END();
+ return ret;
+}
+
int manager_test_get_thumbnail(void)
{
{"get object handle using ALL Image file type", 35, application_test_get_object_handle_using_all_image},
{"test add callback function", 36, application_test_add_event_callback},
{"test remove callback function", 37, application_test_remove_event_callback},
+ {"mtp_get_partial_object", 38, manager_test_get_partial_object},
{"get object and get thumbnail test", TEST_CASE_MAX, NULL},
/*-----------*/