From 006f59071815c5e67647ea899c441599f996a603 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Mon, 16 Nov 2015 22:08:40 +0900 Subject: [PATCH 01/16] Sync with Tizen 2.4 Change-Id: I33a88302b9ed5cb86ff7c91808fc57889b98375d Signed-off-by: HyiHong Chae --- include/mtp.h | 3 ++- packaging/capi-network-mtp.spec | 6 +++--- test/mtp_unit_test.c | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/mtp.h b/include/mtp.h index 1297417..bae4233 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -141,7 +141,8 @@ typedef enum { MTP_EVENT_OBJECT_ADDED, /**< Object is added */ MTP_EVENT_OBJECT_REMOVED, /**< Object is removed */ MTP_EVENT_DEVICE_ADDED, /**< Device is added */ - MTP_EVENT_DEVICE_REMOVED /**< Device is removed */ + MTP_EVENT_DEVICE_REMOVED, /**< Device is removed */ + MTP_EVENT_DAEMON_TERMINATED /**< Daemon is terminated */ } mtp_event_e; /** diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 139898b..3355fe0 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,14 +1,14 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.2.1 +Version: 1.2.2 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 Source0: %{name}-%{version}.tar.gz # This package would be built only TV -%if "%{?tizen_profile_name}" != "tv" -ExcludeArch: %{arm} %ix86 x86_64 +%if "%{?profile}" != "tv" +ExcludeArch: %arm aarch64 %ix86 x86_64 %endif BuildRequires: cmake diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 5aa8377..8667883 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -1013,7 +1013,14 @@ int application_test_get_object_handle_using_all_image(void) void __test_mtp_event_cb(mtp_event_e state, int arg, void *user_data) { + int ret = 0; + TC_PRT("state [%d] : %d", state, arg); + + if (state == MTP_EVENT_DAEMON_TERMINATED) { + ret = mtp_deinitialize(); + TC_PRT("ret[%d] : Terminated daemon", ret); + } } int application_test_event_callback(void) -- 2.7.4 From c4fa94c7d0425efe3b43e69443d78b434316da9d Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Wed, 18 Nov 2015 13:45:35 +0900 Subject: [PATCH 02/16] modify to support mobile profile. Change-Id: I4b41e5bbad65e83b84619a2315f11cb53dd5e7c8 Signed-off-by: HyiHong Chae --- packaging/capi-network-mtp.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 3355fe0..87cb0b2 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -6,10 +6,7 @@ Group: Network & Connectivity/Other License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -# This package would be built only TV -%if "%{?profile}" != "tv" -ExcludeArch: %arm aarch64 %ix86 x86_64 -%endif +ExcludeArch: %ix86 x86_64 BuildRequires: cmake BuildRequires: pkgconfig(dlog) -- 2.7.4 From c7c381b986f431a645ed940435b204e4677e7b61 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Fri, 20 Nov 2015 18:11:23 +0900 Subject: [PATCH 03/16] change parameter type of some APIs Change-Id: Ifbe370712512bac25712d1b650eea981821fe786 Signed-off-by: HyiHong Chae --- include/mtp.h | 4 ++-- packaging/capi-network-mtp.spec | 2 +- src/mtp.c | 12 ++++++------ test/mtp_unit_test.c | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/mtp.h b/include/mtp.h index bae4233..1f6f3ac 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -419,7 +419,7 @@ MTP_API int mtp_storageinfo_get_description(int device_handle, int storage_id, c * * @see mtp_get_storage_ids() */ -MTP_API int mtp_storageinfo_get_freespace(int device_handle, int storage_id, guint64 *freespace); +MTP_API int mtp_storageinfo_get_freespace(int device_handle, int storage_id, unsigned long long *freespace); /** * @brief Get the max capacity of the storage information. @@ -435,7 +435,7 @@ MTP_API int mtp_storageinfo_get_freespace(int device_handle, int storage_id, gui * * @see mtp_get_storage_ids() */ -MTP_API int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, guint64 *maxcapacity); +MTP_API int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, unsigned long long *maxcapacity); /** * @brief Get the storage type of the storage information. diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 87cb0b2..8b94159 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.2.2 +Version: 1.2.3 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp.c b/src/mtp.c index d1096a1..3ce3e87 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -493,7 +493,7 @@ int mtp_storageinfo_get_description(int device_handle, int storage_id, char **de return ret; } -int mtp_storageinfo_get_freespace(int device_handle, int storage_id, guint64 *freespace) +int mtp_storageinfo_get_freespace(int device_handle, int storage_id, unsigned long long *freespace) { int ret = MTP_ERROR_NONE; @@ -509,16 +509,16 @@ int mtp_storageinfo_get_freespace(int device_handle, int storage_id, guint64 *fr /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_freespace(device_handle, storage_id, freespace); + ret = mtp_gdbus_storageinfo_get_freespace(device_handle, storage_id, (guint64 *)freespace); - TC_PRT("freespace %d", (int)*freespace); + TC_PRT("freespace %llu", *freespace); _END(); return ret; } -int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, guint64 *maxcapacity) +int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, unsigned long long *maxcapacity) { int ret = MTP_ERROR_NONE; @@ -534,9 +534,9 @@ int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, guint64 * /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_maxcapacity(device_handle, storage_id, maxcapacity); + ret = mtp_gdbus_storageinfo_get_maxcapacity(device_handle, storage_id, (guint64 *)maxcapacity); - TC_PRT("maxcapacity %d", (int)*maxcapacity); + TC_PRT("maxcapacity %llu", *maxcapacity); _END(); diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 8667883..6488e98 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -506,11 +506,11 @@ int storageinfo_test_get_description(void) int storageinfo_test_get_freespace(void) { int ret = 0; - guint64 value = 0; + unsigned long long value = 0; BEGIN(); ret = mtp_storageinfo_get_freespace(handle, strg_handle, &value); - TC_PRT("ret[%d]: freespace[%d]", ret, (int)value); + TC_PRT("ret[%d]: freespace[%llu]", ret, value); END(); return ret; @@ -519,11 +519,11 @@ int storageinfo_test_get_freespace(void) int storageinfo_test_get_maxcapacity(void) { int ret = 0; - guint64 value = 0; + unsigned long long value = 0; BEGIN(); ret = mtp_storageinfo_get_maxcapacity(handle, strg_handle, &value); - TC_PRT("ret[%d]: maxcapacity[%d]", ret, (int)value); + TC_PRT("ret[%d]: maxcapacity[%llu]", ret, value); END(); return ret; @@ -1118,7 +1118,7 @@ int application_test_scenario(void) tc_table_t tc_table[] = { /* manager api */ {"mtp_initialize", 1, manager_test_initialize}, - {"mtp_get_device_list", 2, manager_test_get_device_list}, + {"mtp_get_device_list", 2, manager_test_get_device_list}, {"mtp_get_device_handle", 3, manager_test_get_device_handle}, {"mtp_get_storage_ids", 4, manager_test_get_storage_ids}, {"mtp_get_object_handles", 5, manager_test_get_object_handles}, -- 2.7.4 From 5497abd9b020703e30c7e7462497028769d9ab16 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Fri, 18 Dec 2015 18:25:33 +0900 Subject: [PATCH 04/16] remove the unnecessary ref_count value. Change-Id: I7b4d72659979b727dfe148cd1925156e68068113 Signed-off-by: HyiHong Chae --- packaging/capi-network-mtp.spec | 2 +- src/mtp_db.c | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 8b94159..e03c530 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.2.3 +Version: 1.2.4 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp_db.c b/src/mtp_db.c index 84e518d..fe4b685 100755 --- a/src/mtp_db.c +++ b/src/mtp_db.c @@ -28,7 +28,6 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static sqlite3 *db; -int ref_count; mtp_error_e mtp_db_init() { @@ -37,15 +36,11 @@ mtp_error_e mtp_db_init() MTP_DB_LOCK; - if (ref_count > 0) { - ref_count++; - } else if (db == NULL) { + if (db == NULL) { sql_ret = sqlite3_open_v2(MTP_DB_FILE, &db, - SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); + SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_READWRITE, NULL); - if (sql_ret == SQLITE_OK) - ref_count++; - else + if (sql_ret != SQLITE_OK) ret = MTP_ERROR_DB; } @@ -125,10 +120,7 @@ mtp_error_e mtp_db_deinit() MTP_DB_LOCK; - if (ref_count > 0) - ref_count--; - - if (db != NULL && ref_count == 0) { + if (db != NULL) { sql_ret = sqlite3_close(db); if (sql_ret != SQLITE_OK) -- 2.7.4 From 61af2a21e477ed5fa99d49bb4601cbf12a3d2f22 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Wed, 23 Dec 2015 15:29:54 +0900 Subject: [PATCH 05/16] Apply ACR comment in native mtp api Signed-off-by: Ji-hoon Jung Change-Id: I4001f01051ef2b9c450be787fd4e3b97f7fc95f6 --- doc/mtp_doc.h | 168 +++++++ include/mtp.h | 966 ++++++++++++++++++++++++++++------------ include/mtp_db.h | 2 +- include/mtp_gdbus.h | 1 + include/mtp_gdbus_manager.h | 20 +- include/mtp_gdbus_objectinfo.h | 4 +- include/mtp_gdbus_storageinfo.h | 20 +- include/mtp_internal.h | 4 +- include/mtp_private.h | 65 +++ packaging/capi-network-mtp.spec | 2 +- src/mtp.c | 389 +++++++++------- src/mtp_db.c | 6 +- src/mtp_gdbus_deviceinfo.c | 32 +- src/mtp_gdbus_manager.c | 95 ++-- src/mtp_gdbus_objectinfo.c | 16 +- src/mtp_gdbus_storageinfo.c | 60 +-- src/mtp_gdbuslib.xml | 59 +-- test/mtp_unit_test.c | 430 ++++++++---------- 18 files changed, 1491 insertions(+), 848 deletions(-) create mode 100755 doc/mtp_doc.h create mode 100755 include/mtp_private.h diff --git a/doc/mtp_doc.h b/doc/mtp_doc.h new file mode 100755 index 0000000..a041d94 --- /dev/null +++ b/doc/mtp_doc.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * 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_NETWORK_MTP_DOC_H__ +#define __TIZEN_NETWORK_MTP_DOC_H__ + +/** + * @defgroup CAPI_NETWORK_MTP_MODULE MTP + * @brief The MTP API provides functions for support PTP(Picture Transfer Protocol) subset of MTP(Media Transfer Protocol). + * @ingroup CAPI_NETWORK_FRAMEWORK + * + * @section CAPI_NETWORK_MTP_MODULE_HEADER Required Header + * \#include + * @section CAPI_NETWORK_MTP_MODULE_OVERVIEW Overview + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
API Description
@ref CAPI_NETWORK_MTP_MANAGER_MODULE Provide functions to establish connection to access MTP responder device, and to Get/Delete files
@ref CAPI_NETWORK_MTP_DEVICEINFO_MODULE Provide functions to gets the device information of MTP responder device
@ref CAPI_NETWORK_MTP_STORAGEINFO_MODULE Provide functions to gets the storage information of MTP responder storage
@ref CAPI_NETWORK_MTP_OBJECTINFO_MODULE Provide functions to gets the object information of certain file in MTP responder
+ **/ + +/** + * @defgroup CAPI_NETWORK_MTP_MANAGER_MODULE MTP Manager + * @brief The MTP Manager API provides functions for establish connection to access MTP responder device, and to Get/Delete files. + * @ingroup CAPI_NETWORK_MTP_MODULE + * + * @section CAPI_NETWORK_MTP_MANAGER_MODULE_HEADER Required Header + * \#include + * @section CAPI_NETWORK_MTP_MANAGER_MODULE_OVERVIEW Overview + * The MTP manager api provides following functions :\n + * - Create / destroy connection to access MTP responder device\n + * - Get Device list\n + * - Get Storage list\n + * - Get Object handles\n + * - Get thumbnail\n + * - Get Object\n + * - Delete Object\n + * + * @section CAPI_NETWORK_MTP_MANAGER_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.mtp\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature List. + * + */ + +/* + * @defgroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE MTP Device Information + * @brief The MTP Device Information API provides functions for gets the device information of MTP responder device. + * @ingroup CAPI_NETWORK_MTP_MODULE + * + * @section CAPI_NETWORK_MTP_DEVICEINFO_MODULE_HEADER Required Header + * \#include + * @section CAPI_NETWORK_MTP_DEVICEINFO_MODULE_OVERVIEW Overview + * The MTP Device Information api provides following functions :\n + * - Get device manufacturer name\n + * - Get device model name\n + * - Get device serial number\n + * - Get device version\n + * + * @section CAPI_NETWORK_MTP_DEVICEINFO_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.mtp\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature List. + * + */ + + +/* + * @defgroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE MTP Storage Information + * @brief The MTP Storage Information API provides functions for gets the storage information of MTP responder storage. + * @ingroup CAPI_NETWORK_MTP_MODULE + * + * @section CAPI_NETWORK_MTP_STORAGEINFO_MODULE_HEADER Required Header + * \#include + * @section CAPI_NETWORK_MTP_STORAGEINFO_MODULE_OVERVIEW Overview + * The MTP Storage Information api provides following functions :\n + * - Get storage free space\n + * - Get storage description\n + * - Get storage type\n + * - and, more storage information\n + * + * @section CAPI_NETWORK_MTP_STORAGEINFO_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.mtp\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature List. + * + */ + +/* + * @defgroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE MTP Object Information + * @brief The MTP Manager API provides functions for gets the object information of certain file in MTP responder. + * @ingroup CAPI_NETWORK_MTP_MODULE + * + * @section CAPI_NETWORK_MTP_OBJECTINFO_MODULE_HEADER Required Header + * \#include + * @section CAPI_NETWORK_MTP_OBJECTINFO_MODULE_OVERVIEW Overview + * The MTP Object Information api provides following functions :\n + * - Get object format\n + * - Get object name\n + * - Get object size\n + * - and, more object information\n + * + * @section CAPI_NETWORK_MTP_OBJECTINFO_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.mtp\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature List. + * + */ + +#endif diff --git a/include/mtp.h b/include/mtp.h index 1f6f3ac..79a3b4c 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -23,60 +23,66 @@ extern "C" { #endif -#ifndef MTP_API -#define MTP_API -#endif - /** * @file mtp.h * @brief This file contains the MTP API */ -#define MTP_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS /* Need define mtp error class */ +#ifndef TIZEN_ERROR_MTP +#define TIZEN_ERROR_MTP -0x03000000 +#endif /** - * @brief Structure for mtp device + * @addtogroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @{ + */ + +/** + * @brief The handle to the mtp raw device * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE */ -typedef struct _mtp_device { - int bus_location; - char *model_name; -} mtp_device; +typedef struct mtp_raw_device *mtp_raw_device_h; /** - * @brief Structure for mtp device list + * @brief The handle to the mtp device * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE */ -typedef struct _mtp_device_list { - mtp_device *devices; - int device_num; -} mtp_device_list; +typedef int mtp_device_h; + +/** + * @brief The handle to the mtp storage + * @since_tizen 3.0 + */ +typedef int mtp_storage_h; + +/** + * @brief The handle to the mtp object + * @since_tizen 3.0 + */ +typedef int mtp_object_h; /** * @brief Error codes reported by the MTP API. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE */ typedef enum { MTP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - MTP_ERROR_GENERAL = MTP_ERROR_CLASS | 0x01, /**< A general error occurred */ MTP_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ MTP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - MTP_ERROR_NO_DEVICE = MTP_ERROR_CLASS | 0x02, /**< MTP have not any device */ - MTP_ERROR_ALLOC_FAIL = MTP_ERROR_CLASS | 0x03, /**< Memory Allocation failed */ - MTP_ERROR_PLUGIN = MTP_ERROR_CLASS | 0x04, /**< Plugin failed */ - MTP_ERROR_DB = MTP_ERROR_CLASS | 0x05, /**< Plugin failed */ + MTP_ERROR_NO_DEVICE = TIZEN_ERROR_MTP | 0x01, /**< MTP have not any device */ + MTP_ERROR_ALLOC_FAIL = TIZEN_ERROR_MTP | 0x02, /**< Memory Allocation failed */ + MTP_ERROR_PLUGIN_FAIL = TIZEN_ERROR_MTP | 0x03, /**< Plugin failed */ MTP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - MTP_ERROR_NOT_INITIALIZED = MTP_ERROR_CLASS | 0x06, /**< MTP is not supported */ - MTP_ERROR_NOT_ACTIVATED = MTP_ERROR_CLASS | 0x07, /**< MTP is not activated */ + MTP_ERROR_COMM_ERROR = TIZEN_ERROR_MTP | 0x04, /**< MTP communication error */ + MTP_ERROR_CONTROLLER = TIZEN_ERROR_MTP | 0x05, /**< MTP controller error */ + MTP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_MTP | 0x06, /**< MTP is not initialized */ + MTP_ERROR_NOT_ACTIVATED = TIZEN_ERROR_MTP | 0x07, /**< MTP is not activated */ MTP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MTP is not supported */ + MTP_ERROR_NOT_COMM_INITIALIZED = TIZEN_ERROR_MTP | 0x08 /**< MTP communication is not initialized */ } mtp_error_e; /** * @brief Enumerations for MTP file type * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE */ typedef enum { MTP_FILETYPE_FOLDER, /**< FOLDER file type */ @@ -125,14 +131,13 @@ typedef enum { MTP_FILETYPE_PLAYLIST, /**< PLAYLIST file type */ MTP_FILETYPE_UNKNOWN, /**< Unknown file type */ - MTP_FILETYPE_ALL, /**< helper enum value for certain function */ - MTP_FILETYPE_ALL_IMAGE /**< helper enum value for certain function */ + MTP_FILETYPE_ALL, /**< Helper enum value for certain function */ + MTP_FILETYPE_ALL_IMAGE /**< Helper enum value for certain function */ } mtp_filetype_e; /** * @brief Enumerations for MTP event type * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE */ typedef enum { MTP_EVENT_UNKNOWN, /**< Unknown event type */ @@ -142,604 +147,977 @@ typedef enum { MTP_EVENT_OBJECT_REMOVED, /**< Object is removed */ MTP_EVENT_DEVICE_ADDED, /**< Device is added */ MTP_EVENT_DEVICE_REMOVED, /**< Device is removed */ - MTP_EVENT_DAEMON_TERMINATED /**< Daemon is terminated */ + MTP_EVENT_TURNED_OFF /**< MTP is turned off */ } mtp_event_e; /** * @brief Called after mtp_set_mtp_event_cb() has completed. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks Depending on the type of event, the meaning of event parameter is different. + * - If event is device event, then event_parameter type is mtp_device_h. + * - If event is storage event, then event_parameter type is mtp_storage_h. + * - If event is object event, then event_parameter type is mtp_object_h. + * - If event is MTP_EVENT_TURNED_OFF, then event_parameter is 0. * * @param [in] event The event - * @param [in] arg The argument + * @param [in] event_parameter The event parameter * @param [in] user_data The user data passed from the callback registration function * * @see mtp_set_mtp_event_cb() * @see mtp_unset_mtp_event_cb() */ -typedef void (* mtp_event_cb)(mtp_event_e event, int arg, void *user_data); +typedef void (* mtp_event_cb)(mtp_event_e event, int event_parameter, void *user_data); /** * @brief Initializes for using MTP. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE - * @remarks This function must be called before proceeding any other mtp functions\n + * @remarks This function must be called before proceeding any other mtp functions. * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_PERMISSION_DENIED Permission Denied + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * * @see mtp_deinitialize() */ -MTP_API int mtp_initialize(void); +int mtp_initialize(void); /** - * @brief Get device list. + * @brief Gets device list. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks The @a raw_devices should be freed using mtp_destroy_raw_devices(). + * + * @param [out] raw_devices All current connected device list + * @param [out] device_count The count of device * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * - * @param [out] dev_list All current device list + * @see mtp_destroy_raw_devices() */ -MTP_API int mtp_get_device_list(mtp_device_list **dev_list); +int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count); /** - * @brief Get device handler from bus location + * @brief Gets bus location from raw device. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks The @a raw_device can get using mtp_get_raw_devices(). + * + * @param [in] raw_device The raw device + * @param [out] bus_location The bus location * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * - * @param [in] bus_location The bus location - * @param [out] device_handle The device handle - * - * @see mtp_initialize() + * @see mtp_get_raw_devices() */ -MTP_API int mtp_get_device_handle(int bus_location, int* device_handle); +int mtp_get_bus_location(mtp_raw_device_h raw_device, int *bus_location); /** - * @brief Get storage ids from device + * @brief Gets device number from raw device. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks The @a raw_device can get using mtp_get_raw_devices(). + * + * @param [in] raw_device The raw device + * @param [out] device_number The device number * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * - * @param [in] device_handle The device handle - * @param [out] storage_id Current storage id list - * @param [out] storage_num Length of storage id list - * - * @see mtp_get_device_handle() + * @see mtp_get_raw_devices() */ -MTP_API int mtp_get_storage_ids(int device_handle, int **storage_id, int* storage_num); +int mtp_get_device_number(mtp_raw_device_h raw_device, int *device_number); /** - * @brief Get object handles from device + * @brief Gets device name from raw device. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks The @a raw_device can get using mtp_get_raw_devices(). + * @remarks The @a model_name should be freed using free(). + * + * @param [in] raw_device The raw device + * @param [out] model_name The model name * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id - * @param [in] format The file type what you want - * @param [in] parent_object_handle The parent object handle - * @param [out] object_handles The object handle list - * @param [out] object_num Length of object handle list - * - * @see mtp_get_device_handle() - * @see mtp_get_storage_ids() + * @see mtp_get_raw_devices() */ -MTP_API int mtp_get_object_handles(int device_handle, int storage_id, int format, - int parent_object_handle, int **object_handles, int* object_num); +int mtp_get_device_name(mtp_raw_device_h raw_device, char **model_name); /** - * @brief Delete object from device + * @brief Destroys the raw devices handler. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * + * @param [in] raw_devices The raw devices handler * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * - * @see mtp_get_device_handle() - * @see mtp_get_object_handles() + * @see mtp_get_raw_devices() */ -MTP_API int mtp_delete_object(int device_handle, int object_handle); +int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices); /** - * @brief Get object from object handle + * @brief Gets device handler from bus location. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks For using this api, you should get bus location and device number from raw device. + * + * @param [in] bus_location The bus location + * @param [in] device_number The device number + * @param [out] mtp_device The MTP device * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * + * @pre mtp_get_bus_location(), mtp_get_device_number() + * @see mtp_initialize() + */ +int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device); + +/** + * @brief Gets mtp storages from device. + * @since_tizen 3.0 + * @remarks The @a mtp_storages should be freed using free(). * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [in] dest_path The dest path + * @param [in] mtp_device The MTP device + * @param [out] mtp_storages Current mtp storage list + * @param [out] storage_num Length of storage list * - * @see mtp_get_device_handle() - * @see mtp_get_object_handles() + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * + * @see mtp_get_device() */ -MTP_API int mtp_get_object(int device_handle, int object_handle, char *dest_path); +int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* storage_num); /** - * @brief Get thumbnail from object handle + * @brief Gets object handles from device. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks The @a object_handles should be freed using free(). + * @remarks If the @a parent is 0, it means "root folder" of mtp storage. + * + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage + * @param [in] file_type The file type what you want + * @param [in] parent The parent object handle + * @param [out] object_handles The object handle list + * @param [out] object_num Length of object handle list * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * + * @see mtp_get_device() + * @see mtp_get_storages() + */ +int mtp_get_object_handles(mtp_device_h mtp_device, mtp_storage_h mtp_storage, mtp_filetype_e file_type, + mtp_object_h parent, mtp_object_h **object_handles, int* object_num); + +/** + * @brief Gets object for a given path from object handle. + * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [in] dest_path The dest path * - * @see mtp_get_device_handle() + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_IO_ERROR I/O error + * + * @see mtp_get_device() * @see mtp_get_object_handles() */ -MTP_API int mtp_get_thumbnail(int device_handle, int object_handle, char *dest_path); +int mtp_get_object(mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path); /** - * @brief Registers a callback function for receiving MTP event. + * @brief Gets thumbnail from object handle. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. * - * @detail If device state is changed, DEVICE_ADD or DEVICE_REMOVE event is occur. \n - * If storage state is changed, STORAGE_ADD or STORAGE_REMOVE event is occur. \n - * If object state is changed, OBJECT_ADD or OBJECT_REMOVE event is occur. + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [in] dest_path The dest path * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_IO_ERROR I/O error + * + * @see mtp_get_device() + * @see mtp_get_object_handles() + */ +int mtp_get_thumbnail(mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path); + +/** + * @brief Registers a callback function for receiving MTP event. + * @since_tizen 3.0 + * + * @remarks If device state is changed, DEVICE_ADD or DEVICE_REMOVE event is occur. \n + * If storage state is changed, STORAGE_ADD or STORAGE_REMOVE event is occur. \n + * If object state is changed, OBJECT_ADD or OBJECT_REMOVE event is occur. * - * @param [in] callback The callback + * @param [in] event_cb The callback * @param [in] user_data The user data * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @see mtp_unset_mtp_event_cb() */ -MTP_API int mtp_set_mtp_event_cb(mtp_event_cb callback, void *user_data); +int mtp_set_mtp_event_cb(mtp_event_cb event_cb, void *user_data); /** * @brief Unregisters the callback function. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized * * @see mtp_set_mtp_event_cb() */ -MTP_API int mtp_unset_mtp_event_cb(void); +int mtp_unset_mtp_event_cb(void); /** * @brief Deinitializes MTP operation. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_MANAGER_MODULE * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_PERMISSION_DENIED Permission Denied * * @see mtp_initialize() */ -MTP_API int mtp_deinitialize(void); +int mtp_deinitialize(void); /** - * @brief Get the manufacturer name of the device information. +* @} +*/ + +/** + * @addtogroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE + * @{ + */ + +/** + * @brief Gets the manufacturer name of the device information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE + * @remarks The @a manufacturer_name should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [out] manufacturer_name The manufacturer name of Device information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [out] manufacturername The manufacturername of Device information - * - * @see mtp_get_device_handle() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_device() */ -MTP_API int mtp_deviceinfo_get_manufacturername(int device_handle, char **manufacturername); +int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufacturer_name); /** - * @brief Get the model name of the device information. + * @brief Gets the model name of the device information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE + * @remarks The @a model_name should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [out] model_name The model name of Device information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [out] modelname The modelname of Device information - * - * @see mtp_get_device_handle() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_device() */ -MTP_API int mtp_deviceinfo_get_modelname(int device_handle, char **modelname); +int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); /** - * @brief Get the serial number of the device information. + * @brief Gets the serial number of the device information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE + * @remarks The @a serial_number should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [out] serial_number The serial number of Device information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [out] serialnumber The serialnumber of Device information - * - * @see mtp_get_device_handle() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_device() */ -MTP_API int mtp_deviceinfo_get_serialnumber(int device_handle, char **serialnumber); +int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_number); /** - * @brief Get the device version of the device information. + * @brief Gets the device version of the device information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_DEVICEINFO_MODULE + * @remarks The @a device_version should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [out] device_version The device version of Device information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [out] serialnumber The deviceversion of Device information - * - * @see mtp_get_device_handle() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_device() */ -MTP_API int mtp_deviceinfo_get_deviceversion(int device_handle, char **deviceversion); +int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_version); + +/** +* @} +*/ /** - * @brief Get the description of the storage information. + * @addtogroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE + * @{ + */ + +/** + * @brief Gets the description of the storage information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful + * @remarks The @a description should be freed using free(). * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage * @param [out] description The description of Storage information * - * @see mtp_get_storage_ids() + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_storages() */ -MTP_API int mtp_storageinfo_get_description(int device_handle, int storage_id, char **description); +int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_storage, char **description); /** - * @brief Get the freespace of the storage information. + * @brief Gets the freespace of the storage information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage + * @param [out] free_space The free space of Storage information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id - * @param [out] freespace The freespace of Storage information - * - * @see mtp_get_storage_ids() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_storages() */ -MTP_API int mtp_storageinfo_get_freespace(int device_handle, int storage_id, unsigned long long *freespace); +int mtp_storageinfo_get_free_space(mtp_device_h mtp_device, mtp_storage_h mtp_storage, unsigned long long *free_space); /** - * @brief Get the max capacity of the storage information. + * @brief Gets the max capacity of the storage information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage + * @param [out] max_capacity The max capacity of Storage information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id - * @param [out] maxcapacity The maxcapacity of Storage information - * - * @see mtp_get_storage_ids() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_storages() */ -MTP_API int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, unsigned long long *maxcapacity); +int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_storage, unsigned long long *max_capacity); /** - * @brief Get the storage type of the storage information. + * @brief Gets the storage type of the storage information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage + * @param [out] storage_type The storage type of Storage information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id - * @param [out] storagetype The storagetype of Storage information - * - * @see mtp_get_storage_ids() + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * + * @see mtp_get_storages() */ -MTP_API int mtp_storageinfo_get_storagetype(int device_handle, int storage_id, int *storagetype); +int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_storage, int *storage_type); /** - * @brief Get the volumeidentifier of the storage information. + * @brief Gets the volumeidentifier of the storage information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_STORAGEINFO_MODULE + * @remarks The @a volume_identifier should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [in] mtp_storage The MTP storage + * @param [out] volume_identifier The volume identifier of Storage information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] storage_id The storage id - * @param [out] volumeidentifier The volumeidentifier of Storage information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_object_handles() */ -MTP_API int mtp_storageinfo_get_volumeidentifier(int device_handle, int storage_id, char **volumeidentifier); +int mtp_storageinfo_get_volume_identifier(mtp_device_h mtp_device, mtp_storage_h mtp_storage, char **volume_identifier); + +/** +* @} +*/ /** - * @brief Get the filename of the object information. + * @addtogroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * @{ + */ + +/** + * @brief Gets the filename of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * @remarks The @a file_name should be freed using free(). + * + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [out] file_name The file name of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [out] filename The filename of Object information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_filename(int device_handle, int object_handle, char **filename); +int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_handle, char **file_name); /** - * @brief Get the keywords of the object information. + * @brief Gets the keywords of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful + * @remarks The @a keywords should be freed using free(). * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] keywords The keywords of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_keywords(int device_handle, int object_handle, char **keywords); +int mtp_objectinfo_get_keywords(mtp_device_h mtp_device, mtp_object_h object_handle, char **keywords); /** - * @brief Get the association desc of the object information. + * @brief Gets the association desc of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] asso_desc The association description of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_association_desc(int device_handle, int object_handle, int *asso_desc); +int mtp_objectinfo_get_association_desc(mtp_device_h mtp_device, mtp_object_h object_handle, int *asso_desc); /** - * @brief Get the association type of the object information. + * @brief Gets the association type of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] asso_type The association type of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_association_type(int device_handle, int object_handle, int *asso_type); +int mtp_objectinfo_get_association_type(mtp_device_h mtp_device, mtp_object_h object_handle, int *asso_type); /** - * @brief Get the size of the object information. + * @brief Gets the size of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] size The size of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_size(int device_handle, int object_handle, int *size); +int mtp_objectinfo_get_size(mtp_device_h mtp_device, mtp_object_h object_handle, int *size); /** - * @brief Get the parent object handle of the object information. + * @brief Gets the parent object handle of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] parent_object_handle The parent of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_parent_object_handle(int device_handle, int object_handle, int *parent_object_handle); +int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_object_h *parent_object_handle); /** - * @brief Get the storage id of the object information. + * @brief Gets the mtp storage of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [out] mtp_storage The MTP storage of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [out] storage_id The storage id of Object information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_storage_id(int device_handle, int object_handle, int *storage_id); +int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_storage_h* mtp_storage); /** - * @brief Get the data created time of the object information. + * @brief Gets the data created time of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] data_created The data created time of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_data_created(int device_handle, int object_handle, int *data_created); +int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object_handle, int *data_created); /** - * @brief Get the data modified time of the object information. + * @brief Gets the data modified time of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] data_modified The data modified time of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_data_modified(int device_handle, int object_handle, int *data_modified); +int mtp_objectinfo_get_data_modified(mtp_device_h mtp_device, mtp_object_h object_handle, int *data_modified); /** - * @brief Get the format of the object information. + * @brief Gets the file type of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [out] file_type The file type of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [out] format The image format of Object information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_format(int device_handle, int object_handle, int *format); +int mtp_objectinfo_get_file_type(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_filetype_e *file_type); /** - * @brief Get the image pix depth of the object information. + * @brief Gets the image bit depth of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [out] depth The image bit depth of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [out] depth The image pixel depth of Object information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_image_pix_depth(int device_handle, int object_handle, int *depth); +int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h object_handle, int *depth); /** - * @brief Get the image pix width of the object information. + * @brief Gets the image pix width of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] width The image pixel width of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_image_pix_width(int device_handle, int object_handle, int *width); +int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h object_handle, int *width); /** - * @brief Get the image pix height of the object information. + * @brief Gets the image pix height of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] height The image pixel height of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_image_pix_height(int device_handle, int object_handle, int *height); +int mtp_objectinfo_get_image_pix_height(mtp_device_h mtp_device, mtp_object_h object_handle, int *height); /** - * @brief Get the thumbnail size of the object information. + * @brief Gets the thumbnail size of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] size The thumbnail size of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_thumbnail_size(int device_handle, int object_handle, int *size); +int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h object_handle, int *size); /** - * @brief Get the thumbnail format of the object information. + * @brief Gets the thumbnail file_type of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE + * + * @param [in] mtp_device The MTP device + * @param [in] object_handle The object handle + * @param [out] file_type The file type of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle - * @param [in] object_handle The object handle - * @param [out] format The thumbnail format of Object information + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_thumbnail_format(int device_handle, int object_handle, int *format); +int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_filetype_e *file_type); /** - * @brief Get the thumbnail pix height of the object information. + * @brief Gets the thumbnail pix height of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] height The thumbnail pixel height of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_thumbnail_pix_height(int device_handle, int object_handle, int *height); +int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_h object_handle, int *height); /** - * @brief Get the thumbnail pix width of the object information. + * @brief Gets the thumbnail pix width of the object information. * @since_tizen 3.0 - * @ingroup CAPI_NETWORK_MTP_OBJECTINFO_MODULE - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful * - * @param [in] device_handle The device handle + * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle * @param [out] width The thumbnail pixel width of Object information * + * @return 0 on success, otherwise a negative error value. + * @retval #MTP_ERROR_NONE Successful + * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported + * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized + * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_CONTROLLER MTP controller error + * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_NO_DEVICE MTP have not any device + * @retval #MTP_ERROR_PLUGIN Plugin failed + * * @see mtp_get_object_handles() */ -MTP_API int mtp_objectinfo_get_thumbnail_pix_width(int device_handle, int object_handle, int *width); +int mtp_objectinfo_get_thumbnail_pix_width(mtp_device_h mtp_device, mtp_object_h object_handle, int *width); + +/** +* @} +*/ #ifdef __cplusplus } diff --git a/include/mtp_db.h b/include/mtp_db.h index a546820..2364d0a 100755 --- a/include/mtp_db.h +++ b/include/mtp_db.h @@ -30,7 +30,7 @@ #define MTP_DB_TABLE "mtp_object_info" mtp_error_e mtp_db_init(void); -mtp_error_e mtp_db_get_object_info(int device_handle, int object_handle, mtp_object_info** object_info); +mtp_error_e mtp_db_get_object_info(int mtp_device, int object_handle, mtp_object_info** object_info); mtp_error_e mtp_db_deinit(void); #endif diff --git a/include/mtp_gdbus.h b/include/mtp_gdbus.h index a740ff1..2811fb1 100755 --- a/include/mtp_gdbus.h +++ b/include/mtp_gdbus.h @@ -21,6 +21,7 @@ #include #include "mtp.h" +#include "mtp_private.h" #include "mtp_gdbuslib.h" #define MTP_DBUS_SERVICE "org.tizen.mtp" diff --git a/include/mtp_gdbus_manager.h b/include/mtp_gdbus_manager.h index 9c9699c..ea2eaf4 100755 --- a/include/mtp_gdbus_manager.h +++ b/include/mtp_gdbus_manager.h @@ -20,17 +20,17 @@ #include "mtp_gdbus.h" mtp_error_e mtp_gdbus_manager_initialize(void); -mtp_error_e mtp_gdbus_manager_get_device_list(mtp_device_list **dev_list); -mtp_error_e mtp_gdbus_manager_get_device_handle(int bus_location, - int *device_handle); -mtp_error_e mtp_gdbus_manager_get_storage_ids(int device_handle, - int **storage_ids, int *storage_num); -mtp_error_e mtp_gdbus_manager_get_object_handles(int device_handle, - int storage_id, int format, int parent_object_handle, int **object_handles, int *object_num); -mtp_error_e mtp_gdbus_manager_delete_object(int device_handle, int object_handle); -mtp_error_e mtp_gdbus_manager_get_object(int device_handle, +mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int *device_count); +mtp_error_e mtp_gdbus_manager_get_device(int bus_location, int device_number, + int *mtp_device); +mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device, + int **mtp_storages, int *storage_num); +mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device, + int mtp_storage, int format, int parent_object_handle, int **object_handles, int *object_num); +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_thumbnail(int device_handle, +mtp_error_e mtp_gdbus_manager_get_thumbnail(int mtp_device, int object_handle, char *dest_path); mtp_error_e mtp_gdbus_manager_set_event_cb(mtp_event_cb callback, void *user_data); mtp_error_e mtp_gdbus_manager_unset_event_cb(); diff --git a/include/mtp_gdbus_objectinfo.h b/include/mtp_gdbus_objectinfo.h index 3c5930f..421704d 100755 --- a/include/mtp_gdbus_objectinfo.h +++ b/include/mtp_gdbus_objectinfo.h @@ -22,9 +22,9 @@ void mtp_gdbus_objectinfo_proxy_init(void); void mtp_gdbus_objectinfo_proxy_deinit(void); -int mtp_gdbus_objectinfo_get_property(int device_handle, +int mtp_gdbus_objectinfo_get_property(int mtp_device, int object_handle, int property, int *property_value); -int mtp_gdbus_objectinfo_get_property_string(int device_handle, +int mtp_gdbus_objectinfo_get_property_string(int mtp_device, int object_handle, int property, char **property_value); #endif diff --git a/include/mtp_gdbus_storageinfo.h b/include/mtp_gdbus_storageinfo.h index c4e90a3..f335e1f 100755 --- a/include/mtp_gdbus_storageinfo.h +++ b/include/mtp_gdbus_storageinfo.h @@ -22,15 +22,15 @@ void mtp_gdbus_storageinfo_proxy_init(void); void mtp_gdbus_storageinfo_proxy_deinit(void); -mtp_error_e mtp_gdbus_storageinfo_get_description(int device_handle, - int storage_id, char **description); -mtp_error_e mtp_gdbus_storageinfo_get_freespace(int device_handle, - int storage_id, guint64 *freespace); -mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int device_handle, - int storage_id, guint64 *maxcapacity); -mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int device_handle, - int storage_id, int *storagetype); -mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int device_handle, - int storage_id, char **volumeidentifier); +mtp_error_e mtp_gdbus_storageinfo_get_description(int mtp_device, + int mtp_storage, char **description); +mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, + int mtp_storage, guint64 *freespace); +mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, + int mtp_storage, guint64 *maxcapacity); +mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, + int mtp_storage, int *storagetype); +mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int mtp_device, + int mtp_storage, char **volumeidentifier); #endif diff --git a/include/mtp_internal.h b/include/mtp_internal.h index 0702f5a..71a0d1d 100755 --- a/include/mtp_internal.h +++ b/include/mtp_internal.h @@ -49,7 +49,9 @@ typedef struct _mtp_object_info { }mtp_object_info; /* internal api */ -MTP_API int mtp_objectinfo_get_object_info(int device_handle, int object_handle, mtp_object_info **object_info); +int mtp_objectinfo_get_object_info(int mtp_device, int object_handle, mtp_object_info **object_info); + +int mtp_delete_object(mtp_device_h mtp_device, mtp_object_h object_handle); #ifdef __cplusplus } diff --git a/include/mtp_private.h b/include/mtp_private.h new file mode 100755 index 0000000..cb4075a --- /dev/null +++ b/include/mtp_private.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd. + * + * 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 __MTP_PRIVATE_H__ +#define __MTP_PRIVATE_H__ + +typedef struct _mtp_raw_device { + int bus_location; + int device_number; + char *model_name; + int dev_count; +} mtp_raw_device; + +#define CHECK_SUPPORTED() \ +do { \ + { \ + if (__is_mtp_supported() == false) { \ + return MTP_ERROR_NOT_SUPPORTED; \ + } \ + } \ +} while (0); + +#define CHECK_ACTIVATED() \ +do { \ + { \ + if (__is_mtp_activated() == false) { \ + return MTP_ERROR_NOT_ACTIVATED; \ + } \ + } \ +} while (0); + +typedef enum { + MTP_PROPERTY_ASSOCIATION_DESC = 1, + MTP_PROPERTY_ASSOCIATION_TYPE, + MTP_PROPERTY_SIZE, + MTP_PROPERTY_DATA_CREATED, + MTP_PROPERTY_DATA_MODIFIED, + MTP_PROPERTY_FORMAT, + MTP_PROPERTY_IMAGE_BIT_DEPTH, + MTP_PROPERTY_IMAGE_FIX_WIDTH, + MTP_PROPERTY_IMAGE_FIX_HEIGHT, + MTP_PROPERTY_PARENT_OBJECT_HANDLE, + MTP_PROPERTY_STORAGE, + MTP_PROPERTY_THUMBNAIL_SIZE, + MTP_PROPERTY_THUMBNAIL_FORMAT, + MTP_PROPERTY_THUMBNAIL_WIDTH, + MTP_PROPERTY_THUMBNAIL_HEIGHT, + MTP_PROPERTY_FILENAME, + MTP_PROPERTY_KEYWORDS +} mtp_property_e; + +#endif diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index e03c530..d3271c5 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.2.4 +Version: 1.3.0 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp.c b/src/mtp.c index 3ce3e87..03357dc 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -26,15 +26,13 @@ #include "mtp_internal.h" #include "mtp_db.h" #include "mtp_debug.h" +#include "mtp_private.h" #include "mtp_gdbus_manager.h" #include "mtp_gdbus_deviceinfo.h" #include "mtp_gdbus_storageinfo.h" #include "mtp_gdbus_objectinfo.h" -int ref_count = 0; -bool __is_initialized = false; - #define MTP_LOCK \ do { \ pthread_mutex_lock(&mutex); \ @@ -59,43 +57,8 @@ do { \ MTP_UNLOCK; \ } while (0); -#define CHECK_SUPPORTED() \ -do { \ - { \ - if (__is_mtp_supported() == false) { \ - return MTP_ERROR_NOT_SUPPORTED; \ - } \ - } \ -} while (0); - -#define CHECK_ACTIVATED() \ -do { \ - { \ - if (__is_mtp_activated() == false) { \ - return MTP_ERROR_NOT_ACTIVATED; \ - } \ - } \ -} while (0); - -typedef enum { - MTP_PROPERTY_ASSOCIATION_DESC = 1, - MTP_PROPERTY_ASSOCIATION_TYPE, - MTP_PROPERTY_SIZE, - MTP_PROPERTY_DATA_CREATED, - MTP_PROPERTY_DATA_MODIFIED, - MTP_PROPERTY_FORMAT, - MTP_PROPERTY_IMAGE_FIX_DEPTH, - MTP_PROPERTY_IMAGE_FIX_WIDTH, - MTP_PROPERTY_IMAGE_FIX_HEIGHT, - MTP_PROPERTY_PARENT_OBJECT_HANDLE, - MTP_PROPERTY_STORAGE_ID, - MTP_PROPERTY_THUMBNAIL_SIZE, - MTP_PROPERTY_THUMBNAIL_FORMAT, - MTP_PROPERTY_THUMBNAIL_WIDTH, - MTP_PROPERTY_THUMBNAIL_HEIGHT, - MTP_PROPERTY_FILENAME, - MTP_PROPERTY_KEYWORDS -} mtp_property_e; +int ref_count = 0; +bool __is_initialized = false; static bool __is_mtp_supported() { @@ -136,7 +99,7 @@ int mtp_initialize(void) return ret; } -int mtp_get_device_list(mtp_device_list **dev_list) +int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count) { int ret = MTP_ERROR_NONE; @@ -147,17 +110,117 @@ int mtp_get_device_list(mtp_device_list **dev_list) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); + cond_expr_ret(device_count == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ + *device_count = 0; + + ret = mtp_gdbus_manager_get_raw_devices((mtp_raw_device ***)raw_devices, device_count); + + _END(); + + return ret; +} + +int mtp_get_bus_location(mtp_raw_device_h raw_device, int *bus_location) +{ + int ret = MTP_ERROR_NONE; + + _BEGIN(); + + /* precondition check start */ + + CHECK_SUPPORTED(); + CHECK_INIT(); + cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(bus_location == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + + *bus_location = ((mtp_raw_device *)raw_device)->bus_location; + + _END(); + + return ret; +} + +int mtp_get_device_number(mtp_raw_device_h raw_device, int *device_number) +{ + int ret = MTP_ERROR_NONE; + + _BEGIN(); + + /* precondition check start */ + + CHECK_SUPPORTED(); + CHECK_INIT(); + cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(device_number == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + + *device_number = ((mtp_raw_device *)raw_device)->device_number; + + _END(); + + return ret; +} + +int mtp_get_device_name(mtp_raw_device_h raw_device, char **model_name) +{ + int ret = MTP_ERROR_NONE; + + /* precondition check start */ + + CHECK_SUPPORTED(); + CHECK_INIT(); + cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(model_name == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + + *model_name = g_strdup(((mtp_raw_device *)raw_device)->model_name); + + return ret; +} + +int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices) +{ + int i; + int ret = MTP_ERROR_NONE; + int dev_count; + mtp_raw_device *first_device = (mtp_raw_device *)raw_devices[0]; + + _BEGIN(); + + /* precondition check start */ + + CHECK_SUPPORTED(); + cond_expr_ret(raw_devices == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(first_device == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + dev_count = first_device->dev_count; + if (dev_count <= 0 || dev_count > 6) + return MTP_ERROR_INVALID_PARAMETER; + + for (i = 0; i < dev_count; i++) { + mtp_raw_device *r_device = (mtp_raw_device *)raw_devices[i]; + + if (r_device != NULL && r_device->model_name != NULL) { + free(r_device->model_name); + free(r_device); + } + } - ret = mtp_gdbus_manager_get_device_list(dev_list); + free(raw_devices); _END(); return ret; } -int mtp_get_device_handle(int bus_location, int *device_handle) +int mtp_get_device(int bus_location, int device_number, int *mtp_device) { int ret = MTP_ERROR_NONE; @@ -172,16 +235,16 @@ int mtp_get_device_handle(int bus_location, int *device_handle) /* precondition check end */ - ret = mtp_gdbus_manager_get_device_handle(bus_location, device_handle); + ret = mtp_gdbus_manager_get_device(bus_location, device_number, mtp_device); - TC_PRT("mtp_handle %d", *device_handle); + TC_PRT("mtp_device %d", *mtp_device); _END(); return ret; } -int mtp_get_storage_ids(int device_handle, int **storage_ids, int *storage_num) +int mtp_get_storages(int mtp_device, int **mtp_storages, int* storage_num) { int ret = MTP_ERROR_NONE; @@ -192,11 +255,11 @@ int mtp_get_storage_ids(int device_handle, int **storage_ids, int *storage_num) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_get_storage_ids(device_handle, storage_ids, storage_num); + ret = mtp_gdbus_manager_get_storages(mtp_device, mtp_storages, storage_num); TC_PRT("storage number %d", *storage_num); @@ -205,8 +268,8 @@ int mtp_get_storage_ids(int device_handle, int **storage_ids, int *storage_num) return ret; } -int mtp_get_object_handles(int device_handle, int storage_id, int format, - int parent_object_handle, int **object_handles, int *object_num) +int mtp_get_object_handles(int mtp_device, int mtp_storage, mtp_filetype_e file_type, + int parent, int **object_handles, int* object_num) { int ret = MTP_ERROR_NONE; @@ -217,20 +280,20 @@ int mtp_get_object_handles(int device_handle, int storage_id, int format, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_get_object_handles(device_handle, - storage_id, format, parent_object_handle, object_handles, object_num); + ret = mtp_gdbus_manager_get_object_handles(mtp_device, + mtp_storage, file_type, parent, object_handles, object_num); _END(); return ret; } -int mtp_delete_object(int device_handle, int object_handle) +int mtp_delete_object(int mtp_device, int object_handle) { int ret = MTP_ERROR_NONE; @@ -241,19 +304,19 @@ int mtp_delete_object(int device_handle, int object_handle) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); cond_expr_ret(object_handle == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_delete_object(device_handle, object_handle); + ret = mtp_gdbus_manager_delete_object(mtp_device, object_handle); _END(); return ret; } -int mtp_get_object(int device_handle, int object_handle, char *dest_path) +int mtp_get_object(int mtp_device, int object_handle, char *dest_path) { int ret = MTP_ERROR_NONE; @@ -264,19 +327,19 @@ int mtp_get_object(int device_handle, int object_handle, char *dest_path) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); cond_expr_ret(dest_path == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_get_object(device_handle, object_handle, dest_path); + ret = mtp_gdbus_manager_get_object(mtp_device, object_handle, dest_path); _END(); return ret; } -int mtp_get_thumbnail(int device_handle, int object_handle, char *dest_path) +int mtp_get_thumbnail(int mtp_device, int object_handle, char *dest_path) { int ret = MTP_ERROR_NONE; @@ -287,12 +350,12 @@ int mtp_get_thumbnail(int device_handle, int object_handle, char *dest_path) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); cond_expr_ret(dest_path == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_get_thumbnail(device_handle, object_handle, dest_path); + ret = mtp_gdbus_manager_get_thumbnail(mtp_device, object_handle, dest_path); _END(); @@ -371,7 +434,7 @@ int mtp_deinitialize(void) } /* Device Info */ -int mtp_deviceinfo_get_manufacturername(int device_handle, char **manufacturername) +int mtp_deviceinfo_get_manufacturer_name(int mtp_device, char **manufacturer_name) { int ret = MTP_ERROR_NONE; @@ -382,20 +445,20 @@ int mtp_deviceinfo_get_manufacturername(int device_handle, char **manufacturerna CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_manufacturername(device_handle, manufacturername); + ret = mtp_gdbus_deviceinfo_get_manufacturername(mtp_device, manufacturer_name); - TC_PRT("manufacturername %s", *manufacturername); + TC_PRT("manufacturername %s", *manufacturer_name); _END(); return ret; } -int mtp_deviceinfo_get_modelname(int device_handle, char **modelname) +int mtp_deviceinfo_get_model_name(int mtp_device, char **model_name) { int ret = MTP_ERROR_NONE; @@ -406,20 +469,20 @@ int mtp_deviceinfo_get_modelname(int device_handle, char **modelname) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_modelname(device_handle, modelname); + ret = mtp_gdbus_deviceinfo_get_modelname(mtp_device, model_name); - TC_PRT("modelname %s", *modelname); + TC_PRT("modelname %s", *model_name); _END(); return ret; } -int mtp_deviceinfo_get_serialnumber(int device_handle, char **serialnumber) +int mtp_deviceinfo_get_serial_number(int mtp_device, char **serial_number) { int ret = MTP_ERROR_NONE; @@ -430,20 +493,20 @@ int mtp_deviceinfo_get_serialnumber(int device_handle, char **serialnumber) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_serialnumber(device_handle, serialnumber); + ret = mtp_gdbus_deviceinfo_get_serialnumber(mtp_device, serial_number); - TC_PRT("serialnumber %s", *serialnumber); + TC_PRT("serialnumber %s", *serial_number); _END(); return ret; } -int mtp_deviceinfo_get_deviceversion(int device_handle, char **deviceversion) +int mtp_deviceinfo_get_device_version(int mtp_device, char **device_version) { int ret = MTP_ERROR_NONE; @@ -454,13 +517,13 @@ int mtp_deviceinfo_get_deviceversion(int device_handle, char **deviceversion) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_deviceversion(device_handle, deviceversion); + ret = mtp_gdbus_deviceinfo_get_deviceversion(mtp_device, device_version); - TC_PRT("deviceversion %s", *deviceversion); + TC_PRT("deviceversion %s", *device_version); _END(); @@ -468,7 +531,7 @@ int mtp_deviceinfo_get_deviceversion(int device_handle, char **deviceversion) } /* Storage Info */ -int mtp_storageinfo_get_description(int device_handle, int storage_id, char **description) +int mtp_storageinfo_get_description(int mtp_device, int mtp_storage, char **description) { int ret = MTP_ERROR_NONE; @@ -479,12 +542,12 @@ int mtp_storageinfo_get_description(int device_handle, int storage_id, char **de CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_description(device_handle, storage_id, description); + ret = mtp_gdbus_storageinfo_get_description(mtp_device, mtp_storage, description); TC_PRT("description %s", *description); @@ -493,7 +556,7 @@ int mtp_storageinfo_get_description(int device_handle, int storage_id, char **de return ret; } -int mtp_storageinfo_get_freespace(int device_handle, int storage_id, unsigned long long *freespace) +int mtp_storageinfo_get_free_space(int mtp_device, int mtp_storage, unsigned long long *free_space) { int ret = MTP_ERROR_NONE; @@ -504,21 +567,21 @@ int mtp_storageinfo_get_freespace(int device_handle, int storage_id, unsigned lo CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_freespace(device_handle, storage_id, (guint64 *)freespace); + ret = mtp_gdbus_storageinfo_get_freespace(mtp_device, mtp_storage, (guint64 *)free_space); - TC_PRT("freespace %llu", *freespace); + TC_PRT("freespace %llu", *free_space); _END(); return ret; } -int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, unsigned long long *maxcapacity) +int mtp_storageinfo_get_max_capacity(int mtp_device, int mtp_storage, unsigned long long *max_capacity) { int ret = MTP_ERROR_NONE; @@ -529,21 +592,21 @@ int mtp_storageinfo_get_maxcapacity(int device_handle, int storage_id, unsigned CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_maxcapacity(device_handle, storage_id, (guint64 *)maxcapacity); + ret = mtp_gdbus_storageinfo_get_maxcapacity(mtp_device, mtp_storage, (guint64 *)max_capacity); - TC_PRT("maxcapacity %llu", *maxcapacity); + TC_PRT("maxcapacity %llu", *max_capacity); _END(); return ret; } -int mtp_storageinfo_get_storagetype(int device_handle, int storage_id, int *storagetype) +int mtp_storageinfo_get_storage_type(int mtp_device, int mtp_storage, int *storage_type) { int ret = MTP_ERROR_NONE; @@ -554,21 +617,21 @@ int mtp_storageinfo_get_storagetype(int device_handle, int storage_id, int *stor CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_storagetype(device_handle, storage_id, storagetype); + ret = mtp_gdbus_storageinfo_get_storagetype(mtp_device, mtp_storage, storage_type); - TC_PRT("storagetype %d", *storagetype); + TC_PRT("storagetype %d", *storage_type); _END(); return ret; } -int mtp_storageinfo_get_volumeidentifier(int device_handle, int storage_id, char **volumeidentifier) +int mtp_storageinfo_get_volume_identifier(int mtp_device, int mtp_storage, char **volume_identifier) { int ret = MTP_ERROR_NONE; @@ -579,14 +642,14 @@ int mtp_storageinfo_get_volumeidentifier(int device_handle, int storage_id, char CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(storage_id == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_volumeidentifier(device_handle, storage_id, volumeidentifier); + ret = mtp_gdbus_storageinfo_get_volumeidentifier(mtp_device, mtp_storage, volume_identifier); - TC_PRT("volumeidentifier %s", *volumeidentifier); + TC_PRT("volumeidentifier %s", *volume_identifier); _END(); @@ -594,7 +657,7 @@ int mtp_storageinfo_get_volumeidentifier(int device_handle, int storage_id, char } /* Object Info */ -int mtp_objectinfo_get_parent_object_handle(int device_handle, int object_handle, +int mtp_objectinfo_get_parent_object_handle(int mtp_device, int object_handle, int *parent_object_handle) { int ret = MTP_ERROR_NONE; @@ -606,11 +669,11 @@ int mtp_objectinfo_get_parent_object_handle(int device_handle, int object_handle CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_PARENT_OBJECT_HANDLE, parent_object_handle); TC_PRT("parent object id %d", *parent_object_handle); @@ -620,8 +683,8 @@ int mtp_objectinfo_get_parent_object_handle(int device_handle, int object_handle return ret; } -int mtp_objectinfo_get_storage_id(int device_handle, int object_handle, - int *storage_id) +int mtp_objectinfo_get_storage(int mtp_device, int object_handle, + int *mtp_storage) { int ret = MTP_ERROR_NONE; @@ -632,19 +695,19 @@ int mtp_objectinfo_get_storage_id(int device_handle, int object_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, - object_handle, MTP_PROPERTY_STORAGE_ID, storage_id); + ret = mtp_gdbus_objectinfo_get_property(mtp_device, + object_handle, MTP_PROPERTY_STORAGE, mtp_storage); _END(); return ret; } -int mtp_objectinfo_get_association_desc(int device_handle, +int mtp_objectinfo_get_association_desc(int mtp_device, int object_handle, int *asso_desc) { int ret = MTP_ERROR_NONE; @@ -656,11 +719,11 @@ int mtp_objectinfo_get_association_desc(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_ASSOCIATION_DESC, asso_desc); _END(); @@ -668,7 +731,7 @@ int mtp_objectinfo_get_association_desc(int device_handle, return ret; } -int mtp_objectinfo_get_association_type(int device_handle, +int mtp_objectinfo_get_association_type(int mtp_device, int object_handle, int *asso_type) { int ret = MTP_ERROR_NONE; @@ -680,11 +743,11 @@ int mtp_objectinfo_get_association_type(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_ASSOCIATION_TYPE, asso_type); _END(); @@ -692,7 +755,7 @@ int mtp_objectinfo_get_association_type(int device_handle, return ret; } -int mtp_objectinfo_get_size(int device_handle, int object_handle, int *size) +int mtp_objectinfo_get_size(int mtp_device, int object_handle, int *size) { int ret = MTP_ERROR_NONE; @@ -703,11 +766,11 @@ int mtp_objectinfo_get_size(int device_handle, int object_handle, int *size) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_SIZE, size); _END(); @@ -715,7 +778,7 @@ int mtp_objectinfo_get_size(int device_handle, int object_handle, int *size) return ret; } -int mtp_objectinfo_get_data_created(int device_handle, +int mtp_objectinfo_get_data_created(int mtp_device, int object_handle, int *data_created) { int ret = MTP_ERROR_NONE; @@ -727,11 +790,11 @@ int mtp_objectinfo_get_data_created(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_DATA_CREATED, data_created); _END(); @@ -739,7 +802,7 @@ int mtp_objectinfo_get_data_created(int device_handle, return ret; } -int mtp_objectinfo_get_data_modified(int device_handle, +int mtp_objectinfo_get_data_modified(int mtp_device, int object_handle, int *data_modified) { int ret = MTP_ERROR_NONE; @@ -751,11 +814,11 @@ int mtp_objectinfo_get_data_modified(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_DATA_MODIFIED, data_modified); _END(); @@ -763,7 +826,7 @@ int mtp_objectinfo_get_data_modified(int device_handle, return ret; } -int mtp_objectinfo_get_format(int device_handle, int object_handle, int *format) +int mtp_objectinfo_get_file_type(int mtp_device, int object_handle, mtp_filetype_e *file_type) { int ret = MTP_ERROR_NONE; @@ -774,19 +837,19 @@ int mtp_objectinfo_get_format(int device_handle, int object_handle, int *format) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, - object_handle, MTP_PROPERTY_FORMAT, format); + ret = mtp_gdbus_objectinfo_get_property(mtp_device, + object_handle, MTP_PROPERTY_FORMAT, (int*)file_type); _END(); return ret; } -int mtp_objectinfo_get_image_pix_depth(int device_handle, +int mtp_objectinfo_get_image_bit_depth(int mtp_device, int object_handle, int *depth) { int ret = MTP_ERROR_NONE; @@ -798,19 +861,19 @@ int mtp_objectinfo_get_image_pix_depth(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, - object_handle, MTP_PROPERTY_IMAGE_FIX_DEPTH, depth); + ret = mtp_gdbus_objectinfo_get_property(mtp_device, + object_handle, MTP_PROPERTY_IMAGE_BIT_DEPTH, depth); _END(); return ret; } -int mtp_objectinfo_get_image_pix_width(int device_handle, +int mtp_objectinfo_get_image_pix_width(int mtp_device, int object_handle, int *width) { int ret = MTP_ERROR_NONE; @@ -822,11 +885,11 @@ int mtp_objectinfo_get_image_pix_width(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_IMAGE_FIX_WIDTH, width); _END(); @@ -834,7 +897,7 @@ int mtp_objectinfo_get_image_pix_width(int device_handle, return ret; } -int mtp_objectinfo_get_image_pix_height(int device_handle, +int mtp_objectinfo_get_image_pix_height(int mtp_device, int object_handle, int *height) { int ret = MTP_ERROR_NONE; @@ -846,11 +909,11 @@ int mtp_objectinfo_get_image_pix_height(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_IMAGE_FIX_HEIGHT, height); _END(); @@ -858,7 +921,7 @@ int mtp_objectinfo_get_image_pix_height(int device_handle, return ret; } -int mtp_objectinfo_get_thumbnail_size(int device_handle, +int mtp_objectinfo_get_thumbnail_size(int mtp_device, int object_handle, int *size) { int ret = MTP_ERROR_NONE; @@ -870,11 +933,11 @@ int mtp_objectinfo_get_thumbnail_size(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_THUMBNAIL_SIZE, size); _END(); @@ -882,8 +945,8 @@ int mtp_objectinfo_get_thumbnail_size(int device_handle, return ret; } -int mtp_objectinfo_get_thumbnail_format(int device_handle, - int object_handle, int *format) +int mtp_objectinfo_get_thumbnail_file_type(int mtp_device, + int object_handle, mtp_filetype_e *file_type) { int ret = MTP_ERROR_NONE; @@ -894,19 +957,19 @@ int mtp_objectinfo_get_thumbnail_format(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, - object_handle, MTP_PROPERTY_THUMBNAIL_FORMAT, format); + ret = mtp_gdbus_objectinfo_get_property(mtp_device, + object_handle, MTP_PROPERTY_THUMBNAIL_FORMAT, (int*)file_type); _END(); return ret; } -int mtp_objectinfo_get_thumbnail_pix_height(int device_handle, +int mtp_objectinfo_get_thumbnail_pix_height(int mtp_device, int object_handle, int *height) { int ret = MTP_ERROR_NONE; @@ -918,11 +981,11 @@ int mtp_objectinfo_get_thumbnail_pix_height(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_THUMBNAIL_HEIGHT, height); _END(); @@ -930,7 +993,7 @@ int mtp_objectinfo_get_thumbnail_pix_height(int device_handle, return ret; } -int mtp_objectinfo_get_thumbnail_pix_width(int device_handle, +int mtp_objectinfo_get_thumbnail_pix_width(int mtp_device, int object_handle, int *width) { int ret = MTP_ERROR_NONE; @@ -942,11 +1005,11 @@ int mtp_objectinfo_get_thumbnail_pix_width(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property(device_handle, + ret = mtp_gdbus_objectinfo_get_property(mtp_device, object_handle, MTP_PROPERTY_THUMBNAIL_WIDTH, width); _END(); @@ -954,7 +1017,7 @@ int mtp_objectinfo_get_thumbnail_pix_width(int device_handle, return ret; } -int mtp_objectinfo_get_filename(int device_handle, +int mtp_objectinfo_get_file_name(int mtp_device, int object_handle, char **filename) { int ret = MTP_ERROR_NONE; @@ -966,11 +1029,11 @@ int mtp_objectinfo_get_filename(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property_string(device_handle, + ret = mtp_gdbus_objectinfo_get_property_string(mtp_device, object_handle, MTP_PROPERTY_FILENAME, filename); _END(); @@ -978,7 +1041,7 @@ int mtp_objectinfo_get_filename(int device_handle, return ret; } -int mtp_objectinfo_get_keywords(int device_handle, +int mtp_objectinfo_get_keywords(int mtp_device, int object_handle, char **keywords) { int ret = MTP_ERROR_NONE; @@ -990,11 +1053,11 @@ int mtp_objectinfo_get_keywords(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_objectinfo_get_property_string(device_handle, + ret = mtp_gdbus_objectinfo_get_property_string(mtp_device, object_handle, MTP_PROPERTY_KEYWORDS, keywords); _END(); @@ -1002,7 +1065,7 @@ int mtp_objectinfo_get_keywords(int device_handle, return ret; } -int mtp_objectinfo_get_object_info(int device_handle, +int mtp_objectinfo_get_object_info(int mtp_device, int object_handle, mtp_object_info **object_info) { int ret = MTP_ERROR_NONE; @@ -1014,11 +1077,11 @@ int mtp_objectinfo_get_object_info(int device_handle, CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); - cond_expr_ret(device_handle == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_db_get_object_info(device_handle, object_handle, object_info); + ret = mtp_db_get_object_info(mtp_device, object_handle, object_info); _END(); diff --git a/src/mtp_db.c b/src/mtp_db.c index fe4b685..ddd1e2e 100755 --- a/src/mtp_db.c +++ b/src/mtp_db.c @@ -49,7 +49,7 @@ mtp_error_e mtp_db_init() return ret; } -mtp_error_e mtp_db_get_object_info(int device_handle, int object_handle, mtp_object_info** object_info) +mtp_error_e mtp_db_get_object_info(int mtp_device, int object_handle, mtp_object_info** object_info) { int ret = MTP_ERROR_NONE; int sql_ret; @@ -65,8 +65,8 @@ mtp_error_e mtp_db_get_object_info(int device_handle, int object_handle, mtp_obj *object_info = (mtp_object_info *)malloc(sizeof(mtp_object_info)); - sql = sqlite3_mprintf("SELECT * FROM %s WHERE device_handle=%d and object_handle=%d;", - MTP_DB_TABLE, device_handle, object_handle); + sql = sqlite3_mprintf("SELECT * FROM %s WHERE mtp_device=%d and object_handle=%d;", + MTP_DB_TABLE, mtp_device, object_handle); if (sql != NULL && (*object_info) != NULL) { sql_ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL); diff --git a/src/mtp_gdbus_deviceinfo.c b/src/mtp_gdbus_deviceinfo.c index eff5d5b..f6e0da4 100755 --- a/src/mtp_gdbus_deviceinfo.c +++ b/src/mtp_gdbus_deviceinfo.c @@ -34,88 +34,88 @@ void mtp_gdbus_deviceinfo_proxy_deinit(void) deviceinfo_proxy = NULL; } -mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int device_handle, char **manufacturername) +mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int mtp_device, char **manufacturername) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (deviceinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_deviceinfo_call_get_manufacturername_sync( deviceinfo_proxy, - device_handle, + mtp_device, manufacturername, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int device_handle, char **modelname) +mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int mtp_device, char **modelname) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (deviceinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_deviceinfo_call_get_modelname_sync( deviceinfo_proxy, - device_handle, + mtp_device, modelname, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int device_handle, char **serialnumber) +mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int mtp_device, char **serialnumber) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (deviceinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_deviceinfo_call_get_serialnumber_sync( deviceinfo_proxy, - device_handle, + mtp_device, serialnumber, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_deviceversion(int device_handle, char **deviceversion) +mtp_error_e mtp_gdbus_deviceinfo_get_deviceversion(int mtp_device, char **deviceversion) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (deviceinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_deviceinfo_call_get_deviceversion_sync( deviceinfo_proxy, - device_handle, + mtp_device, deviceversion, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } diff --git a/src/mtp_gdbus_manager.c b/src/mtp_gdbus_manager.c index ca4b603..63be494 100755 --- a/src/mtp_gdbus_manager.c +++ b/src/mtp_gdbus_manager.c @@ -14,6 +14,12 @@ * limitations under the License. */ +#include +#include +#include +#include +#include + #include "mtp_gdbus_manager.h" #include "mtp_gdbus_objectinfo.h" #include "mtp_gdbus_deviceinfo.h" @@ -76,12 +82,12 @@ mtp_error_e mtp_gdbus_manager_initialize(void) mtp_gdbus_objectinfo_proxy_init(); if (manager_proxy == NULL) - result = MTP_ERROR_GENERAL; + result = MTP_ERROR_NOT_COMM_INITIALIZED; return result; } -mtp_error_e mtp_gdbus_manager_get_device_list(mtp_device_list **dev_list) +mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int *device_count) { int dev_count; GVariant *va = NULL; @@ -89,41 +95,45 @@ mtp_error_e mtp_gdbus_manager_get_device_list(mtp_device_list **dev_list) GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_manager_call_get_device_list_sync( + if (mtp_gdbuslib_manager_call_get_raw_devices_sync( manager_proxy, &dev_count, &va, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); return result; } + *device_count = dev_count; + if (dev_count != 0 && (g_variant_n_children(va) == dev_count)) { GVariantIter *iter = NULL, *iter_row = NULL; GVariant *key_value; const gchar *key; guint i = 0; - *dev_list = g_new(mtp_device_list, 1); - (*dev_list)->device_num = dev_count; - (*dev_list)->devices = g_new(mtp_device, dev_count); + *raw_devices = (mtp_raw_device **)malloc(sizeof(mtp_raw_device*) * 1); + **raw_devices = (mtp_raw_device *)malloc(sizeof(mtp_raw_device) * *device_count); g_variant_get(va, "aa{sv}", &iter); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) { if (g_strcmp0(key, "model_name") == 0) { - ((*dev_list)->devices)[i].model_name = + (**raw_devices)[i].model_name = g_strdup(g_variant_get_string(key_value, NULL)); } else if (g_strcmp0(key, "bus_location") == 0) { - ((*dev_list)->devices)[i].bus_location = g_variant_get_int32(key_value); + (**raw_devices)[i].bus_location = g_variant_get_int32(key_value); + } else if (g_strcmp0(key, "device_number") == 0) { + (**raw_devices)[i].device_number = g_variant_get_int32(key_value); } } + (**raw_devices)[i].dev_count = dev_count; i++; g_variant_iter_free(iter_row); } @@ -137,22 +147,23 @@ mtp_error_e mtp_gdbus_manager_get_device_list(mtp_device_list **dev_list) return result; } -mtp_error_e mtp_gdbus_manager_get_device_handle(int bus_location, int *device_handle) +mtp_error_e mtp_gdbus_manager_get_device(int bus_location, int device_number, int *mtp_device) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_manager_call_get_device_handle_sync( + if (mtp_gdbuslib_manager_call_get_device_sync( manager_proxy, bus_location, - device_handle, + device_number, + mtp_device, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } @@ -160,25 +171,25 @@ mtp_error_e mtp_gdbus_manager_get_device_handle(int bus_location, int *device_ha return result; } -mtp_error_e mtp_gdbus_manager_get_storage_ids(int device_handle, - int **storage_ids, int *storage_num) +mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device, + int **mtp_storages, int *storage_num) { GVariant *va = NULL; mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_manager_call_get_storage_ids_sync( + if (mtp_gdbuslib_manager_call_get_storages_sync( manager_proxy, - device_handle, + mtp_device, storage_num, &va, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); return result; @@ -190,13 +201,13 @@ mtp_error_e mtp_gdbus_manager_get_storage_ids(int device_handle, const gchar *key; guint i = 0; - *storage_ids = g_new(int, *storage_num); + *mtp_storages = g_new(int, *storage_num); g_variant_get(va, "aa{sv}", &iter); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) { - if (g_strcmp0(key, "storage_id") == 0) - (*storage_ids)[i] = g_variant_get_int32(key_value); + if (g_strcmp0(key, "mtp_storage") == 0) + (*mtp_storages)[i] = g_variant_get_int32(key_value); } i++; g_variant_iter_free(iter_row); @@ -209,20 +220,20 @@ mtp_error_e mtp_gdbus_manager_get_storage_ids(int device_handle, return result; } -mtp_error_e mtp_gdbus_manager_get_object_handles(int device_handle, - int storage_id, int format, int parent_object_handle, int **object_handles, int *object_num) +mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device, + int mtp_storage, int format, int parent_object_handle, int **object_handles, int *object_num) { GVariant *va = NULL; mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_manager_call_get_object_handles_sync( manager_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, format, parent_object_handle, object_num, @@ -230,7 +241,7 @@ mtp_error_e mtp_gdbus_manager_get_object_handles(int device_handle, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); return result; @@ -261,23 +272,23 @@ mtp_error_e mtp_gdbus_manager_get_object_handles(int device_handle, return result; } -mtp_error_e mtp_gdbus_manager_delete_object(int device_handle, +mtp_error_e mtp_gdbus_manager_delete_object(int mtp_device, int object_handle) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_manager_call_delete_object_sync( manager_proxy, - device_handle, + mtp_device, object_handle, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } @@ -285,24 +296,24 @@ mtp_error_e mtp_gdbus_manager_delete_object(int device_handle, return result; } -mtp_error_e mtp_gdbus_manager_get_object(int device_handle, +mtp_error_e mtp_gdbus_manager_get_object(int mtp_device, int object_handle, char *dest_path) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_manager_call_get_object_sync( manager_proxy, - device_handle, + mtp_device, object_handle, dest_path, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } @@ -310,24 +321,24 @@ mtp_error_e mtp_gdbus_manager_get_object(int device_handle, return result; } -mtp_error_e mtp_gdbus_manager_get_thumbnail(int device_handle, +mtp_error_e mtp_gdbus_manager_get_thumbnail(int mtp_device, int object_handle, char *dest_path) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_manager_call_get_thumbnail_sync( manager_proxy, - device_handle, + mtp_device, object_handle, dest_path, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } diff --git a/src/mtp_gdbus_objectinfo.c b/src/mtp_gdbus_objectinfo.c index 38077fb..c5382ff 100755 --- a/src/mtp_gdbus_objectinfo.c +++ b/src/mtp_gdbus_objectinfo.c @@ -34,50 +34,50 @@ void mtp_gdbus_objectinfo_proxy_deinit(void) objectinfo_proxy = NULL; } -int mtp_gdbus_objectinfo_get_property(int device_handle, +int mtp_gdbus_objectinfo_get_property(int mtp_device, int object_handle, int property, int *property_value) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (objectinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_objectinfo_call_get_property_sync( objectinfo_proxy, - device_handle, + mtp_device, object_handle, property, property_value, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -int mtp_gdbus_objectinfo_get_property_string(int device_handle, +int mtp_gdbus_objectinfo_get_property_string(int mtp_device, int object_handle, int property, char **property_value) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (objectinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_objectinfo_call_get_property_string_sync( objectinfo_proxy, - device_handle, + mtp_device, object_handle, property, property_value, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } diff --git a/src/mtp_gdbus_storageinfo.c b/src/mtp_gdbus_storageinfo.c index b8ab9f6..db5f020 100755 --- a/src/mtp_gdbus_storageinfo.c +++ b/src/mtp_gdbus_storageinfo.c @@ -34,120 +34,120 @@ void mtp_gdbus_storageinfo_proxy_deinit(void) storageinfo_proxy = NULL; } -mtp_error_e mtp_gdbus_storageinfo_get_description(int device_handle, - int storage_id, char **description) +mtp_error_e mtp_gdbus_storageinfo_get_description(int mtp_device, + int mtp_storage, char **description) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (storageinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_storageinfo_call_get_description_sync( storageinfo_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, description, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_storageinfo_get_freespace(int device_handle, - int storage_id, guint64 *freespace) +mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, + int mtp_storage, guint64 *freespace) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (storageinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_storageinfo_call_get_free_space_sync( storageinfo_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, freespace, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int device_handle, - int storage_id, guint64 *maxcapacity) +mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, + int mtp_storage, guint64 *maxcapacity) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (storageinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_storageinfo_call_get_max_capacity_sync( storageinfo_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, maxcapacity, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int device_handle, - int storage_id, int *storagetype) +mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, + int mtp_storage, int *storagetype) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (storageinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_storageinfo_call_get_storage_type_sync( storageinfo_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, storagetype, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } return result; } -mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int device_handle, - int storage_id, char **volumeidentifier) +mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int mtp_device, + int mtp_storage, char **volumeidentifier) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (storageinfo_proxy == NULL) - return MTP_ERROR_GENERAL; + return MTP_ERROR_NOT_COMM_INITIALIZED; if (mtp_gdbuslib_storageinfo_call_get_volume_identifier_sync( storageinfo_proxy, - device_handle, - storage_id, + mtp_device, + mtp_storage, volumeidentifier, &result, NULL, &error) == FALSE) { - result = MTP_ERROR_IO_ERROR; + result = MTP_ERROR_COMM_ERROR; g_error_free(error); } diff --git a/src/mtp_gdbuslib.xml b/src/mtp_gdbuslib.xml index 45afda8..aaca563 100755 --- a/src/mtp_gdbuslib.xml +++ b/src/mtp_gdbuslib.xml @@ -4,28 +4,29 @@ - - - + + + - + - + + - - + + - + - - + + @@ -34,21 +35,21 @@ - + - + - + @@ -60,75 +61,75 @@ - + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - + diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 6488e98..266a0d2 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -18,14 +18,10 @@ #define BEGIN() TC_PRT("BEGIN >>>>"); #define END() TC_PRT("END <<<<"); -static int handle; -static mtp_device_list* dev_list; - -static int strg_handle = 0; -static int* strg_list; - -static int obj_handle = 0; -static int* obj_list; +static mtp_device_h mtp_device; +static mtp_storage_h mtp_storage = 0; +static mtp_object_h mtp_object = 0; +static mtp_object_h* mtp_objects; int obj_count; GMainLoop *main_loop = NULL; @@ -144,20 +140,28 @@ int manager_test_initialize(void) return ret; } -int manager_test_get_device_list(void) +int manager_test_get_raw_devices(void) { int ret = 0; int i; + mtp_raw_device_h *raw_devices = NULL; + int device_count; + BEGIN(); - ret = mtp_get_device_list(&dev_list); + ret = mtp_get_raw_devices(&raw_devices, &device_count); + TC_PRT("ret[%d]: device_num[%d]", ret, device_count); if (ret == MTP_ERROR_NONE) { - TC_PRT("ret[%d]: device_num[%d]", ret, dev_list->device_num); - - for (i = 0; i < dev_list->device_num; i++) { - TC_PRT("device bus_location[%d] model_name[%s]", - dev_list->devices[i].bus_location, dev_list->devices[i].model_name); + for (i = 0; i < device_count; i++) { + int bus_location; + int device_number; + char *device_name = NULL; + mtp_get_bus_location(raw_devices[i], &bus_location); + mtp_get_device_number(raw_devices[i], &device_number); + mtp_get_device_name(raw_devices[i], &device_name); + TC_PRT("device bus_location[%d], dev_no [%d], model_name[%s]", + bus_location, device_number, device_name); } } else { TC_PRT("get device list failed, ret[%d]", ret); @@ -167,64 +171,94 @@ int manager_test_get_device_list(void) return ret; } -int manager_test_get_device_handle(void) +int manager_test_get_device(void) { int ret = 0; - int input_int = 0; int bus_location = 0; + int device_number = 0; + int device_count; + mtp_raw_device_h *raw_devices = NULL; + BEGIN(); - if (dev_list->device_num == 0) { + ret = mtp_get_raw_devices(&raw_devices, &device_count); + + if (ret != MTP_ERROR_NONE) { + TC_PRT("mtp_get_raw_devices is failed!!!"); + return -1; + } + + if (device_count == 0) { TC_PRT("device is not exist!!!"); END(); return -1; } - input_int = dev_list->devices[0].bus_location; + TC_PRT("Select first device"); - if (dev_list->device_num > 1) { - if (!test_get_user_int("==> Input Bus_location No :", &input_int)) - TC_PRT("select first bus[%d]", input_int); - } + mtp_get_bus_location(raw_devices[0], &bus_location); + mtp_get_device_number(raw_devices[0], &device_number); - bus_location = input_int; + TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); - ret = mtp_get_device_handle(bus_location, &handle); - TC_PRT("ret[%d]: 1st device handle[%d]", ret, handle); + ret = mtp_get_device(bus_location, device_number, &mtp_device); + TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); END(); return ret; } -int manager_test_get_storage_ids(void) +int manager_test_get_storages(void) { - int ret = 0; int i; - int count = 0; - int input_int = 0; - BEGIN(); + int ret = 0; + int bus_location = 0; + int device_number = 0; + int device_count; + int storage_count; + mtp_raw_device_h *raw_devices = NULL; + mtp_storage_h *mtp_storages = NULL; - ret = mtp_get_storage_ids(handle, &strg_list, &count); - TC_PRT("ret[%d]: storage_num[%d]", ret, count); + ret = mtp_get_raw_devices(&raw_devices, &device_count); - if (count == 0) { - TC_PRT("storage is not exist!!!"); + if (ret != MTP_ERROR_NONE) { + TC_PRT("mtp_get_raw_devices is failed!!!"); + return -1; + } + + if (device_count == 0) { + TC_PRT("device is not exist!!!"); END(); return -1; } - for (i = 0; i < count; i++) - TC_PRT("storage handle[%d]", strg_list[i]); + TC_PRT("Select first device"); + + mtp_get_bus_location(raw_devices[0], &bus_location); + mtp_get_device_number(raw_devices[0], &device_number); - input_int = strg_list[0]; + TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); - if (count > 1) { - if (!test_get_user_int("==> Input Storage Handle :", &input_int)) - TC_PRT("select first storage[%d]", strg_list[0]); + ret = mtp_get_device(bus_location, device_number, &mtp_device); + TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); + + ret = mtp_get_storages(mtp_device, &mtp_storages, &storage_count); + TC_PRT("ret[%d]: storage_count[%d]", ret, storage_count); + + if (storage_count == 0) { + TC_PRT("storage is not exist!!!"); + END(); + return -1; } - strg_handle = input_int; - TC_PRT("selected storage handle[%d]", strg_handle); + ret = mtp_destroy_raw_devices(raw_devices); + TC_PRT("ret[%d]: mtp_destroy_raw_devices", ret); + + + for (i = 0; i < storage_count; i++) + TC_PRT("mtp storage %d [%d]", i, mtp_storages[i]); + + mtp_storage = mtp_storages[0]; END(); return ret; @@ -239,35 +273,35 @@ int manager_test_get_object_handles(void) int folder_count = 0; int *file_list; int file_count = 0; - int format = MTP_FILETYPE_FOLDER; + mtp_filetype_e filetype = MTP_FILETYPE_FOLDER; char *filename = NULL; int folder_max = 0; int file_max = 0; int list_max = 0; BEGIN(); - ret = mtp_get_object_handles(handle, strg_handle, MTP_FILETYPE_FOLDER, obj_handle, &folder_list, &folder_count); + ret = mtp_get_object_handles(mtp_device, mtp_storage, MTP_FILETYPE_FOLDER, mtp_object, &folder_list, &folder_count); TC_PRT("ret[%d]: total folder_count[%d]", ret, folder_count); folder_max = (folder_count < TEST_LIST_MAX) ? folder_count : TEST_LIST_MAX; for (i = 0; i < folder_max; i++) { - ret = mtp_objectinfo_get_filename(handle, folder_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, folder_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, folder_list[i], filename, test_filetype_to_string(format)); + ret = mtp_objectinfo_get_file_name(mtp_device, folder_list[i], &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, folder_list[i], &filetype); + TC_PRT("ret[%d]: object id[%d] - filename[%s], filetype[%s]", + ret, folder_list[i], filename, test_filetype_to_string(filetype)); } - ret = mtp_get_object_handles(handle, strg_handle, MTP_FILETYPE_JPEG, obj_handle, &file_list, &file_count); + ret = mtp_get_object_handles(mtp_device, mtp_storage, MTP_FILETYPE_JPEG, mtp_object, &file_list, &file_count); TC_PRT("ret[%d]: total file_count[%d]", ret, file_count); file_max = (file_count < TEST_LIST_MAX) ? file_count : TEST_LIST_MAX; for (i = 0; i < file_max; i++) { - ret = mtp_objectinfo_get_filename(handle, file_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, file_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, file_list[i], filename, test_filetype_to_string(format)); + ret = mtp_objectinfo_get_file_name(mtp_device, file_list[i], &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, file_list[i], &filetype); + TC_PRT("ret[%d]: object id[%d] - filename[%s], filetype[%s]", + ret, file_list[i], filename, test_filetype_to_string(filetype)); } if (!test_get_user_int("==> Select Object Type(FOLDER:0, JPEG:14)" @@ -275,27 +309,27 @@ int manager_test_get_object_handles(void) TC_PRT("select default : folder[%d]", input_int); } - ret = mtp_get_object_handles(handle, strg_handle, input_int, obj_handle, &obj_list, &obj_count); + ret = mtp_get_object_handles(mtp_device, mtp_storage, input_int, mtp_object, &mtp_objects, &obj_count); TC_PRT("ret[%d]: total object_num[%d]", ret, 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_filename(handle, obj_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, obj_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, obj_list[i], filename, test_filetype_to_string(format)); + 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 (input_int == MTP_FILETYPE_FOLDER) { - if (!test_get_user_int("==> Input Object ID :", &obj_handle)) { - TC_PRT("invalid input !!![%d]", obj_handle); - obj_handle = 0; + if (!test_get_user_int("==> Input Object ID :", &mtp_object)) { + TC_PRT("invalid input !!![%d]", mtp_object); + mtp_object = 0; END(); return -1; } - TC_PRT("selected object id[%d]", obj_handle); + TC_PRT("selected object id[%d]", mtp_object); TC_PRT("===== Object List - Folder ====="); } else { TC_PRT("===== Object List - JPEG ====="); @@ -310,7 +344,7 @@ int manager_test_delete_object(void) int ret = 0; int i; int input_int = 0; - int format = MTP_FILETYPE_JPEG; + mtp_filetype_e filetype = MTP_FILETYPE_JPEG; char *filename = NULL; int list_max = 0; BEGIN(); @@ -320,10 +354,10 @@ int manager_test_delete_object(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_filename(handle, obj_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, obj_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, obj_list[i], filename, test_filetype_to_string(format)); + 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)) { @@ -332,7 +366,7 @@ int manager_test_delete_object(void) return -1; } - ret = mtp_delete_object(handle, input_int); + ret = mtp_delete_object(mtp_device, input_int); TC_PRT("ret[%d]: input id[%d]", ret, input_int); END(); @@ -344,7 +378,7 @@ int manager_test_get_object(void) int ret = 0; int i; int input_int = 0; - int format = MTP_FILETYPE_JPEG; + mtp_filetype_e filetype = MTP_FILETYPE_JPEG; char *filename = NULL; char filepath[100] = {0,}; int list_max = 0; @@ -355,10 +389,10 @@ int manager_test_get_object(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_filename(handle, obj_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, obj_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, obj_list[i], filename, test_filetype_to_string(format)); + 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)) { @@ -369,7 +403,7 @@ int manager_test_get_object(void) snprintf(filepath, 100, "/opt/usr/media/Downloads/JpegObject_%d.jpg", input_int); - ret = mtp_get_object(handle, input_int, filepath); + ret = mtp_get_object(mtp_device, input_int, filepath); TC_PRT("ret[%d]: input id[%d]", ret, input_int); END(); @@ -384,7 +418,7 @@ int manager_test_get_thumbnail(void) int input_int = 0; char input_str[50] = {0, }; char filepath[100] = {0,}; - int format = MTP_FILETYPE_JPEG; + mtp_filetype_e filetype = MTP_FILETYPE_JPEG; char *filename = NULL; int list_max = 0; BEGIN(); @@ -394,10 +428,10 @@ int manager_test_get_thumbnail(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_filename(handle, obj_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, obj_list[i], &format); - TC_PRT("ret[%d]: object id[%d] - filename[%s], format[%s]", - ret, obj_list[i], filename, test_filetype_to_string(format)); + 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 JPEG ID :", &input_int)) { @@ -418,7 +452,7 @@ int manager_test_get_thumbnail(void) snprintf(filepath, 100, "/opt/usr/media/Downloads/%s_%d.jpg", input_str, input_int); - ret = mtp_get_thumbnail(handle, input_int, filepath); + ret = mtp_get_thumbnail(mtp_device, input_int, filepath); TC_PRT("ret[%d]: input jpeg id[%d], input file path[%s]", ret, input_int, filepath); END(); @@ -443,7 +477,7 @@ int deviceinfo_test_get_manufacturername(void) char *name = NULL; BEGIN(); - ret = mtp_deviceinfo_get_manufacturername(handle, &name); + ret = mtp_deviceinfo_get_manufacturer_name(mtp_device, &name); TC_PRT("ret[%d]: manufacturername[%s]", ret, name); END(); @@ -456,7 +490,7 @@ int deviceinfo_test_get_modelname(void) char *name = NULL; BEGIN(); - ret = mtp_deviceinfo_get_modelname(handle, &name); + ret = mtp_deviceinfo_get_model_name(mtp_device, &name); TC_PRT("ret[%d]: modelname[%s]", ret, name); END(); @@ -469,7 +503,7 @@ int deviceinfo_test_get_serialnumber(void) char *name = NULL; BEGIN(); - ret = mtp_deviceinfo_get_serialnumber(handle, &name); + ret = mtp_deviceinfo_get_serial_number(mtp_device, &name); TC_PRT("ret[%d]: serialnumber[%s]", ret, name); END(); @@ -482,7 +516,7 @@ int deviceinfo_test_get_deviceversion(void) char *name = NULL; BEGIN(); - ret = mtp_deviceinfo_get_deviceversion(handle, &name); + ret = mtp_deviceinfo_get_device_version(mtp_device, &name); TC_PRT("ret[%d]: deviceversion[%s]", ret, name); END(); @@ -496,7 +530,7 @@ int storageinfo_test_get_description(void) char *name = NULL; BEGIN(); - ret = mtp_storageinfo_get_description(handle, strg_handle, &name); + ret = mtp_storageinfo_get_description(mtp_device, mtp_storage, &name); TC_PRT("ret[%d]: description[%s]", ret, name); END(); @@ -509,7 +543,7 @@ int storageinfo_test_get_freespace(void) unsigned long long value = 0; BEGIN(); - ret = mtp_storageinfo_get_freespace(handle, strg_handle, &value); + ret = mtp_storageinfo_get_free_space(mtp_device, mtp_storage, &value); TC_PRT("ret[%d]: freespace[%llu]", ret, value); END(); @@ -522,7 +556,7 @@ int storageinfo_test_get_maxcapacity(void) unsigned long long value = 0; BEGIN(); - ret = mtp_storageinfo_get_maxcapacity(handle, strg_handle, &value); + ret = mtp_storageinfo_get_max_capacity(mtp_device, mtp_storage, &value); TC_PRT("ret[%d]: maxcapacity[%llu]", ret, value); END(); @@ -535,7 +569,7 @@ int storageinfo_test_get_storagetype(void) int value = 0; BEGIN(); - ret = mtp_storageinfo_get_storagetype(handle, strg_handle, &value); + ret = mtp_storageinfo_get_storage_type(mtp_device, mtp_storage, &value); TC_PRT("ret[%d]: storagetype[%d]", ret, value); END(); @@ -548,7 +582,7 @@ int storageinfo_test_get_volumeidentifier(void) char *name = NULL; BEGIN(); - ret = mtp_storageinfo_get_volumeidentifier(handle, strg_handle, &name); + ret = mtp_storageinfo_get_volume_identifier(mtp_device, mtp_storage, &name); TC_PRT("ret[%d]: volumeidentifier[%s]", ret, name); END(); @@ -566,8 +600,8 @@ int objectinfo_test_get_association_desc(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_association_desc(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] association_desc[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_association_desc(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] association_desc[%d]", ret, mtp_objects[i], value); } END(); @@ -585,8 +619,8 @@ int objectinfo_test_get_association_type(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_association_type(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] association_type[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_association_type(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] association_type[%d]", ret, mtp_objects[i], value); } END(); @@ -604,8 +638,8 @@ int objectinfo_test_get_size(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_size(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] size[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_size(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] size[%d]", ret, mtp_objects[i], value); } END(); @@ -623,8 +657,8 @@ int objectinfo_test_get_parent_object_handle(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_parent_object_handle(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] parent_object_handle[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_parent_object_handle(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] parent_object_handle[%d]", ret, mtp_objects[i], value); } END(); @@ -642,8 +676,8 @@ int objectinfo_test_get_storage_id(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_storage_id(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] storage_id[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_storage(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] mtp_storage[%d]", ret, mtp_objects[i], value); } END(); @@ -661,8 +695,8 @@ int objectinfo_test_get_data_created(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_data_created(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] data_created[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_data_created(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] mtp_device[%d]", ret, mtp_objects[i], value); } END(); @@ -680,34 +714,34 @@ int objectinfo_test_get_data_modified(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_data_modified(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] data_modified[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_data_modified(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] data_modified[%d]", ret, mtp_objects[i], value); } END(); return ret; } -int objectinfo_test_get_format(void) +int objectinfo_test_get_file_type(void) { int i; int ret = 0; - int value = 0; + mtp_filetype_e value = 0; int list_max = 0; BEGIN(); list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_format(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] format[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_file_type(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] file type[%d]", ret, mtp_objects[i], value); } END(); return ret; } -int objectinfo_test_get_image_pix_depth(void) +int objectinfo_test_get_image_bit_depth(void) { int i; int ret = 0; @@ -718,8 +752,8 @@ int objectinfo_test_get_image_pix_depth(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_image_pix_depth(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] image_pix_depth[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_image_bit_depth(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] image_bit_depth[%d]", ret, mtp_objects[i], value); } END(); @@ -737,8 +771,8 @@ int objectinfo_test_get_image_pix_width(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_image_pix_width(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] image_pix_width[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_image_pix_width(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] image_pix_width[%d]", ret, mtp_objects[i], value); } END(); @@ -756,8 +790,8 @@ int objectinfo_test_get_image_pix_height(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_image_pix_height(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] image_pix_height[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_image_pix_height(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] image_pix_height[%d]", ret, mtp_objects[i], value); } END(); @@ -775,27 +809,27 @@ int objectinfo_test_get_thumbnail_size(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_thumbnail_size(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] thumbnail_size[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_thumbnail_size(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] thumbnail_size[%d]", ret, mtp_objects[i], value); } END(); return ret; } -int objectinfo_test_get_thumbnail_format(void) +int objectinfo_test_get_thumbnail_file_type(void) { int i; int ret = 0; - int value = 0; + mtp_filetype_e value = 0; int list_max = 0; BEGIN(); list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_thumbnail_format(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] thumbnail_format[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_thumbnail_file_type(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] thumbnail_format[%d]", ret, mtp_objects[i], value); } END(); @@ -813,8 +847,8 @@ int objectinfo_test_get_thumbnail_pix_height(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_thumbnail_pix_height(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] thumbnail_pix_height[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_thumbnail_pix_height(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] thumbnail_pix_height[%d]", ret, mtp_objects[i], value); } END(); @@ -832,8 +866,8 @@ int objectinfo_test_get_thumbnail_pix_width(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_thumbnail_pix_width(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] thumbnail_pix_width[%d]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_thumbnail_pix_width(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] thumbnail_pix_width[%d]", ret, mtp_objects[i], value); } END(); @@ -851,8 +885,8 @@ int objectinfo_test_get_filename(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_filename(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] filename[%s]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_file_name(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] filename[%s]", ret, mtp_objects[i], value); } END(); @@ -870,8 +904,8 @@ int objectinfo_test_get_keywords(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_keywords(handle, obj_list[i], &value); - TC_PRT("ret[%d]: object id[%d] keywords[%s]", ret, obj_list[i], value); + ret = mtp_objectinfo_get_keywords(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] keywords[%s]", ret, mtp_objects[i], value); } END(); @@ -882,7 +916,7 @@ int application_test_get_image_from_DCIM(void) { int ret = 0; int i; - int format = MTP_FILETYPE_FOLDER; + mtp_filetype_e filetype = MTP_FILETYPE_FOLDER; int *object_list; int object_count = 0; int *object_list2; @@ -895,7 +929,7 @@ int application_test_get_image_from_DCIM(void) BEGIN(); while (true) { - TC_PRT("storage_handle : %d", strg_handle); + TC_PRT("storage_handle : %d", mtp_storage); if (!test_get_user_int("==> 1. Select Object type (FOLDER:0, JPEG:14, BMP:17)" " - (Enter for skip) :", &input_object_id2)) { @@ -903,18 +937,18 @@ int application_test_get_image_from_DCIM(void) break; } - ret = mtp_get_object_handles(handle, (strg_handle > 0 ? strg_handle : 0), input_object_id2, selected_id, &object_list, &object_count); + ret = mtp_get_object_handles(mtp_device, (mtp_storage > 0 ? mtp_storage : 0), input_object_id2, selected_id, &object_list, &object_count); TC_PRT("Total object_num [%d]", object_count); for (i = 0; i < object_count; i++) { TC_PRT("object handle %d", object_list[i]); - ret = mtp_objectinfo_get_filename(handle, object_list[i], &filename); - ret = mtp_objectinfo_get_format(handle, object_list[i], &format); + ret = mtp_objectinfo_get_file_name(mtp_device, object_list[i], &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, object_list[i], &filetype); TC_PRT("ret : %d", ret); - TC_PRT("Folder object id %d - filename[%s], format[%s]\n", object_list[i], filename, test_filetype_to_string(format)); + TC_PRT("Folder object id %d - filename[%s], filetype[%s]\n", object_list[i], filename, test_filetype_to_string(filetype)); } if (!test_get_user_int("==> 1. Input Folder Object ID (Enter for exit):", &input_object_id)) { @@ -925,27 +959,27 @@ int application_test_get_image_from_DCIM(void) selected_id = input_object_id; - ret = mtp_objectinfo_get_filename(handle, selected_id, &filename); - ret = mtp_objectinfo_get_format(handle, selected_id, &format); + ret = mtp_objectinfo_get_file_name(mtp_device, selected_id, &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, selected_id, &filetype); TC_PRT("ret : %d", ret); - TC_PRT("selected id[%d] - filename[%s], format[%s]\n", selected_id, filename, test_filetype_to_string(format)); + TC_PRT("selected id[%d] - filename[%s], filetype[%s]\n", selected_id, filename, test_filetype_to_string(filetype)); g_free(filename); } - ret = mtp_get_object_handles(handle, (strg_handle > 0 ? strg_handle : 0), MTP_FILETYPE_JPEG, selected_id, &object_list2, &object_count2); + ret = mtp_get_object_handles(mtp_device, (mtp_storage > 0 ? mtp_storage : 0), MTP_FILETYPE_JPEG, selected_id, &object_list2, &object_count2); TC_PRT("Total object_num [%d]", object_count2); for (i = 0; i < object_count2; i++) { TC_PRT("object handle %d", object_list2[i]); - ret = mtp_objectinfo_get_filename(handle, object_list2[i], &filename); - ret = mtp_objectinfo_get_format(handle, object_list2[i], &format); + ret = mtp_objectinfo_get_file_name(mtp_device, object_list2[i], &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, object_list2[i], &filetype); TC_PRT("ret : %d", ret); - TC_PRT("JPEG id[%d] - filename[%s], format[%s]\n", object_list2[i], filename, test_filetype_to_string(format)); + TC_PRT("JPEG id[%d] - filename[%s], filetype[%s]\n", object_list2[i], filename, test_filetype_to_string(filetype)); } while (true) { @@ -954,18 +988,18 @@ int application_test_get_image_from_DCIM(void) break; } - ret = mtp_objectinfo_get_filename(handle, input_object_id2, &filename); - ret = mtp_objectinfo_get_format(handle, input_object_id2, &format); + ret = mtp_objectinfo_get_file_name(mtp_device, input_object_id2, &filename); + ret = mtp_objectinfo_get_file_type(mtp_device, input_object_id2, &filetype); TC_PRT("ret : %d", ret); - TC_PRT("selected id[%d] - filename[%s], format[%s]\n", input_object_id2, filename, test_filetype_to_string(format)); + TC_PRT("selected id[%d] - filename[%s], filetype[%s]\n", input_object_id2, filename, test_filetype_to_string(filetype)); g_free(filename); - if (format == MTP_FILETYPE_JPEG) { + if (filetype == MTP_FILETYPE_JPEG) { snprintf(filepath, 100, "/home/JpegObject_%d.jpg", input_object_id2); - ret = mtp_get_object(handle, input_object_id2, filepath); + ret = mtp_get_object(mtp_device, input_object_id2, filepath); TC_PRT("mtp_get_object ret : %d", ret); } } @@ -983,7 +1017,7 @@ int application_test_get_object_handle_using_all(void) BEGIN(); - ret = mtp_get_object_handles(handle, strg_handle, MTP_FILETYPE_ALL, 0, &file_list, &file_count); + ret = mtp_get_object_handles(mtp_device, mtp_storage, MTP_FILETYPE_ALL, 0, &file_list, &file_count); TC_PRT("ret[%d]: total folder_count[%d]", ret, file_count); for (i = 0; i < file_count; i++) @@ -1001,7 +1035,7 @@ int application_test_get_object_handle_using_all_image(void) int ret = 0; BEGIN(); - ret = mtp_get_object_handles(handle, strg_handle, MTP_FILETYPE_ALL_IMAGE, 0, &file_list, &file_count); + ret = mtp_get_object_handles(mtp_device, mtp_storage, MTP_FILETYPE_ALL_IMAGE, 0, &file_list, &file_count); TC_PRT("ret[%d]: total folder_count[%d]", ret, file_count); for (i = 0; i < file_count; i++) @@ -1017,7 +1051,7 @@ void __test_mtp_event_cb(mtp_event_e state, int arg, void *user_data) TC_PRT("state [%d] : %d", state, arg); - if (state == MTP_EVENT_DAEMON_TERMINATED) { + if (state == MTP_EVENT_TURNED_OFF) { ret = mtp_deinitialize(); TC_PRT("ret[%d] : Terminated daemon", ret); } @@ -1036,91 +1070,12 @@ int application_test_event_callback(void) return ret; } -int application_test_scenario(void) -{ - int i; - int ret; - int device_handle = 0; - int *storage_list; - int storage_count = 0; - int *image_list; - int image_count = 0; - mtp_device_list* dev_list; - struct timeval start1, start2, start3, start4; - struct timeval end1, end2, end3, end4; - - BEGIN(); - - /* init phase */ - gettimeofday(&start1, NULL); - TC_PRT("init phase start, %ld.%ld", start1.tv_sec, start1.tv_usec); - - ret = mtp_initialize(); - - ret = mtp_get_device_list(&dev_list); - - if (dev_list->device_num == 0) { - TC_PRT("device is not exist!!!"); - END(); - return -1; - } - - ret = mtp_get_device_handle(dev_list->devices[0].bus_location, &device_handle); - ret = mtp_get_storage_ids(device_handle, &storage_list, &storage_count); - - gettimeofday(&end1, NULL); - TC_PRT("init phase end time, %ld.%ld", end1.tv_sec, end1.tv_usec); - - /* scan phase */ - gettimeofday(&start2, NULL); - TC_PRT("scan phase start, %ld.%ld", start2.tv_sec, start2.tv_usec); - - ret = mtp_get_object_handles(device_handle, storage_list[0], MTP_FILETYPE_ALL_IMAGE, - 0, &image_list, &image_count); - - gettimeofday(&end2, NULL); - TC_PRT("scan phase end time, %ld.%ld", end2.tv_sec, end2.tv_usec); - - /* get objectinfo phase */ - gettimeofday(&start3, NULL); - TC_PRT("get objectinfo phase start, %ld.%ld", start3.tv_sec, start3.tv_usec); - - for (i = 0; i < image_count; i++) { - mtp_object_info *object_info; - mtp_objectinfo_get_object_info(device_handle, image_list[i], &object_info); - TC_PRT("filename : %s", object_info->Filename); - g_free(object_info); - } - - gettimeofday(&end3, NULL); - TC_PRT("get objectinfo phase end, %ld.%ld", end3.tv_sec, end3.tv_usec); - - /* get thumbnail phase */ - gettimeofday(&start4, NULL); - TC_PRT("get thumbnail phase start, %ld.%ld", start4.tv_sec, start4.tv_usec); - - for (i = 0; i < image_count; i++) { - char path[256] = {0,}; - - snprintf(path, 256, "/tmp/thumbnail%d.jpg", i); - mtp_get_thumbnail(device_handle, image_list[i], path); - } - gettimeofday(&end4, NULL); - TC_PRT("get thumbnail phase end, %ld.%ld", end4.tv_sec, end4.tv_usec); - - ret = mtp_deinitialize(); - - END(); - - return ret; -} - tc_table_t tc_table[] = { /* manager api */ {"mtp_initialize", 1, manager_test_initialize}, - {"mtp_get_device_list", 2, manager_test_get_device_list}, - {"mtp_get_device_handle", 3, manager_test_get_device_handle}, - {"mtp_get_storage_ids", 4, manager_test_get_storage_ids}, + {"mtp_get_raw_devices", 2, manager_test_get_raw_devices}, + {"mtp_get_device", 3, manager_test_get_device}, + {"mtp_get_storages", 4, manager_test_get_storages}, {"mtp_get_object_handles", 5, manager_test_get_object_handles}, {"mtp_delete_object", 6, manager_test_delete_object}, {"mtp_get_object", 7, manager_test_get_object}, @@ -1146,12 +1101,12 @@ tc_table_t tc_table[] = { {"mtp_objectinfo_get_size", 21, objectinfo_test_get_size}, {"mtp_objectinfo_get_data_created", 22, objectinfo_test_get_data_created}, {"mtp_objectinfo_get_data_modified", 23, objectinfo_test_get_data_modified}, - {"mtp_objectinfo_get_format", 24, objectinfo_test_get_format}, - {"mtp_objectinfo_get_image_pix_depth", 25, objectinfo_test_get_image_pix_depth}, + {"mtp_objectinfo_get_file_type", 24, objectinfo_test_get_file_type}, + {"mtp_objectinfo_get_image_pix_depth", 25, objectinfo_test_get_image_bit_depth}, {"mtp_objectinfo_get_image_pix_width", 26, objectinfo_test_get_image_pix_width}, {"mtp_objectinfo_get_image_pix_height", 27, objectinfo_test_get_image_pix_height}, {"mtp_objectinfo_get_thumbnail_size", 28, objectinfo_test_get_thumbnail_size}, - {"mtp_objectinfo_get_thumbnail_format", 29, objectinfo_test_get_thumbnail_format}, + {"mtp_objectinfo_get_thumbnail_format", 29, objectinfo_test_get_thumbnail_file_type}, {"mtp_objectinfo_get_thumbnail_pix_height", 30, objectinfo_test_get_thumbnail_pix_height}, {"mtp_objectinfo_get_thumbnail_pix_width", 31, objectinfo_test_get_thumbnail_pix_width}, {"mtp_objectinfo_get_filename", 32, objectinfo_test_get_filename}, @@ -1159,10 +1114,9 @@ tc_table_t tc_table[] = { /* application test */ {"get Jpeg image from /DCIM folder", 34, application_test_get_image_from_DCIM}, - {"get object handle using ALL format", 35, application_test_get_object_handle_using_all}, - {"get object handle using ALL Image format", 36, application_test_get_object_handle_using_all_image}, + {"get object handle using ALL file type", 35, application_test_get_object_handle_using_all}, + {"get object handle using ALL Image file type", 36, application_test_get_object_handle_using_all_image}, {"test callback function", 37, application_test_event_callback}, - {"application_test_scenario", 38, application_test_scenario}, {"get object and get thumbnail test", TEST_CASE_MAX, NULL}, /*-----------*/ -- 2.7.4 From 135c004f336e37f904086e4a3f22503d187ffd2c Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Tue, 5 Jan 2016 15:28:36 +0900 Subject: [PATCH 06/16] fix naming error of property Change-Id: Iea288dbd68803d17076f62bacf2e5eb636dec0e2 Signed-off-by: HyiHong Chae --- include/mtp_private.h | 4 ++-- packaging/capi-network-mtp.spec | 2 +- src/mtp.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mtp_private.h b/include/mtp_private.h index cb4075a..e849a0a 100755 --- a/include/mtp_private.h +++ b/include/mtp_private.h @@ -50,8 +50,8 @@ typedef enum { MTP_PROPERTY_DATA_MODIFIED, MTP_PROPERTY_FORMAT, MTP_PROPERTY_IMAGE_BIT_DEPTH, - MTP_PROPERTY_IMAGE_FIX_WIDTH, - MTP_PROPERTY_IMAGE_FIX_HEIGHT, + MTP_PROPERTY_IMAGE_PIX_WIDTH, + MTP_PROPERTY_IMAGE_PIX_HEIGHT, MTP_PROPERTY_PARENT_OBJECT_HANDLE, MTP_PROPERTY_STORAGE, MTP_PROPERTY_THUMBNAIL_SIZE, diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index d3271c5..81d4ff9 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.0 +Version: 1.3.1 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp.c b/src/mtp.c index 03357dc..50f03f3 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -890,7 +890,7 @@ int mtp_objectinfo_get_image_pix_width(int mtp_device, /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_IMAGE_FIX_WIDTH, width); + object_handle, MTP_PROPERTY_IMAGE_PIX_WIDTH, width); _END(); @@ -914,7 +914,7 @@ int mtp_objectinfo_get_image_pix_height(int mtp_device, /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_IMAGE_FIX_HEIGHT, height); + object_handle, MTP_PROPERTY_IMAGE_PIX_HEIGHT, height); _END(); -- 2.7.4 From 8ba583250fcc25beb263ab99475406d1ae753b77 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Wed, 6 Jan 2016 10:50:51 +0900 Subject: [PATCH 07/16] apply ACR comments Change-Id: I7eabf6f2c0ccd7f8892a9ed670d12d3f5a44cbf3 Signed-off-by: HyiHong Chae --- include/mtp.h | 110 ++++++++++++++++++++-------------------- packaging/capi-network-mtp.spec | 2 +- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/include/mtp.h b/include/mtp.h index 79a3b4c..05b8fbf 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -289,7 +289,7 @@ int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices); * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * * @pre mtp_get_bus_location(), mtp_get_device_number() * @see mtp_initialize() @@ -312,7 +312,7 @@ int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * * @see mtp_get_device() */ @@ -338,7 +338,7 @@ int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * * @see mtp_get_device() * @see mtp_get_storages() @@ -363,7 +363,7 @@ int mtp_get_object_handles(mtp_device_h mtp_device, mtp_storage_h mtp_storage, m * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_IO_ERROR I/O error * * @see mtp_get_device() @@ -388,7 +388,7 @@ int mtp_get_object(mtp_device_h mtp_device, mtp_object_h object_handle, char *de * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_IO_ERROR I/O error * * @see mtp_get_device() @@ -467,7 +467,7 @@ int mtp_deinitialize(void); * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -491,7 +491,7 @@ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufac * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -515,7 +515,7 @@ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -539,7 +539,7 @@ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_numb * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -573,7 +573,7 @@ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_ver * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -583,7 +583,7 @@ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_ver int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_storage, char **description); /** - * @brief Gets the freespace of the storage information. + * @brief Gets the free space of the storage information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -597,7 +597,7 @@ int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_s * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -621,7 +621,7 @@ int mtp_storageinfo_get_free_space(mtp_device_h mtp_device, mtp_storage_h mtp_st * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -645,7 +645,7 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -655,7 +655,7 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_storage, int *storage_type); /** - * @brief Gets the volumeidentifier of the storage information. + * @brief Gets the volume identifier of the storage information. * @since_tizen 3.0 * @remarks The @a volume_identifier should be freed using free(). * @@ -670,7 +670,7 @@ int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_ * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device @@ -704,11 +704,11 @@ int mtp_storageinfo_get_volume_identifier(mtp_device_h mtp_device, mtp_storage_h * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -730,11 +730,11 @@ int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_ha * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -755,11 +755,11 @@ int mtp_objectinfo_get_keywords(mtp_device_h mtp_device, mtp_object_h object_han * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -780,11 +780,11 @@ int mtp_objectinfo_get_association_desc(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -805,11 +805,11 @@ int mtp_objectinfo_get_association_type(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -830,11 +830,11 @@ int mtp_objectinfo_get_size(mtp_device_h mtp_device, mtp_object_h object_handle, * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -855,11 +855,11 @@ int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_ * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -880,11 +880,11 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -905,11 +905,11 @@ int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -930,11 +930,11 @@ int mtp_objectinfo_get_data_modified(mtp_device_h mtp_device, mtp_object_h objec * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -955,18 +955,18 @@ int mtp_objectinfo_get_file_type(mtp_device_h mtp_device, mtp_object_h object_ha * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h object_handle, int *depth); /** - * @brief Gets the image pix width of the object information. + * @brief Gets the image pixel width of the object information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -980,18 +980,18 @@ int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h obj * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h object_handle, int *width); /** - * @brief Gets the image pix height of the object information. + * @brief Gets the image pixel height of the object information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -1005,11 +1005,11 @@ int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h obj * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ @@ -1030,18 +1030,18 @@ int mtp_objectinfo_get_image_pix_height(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h object_handle, int *size); /** - * @brief Gets the thumbnail file_type of the object information. + * @brief Gets the thumbnail file type of the object information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -1055,18 +1055,18 @@ int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h obje * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_filetype_e *file_type); /** - * @brief Gets the thumbnail pix height of the object information. + * @brief Gets the thumbnail pixel height of the object information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -1080,18 +1080,18 @@ int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_h object_handle, int *height); /** - * @brief Gets the thumbnail pix width of the object information. + * @brief Gets the thumbnail pixel width of the object information. * @since_tizen 3.0 * * @param [in] mtp_device The MTP device @@ -1105,11 +1105,11 @@ int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_ * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * @retval #MTP_ERROR_COMM MTP communication error + * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device - * @retval #MTP_ERROR_PLUGIN Plugin failed + * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 81d4ff9..98f917c 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.1 +Version: 1.3.2 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 -- 2.7.4 From d416b10dde47e2c422ac66e78041eb354f9e0b03 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Mon, 11 Jan 2016 18:39:59 +0900 Subject: [PATCH 08/16] apply ACR comments Signed-off-by: Ji-hoon Jung Change-Id: Icdb528587e2d67a5f2314b6fbb82511000062cfe --- include/mtp.h | 19 ++++++++++++++++++- src/mtp.c | 4 ++-- test/mtp_unit_test.c | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/mtp.h b/include/mtp.h index 05b8fbf..0ea1b30 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -81,6 +81,19 @@ typedef enum { } mtp_error_e; /** + * @brief Enumerations for MTP Storage type + * @since_tizen 3.0 + */ + +typedef enum { + MTP_STORAGE_TYPE_UNDEFINED, /**< Storage type is undefined */ + MTP_STORAGE_TYPE_FIXED_ROM, /**< Storage type is fixed ROM */ + MTP_STORAGE_TYPE_REMOVABLE_ROM, /**< Storage type is removable ROM */ + MTP_STORAGE_TYPE_FIXED_RAM, /**< Storage type is fixed RAM */ + MTP_STORAGE_TYPE_REMOVABLE_RAM /**< Storage type is Removable RAM */ +} mtp_storage_type_e; + +/** * @brief Enumerations for MTP file type * @since_tizen 3.0 */ @@ -652,7 +665,7 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ * * @see mtp_get_storages() */ -int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_storage, int *storage_type); +int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_storage, mtp_storage_type_e *storage_type); /** * @brief Gets the volume identifier of the storage information. @@ -868,6 +881,8 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand /** * @brief Gets the data created time of the object information. * @since_tizen 3.0 + * @remarks When interpreted as an absolute time value, \n + * @a data_created represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -893,6 +908,8 @@ int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object /** * @brief Gets the data modified time of the object information. * @since_tizen 3.0 + * @remarks When interpreted as an absolute time value, \n + * @a data_modified represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle diff --git a/src/mtp.c b/src/mtp.c index 50f03f3..b250cba 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -606,7 +606,7 @@ int mtp_storageinfo_get_max_capacity(int mtp_device, int mtp_storage, unsigned l return ret; } -int mtp_storageinfo_get_storage_type(int mtp_device, int mtp_storage, int *storage_type) +int mtp_storageinfo_get_storage_type(int mtp_device, int mtp_storage, mtp_storage_type_e *storage_type) { int ret = MTP_ERROR_NONE; @@ -622,7 +622,7 @@ int mtp_storageinfo_get_storage_type(int mtp_device, int mtp_storage, int *stora /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_storagetype(mtp_device, mtp_storage, storage_type); + ret = mtp_gdbus_storageinfo_get_storagetype(mtp_device, mtp_storage, (int *)storage_type); TC_PRT("storagetype %d", *storage_type); diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 266a0d2..f33ee83 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -566,7 +566,7 @@ int storageinfo_test_get_maxcapacity(void) int storageinfo_test_get_storagetype(void) { int ret = 0; - int value = 0; + mtp_storage_type_e value = 0; BEGIN(); ret = mtp_storageinfo_get_storage_type(mtp_device, mtp_storage, &value); -- 2.7.4 From c41f3a2a09053fd71e6781d8c7f6e1a545aede41 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Thu, 14 Jan 2016 21:48:34 +0900 Subject: [PATCH 09/16] apply security comments. Change-Id: Ib3358ec53d270de0750aca2c27a344cfd7ba56ee Signed-off-by: HyiHong Chae --- include/mtp.h | 76 +++++++++++++++++++++++++++++++++++++++++ packaging/capi-network-mtp.spec | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/include/mtp.h b/include/mtp.h index 0ea1b30..93af315 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -185,6 +185,8 @@ typedef void (* mtp_event_cb)(mtp_event_e event, int event_parameter, void *user * @brief Initializes for using MTP. * @since_tizen 3.0 * @remarks This function must be called before proceeding any other mtp functions. + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -200,6 +202,8 @@ int mtp_initialize(void); * @brief Gets device list. * @since_tizen 3.0 * @remarks The @a raw_devices should be freed using mtp_destroy_raw_devices(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [out] raw_devices All current connected device list * @param [out] device_count The count of device @@ -220,6 +224,8 @@ int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count); * @brief Gets bus location from raw device. * @since_tizen 3.0 * @remarks The @a raw_device can get using mtp_get_raw_devices(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] raw_device The raw device * @param [out] bus_location The bus location @@ -238,6 +244,8 @@ int mtp_get_bus_location(mtp_raw_device_h raw_device, int *bus_location); * @brief Gets device number from raw device. * @since_tizen 3.0 * @remarks The @a raw_device can get using mtp_get_raw_devices(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] raw_device The raw device * @param [out] device_number The device number @@ -257,6 +265,8 @@ int mtp_get_device_number(mtp_raw_device_h raw_device, int *device_number); * @since_tizen 3.0 * @remarks The @a raw_device can get using mtp_get_raw_devices(). * @remarks The @a model_name should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] raw_device The raw device * @param [out] model_name The model name @@ -274,6 +284,8 @@ int mtp_get_device_name(mtp_raw_device_h raw_device, char **model_name); /** * @brief Destroys the raw devices handler. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] raw_devices The raw devices handler * @@ -290,6 +302,8 @@ int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices); * @brief Gets device handler from bus location. * @since_tizen 3.0 * @remarks For using this api, you should get bus location and device number from raw device. + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] bus_location The bus location * @param [in] device_number The device number @@ -313,6 +327,8 @@ int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device * @brief Gets mtp storages from device. * @since_tizen 3.0 * @remarks The @a mtp_storages should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] mtp_storages Current mtp storage list @@ -336,6 +352,8 @@ int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* * @since_tizen 3.0 * @remarks The @a object_handles should be freed using free(). * @remarks If the @a parent is 0, it means "root folder" of mtp storage. + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -416,6 +434,8 @@ int mtp_get_thumbnail(mtp_device_h mtp_device, mtp_object_h object_handle, char * @remarks If device state is changed, DEVICE_ADD or DEVICE_REMOVE event is occur. \n * If storage state is changed, STORAGE_ADD or STORAGE_REMOVE event is occur. \n * If object state is changed, OBJECT_ADD or OBJECT_REMOVE event is occur. + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] event_cb The callback * @param [in] user_data The user data @@ -433,6 +453,8 @@ int mtp_set_mtp_event_cb(mtp_event_cb event_cb, void *user_data); /** * @brief Unregisters the callback function. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -446,6 +468,8 @@ int mtp_unset_mtp_event_cb(void); /** * @brief Deinitializes MTP operation. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -469,6 +493,8 @@ int mtp_deinitialize(void); * @brief Gets the manufacturer name of the device information. * @since_tizen 3.0 * @remarks The @a manufacturer_name should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] manufacturer_name The manufacturer name of Device information @@ -493,6 +519,8 @@ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufac * @brief Gets the model name of the device information. * @since_tizen 3.0 * @remarks The @a model_name should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] model_name The model name of Device information @@ -517,6 +545,8 @@ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); * @brief Gets the serial number of the device information. * @since_tizen 3.0 * @remarks The @a serial_number should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] serial_number The serial number of Device information @@ -541,6 +571,8 @@ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_numb * @brief Gets the device version of the device information. * @since_tizen 3.0 * @remarks The @a device_version should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] device_version The device version of Device information @@ -574,6 +606,8 @@ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_ver * @brief Gets the description of the storage information. * @since_tizen 3.0 * @remarks The @a description should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -598,6 +632,8 @@ int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_s /** * @brief Gets the free space of the storage information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -622,6 +658,8 @@ int mtp_storageinfo_get_free_space(mtp_device_h mtp_device, mtp_storage_h mtp_st /** * @brief Gets the max capacity of the storage information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -646,6 +684,8 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ /** * @brief Gets the storage type of the storage information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -671,6 +711,8 @@ int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_ * @brief Gets the volume identifier of the storage information. * @since_tizen 3.0 * @remarks The @a volume_identifier should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -705,6 +747,8 @@ int mtp_storageinfo_get_volume_identifier(mtp_device_h mtp_device, mtp_storage_h * @brief Gets the filename of the object information. * @since_tizen 3.0 * @remarks The @a file_name should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -731,6 +775,8 @@ int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_ha * @brief Gets the keywords of the object information. * @since_tizen 3.0 * @remarks The @a keywords should be freed using free(). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -756,6 +802,8 @@ int mtp_objectinfo_get_keywords(mtp_device_h mtp_device, mtp_object_h object_han /** * @brief Gets the association desc of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -781,6 +829,8 @@ int mtp_objectinfo_get_association_desc(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the association type of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -806,6 +856,8 @@ int mtp_objectinfo_get_association_type(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the size of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -831,6 +883,8 @@ int mtp_objectinfo_get_size(mtp_device_h mtp_device, mtp_object_h object_handle, /** * @brief Gets the parent object handle of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -856,6 +910,8 @@ int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_ /** * @brief Gets the mtp storage of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -883,6 +939,8 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_created represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -910,6 +968,8 @@ int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_modified represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -935,6 +995,8 @@ int mtp_objectinfo_get_data_modified(mtp_device_h mtp_device, mtp_object_h objec /** * @brief Gets the file type of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -960,6 +1022,8 @@ int mtp_objectinfo_get_file_type(mtp_device_h mtp_device, mtp_object_h object_ha /** * @brief Gets the image bit depth of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -985,6 +1049,8 @@ int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h obj /** * @brief Gets the image pixel width of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1010,6 +1076,8 @@ int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h obj /** * @brief Gets the image pixel height of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1035,6 +1103,8 @@ int mtp_objectinfo_get_image_pix_height(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the thumbnail size of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1060,6 +1130,8 @@ int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h obje /** * @brief Gets the thumbnail file type of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1085,6 +1157,8 @@ int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h /** * @brief Gets the thumbnail pixel height of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1110,6 +1184,8 @@ int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_ /** * @brief Gets the thumbnail pixel width of the object information. * @since_tizen 3.0 + * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n + * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 98f917c..17e447f 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.2 +Version: 1.3.3 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 -- 2.7.4 From 5a65b1e0be7f3ef3b2a4bd2bf99e32d032e87ca1 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Fri, 22 Jan 2016 10:35:43 +0900 Subject: [PATCH 10/16] Apply ACR comment Signed-off-by : Jihoon Jung Change-Id: I1e2695b869b8f1fccf14650abd847b07e082a813 --- doc/mtp_doc.h | 17 ++++++++ include/mtp.h | 88 +++++++++++++++++++++-------------------- include/mtp_private.h | 4 +- packaging/capi-network-mtp.spec | 2 +- src/mtp.c | 8 ++-- test/mtp_unit_test.c | 14 +++---- 6 files changed, 76 insertions(+), 57 deletions(-) diff --git a/doc/mtp_doc.h b/doc/mtp_doc.h index a041d94..0e1f9c5 100755 --- a/doc/mtp_doc.h +++ b/doc/mtp_doc.h @@ -47,6 +47,23 @@ * Provide functions to gets the object information of certain file in MTP responder * * + * + * MTP is consist of three components : + * 1. MTP device + * - Meaning that the device supports MTP. + * - Having mtp-responder role. + * - Having one or more MTP storages. + * + * 2. MTP storage + * - Meaning that the storage in the mtp device. + * - Having zero or more MTP objects. + * + * 3. MTP object + * - MTP object meaning is the actual file. + * - Each file in the device has a unique handle called "Object Handle". + * This is not a unique handle each storage. + * - Mtp object is to have the parent object, so it can indicate a file hierarchy. + * If parent object is 0, then it means object is in root of storage. **/ /** diff --git a/include/mtp.h b/include/mtp.h index 93af315..3f7e2c7 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -69,15 +69,15 @@ typedef enum { MTP_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ MTP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ MTP_ERROR_NO_DEVICE = TIZEN_ERROR_MTP | 0x01, /**< MTP have not any device */ - MTP_ERROR_ALLOC_FAIL = TIZEN_ERROR_MTP | 0x02, /**< Memory Allocation failed */ - MTP_ERROR_PLUGIN_FAIL = TIZEN_ERROR_MTP | 0x03, /**< Plugin failed */ + MTP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + MTP_ERROR_PLUGIN_FAIL = TIZEN_ERROR_MTP | 0x02, /**< Plugin failed */ MTP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - MTP_ERROR_COMM_ERROR = TIZEN_ERROR_MTP | 0x04, /**< MTP communication error */ - MTP_ERROR_CONTROLLER = TIZEN_ERROR_MTP | 0x05, /**< MTP controller error */ - MTP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_MTP | 0x06, /**< MTP is not initialized */ - MTP_ERROR_NOT_ACTIVATED = TIZEN_ERROR_MTP | 0x07, /**< MTP is not activated */ + MTP_ERROR_COMM_ERROR = TIZEN_ERROR_MTP | 0x03, /**< MTP communication error */ + MTP_ERROR_CONTROLLER = TIZEN_ERROR_MTP | 0x04, /**< MTP controller error */ + MTP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_MTP | 0x05, /**< MTP is not initialized */ + MTP_ERROR_NOT_ACTIVATED = TIZEN_ERROR_MTP | 0x06, /**< MTP is not activated */ MTP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MTP is not supported */ - MTP_ERROR_NOT_COMM_INITIALIZED = TIZEN_ERROR_MTP | 0x08 /**< MTP communication is not initialized */ + MTP_ERROR_NOT_COMM_INITIALIZED = TIZEN_ERROR_MTP | 0x07, /**< MTP communication is not initialized */ } mtp_error_e; /** @@ -348,7 +348,7 @@ int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* storage_num); /** - * @brief Gets object handles from device. + * @brief Gets object handles from the given device and storage. * @since_tizen 3.0 * @remarks The @a object_handles should be freed using free(). * @remarks If the @a parent is 0, it means "root folder" of mtp storage. @@ -431,9 +431,10 @@ int mtp_get_thumbnail(mtp_device_h mtp_device, mtp_object_h object_handle, char * @brief Registers a callback function for receiving MTP event. * @since_tizen 3.0 * - * @remarks If device state is changed, DEVICE_ADD or DEVICE_REMOVE event is occur. \n - * If storage state is changed, STORAGE_ADD or STORAGE_REMOVE event is occur. \n - * If object state is changed, OBJECT_ADD or OBJECT_REMOVE event is occur. + * @remarks If device state is changed, #MTP_EVENT_DEVICE_ADDED or #MTP_EVENT_DEVICE_REMOVED event is occur. \n + * If storage state is changed, #MTP_EVENT_STORAGE_ADDED or #MTP_EVENT_STORAGE_REMOVED event is occur. \n + * If object state is changed, #MTP_EVENT_OBJECT_ADDED or #MTP_EVENT_OBJECT_REMOVED event is occur. \n + * If mtp service is turned off, #MTP_EVENT_TURNED_OFF event is occur. \n * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * @@ -508,7 +509,7 @@ int mtp_deinitialize(void); * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_device() @@ -534,7 +535,7 @@ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufac * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_device() @@ -560,7 +561,7 @@ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_device() @@ -586,7 +587,7 @@ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_numb * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_device() @@ -622,7 +623,7 @@ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_ver * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_storages() @@ -648,7 +649,7 @@ int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_s * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_storages() @@ -674,7 +675,7 @@ int mtp_storageinfo_get_free_space(mtp_device_h mtp_device, mtp_storage_h mtp_st * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_storages() @@ -700,7 +701,7 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_storages() @@ -727,7 +728,7 @@ int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_ * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * * @see mtp_get_object_handles() @@ -763,7 +764,7 @@ int mtp_storageinfo_get_volume_identifier(mtp_device_h mtp_device, mtp_storage_h * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -775,6 +776,7 @@ int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_ha * @brief Gets the keywords of the object information. * @since_tizen 3.0 * @remarks The @a keywords should be freed using free(). + * @remarks The keywords are separated by comma. * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * @@ -791,7 +793,7 @@ int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_ha * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -818,7 +820,7 @@ int mtp_objectinfo_get_keywords(mtp_device_h mtp_device, mtp_object_h object_han * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -845,7 +847,7 @@ int mtp_objectinfo_get_association_desc(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -872,7 +874,7 @@ int mtp_objectinfo_get_association_type(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -899,7 +901,7 @@ int mtp_objectinfo_get_size(mtp_device_h mtp_device, mtp_object_h object_handle, * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -926,7 +928,7 @@ int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_ * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -935,7 +937,7 @@ int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_handle, mtp_storage_h* mtp_storage); /** - * @brief Gets the data created time of the object information. + * @brief Gets the object created time of the object information. * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_created represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). @@ -944,7 +946,7 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle - * @param [out] data_created The data created time of Object information + * @param [out] date_created The object created time of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -955,16 +957,16 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ -int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object_handle, int *data_created); +int mtp_objectinfo_get_date_created(mtp_device_h mtp_device, mtp_object_h object_handle, int *date_created); /** - * @brief Gets the data modified time of the object information. + * @brief Gets the object modified time of the object information. * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_modified represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). @@ -973,7 +975,7 @@ int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle - * @param [out] data_modified The data modified time of Object information + * @param [out] date_modified The object modified time of Object information * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -984,13 +986,13 @@ int mtp_objectinfo_get_data_created(mtp_device_h mtp_device, mtp_object_h object * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * * @see mtp_get_object_handles() */ -int mtp_objectinfo_get_data_modified(mtp_device_h mtp_device, mtp_object_h object_handle, int *data_modified); +int mtp_objectinfo_get_date_modified(mtp_device_h mtp_device, mtp_object_h object_handle, int *date_modified); /** * @brief Gets the file type of the object information. @@ -1011,7 +1013,7 @@ int mtp_objectinfo_get_data_modified(mtp_device_h mtp_device, mtp_object_h objec * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1038,7 +1040,7 @@ int mtp_objectinfo_get_file_type(mtp_device_h mtp_device, mtp_object_h object_ha * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1065,7 +1067,7 @@ int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h obj * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1092,7 +1094,7 @@ int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h obj * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1119,7 +1121,7 @@ int mtp_objectinfo_get_image_pix_height(mtp_device_h mtp_device, mtp_object_h ob * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1146,7 +1148,7 @@ int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h obje * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1173,7 +1175,7 @@ int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * @@ -1200,7 +1202,7 @@ int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_ * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_CONTROLLER MTP controller error - * @retval #MTP_ERROR_ALLOC_FAIL Memory Allocation failed + * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * @retval #MTP_ERROR_PLUGIN_FAIL Plugin failed * diff --git a/include/mtp_private.h b/include/mtp_private.h index e849a0a..db7e651 100755 --- a/include/mtp_private.h +++ b/include/mtp_private.h @@ -46,8 +46,8 @@ typedef enum { MTP_PROPERTY_ASSOCIATION_DESC = 1, MTP_PROPERTY_ASSOCIATION_TYPE, MTP_PROPERTY_SIZE, - MTP_PROPERTY_DATA_CREATED, - MTP_PROPERTY_DATA_MODIFIED, + MTP_PROPERTY_DATE_CREATED, + MTP_PROPERTY_DATE_MODIFIED, MTP_PROPERTY_FORMAT, MTP_PROPERTY_IMAGE_BIT_DEPTH, MTP_PROPERTY_IMAGE_PIX_WIDTH, diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 17e447f..8e30d8d 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.3 +Version: 1.3.4 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp.c b/src/mtp.c index b250cba..2801220 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -778,7 +778,7 @@ int mtp_objectinfo_get_size(int mtp_device, int object_handle, int *size) return ret; } -int mtp_objectinfo_get_data_created(int mtp_device, +int mtp_objectinfo_get_date_created(int mtp_device, int object_handle, int *data_created) { int ret = MTP_ERROR_NONE; @@ -795,14 +795,14 @@ int mtp_objectinfo_get_data_created(int mtp_device, /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_DATA_CREATED, data_created); + object_handle, MTP_PROPERTY_DATE_CREATED, data_created); _END(); return ret; } -int mtp_objectinfo_get_data_modified(int mtp_device, +int mtp_objectinfo_get_date_modified(int mtp_device, int object_handle, int *data_modified) { int ret = MTP_ERROR_NONE; @@ -819,7 +819,7 @@ int mtp_objectinfo_get_data_modified(int mtp_device, /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_DATA_MODIFIED, data_modified); + object_handle, MTP_PROPERTY_DATE_MODIFIED, data_modified); _END(); diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index f33ee83..47b7d0c 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -684,7 +684,7 @@ int objectinfo_test_get_storage_id(void) return ret; } -int objectinfo_test_get_data_created(void) +int objectinfo_test_get_date_created(void) { int i; int ret = 0; @@ -695,7 +695,7 @@ int objectinfo_test_get_data_created(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_data_created(mtp_device, mtp_objects[i], &value); + ret = mtp_objectinfo_get_date_created(mtp_device, mtp_objects[i], &value); TC_PRT("ret[%d]: object id[%d] mtp_device[%d]", ret, mtp_objects[i], value); } @@ -703,7 +703,7 @@ int objectinfo_test_get_data_created(void) return ret; } -int objectinfo_test_get_data_modified(void) +int objectinfo_test_get_date_modified(void) { int i; int ret = 0; @@ -714,8 +714,8 @@ int objectinfo_test_get_data_modified(void) list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; for (i = 0; i < list_max; i++) { - ret = mtp_objectinfo_get_data_modified(mtp_device, mtp_objects[i], &value); - TC_PRT("ret[%d]: object id[%d] data_modified[%d]", ret, mtp_objects[i], value); + ret = mtp_objectinfo_get_date_modified(mtp_device, mtp_objects[i], &value); + TC_PRT("ret[%d]: object id[%d] date_modified[%d]", ret, mtp_objects[i], value); } END(); @@ -1099,8 +1099,8 @@ tc_table_t tc_table[] = { {"mtp_objectinfo_get_association_desc", 19, objectinfo_test_get_association_desc}, {"mtp_objectinfo_get_association_type", 20, objectinfo_test_get_association_type}, {"mtp_objectinfo_get_size", 21, objectinfo_test_get_size}, - {"mtp_objectinfo_get_data_created", 22, objectinfo_test_get_data_created}, - {"mtp_objectinfo_get_data_modified", 23, objectinfo_test_get_data_modified}, + {"mtp_objectinfo_get_date_created", 22, objectinfo_test_get_date_created}, + {"mtp_objectinfo_get_date_modified", 23, objectinfo_test_get_date_modified}, {"mtp_objectinfo_get_file_type", 24, objectinfo_test_get_file_type}, {"mtp_objectinfo_get_image_pix_depth", 25, objectinfo_test_get_image_bit_depth}, {"mtp_objectinfo_get_image_pix_width", 26, objectinfo_test_get_image_pix_width}, -- 2.7.4 From f73fb6610dd0d59fb0123ec41d8038f8e45fa81f Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Wed, 27 Jan 2016 18:00:48 +0900 Subject: [PATCH 11/16] Apply 3.0 ACR comment Signed-off-by: Jihoon Jung Change-Id: Ie7814420df1f6aacc1c34d5d9be6294a21f216c9 --- doc/mtp_doc.h | 2 +- include/mtp.h | 248 +++++++--------------------------------- include/mtp_gdbus_deviceinfo.h | 10 +- include/mtp_gdbus_manager.h | 9 +- include/mtp_gdbus_storageinfo.h | 16 +-- include/mtp_internal.h | 3 +- include/mtp_private.h | 11 +- src/mtp.c | 226 +++++++++++++----------------------- src/mtp_gdbus_deviceinfo.c | 68 +++++++++-- src/mtp_gdbus_manager.c | 102 ++++++++--------- src/mtp_gdbus_storageinfo.c | 24 ++-- src/mtp_gdbuslib.xml | 37 +++--- test/mtp_unit_test.c | 130 +++++++-------------- 13 files changed, 320 insertions(+), 566 deletions(-) diff --git a/doc/mtp_doc.h b/doc/mtp_doc.h index 0e1f9c5..81ac6a7 100755 --- a/doc/mtp_doc.h +++ b/doc/mtp_doc.h @@ -163,7 +163,7 @@ * \#include * @section CAPI_NETWORK_MTP_OBJECTINFO_MODULE_OVERVIEW Overview * The MTP Object Information api provides following functions :\n - * - Get object format\n + * - Get object file type\n * - Get object name\n * - Get object size\n * - and, more object information\n diff --git a/include/mtp.h b/include/mtp.h index 3f7e2c7..4b5dc95 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -37,12 +37,6 @@ extern "C" { */ /** - * @brief The handle to the mtp raw device - * @since_tizen 3.0 - */ -typedef struct mtp_raw_device *mtp_raw_device_h; - -/** * @brief The handle to the mtp device * @since_tizen 3.0 */ @@ -68,23 +62,22 @@ typedef enum { MTP_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ MTP_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ MTP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - MTP_ERROR_NO_DEVICE = TIZEN_ERROR_MTP | 0x01, /**< MTP have not any device */ MTP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - MTP_ERROR_PLUGIN_FAIL = TIZEN_ERROR_MTP | 0x02, /**< Plugin failed */ MTP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - MTP_ERROR_COMM_ERROR = TIZEN_ERROR_MTP | 0x03, /**< MTP communication error */ - MTP_ERROR_CONTROLLER = TIZEN_ERROR_MTP | 0x04, /**< MTP controller error */ - MTP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_MTP | 0x05, /**< MTP is not initialized */ - MTP_ERROR_NOT_ACTIVATED = TIZEN_ERROR_MTP | 0x06, /**< MTP is not activated */ - MTP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MTP is not supported */ - MTP_ERROR_NOT_COMM_INITIALIZED = TIZEN_ERROR_MTP | 0x07, /**< MTP communication is not initialized */ + MTP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ + MTP_ERROR_COMM_ERROR = TIZEN_ERROR_MTP | 0x01, /**< MTP communication error */ + MTP_ERROR_CONTROLLER = TIZEN_ERROR_MTP | 0x02, /**< MTP controller error */ + MTP_ERROR_NO_DEVICE = TIZEN_ERROR_MTP | 0x03, /**< MTP have not any device */ + MTP_ERROR_NOT_INITIALIZED = TIZEN_ERROR_MTP | 0x04, /**< MTP is not initialized */ + MTP_ERROR_NOT_ACTIVATED = TIZEN_ERROR_MTP | 0x05, /**< MTP is not activated */ + MTP_ERROR_NOT_COMM_INITIALIZED = TIZEN_ERROR_MTP | 0x06, /**< MTP communication is not initialized */ + MTP_ERROR_PLUGIN_FAIL = TIZEN_ERROR_MTP | 0x07, /**< MTP Plugin failed */ } mtp_error_e; /** * @brief Enumerations for MTP Storage type * @since_tizen 3.0 */ - typedef enum { MTP_STORAGE_TYPE_UNDEFINED, /**< Storage type is undefined */ MTP_STORAGE_TYPE_FIXED_ROM, /**< Storage type is fixed ROM */ @@ -164,7 +157,7 @@ typedef enum { } mtp_event_e; /** - * @brief Called after mtp_set_mtp_event_cb() has completed. + * @brief Called when mtp event is occured. * @since_tizen 3.0 * @remarks Depending on the type of event, the meaning of event parameter is different. * - If event is device event, then event_parameter type is mtp_device_h. @@ -199,115 +192,10 @@ typedef void (* mtp_event_cb)(mtp_event_e event, int event_parameter, void *user int mtp_initialize(void); /** - * @brief Gets device list. - * @since_tizen 3.0 - * @remarks The @a raw_devices should be freed using mtp_destroy_raw_devices(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [out] raw_devices All current connected device list - * @param [out] device_count The count of device - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported - * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized - * @retval #MTP_ERROR_NOT_ACTIVATED MTP is not activated - * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized - * - * @see mtp_destroy_raw_devices() - */ -int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count); - -/** - * @brief Gets bus location from raw device. - * @since_tizen 3.0 - * @remarks The @a raw_device can get using mtp_get_raw_devices(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [in] raw_device The raw device - * @param [out] bus_location The bus location - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported - * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized - * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mtp_get_raw_devices() - */ -int mtp_get_bus_location(mtp_raw_device_h raw_device, int *bus_location); - -/** - * @brief Gets device number from raw device. - * @since_tizen 3.0 - * @remarks The @a raw_device can get using mtp_get_raw_devices(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [in] raw_device The raw device - * @param [out] device_number The device number - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported - * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized - * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mtp_get_raw_devices() - */ -int mtp_get_device_number(mtp_raw_device_h raw_device, int *device_number); - -/** - * @brief Gets device name from raw device. - * @since_tizen 3.0 - * @remarks The @a raw_device can get using mtp_get_raw_devices(). - * @remarks The @a model_name should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [in] raw_device The raw device - * @param [out] model_name The model name - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported - * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized - * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mtp_get_raw_devices() - */ -int mtp_get_device_name(mtp_raw_device_h raw_device, char **model_name); - -/** - * @brief Destroys the raw devices handler. - * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [in] raw_devices The raw devices handler - * - * @return 0 on success, otherwise a negative error value. - * @retval #MTP_ERROR_NONE Successful - * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported - * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mtp_get_raw_devices() - */ -int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices); - -/** - * @brief Gets device handler from bus location. + * @brief Gets the mtp devices. * @since_tizen 3.0 - * @remarks For using this api, you should get bus location and device number from raw device. - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n - * - * @param [in] bus_location The bus location - * @param [in] device_number The device number - * @param [out] mtp_device The MTP device + * @param [out] mtp_devices The MTP device list + * @param [out] device_count Length of device list * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -318,21 +206,18 @@ int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices); * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * - * @pre mtp_get_bus_location(), mtp_get_device_number() * @see mtp_initialize() */ -int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device); +int mtp_get_devices(mtp_device_h **mtp_devices, int *device_count); /** - * @brief Gets mtp storages from device. + * @brief Gets mtp storages from the given device. * @since_tizen 3.0 * @remarks The @a mtp_storages should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] mtp_storages Current mtp storage list - * @param [out] storage_num Length of storage list + * @param [out] storage_count Length of storage list * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -343,24 +228,22 @@ int mtp_get_device(int bus_location, int device_number, mtp_device_h *mtp_device * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * - * @see mtp_get_device() + * @see mtp_get_devices() */ -int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* storage_num); +int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* storage_count); /** * @brief Gets object handles from the given device and storage. * @since_tizen 3.0 * @remarks The @a object_handles should be freed using free(). * @remarks If the @a parent is 0, it means "root folder" of mtp storage. - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage * @param [in] file_type The file type what you want * @param [in] parent The parent object handle * @param [out] object_handles The object handle list - * @param [out] object_num Length of object handle list + * @param [out] object_count Length of object handle list * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -371,15 +254,16 @@ int mtp_get_storages(mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int* * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * - * @see mtp_get_device() + * @see mtp_get_devices() * @see mtp_get_storages() */ int mtp_get_object_handles(mtp_device_h mtp_device, mtp_storage_h mtp_storage, mtp_filetype_e file_type, - mtp_object_h parent, mtp_object_h **object_handles, int* object_num); + mtp_object_h parent, mtp_object_h **object_handles, int* object_count); /** * @brief Gets object for a given path from object handle. * @since_tizen 3.0 + * @remarks The @a dest_path is host storage path. * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * @@ -396,15 +280,17 @@ int mtp_get_object_handles(mtp_device_h mtp_device, mtp_storage_h mtp_storage, m * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_IO_ERROR I/O error + * @retval #MTP_ERROR_PERMISSION_DENIED Permission denied * - * @see mtp_get_device() + * @see mtp_get_devices() * @see mtp_get_object_handles() */ int mtp_get_object(mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path); /** - * @brief Gets thumbnail from object handle. + * @brief Gets thumbnail from the given object handle. * @since_tizen 3.0 + * @remarks The @a dest_path is host storage path. * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. * @@ -421,22 +307,22 @@ int mtp_get_object(mtp_device_h mtp_device, mtp_object_h object_handle, char *de * @retval #MTP_ERROR_NOT_COMM_INITIALIZED MTP communication is not initialized * @retval #MTP_ERROR_COMM_ERROR MTP communication error * @retval #MTP_ERROR_IO_ERROR I/O error + * @retval #MTP_ERROR_PERMISSION_DENIED Permission denied * - * @see mtp_get_device() + * @see mtp_get_devices() * @see mtp_get_object_handles() */ int mtp_get_thumbnail(mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path); /** - * @brief Registers a callback function for receiving MTP event. + * @brief Adds a callback function for receiving MTP event. * @since_tizen 3.0 - * + * @remarks You can register multiple callback. \n + * If you don't want to receive the event, then using the mtp_remove_mtp_event_cb() function to unregister a callback. * @remarks If device state is changed, #MTP_EVENT_DEVICE_ADDED or #MTP_EVENT_DEVICE_REMOVED event is occur. \n * If storage state is changed, #MTP_EVENT_STORAGE_ADDED or #MTP_EVENT_STORAGE_REMOVED event is occur. \n * If object state is changed, #MTP_EVENT_OBJECT_ADDED or #MTP_EVENT_OBJECT_REMOVED event is occur. \n * If mtp service is turned off, #MTP_EVENT_TURNED_OFF event is occur. \n - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] event_cb The callback * @param [in] user_data The user data @@ -446,16 +332,16 @@ int mtp_get_thumbnail(mtp_device_h mtp_device, mtp_object_h object_handle, char * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter - - * @see mtp_unset_mtp_event_cb() + * + * @see mtp_remove_mtp_event_cb() */ -int mtp_set_mtp_event_cb(mtp_event_cb event_cb, void *user_data); +int mtp_add_mtp_event_cb(mtp_event_cb event_cb, void *user_data); /** - * @brief Unregisters the callback function. + * @brief Removes the callback function. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n + * + * @param [in] event_cb The callback * * @return 0 on success, otherwise a negative error value. * @retval #MTP_ERROR_NONE Successful @@ -464,7 +350,7 @@ int mtp_set_mtp_event_cb(mtp_event_cb event_cb, void *user_data); * * @see mtp_set_mtp_event_cb() */ -int mtp_unset_mtp_event_cb(void); +int mtp_remove_mtp_event_cb(mtp_event_cb event_cb); /** * @brief Deinitializes MTP operation. @@ -494,8 +380,6 @@ int mtp_deinitialize(void); * @brief Gets the manufacturer name of the device information. * @since_tizen 3.0 * @remarks The @a manufacturer_name should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] manufacturer_name The manufacturer name of Device information @@ -512,7 +396,7 @@ int mtp_deinitialize(void); * @retval #MTP_ERROR_OUT_OF_MEMORY Memory Allocation failed * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * - * @see mtp_get_device() + * @see mtp_get_devices() */ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufacturer_name); @@ -520,8 +404,6 @@ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufac * @brief Gets the model name of the device information. * @since_tizen 3.0 * @remarks The @a model_name should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] model_name The model name of Device information @@ -538,7 +420,7 @@ int mtp_deviceinfo_get_manufacturer_name(mtp_device_h mtp_device, char **manufac * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * - * @see mtp_get_device() + * @see mtp_get_devices() */ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); @@ -546,8 +428,6 @@ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); * @brief Gets the serial number of the device information. * @since_tizen 3.0 * @remarks The @a serial_number should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] serial_number The serial number of Device information @@ -564,7 +444,7 @@ int mtp_deviceinfo_get_model_name(mtp_device_h mtp_device, char **model_name); * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * - * @see mtp_get_device() + * @see mtp_get_devices() */ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_number); @@ -572,8 +452,6 @@ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_numb * @brief Gets the device version of the device information. * @since_tizen 3.0 * @remarks The @a device_version should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [out] device_version The device version of Device information @@ -590,7 +468,7 @@ int mtp_deviceinfo_get_serial_number(mtp_device_h mtp_device, char **serial_numb * @retval #MTP_ERROR_OUT_OF_MEMORY Out of memory * @retval #MTP_ERROR_NO_DEVICE MTP have not any device * - * @see mtp_get_device() + * @see mtp_get_devices() */ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_version); @@ -607,8 +485,6 @@ int mtp_deviceinfo_get_device_version(mtp_device_h mtp_device, char **device_ver * @brief Gets the description of the storage information. * @since_tizen 3.0 * @remarks The @a description should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -633,8 +509,6 @@ int mtp_storageinfo_get_description(mtp_device_h mtp_device, mtp_storage_h mtp_s /** * @brief Gets the free space of the storage information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -659,8 +533,6 @@ int mtp_storageinfo_get_free_space(mtp_device_h mtp_device, mtp_storage_h mtp_st /** * @brief Gets the max capacity of the storage information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -685,8 +557,6 @@ int mtp_storageinfo_get_max_capacity(mtp_device_h mtp_device, mtp_storage_h mtp_ /** * @brief Gets the storage type of the storage information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -712,8 +582,6 @@ int mtp_storageinfo_get_storage_type(mtp_device_h mtp_device, mtp_storage_h mtp_ * @brief Gets the volume identifier of the storage information. * @since_tizen 3.0 * @remarks The @a volume_identifier should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] mtp_storage The MTP storage @@ -748,8 +616,6 @@ int mtp_storageinfo_get_volume_identifier(mtp_device_h mtp_device, mtp_storage_h * @brief Gets the filename of the object information. * @since_tizen 3.0 * @remarks The @a file_name should be freed using free(). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -777,8 +643,6 @@ int mtp_objectinfo_get_file_name(mtp_device_h mtp_device, mtp_object_h object_ha * @since_tizen 3.0 * @remarks The @a keywords should be freed using free(). * @remarks The keywords are separated by comma. - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -804,8 +668,6 @@ int mtp_objectinfo_get_keywords(mtp_device_h mtp_device, mtp_object_h object_han /** * @brief Gets the association desc of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -831,8 +693,6 @@ int mtp_objectinfo_get_association_desc(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the association type of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -858,8 +718,6 @@ int mtp_objectinfo_get_association_type(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the size of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -885,8 +743,6 @@ int mtp_objectinfo_get_size(mtp_device_h mtp_device, mtp_object_h object_handle, /** * @brief Gets the parent object handle of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -912,8 +768,6 @@ int mtp_objectinfo_get_parent_object_handle(mtp_device_h mtp_device, mtp_object_ /** * @brief Gets the mtp storage of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -941,8 +795,6 @@ int mtp_objectinfo_get_storage(mtp_device_h mtp_device, mtp_object_h object_hand * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_created represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -970,8 +822,6 @@ int mtp_objectinfo_get_date_created(mtp_device_h mtp_device, mtp_object_h object * @since_tizen 3.0 * @remarks When interpreted as an absolute time value, \n * @a data_modified represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -997,8 +847,6 @@ int mtp_objectinfo_get_date_modified(mtp_device_h mtp_device, mtp_object_h objec /** * @brief Gets the file type of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1024,8 +872,6 @@ int mtp_objectinfo_get_file_type(mtp_device_h mtp_device, mtp_object_h object_ha /** * @brief Gets the image bit depth of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1051,8 +897,6 @@ int mtp_objectinfo_get_image_bit_depth(mtp_device_h mtp_device, mtp_object_h obj /** * @brief Gets the image pixel width of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1078,8 +922,6 @@ int mtp_objectinfo_get_image_pix_width(mtp_device_h mtp_device, mtp_object_h obj /** * @brief Gets the image pixel height of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1105,8 +947,6 @@ int mtp_objectinfo_get_image_pix_height(mtp_device_h mtp_device, mtp_object_h ob /** * @brief Gets the thumbnail size of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1132,8 +972,6 @@ int mtp_objectinfo_get_thumbnail_size(mtp_device_h mtp_device, mtp_object_h obje /** * @brief Gets the thumbnail file type of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1159,8 +997,6 @@ int mtp_objectinfo_get_thumbnail_file_type(mtp_device_h mtp_device, mtp_object_h /** * @brief Gets the thumbnail pixel height of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle @@ -1186,8 +1022,6 @@ int mtp_objectinfo_get_thumbnail_pix_height(mtp_device_h mtp_device, mtp_object_ /** * @brief Gets the thumbnail pixel width of the object information. * @since_tizen 3.0 - * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n - * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n * * @param [in] mtp_device The MTP device * @param [in] object_handle The object handle diff --git a/include/mtp_gdbus_deviceinfo.h b/include/mtp_gdbus_deviceinfo.h index 69f2c92..d3fa84d 100755 --- a/include/mtp_gdbus_deviceinfo.h +++ b/include/mtp_gdbus_deviceinfo.h @@ -22,9 +22,11 @@ void mtp_gdbus_deviceinfo_proxy_init(void); void mtp_gdbus_deviceinfo_proxy_deinit(void); -mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int mtp_handle, char **manufacturername); -mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int mtp_handle, char **modelname); -mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int mtp_handle, char **serialnumber); -mtp_error_e mtp_gdbus_deviceinfo_get_deviceversion(int mtp_handle, char **deviceversion); +mtp_error_e mtp_gdbus_deviceinfo_get_manufacturer_name(int mtp_device, char **manufacturername); +mtp_error_e mtp_gdbus_deviceinfo_get_model_name(int mtp_device, char **modelname); +mtp_error_e mtp_gdbus_deviceinfo_get_serial_number(int mtp_device, char **serialnumber); +mtp_error_e mtp_gdbus_deviceinfo_get_device_version(int mtp_device, char **deviceversion); +mtp_error_e mtp_gdbus_deviceinfo_get_bus_location(int mtp_device, int *bus_location); +mtp_error_e mtp_gdbus_deviceinfo_get_device_number(int mtp_device, int *device_number); #endif diff --git a/include/mtp_gdbus_manager.h b/include/mtp_gdbus_manager.h index ea2eaf4..70e4cbf 100755 --- a/include/mtp_gdbus_manager.h +++ b/include/mtp_gdbus_manager.h @@ -20,9 +20,7 @@ #include "mtp_gdbus.h" mtp_error_e mtp_gdbus_manager_initialize(void); -mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int *device_count); -mtp_error_e mtp_gdbus_manager_get_device(int bus_location, int device_number, - int *mtp_device); +mtp_error_e mtp_gdbus_manager_get_devices(int **mtp_devices, int *device_num); mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device, int **mtp_storages, int *storage_num); mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device, @@ -32,8 +30,9 @@ mtp_error_e mtp_gdbus_manager_get_object(int mtp_device, int object_handle, char *dest_path); mtp_error_e mtp_gdbus_manager_get_thumbnail(int mtp_device, int object_handle, char *dest_path); -mtp_error_e mtp_gdbus_manager_set_event_cb(mtp_event_cb callback, void *user_data); -mtp_error_e mtp_gdbus_manager_unset_event_cb(); +mtp_error_e mtp_gdbus_manager_add_event_cb(mtp_event_cb callback, void *user_data); +mtp_error_e mtp_gdbus_manager_remove_event_cb(mtp_event_cb callback); +mtp_error_e mtp_gdbus_manager_remove_all_event_cb(void); mtp_error_e mtp_gdbus_manager_deinitialize(void); #endif diff --git a/include/mtp_gdbus_storageinfo.h b/include/mtp_gdbus_storageinfo.h index f335e1f..d975ca8 100755 --- a/include/mtp_gdbus_storageinfo.h +++ b/include/mtp_gdbus_storageinfo.h @@ -24,13 +24,13 @@ void mtp_gdbus_storageinfo_proxy_deinit(void); mtp_error_e mtp_gdbus_storageinfo_get_description(int mtp_device, int mtp_storage, char **description); -mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, - int mtp_storage, guint64 *freespace); -mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, - int mtp_storage, guint64 *maxcapacity); -mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, - int mtp_storage, int *storagetype); -mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int mtp_device, - int mtp_storage, char **volumeidentifier); +mtp_error_e mtp_gdbus_storageinfo_get_free_space(int mtp_device, + int mtp_storage, guint64 *free_space); +mtp_error_e mtp_gdbus_storageinfo_get_max_capacity(int mtp_device, + int mtp_storage, guint64 *max_capacity); +mtp_error_e mtp_gdbus_storageinfo_get_storage_type(int mtp_device, + int mtp_storage, int *storage_type); +mtp_error_e mtp_gdbus_storageinfo_get_volume_identifier(int mtp_device, + int mtp_storage, char **volume_identifier); #endif diff --git a/include/mtp_internal.h b/include/mtp_internal.h index 71a0d1d..655513b 100755 --- a/include/mtp_internal.h +++ b/include/mtp_internal.h @@ -50,8 +50,9 @@ typedef struct _mtp_object_info { /* internal api */ int mtp_objectinfo_get_object_info(int mtp_device, int object_handle, mtp_object_info **object_info); - 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); #ifdef __cplusplus } diff --git a/include/mtp_private.h b/include/mtp_private.h index db7e651..c4e2569 100755 --- a/include/mtp_private.h +++ b/include/mtp_private.h @@ -17,13 +17,6 @@ #ifndef __MTP_PRIVATE_H__ #define __MTP_PRIVATE_H__ -typedef struct _mtp_raw_device { - int bus_location; - int device_number; - char *model_name; - int dev_count; -} mtp_raw_device; - #define CHECK_SUPPORTED() \ do { \ { \ @@ -48,14 +41,14 @@ typedef enum { MTP_PROPERTY_SIZE, MTP_PROPERTY_DATE_CREATED, MTP_PROPERTY_DATE_MODIFIED, - MTP_PROPERTY_FORMAT, + MTP_PROPERTY_FILE_TYPE, MTP_PROPERTY_IMAGE_BIT_DEPTH, MTP_PROPERTY_IMAGE_PIX_WIDTH, MTP_PROPERTY_IMAGE_PIX_HEIGHT, MTP_PROPERTY_PARENT_OBJECT_HANDLE, MTP_PROPERTY_STORAGE, MTP_PROPERTY_THUMBNAIL_SIZE, - MTP_PROPERTY_THUMBNAIL_FORMAT, + MTP_PROPERTY_THUMBNAIL_FILE_TYPE, MTP_PROPERTY_THUMBNAIL_WIDTH, MTP_PROPERTY_THUMBNAIL_HEIGHT, MTP_PROPERTY_FILENAME, diff --git a/src/mtp.c b/src/mtp.c index 2801220..e1bd189 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -70,7 +70,7 @@ static bool __is_mtp_activated() return true; } -/* Device Manager */ +/* Manager */ int mtp_initialize(void) { int ret = MTP_ERROR_NONE; @@ -99,7 +99,7 @@ int mtp_initialize(void) return ret; } -int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count) +int mtp_get_devices(int **mtp_devices, int *device_count) { int ret = MTP_ERROR_NONE; @@ -110,141 +110,21 @@ int mtp_get_raw_devices(mtp_raw_device_h **raw_devices, int *device_count) CHECK_SUPPORTED(); CHECK_INIT(); CHECK_ACTIVATED(); + cond_expr_ret(mtp_devices == NULL, MTP_ERROR_INVALID_PARAMETER); cond_expr_ret(device_count == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - *device_count = 0; - ret = mtp_gdbus_manager_get_raw_devices((mtp_raw_device ***)raw_devices, device_count); + ret = mtp_gdbus_manager_get_devices(mtp_devices, device_count); - _END(); - - return ret; -} - -int mtp_get_bus_location(mtp_raw_device_h raw_device, int *bus_location) -{ - int ret = MTP_ERROR_NONE; - - _BEGIN(); - - /* precondition check start */ - - CHECK_SUPPORTED(); - CHECK_INIT(); - cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(bus_location == NULL, MTP_ERROR_INVALID_PARAMETER); - - /* precondition check end */ - - *bus_location = ((mtp_raw_device *)raw_device)->bus_location; + TC_PRT("device count %d", *device_count); _END(); return ret; } -int mtp_get_device_number(mtp_raw_device_h raw_device, int *device_number) -{ - int ret = MTP_ERROR_NONE; - - _BEGIN(); - - /* precondition check start */ - - CHECK_SUPPORTED(); - CHECK_INIT(); - cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(device_number == NULL, MTP_ERROR_INVALID_PARAMETER); - - /* precondition check end */ - - *device_number = ((mtp_raw_device *)raw_device)->device_number; - - _END(); - - return ret; -} - -int mtp_get_device_name(mtp_raw_device_h raw_device, char **model_name) -{ - int ret = MTP_ERROR_NONE; - - /* precondition check start */ - - CHECK_SUPPORTED(); - CHECK_INIT(); - cond_expr_ret(raw_device == NULL, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(model_name == NULL, MTP_ERROR_INVALID_PARAMETER); - - /* precondition check end */ - - *model_name = g_strdup(((mtp_raw_device *)raw_device)->model_name); - - return ret; -} - -int mtp_destroy_raw_devices(mtp_raw_device_h *raw_devices) -{ - int i; - int ret = MTP_ERROR_NONE; - int dev_count; - mtp_raw_device *first_device = (mtp_raw_device *)raw_devices[0]; - - _BEGIN(); - - /* precondition check start */ - - CHECK_SUPPORTED(); - cond_expr_ret(raw_devices == NULL, MTP_ERROR_INVALID_PARAMETER); - cond_expr_ret(first_device == NULL, MTP_ERROR_INVALID_PARAMETER); - - /* precondition check end */ - dev_count = first_device->dev_count; - if (dev_count <= 0 || dev_count > 6) - return MTP_ERROR_INVALID_PARAMETER; - - for (i = 0; i < dev_count; i++) { - mtp_raw_device *r_device = (mtp_raw_device *)raw_devices[i]; - - if (r_device != NULL && r_device->model_name != NULL) { - free(r_device->model_name); - free(r_device); - } - } - - free(raw_devices); - - _END(); - - return ret; -} - -int mtp_get_device(int bus_location, int device_number, int *mtp_device) -{ - int ret = MTP_ERROR_NONE; - - _BEGIN(); - - /* precondition check start */ - - CHECK_SUPPORTED(); - CHECK_INIT(); - CHECK_ACTIVATED(); - cond_expr_ret(bus_location == 0, MTP_ERROR_INVALID_PARAMETER); - - /* precondition check end */ - - ret = mtp_gdbus_manager_get_device(bus_location, device_number, mtp_device); - - TC_PRT("mtp_device %d", *mtp_device); - - _END(); - - return ret; -} - -int mtp_get_storages(int mtp_device, int **mtp_storages, int* storage_num) +int mtp_get_storages(int mtp_device, int **mtp_storages, int* storage_count) { int ret = MTP_ERROR_NONE; @@ -256,12 +136,14 @@ int mtp_get_storages(int mtp_device, int **mtp_storages, int* storage_num) CHECK_INIT(); CHECK_ACTIVATED(); cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(mtp_storages == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(storage_count == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ - ret = mtp_gdbus_manager_get_storages(mtp_device, mtp_storages, storage_num); + ret = mtp_gdbus_manager_get_storages(mtp_device, mtp_storages, storage_count); - TC_PRT("storage number %d", *storage_num); + TC_PRT("storage count %d", *storage_count); _END(); @@ -269,7 +151,7 @@ int mtp_get_storages(int mtp_device, int **mtp_storages, int* storage_num) } int mtp_get_object_handles(int mtp_device, int mtp_storage, mtp_filetype_e file_type, - int parent, int **object_handles, int* object_num) + int parent, int **object_handles, int* object_count) { int ret = MTP_ERROR_NONE; @@ -282,11 +164,13 @@ int mtp_get_object_handles(int mtp_device, int mtp_storage, mtp_filetype_e file_ CHECK_ACTIVATED(); cond_expr_ret(mtp_device == 0, MTP_ERROR_INVALID_PARAMETER); cond_expr_ret(mtp_storage == 0, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(object_handles == NULL, MTP_ERROR_INVALID_PARAMETER); + cond_expr_ret(object_count == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ ret = mtp_gdbus_manager_get_object_handles(mtp_device, - mtp_storage, file_type, parent, object_handles, object_num); + mtp_storage, file_type, parent, object_handles, object_count); _END(); @@ -362,7 +246,7 @@ int mtp_get_thumbnail(int mtp_device, int object_handle, char *dest_path) return ret; } -int mtp_set_mtp_event_cb(mtp_event_cb callback, void *user_data) +int mtp_add_mtp_event_cb(mtp_event_cb callback, void *user_data) { int ret = MTP_ERROR_NONE; @@ -376,14 +260,14 @@ int mtp_set_mtp_event_cb(mtp_event_cb callback, void *user_data) /* precondition check end */ - ret = mtp_gdbus_manager_set_event_cb(callback, user_data); + ret = mtp_gdbus_manager_add_event_cb(callback, user_data); _END(); return ret; } -int mtp_unset_mtp_event_cb(void) +int mtp_remove_mtp_event_cb(mtp_event_cb callback) { int ret = MTP_ERROR_NONE; @@ -396,7 +280,7 @@ int mtp_unset_mtp_event_cb(void) /* precondition check end */ - ret = mtp_gdbus_manager_unset_event_cb(); + ret = mtp_gdbus_manager_remove_event_cb(callback); _END(); @@ -449,7 +333,7 @@ int mtp_deviceinfo_get_manufacturer_name(int mtp_device, char **manufacturer_nam /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_manufacturername(mtp_device, manufacturer_name); + ret = mtp_gdbus_deviceinfo_get_manufacturer_name(mtp_device, manufacturer_name); TC_PRT("manufacturername %s", *manufacturer_name); @@ -473,7 +357,7 @@ int mtp_deviceinfo_get_model_name(int mtp_device, char **model_name) /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_modelname(mtp_device, model_name); + ret = mtp_gdbus_deviceinfo_get_model_name(mtp_device, model_name); TC_PRT("modelname %s", *model_name); @@ -497,9 +381,9 @@ int mtp_deviceinfo_get_serial_number(int mtp_device, char **serial_number) /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_serialnumber(mtp_device, serial_number); + ret = mtp_gdbus_deviceinfo_get_serial_number(mtp_device, serial_number); - TC_PRT("serialnumber %s", *serial_number); + TC_PRT("serial number %s", *serial_number); _END(); @@ -521,9 +405,59 @@ int mtp_deviceinfo_get_device_version(int mtp_device, char **device_version) /* precondition check end */ - ret = mtp_gdbus_deviceinfo_get_deviceversion(mtp_device, device_version); + ret = mtp_gdbus_deviceinfo_get_device_version(mtp_device, device_version); + + TC_PRT("device version %s", *device_version); + + _END(); + + return ret; +} + +int mtp_deviceinfo_get_bus_location(int mtp_device, int *bus_location) +{ + 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(bus_location == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + + ret = mtp_gdbus_deviceinfo_get_bus_location(mtp_device, bus_location); + + TC_PRT("bus location %d", *bus_location); + + _END(); + + return ret; +} + +int mtp_deviceinfo_get_device_number(int mtp_device, int *device_number) +{ + 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(device_number == NULL, MTP_ERROR_INVALID_PARAMETER); + + /* precondition check end */ + + ret = mtp_gdbus_deviceinfo_get_device_number(mtp_device, device_number); - TC_PRT("deviceversion %s", *device_version); + TC_PRT("device number %d", *device_number); _END(); @@ -572,7 +506,7 @@ int mtp_storageinfo_get_free_space(int mtp_device, int mtp_storage, unsigned lon /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_freespace(mtp_device, mtp_storage, (guint64 *)free_space); + ret = mtp_gdbus_storageinfo_get_free_space(mtp_device, mtp_storage, (guint64 *)free_space); TC_PRT("freespace %llu", *free_space); @@ -597,7 +531,7 @@ int mtp_storageinfo_get_max_capacity(int mtp_device, int mtp_storage, unsigned l /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_maxcapacity(mtp_device, mtp_storage, (guint64 *)max_capacity); + ret = mtp_gdbus_storageinfo_get_max_capacity(mtp_device, mtp_storage, (guint64 *)max_capacity); TC_PRT("maxcapacity %llu", *max_capacity); @@ -622,7 +556,7 @@ int mtp_storageinfo_get_storage_type(int mtp_device, int mtp_storage, mtp_storag /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_storagetype(mtp_device, mtp_storage, (int *)storage_type); + ret = mtp_gdbus_storageinfo_get_storage_type(mtp_device, mtp_storage, (int *)storage_type); TC_PRT("storagetype %d", *storage_type); @@ -647,7 +581,7 @@ int mtp_storageinfo_get_volume_identifier(int mtp_device, int mtp_storage, char /* precondition check end */ - ret = mtp_gdbus_storageinfo_get_volumeidentifier(mtp_device, mtp_storage, volume_identifier); + ret = mtp_gdbus_storageinfo_get_volume_identifier(mtp_device, mtp_storage, volume_identifier); TC_PRT("volumeidentifier %s", *volume_identifier); @@ -842,7 +776,7 @@ int mtp_objectinfo_get_file_type(int mtp_device, int object_handle, mtp_filetype /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_FORMAT, (int*)file_type); + object_handle, MTP_PROPERTY_FILE_TYPE, (int*)file_type); _END(); @@ -962,7 +896,7 @@ int mtp_objectinfo_get_thumbnail_file_type(int mtp_device, /* precondition check end */ ret = mtp_gdbus_objectinfo_get_property(mtp_device, - object_handle, MTP_PROPERTY_THUMBNAIL_FORMAT, (int*)file_type); + object_handle, MTP_PROPERTY_THUMBNAIL_FILE_TYPE, (int*)file_type); _END(); diff --git a/src/mtp_gdbus_deviceinfo.c b/src/mtp_gdbus_deviceinfo.c index f6e0da4..8f16d56 100755 --- a/src/mtp_gdbus_deviceinfo.c +++ b/src/mtp_gdbus_deviceinfo.c @@ -34,7 +34,7 @@ void mtp_gdbus_deviceinfo_proxy_deinit(void) deviceinfo_proxy = NULL; } -mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int mtp_device, char **manufacturername) +mtp_error_e mtp_gdbus_deviceinfo_get_manufacturer_name(int mtp_device, char **manufacturer_name) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -42,10 +42,10 @@ mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int mtp_device, char **man if (deviceinfo_proxy == NULL) return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_deviceinfo_call_get_manufacturername_sync( + if (mtp_gdbuslib_deviceinfo_call_get_manufacturer_name_sync( deviceinfo_proxy, mtp_device, - manufacturername, + manufacturer_name, &result, NULL, &error) == FALSE) { @@ -56,7 +56,7 @@ mtp_error_e mtp_gdbus_deviceinfo_get_manufacturername(int mtp_device, char **man return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int mtp_device, char **modelname) +mtp_error_e mtp_gdbus_deviceinfo_get_model_name(int mtp_device, char **model_name) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -64,10 +64,10 @@ mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int mtp_device, char **modelname) if (deviceinfo_proxy == NULL) return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_deviceinfo_call_get_modelname_sync( + if (mtp_gdbuslib_deviceinfo_call_get_model_name_sync( deviceinfo_proxy, mtp_device, - modelname, + model_name, &result, NULL, &error) == FALSE) { @@ -78,7 +78,7 @@ mtp_error_e mtp_gdbus_deviceinfo_get_modelname(int mtp_device, char **modelname) return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int mtp_device, char **serialnumber) +mtp_error_e mtp_gdbus_deviceinfo_get_serial_number(int mtp_device, char **serial_number) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -86,10 +86,10 @@ mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int mtp_device, char **serialn if (deviceinfo_proxy == NULL) return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_deviceinfo_call_get_serialnumber_sync( + if (mtp_gdbuslib_deviceinfo_call_get_serial_number_sync( deviceinfo_proxy, mtp_device, - serialnumber, + serial_number, &result, NULL, &error) == FALSE) { @@ -100,7 +100,7 @@ mtp_error_e mtp_gdbus_deviceinfo_get_serialnumber(int mtp_device, char **serialn return result; } -mtp_error_e mtp_gdbus_deviceinfo_get_deviceversion(int mtp_device, char **deviceversion) +mtp_error_e mtp_gdbus_deviceinfo_get_device_version(int mtp_device, char **device_version) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -108,10 +108,54 @@ mtp_error_e mtp_gdbus_deviceinfo_get_deviceversion(int mtp_device, char **device if (deviceinfo_proxy == NULL) return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_deviceinfo_call_get_deviceversion_sync( + if (mtp_gdbuslib_deviceinfo_call_get_device_version_sync( deviceinfo_proxy, mtp_device, - deviceversion, + device_version, + &result, + NULL, + &error) == FALSE) { + result = MTP_ERROR_COMM_ERROR; + g_error_free(error); + } + + return result; +} + +mtp_error_e mtp_gdbus_deviceinfo_get_bus_location(int mtp_device, int *bus_location) +{ + mtp_error_e result = MTP_ERROR_NONE; + GError *error = NULL; + + if (deviceinfo_proxy == NULL) + return MTP_ERROR_NOT_COMM_INITIALIZED; + + if (mtp_gdbuslib_deviceinfo_call_get_bus_location_sync( + deviceinfo_proxy, + mtp_device, + bus_location, + &result, + NULL, + &error) == FALSE) { + result = MTP_ERROR_COMM_ERROR; + g_error_free(error); + } + + return result; +} + +mtp_error_e mtp_gdbus_deviceinfo_get_device_number(int mtp_device, int *device_number) +{ + mtp_error_e result = MTP_ERROR_NONE; + GError *error = NULL; + + if (deviceinfo_proxy == NULL) + return MTP_ERROR_NOT_COMM_INITIALIZED; + + if (mtp_gdbuslib_deviceinfo_call_get_device_number_sync( + deviceinfo_proxy, + mtp_device, + device_number, &result, NULL, &error) == FALSE) { diff --git a/src/mtp_gdbus_manager.c b/src/mtp_gdbus_manager.c index 63be494..447e430 100755 --- a/src/mtp_gdbus_manager.c +++ b/src/mtp_gdbus_manager.c @@ -25,15 +25,25 @@ #include "mtp_gdbus_deviceinfo.h" #include "mtp_gdbus_storageinfo.h" +typedef struct _event_cb_s { + mtp_event_cb cb; + void *user_data; +} event_cb_s; + mtpgdbuslibManager *manager_proxy = NULL; -mtp_event_cb event_callback; -void *event_user_data; +static __thread GSList *event_cb_list = NULL; static void __mtp_event_cb(mtpgdbuslibManager *object, gint event, gint arg1, gpointer user_data) { - if (event_callback) - event_callback(event, arg1, event_user_data); + GSList *l; + event_cb_s *event_s; + + for (l = event_cb_list; l != NULL; l = l->next) + { + event_s = (event_cb_s *)l->data; + event_s->cb(event, arg1, event_s->user_data); + } } static void __manager_proxy_init(void) @@ -56,18 +66,33 @@ static void __manager_proxy_deinit(void) manager_proxy = NULL; } -mtp_error_e mtp_gdbus_manager_set_event_cb(mtp_event_cb callback, void *user_data) +mtp_error_e mtp_gdbus_manager_add_event_cb(mtp_event_cb callback, void *user_data) { - event_callback = callback; - event_user_data = user_data; + event_cb_s *event_s; + + event_s = g_try_new0(event_cb_s, 1); + if (event_s == NULL) + return MTP_ERROR_OUT_OF_MEMORY; + + event_s->cb = callback; + event_s->user_data = user_data; + + event_cb_list = g_slist_prepend(event_cb_list, event_s); return MTP_ERROR_NONE; } -mtp_error_e mtp_gdbus_manager_unset_event_cb(void) +mtp_error_e mtp_gdbus_manager_remove_event_cb(mtp_event_cb callback) { - event_callback = NULL; - event_user_data = NULL; + GSList *l; + event_cb_s *event_s; + + for (l = event_cb_list; l != NULL; l = l->next) + { + event_s = (event_cb_s *)l->data; + if (callback == event_s->cb) + event_cb_list = g_slist_delete_link (event_cb_list, l); + } return MTP_ERROR_NONE; } @@ -87,19 +112,18 @@ mtp_error_e mtp_gdbus_manager_initialize(void) return result; } -mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int *device_count) +mtp_error_e mtp_gdbus_manager_get_devices(int **mtp_devices, int *device_num) { - int dev_count; GVariant *va = NULL; mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; if (manager_proxy == NULL) - return MTP_ERROR_NOT_COMM_INITIALIZED; + return MTP_ERROR_NOT_COMM_INITIALIZED; - if (mtp_gdbuslib_manager_call_get_raw_devices_sync( + if (mtp_gdbuslib_manager_call_get_devices_sync( manager_proxy, - &dev_count, + device_num, &va, &result, NULL, @@ -110,36 +134,24 @@ mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int return result; } - *device_count = dev_count; - - if (dev_count != 0 && (g_variant_n_children(va) == dev_count)) { + if (*device_num != 0 && (g_variant_n_children(va) == *device_num)) { GVariantIter *iter = NULL, *iter_row = NULL; GVariant *key_value; const gchar *key; guint i = 0; - *raw_devices = (mtp_raw_device **)malloc(sizeof(mtp_raw_device*) * 1); - **raw_devices = (mtp_raw_device *)malloc(sizeof(mtp_raw_device) * *device_count); + *mtp_devices = g_new(int, *device_num); g_variant_get(va, "aa{sv}", &iter); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { while (g_variant_iter_loop(iter_row, "{sv}", &key, &key_value)) { - if (g_strcmp0(key, "model_name") == 0) { - (**raw_devices)[i].model_name = - g_strdup(g_variant_get_string(key_value, NULL)); - } else if (g_strcmp0(key, "bus_location") == 0) { - (**raw_devices)[i].bus_location = g_variant_get_int32(key_value); - } else if (g_strcmp0(key, "device_number") == 0) { - (**raw_devices)[i].device_number = g_variant_get_int32(key_value); - } + if (g_strcmp0(key, "mtp_device") == 0) + (*mtp_devices)[i] = g_variant_get_int32(key_value); } - (**raw_devices)[i].dev_count = dev_count; i++; g_variant_iter_free(iter_row); } g_variant_iter_free(iter); - } else { - result = MTP_ERROR_NO_DEVICE; } g_variant_unref(va); @@ -147,30 +159,6 @@ mtp_error_e mtp_gdbus_manager_get_raw_devices(mtp_raw_device ***raw_devices, int return result; } -mtp_error_e mtp_gdbus_manager_get_device(int bus_location, int device_number, int *mtp_device) -{ - 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_device_sync( - manager_proxy, - bus_location, - device_number, - mtp_device, - &result, - NULL, - &error) == FALSE) { - result = MTP_ERROR_COMM_ERROR; - - g_error_free(error); - } - - return result; -} - mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device, int **mtp_storages, int *storage_num) { @@ -221,7 +209,7 @@ mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device, } mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device, - int mtp_storage, int format, int parent_object_handle, int **object_handles, int *object_num) + int mtp_storage, int file_type, int parent_object_handle, int **object_handles, int *object_num) { GVariant *va = NULL; mtp_error_e result = MTP_ERROR_NONE; @@ -234,7 +222,7 @@ mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device, manager_proxy, mtp_device, mtp_storage, - format, + file_type, parent_object_handle, object_num, &va, diff --git a/src/mtp_gdbus_storageinfo.c b/src/mtp_gdbus_storageinfo.c index db5f020..2698bb2 100755 --- a/src/mtp_gdbus_storageinfo.c +++ b/src/mtp_gdbus_storageinfo.c @@ -58,8 +58,8 @@ mtp_error_e mtp_gdbus_storageinfo_get_description(int mtp_device, return result; } -mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, - int mtp_storage, guint64 *freespace) +mtp_error_e mtp_gdbus_storageinfo_get_free_space(int mtp_device, + int mtp_storage, guint64 *free_space) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -71,7 +71,7 @@ mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, storageinfo_proxy, mtp_device, mtp_storage, - freespace, + free_space, &result, NULL, &error) == FALSE) { @@ -82,8 +82,8 @@ mtp_error_e mtp_gdbus_storageinfo_get_freespace(int mtp_device, return result; } -mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, - int mtp_storage, guint64 *maxcapacity) +mtp_error_e mtp_gdbus_storageinfo_get_max_capacity(int mtp_device, + int mtp_storage, guint64 *max_capacity) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -95,7 +95,7 @@ mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, storageinfo_proxy, mtp_device, mtp_storage, - maxcapacity, + max_capacity, &result, NULL, &error) == FALSE) { @@ -106,8 +106,8 @@ mtp_error_e mtp_gdbus_storageinfo_get_maxcapacity(int mtp_device, return result; } -mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, - int mtp_storage, int *storagetype) +mtp_error_e mtp_gdbus_storageinfo_get_storage_type(int mtp_device, + int mtp_storage, int *storage_type) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -119,7 +119,7 @@ mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, storageinfo_proxy, mtp_device, mtp_storage, - storagetype, + storage_type, &result, NULL, &error) == FALSE) { @@ -130,8 +130,8 @@ mtp_error_e mtp_gdbus_storageinfo_get_storagetype(int mtp_device, return result; } -mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int mtp_device, - int mtp_storage, char **volumeidentifier) +mtp_error_e mtp_gdbus_storageinfo_get_volume_identifier(int mtp_device, + int mtp_storage, char **volume_identifier) { mtp_error_e result = MTP_ERROR_NONE; GError *error = NULL; @@ -143,7 +143,7 @@ mtp_error_e mtp_gdbus_storageinfo_get_volumeidentifier(int mtp_device, storageinfo_proxy, mtp_device, mtp_storage, - volumeidentifier, + volume_identifier, &result, NULL, &error) == FALSE) { diff --git a/src/mtp_gdbuslib.xml b/src/mtp_gdbuslib.xml index aaca563..03998e3 100755 --- a/src/mtp_gdbuslib.xml +++ b/src/mtp_gdbuslib.xml @@ -4,22 +4,15 @@ - + - - - - - - - - + - + @@ -27,9 +20,9 @@ - + - + @@ -60,29 +53,41 @@ - + - + - + - + + + + + + + + + + + + + diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 47b7d0c..f8ed1f2 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -9,7 +9,7 @@ #include #define BUFFER_LEN 100 -#define TEST_CASE_MAX 39 +#define TEST_CASE_MAX 40 #define TEST_LIST_MAX 20 #define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args) @@ -140,74 +140,6 @@ int manager_test_initialize(void) return ret; } -int manager_test_get_raw_devices(void) -{ - int ret = 0; - int i; - mtp_raw_device_h *raw_devices = NULL; - int device_count; - - BEGIN(); - - ret = mtp_get_raw_devices(&raw_devices, &device_count); - TC_PRT("ret[%d]: device_num[%d]", ret, device_count); - - if (ret == MTP_ERROR_NONE) { - for (i = 0; i < device_count; i++) { - int bus_location; - int device_number; - char *device_name = NULL; - mtp_get_bus_location(raw_devices[i], &bus_location); - mtp_get_device_number(raw_devices[i], &device_number); - mtp_get_device_name(raw_devices[i], &device_name); - TC_PRT("device bus_location[%d], dev_no [%d], model_name[%s]", - bus_location, device_number, device_name); - } - } else { - TC_PRT("get device list failed, ret[%d]", ret); - } - - END(); - return ret; -} - -int manager_test_get_device(void) -{ - int ret = 0; - int bus_location = 0; - int device_number = 0; - int device_count; - mtp_raw_device_h *raw_devices = NULL; - - BEGIN(); - - ret = mtp_get_raw_devices(&raw_devices, &device_count); - - if (ret != MTP_ERROR_NONE) { - TC_PRT("mtp_get_raw_devices is failed!!!"); - return -1; - } - - if (device_count == 0) { - TC_PRT("device is not exist!!!"); - END(); - return -1; - } - - TC_PRT("Select first device"); - - mtp_get_bus_location(raw_devices[0], &bus_location); - mtp_get_device_number(raw_devices[0], &device_number); - - TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); - - ret = mtp_get_device(bus_location, device_number, &mtp_device); - TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); - - END(); - return ret; -} - int manager_test_get_storages(void) { int i; @@ -216,10 +148,10 @@ int manager_test_get_storages(void) int device_number = 0; int device_count; int storage_count; - mtp_raw_device_h *raw_devices = NULL; + mtp_device_h *mtp_devices = NULL; mtp_storage_h *mtp_storages = NULL; - ret = mtp_get_raw_devices(&raw_devices, &device_count); + ret = mtp_get_devices(&mtp_devices, &device_count); if (ret != MTP_ERROR_NONE) { TC_PRT("mtp_get_raw_devices is failed!!!"); @@ -234,15 +166,14 @@ int manager_test_get_storages(void) TC_PRT("Select first device"); - mtp_get_bus_location(raw_devices[0], &bus_location); - mtp_get_device_number(raw_devices[0], &device_number); + mtp_deviceinfo_get_bus_location(mtp_devices[0], &bus_location); + mtp_deviceinfo_get_device_number(mtp_devices[0], &device_number); TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); - ret = mtp_get_device(bus_location, device_number, &mtp_device); - TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); + TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_devices[0]); - ret = mtp_get_storages(mtp_device, &mtp_storages, &storage_count); + ret = mtp_get_storages(mtp_devices[0], &mtp_storages, &storage_count); TC_PRT("ret[%d]: storage_count[%d]", ret, storage_count); if (storage_count == 0) { @@ -251,10 +182,6 @@ int manager_test_get_storages(void) return -1; } - ret = mtp_destroy_raw_devices(raw_devices); - TC_PRT("ret[%d]: mtp_destroy_raw_devices", ret); - - for (i = 0; i < storage_count; i++) TC_PRT("mtp storage %d [%d]", i, mtp_storages[i]); @@ -829,7 +756,7 @@ int objectinfo_test_get_thumbnail_file_type(void) for (i = 0; i < list_max; i++) { ret = mtp_objectinfo_get_thumbnail_file_type(mtp_device, mtp_objects[i], &value); - TC_PRT("ret[%d]: object id[%d] thumbnail_format[%d]", ret, mtp_objects[i], value); + TC_PRT("ret[%d]: object id[%d] thumbnail_file_type[%d]", ret, mtp_objects[i], value); } END(); @@ -1045,10 +972,24 @@ int application_test_get_object_handle_using_all_image(void) return ret; } -void __test_mtp_event_cb(mtp_event_e state, int arg, void *user_data) +void __test_mtp_event_cb1(mtp_event_e state, int arg, void *user_data) +{ + int ret = 0; + + TC_PRT("test mtp event cb 1 is called"); + TC_PRT("state [%d] : %d", state, arg); + + if (state == MTP_EVENT_TURNED_OFF) { + ret = mtp_deinitialize(); + TC_PRT("ret[%d] : Terminated daemon", ret); + } +} + +void __test_mtp_event_cb2(mtp_event_e state, int arg, void *user_data) { int ret = 0; + TC_PRT("test mtp event cb 2 is called"); TC_PRT("state [%d] : %d", state, arg); if (state == MTP_EVENT_TURNED_OFF) { @@ -1057,13 +998,27 @@ void __test_mtp_event_cb(mtp_event_e state, int arg, void *user_data) } } -int application_test_event_callback(void) +int application_test_add_event_callback(void) +{ + int ret; + + BEGIN(); + + ret = mtp_add_mtp_event_cb(__test_mtp_event_cb1, NULL); + ret = mtp_add_mtp_event_cb(__test_mtp_event_cb2, NULL); + + END(); + + return ret; +} + +int application_test_remove_event_callback(void) { int ret; BEGIN(); - ret = mtp_set_mtp_event_cb(__test_mtp_event_cb, NULL); + ret = mtp_remove_mtp_event_cb(__test_mtp_event_cb1); END(); @@ -1073,8 +1028,6 @@ int application_test_event_callback(void) tc_table_t tc_table[] = { /* manager api */ {"mtp_initialize", 1, manager_test_initialize}, - {"mtp_get_raw_devices", 2, manager_test_get_raw_devices}, - {"mtp_get_device", 3, manager_test_get_device}, {"mtp_get_storages", 4, manager_test_get_storages}, {"mtp_get_object_handles", 5, manager_test_get_object_handles}, {"mtp_delete_object", 6, manager_test_delete_object}, @@ -1106,7 +1059,7 @@ tc_table_t tc_table[] = { {"mtp_objectinfo_get_image_pix_width", 26, objectinfo_test_get_image_pix_width}, {"mtp_objectinfo_get_image_pix_height", 27, objectinfo_test_get_image_pix_height}, {"mtp_objectinfo_get_thumbnail_size", 28, objectinfo_test_get_thumbnail_size}, - {"mtp_objectinfo_get_thumbnail_format", 29, objectinfo_test_get_thumbnail_file_type}, + {"mtp_objectinfo_get_thumbnail_file_type", 29, objectinfo_test_get_thumbnail_file_type}, {"mtp_objectinfo_get_thumbnail_pix_height", 30, objectinfo_test_get_thumbnail_pix_height}, {"mtp_objectinfo_get_thumbnail_pix_width", 31, objectinfo_test_get_thumbnail_pix_width}, {"mtp_objectinfo_get_filename", 32, objectinfo_test_get_filename}, @@ -1116,7 +1069,8 @@ tc_table_t tc_table[] = { {"get Jpeg image from /DCIM folder", 34, application_test_get_image_from_DCIM}, {"get object handle using ALL file type", 35, application_test_get_object_handle_using_all}, {"get object handle using ALL Image file type", 36, application_test_get_object_handle_using_all_image}, - {"test callback function", 37, application_test_event_callback}, + {"test add callback function", 37, application_test_add_event_callback}, + {"test remove callback function", 38, application_test_remove_event_callback}, {"get object and get thumbnail test", TEST_CASE_MAX, NULL}, /*-----------*/ -- 2.7.4 From f7d6c7f520342c9e6dfd0430b343538367cdd3f2 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Mon, 1 Feb 2016 11:49:22 +0900 Subject: [PATCH 12/16] modify mtp test app. Change-Id: I149b92a8de84cd91db541f66878e65533c0403d6 Signed-off-by: HyiHong Chae --- packaging/capi-network-mtp.spec | 2 +- test/mtp_unit_test.c | 100 ++++++++++++++++++++++++---------------- 2 files changed, 60 insertions(+), 42 deletions(-) diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index 8e30d8d..cfc1939 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.4 +Version: 1.3.5 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index f8ed1f2..22e4a40 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -9,7 +9,7 @@ #include #define BUFFER_LEN 100 -#define TEST_CASE_MAX 40 +#define TEST_CASE_MAX 37 #define TEST_LIST_MAX 20 #define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args) @@ -166,14 +166,16 @@ int manager_test_get_storages(void) TC_PRT("Select first device"); - mtp_deviceinfo_get_bus_location(mtp_devices[0], &bus_location); - mtp_deviceinfo_get_device_number(mtp_devices[0], &device_number); + mtp_device = mtp_devices[0]; + + mtp_deviceinfo_get_bus_location(mtp_device, &bus_location); + mtp_deviceinfo_get_device_number(mtp_device, &device_number); TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); - TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_devices[0]); + TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); - ret = mtp_get_storages(mtp_devices[0], &mtp_storages, &storage_count); + ret = mtp_get_storages(mtp_device, &mtp_storages, &storage_count); TC_PRT("ret[%d]: storage_count[%d]", ret, storage_count); if (storage_count == 0) { @@ -617,6 +619,9 @@ int objectinfo_test_get_date_created(void) int ret = 0; int value = 0; int list_max = 0; + struct tm *loctime; + char tmp[64]; + BEGIN(); list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; @@ -624,6 +629,11 @@ int objectinfo_test_get_date_created(void) for (i = 0; i < list_max; i++) { ret = mtp_objectinfo_get_date_created(mtp_device, mtp_objects[i], &value); TC_PRT("ret[%d]: object id[%d] mtp_device[%d]", ret, mtp_objects[i], value); + + loctime = localtime((time_t *)&value); + strftime (tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); + + TC_PRT("object id[%d]: created date[%s]", mtp_objects[i], tmp); } END(); @@ -636,6 +646,9 @@ int objectinfo_test_get_date_modified(void) int ret = 0; int value = 0; int list_max = 0; + struct tm *loctime; + char tmp[64]; + BEGIN(); list_max = (obj_count < TEST_LIST_MAX) ? obj_count : TEST_LIST_MAX; @@ -643,6 +656,11 @@ int objectinfo_test_get_date_modified(void) for (i = 0; i < list_max; i++) { ret = mtp_objectinfo_get_date_modified(mtp_device, mtp_objects[i], &value); TC_PRT("ret[%d]: object id[%d] date_modified[%d]", ret, mtp_objects[i], value); + + loctime = localtime((time_t *)&value); + strftime (tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); + + TC_PRT("object id[%d]: modified date[%s]", mtp_objects[i], tmp); } END(); @@ -1028,50 +1046,50 @@ int application_test_remove_event_callback(void) tc_table_t tc_table[] = { /* manager api */ {"mtp_initialize", 1, manager_test_initialize}, - {"mtp_get_storages", 4, manager_test_get_storages}, - {"mtp_get_object_handles", 5, manager_test_get_object_handles}, - {"mtp_delete_object", 6, manager_test_delete_object}, - {"mtp_get_object", 7, manager_test_get_object}, - {"mtp_get_thumbnail", 8, manager_test_get_thumbnail}, - {"mtp_deinitialize", 9, manager_test_deinitialize}, + {"mtp_get_storages", 2, manager_test_get_storages}, + {"mtp_get_object_handles", 3, manager_test_get_object_handles}, + {"mtp_delete_object", 4, manager_test_delete_object}, + {"mtp_get_object", 5, manager_test_get_object}, + {"mtp_get_thumbnail", 6, manager_test_get_thumbnail}, + {"mtp_deinitialize", 7, manager_test_deinitialize}, /* device api */ - {"mtp_deviceinfo_manufacturer_name", 10, deviceinfo_test_get_manufacturername}, - {"mtp_deviceinfo_model_name", 11, deviceinfo_test_get_modelname}, - {"mtp_deviceinfo_serial_number", 12, deviceinfo_test_get_serialnumber}, - {"mtp_deviceinfo_device_version", 13, deviceinfo_test_get_deviceversion}, + {"mtp_deviceinfo_manufacturer_name", 8, deviceinfo_test_get_manufacturername}, + {"mtp_deviceinfo_model_name", 9, deviceinfo_test_get_modelname}, + {"mtp_deviceinfo_serial_number", 10, deviceinfo_test_get_serialnumber}, + {"mtp_deviceinfo_device_version", 11, deviceinfo_test_get_deviceversion}, /* storage api */ - {"mtp_storageinfo_get_description", 14, storageinfo_test_get_description}, - {"mtp_storageinfo_get_freespace", 15, storageinfo_test_get_freespace}, - {"mtp_storageinfo_get_maxcapacity", 16, storageinfo_test_get_maxcapacity}, - {"mtp_storageinfo_get_storagetype", 17, storageinfo_test_get_storagetype}, - {"mtp_storageinfo_get_volumeidentifier", 18, storageinfo_test_get_volumeidentifier}, + {"mtp_storageinfo_get_description", 12, storageinfo_test_get_description}, + {"mtp_storageinfo_get_freespace", 13, storageinfo_test_get_freespace}, + {"mtp_storageinfo_get_maxcapacity", 14, storageinfo_test_get_maxcapacity}, + {"mtp_storageinfo_get_storagetype", 15, storageinfo_test_get_storagetype}, + {"mtp_storageinfo_get_volumeidentifier", 16, storageinfo_test_get_volumeidentifier}, /* object api */ - {"mtp_objectinfo_get_association_desc", 19, objectinfo_test_get_association_desc}, - {"mtp_objectinfo_get_association_type", 20, objectinfo_test_get_association_type}, - {"mtp_objectinfo_get_size", 21, objectinfo_test_get_size}, - {"mtp_objectinfo_get_date_created", 22, objectinfo_test_get_date_created}, - {"mtp_objectinfo_get_date_modified", 23, objectinfo_test_get_date_modified}, - {"mtp_objectinfo_get_file_type", 24, objectinfo_test_get_file_type}, - {"mtp_objectinfo_get_image_pix_depth", 25, objectinfo_test_get_image_bit_depth}, - {"mtp_objectinfo_get_image_pix_width", 26, objectinfo_test_get_image_pix_width}, - {"mtp_objectinfo_get_image_pix_height", 27, objectinfo_test_get_image_pix_height}, - {"mtp_objectinfo_get_thumbnail_size", 28, objectinfo_test_get_thumbnail_size}, - {"mtp_objectinfo_get_thumbnail_file_type", 29, objectinfo_test_get_thumbnail_file_type}, - {"mtp_objectinfo_get_thumbnail_pix_height", 30, objectinfo_test_get_thumbnail_pix_height}, - {"mtp_objectinfo_get_thumbnail_pix_width", 31, objectinfo_test_get_thumbnail_pix_width}, - {"mtp_objectinfo_get_filename", 32, objectinfo_test_get_filename}, - {"mtp_objectinfo_get_keywords", 33, objectinfo_test_get_keywords}, + {"mtp_objectinfo_get_association_desc", 17, objectinfo_test_get_association_desc}, + {"mtp_objectinfo_get_association_type", 18, objectinfo_test_get_association_type}, + {"mtp_objectinfo_get_size", 19, objectinfo_test_get_size}, + {"mtp_objectinfo_get_date_created", 20, objectinfo_test_get_date_created}, + {"mtp_objectinfo_get_date_modified", 21, objectinfo_test_get_date_modified}, + {"mtp_objectinfo_get_file_type", 22, objectinfo_test_get_file_type}, + {"mtp_objectinfo_get_image_pix_depth", 23, objectinfo_test_get_image_bit_depth}, + {"mtp_objectinfo_get_image_pix_width", 24, objectinfo_test_get_image_pix_width}, + {"mtp_objectinfo_get_image_pix_height", 25, objectinfo_test_get_image_pix_height}, + {"mtp_objectinfo_get_thumbnail_size", 26, objectinfo_test_get_thumbnail_size}, + {"mtp_objectinfo_get_thumbnail_file_type", 27, objectinfo_test_get_thumbnail_file_type}, + {"mtp_objectinfo_get_thumbnail_pix_height", 28, objectinfo_test_get_thumbnail_pix_height}, + {"mtp_objectinfo_get_thumbnail_pix_width", 29, objectinfo_test_get_thumbnail_pix_width}, + {"mtp_objectinfo_get_filename", 30, objectinfo_test_get_filename}, + {"mtp_objectinfo_get_keywords", 31, objectinfo_test_get_keywords}, /* application test */ - {"get Jpeg image from /DCIM folder", 34, application_test_get_image_from_DCIM}, - {"get object handle using ALL file type", 35, application_test_get_object_handle_using_all}, - {"get object handle using ALL Image file type", 36, application_test_get_object_handle_using_all_image}, - {"test add callback function", 37, application_test_add_event_callback}, - {"test remove callback function", 38, application_test_remove_event_callback}, - {"get object and get thumbnail test", TEST_CASE_MAX, NULL}, + {"get Jpeg image from /DCIM folder", 32, application_test_get_image_from_DCIM}, + {"get object handle using ALL file type", 33, application_test_get_object_handle_using_all}, + {"get object handle using ALL Image file type", 34, application_test_get_object_handle_using_all_image}, + {"test add callback function", 35, application_test_add_event_callback}, + {"test remove callback function", 36, application_test_remove_event_callback}, + {"get object and get thumbnail test", TEST_CASE_MAX, NULL}, /*-----------*/ {"Finish", 0x0000, NULL}, -- 2.7.4 From a6af07a17860e0a436ef7c029d17d931974c07b3 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Mon, 1 Feb 2016 17:47:50 +0900 Subject: [PATCH 13/16] remove exclusive arch Change-Id: I52d329e0d380d2165cf5d148c16270d4d9f447f6 --- packaging/capi-network-mtp.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index cfc1939..fea8e1f 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,13 +1,11 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.5 +Version: 1.3.6 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -ExcludeArch: %ix86 x86_64 - BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) -- 2.7.4 From 6d12a708b46294f07f27a0b887fd3f57cfac52c1 Mon Sep 17 00:00:00 2001 From: Hyihong Chae Date: Tue, 2 Feb 2016 10:24:54 +0900 Subject: [PATCH 14/16] add test case to get device lists / apply coding rules Change-Id: I4e6d7ecc1d40acc25c009482c09ea4c75b3cc69c Signed-off-by: HyiHong Chae --- packaging/capi-network-mtp.spec | 2 +- src/mtp_gdbus_manager.c | 8 ++- test/mtp_unit_test.c | 117 ++++++++++++++++++++++++---------------- 3 files changed, 76 insertions(+), 51 deletions(-) diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index fea8e1f..da81659 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.6 +Version: 1.3.7 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp_gdbus_manager.c b/src/mtp_gdbus_manager.c index 447e430..e7be1ac 100755 --- a/src/mtp_gdbus_manager.c +++ b/src/mtp_gdbus_manager.c @@ -39,8 +39,7 @@ static void __mtp_event_cb(mtpgdbuslibManager *object, GSList *l; event_cb_s *event_s; - for (l = event_cb_list; l != NULL; l = l->next) - { + for (l = event_cb_list; l != NULL; l = l->next) { event_s = (event_cb_s *)l->data; event_s->cb(event, arg1, event_s->user_data); } @@ -87,11 +86,10 @@ mtp_error_e mtp_gdbus_manager_remove_event_cb(mtp_event_cb callback) GSList *l; event_cb_s *event_s; - for (l = event_cb_list; l != NULL; l = l->next) - { + for (l = event_cb_list; l != NULL; l = l->next) { event_s = (event_cb_s *)l->data; if (callback == event_s->cb) - event_cb_list = g_slist_delete_link (event_cb_list, l); + event_cb_list = g_slist_delete_link(event_cb_list, l); } return MTP_ERROR_NONE; diff --git a/test/mtp_unit_test.c b/test/mtp_unit_test.c index 22e4a40..79e6c4b 100755 --- a/test/mtp_unit_test.c +++ b/test/mtp_unit_test.c @@ -9,7 +9,7 @@ #include #define BUFFER_LEN 100 -#define TEST_CASE_MAX 37 +#define TEST_CASE_MAX 38 #define TEST_LIST_MAX 20 #define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args) @@ -140,16 +140,15 @@ int manager_test_initialize(void) return ret; } -int manager_test_get_storages(void) +int manager_test_get_devices(void) { int i; int ret = 0; int bus_location = 0; int device_number = 0; int device_count; - int storage_count; mtp_device_h *mtp_devices = NULL; - mtp_storage_h *mtp_storages = NULL; + char *name = NULL; ret = mtp_get_devices(&mtp_devices, &device_count); @@ -164,16 +163,37 @@ int manager_test_get_storages(void) return -1; } + for (i = 0; i < device_count; i++) { + TC_PRT("mtp_device[%d] handle - %d", i, mtp_devices[i]); + ret = mtp_deviceinfo_get_manufacturer_name(mtp_devices[i], &name); + g_free(name); + ret = mtp_deviceinfo_get_model_name(mtp_devices[i], &name); + g_free(name); + ret = mtp_deviceinfo_get_bus_location(mtp_devices[i], &bus_location); + ret = mtp_deviceinfo_get_device_number(mtp_devices[i], &device_number); + } + TC_PRT("Select first device"); mtp_device = mtp_devices[0]; - mtp_deviceinfo_get_bus_location(mtp_device, &bus_location); - mtp_deviceinfo_get_device_number(mtp_device, &device_number); + TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); + + END(); + return ret; +} + + +int manager_test_get_storages(void) +{ + int i; + int ret = 0; + int storage_count; + mtp_storage_h *mtp_storages = NULL; - TC_PRT("bus location : %d, device_number : %d", bus_location, device_number); + TC_PRT(""); - TC_PRT("ret[%d]: 1st mtp device [%d]", ret, mtp_device); + TC_PRT("Selected first mtp device[%d]", mtp_device); ret = mtp_get_storages(mtp_device, &mtp_storages, &storage_count); TC_PRT("ret[%d]: storage_count[%d]", ret, storage_count); @@ -408,6 +428,7 @@ int deviceinfo_test_get_manufacturername(void) ret = mtp_deviceinfo_get_manufacturer_name(mtp_device, &name); TC_PRT("ret[%d]: manufacturername[%s]", ret, name); + g_free(name); END(); return ret; @@ -421,6 +442,7 @@ int deviceinfo_test_get_modelname(void) ret = mtp_deviceinfo_get_model_name(mtp_device, &name); TC_PRT("ret[%d]: modelname[%s]", ret, name); + g_free(name); END(); return ret; @@ -434,6 +456,7 @@ int deviceinfo_test_get_serialnumber(void) ret = mtp_deviceinfo_get_serial_number(mtp_device, &name); TC_PRT("ret[%d]: serialnumber[%s]", ret, name); + g_free(name); END(); return ret; @@ -447,6 +470,7 @@ int deviceinfo_test_get_deviceversion(void) ret = mtp_deviceinfo_get_device_version(mtp_device, &name); TC_PRT("ret[%d]: deviceversion[%s]", ret, name); + g_free(name); END(); return ret; @@ -461,6 +485,7 @@ int storageinfo_test_get_description(void) ret = mtp_storageinfo_get_description(mtp_device, mtp_storage, &name); TC_PRT("ret[%d]: description[%s]", ret, name); + g_free(name); END(); return ret; @@ -513,6 +538,7 @@ int storageinfo_test_get_volumeidentifier(void) ret = mtp_storageinfo_get_volume_identifier(mtp_device, mtp_storage, &name); TC_PRT("ret[%d]: volumeidentifier[%s]", ret, name); + g_free(name); END(); return ret; @@ -631,7 +657,7 @@ int objectinfo_test_get_date_created(void) TC_PRT("ret[%d]: object id[%d] mtp_device[%d]", ret, mtp_objects[i], value); loctime = localtime((time_t *)&value); - strftime (tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); + strftime(tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); TC_PRT("object id[%d]: created date[%s]", mtp_objects[i], tmp); } @@ -658,7 +684,7 @@ int objectinfo_test_get_date_modified(void) TC_PRT("ret[%d]: object id[%d] date_modified[%d]", ret, mtp_objects[i], value); loctime = localtime((time_t *)&value); - strftime (tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); + strftime(tmp, sizeof(tmp), "%Y/%m/%d-%H:%M:%S", loctime); TC_PRT("object id[%d]: modified date[%s]", mtp_objects[i], tmp); } @@ -1046,49 +1072,50 @@ int application_test_remove_event_callback(void) tc_table_t tc_table[] = { /* manager api */ {"mtp_initialize", 1, manager_test_initialize}, - {"mtp_get_storages", 2, manager_test_get_storages}, - {"mtp_get_object_handles", 3, manager_test_get_object_handles}, - {"mtp_delete_object", 4, manager_test_delete_object}, - {"mtp_get_object", 5, manager_test_get_object}, - {"mtp_get_thumbnail", 6, manager_test_get_thumbnail}, - {"mtp_deinitialize", 7, manager_test_deinitialize}, + {"mtp_get_devices", 2, manager_test_get_devices}, + {"mtp_get_storages", 3, manager_test_get_storages}, + {"mtp_get_object_handles", 4, manager_test_get_object_handles}, + {"mtp_delete_object", 5, manager_test_delete_object}, + {"mtp_get_object", 6, manager_test_get_object}, + {"mtp_get_thumbnail", 7, manager_test_get_thumbnail}, + {"mtp_deinitialize", 8, manager_test_deinitialize}, /* device api */ - {"mtp_deviceinfo_manufacturer_name", 8, deviceinfo_test_get_manufacturername}, - {"mtp_deviceinfo_model_name", 9, deviceinfo_test_get_modelname}, - {"mtp_deviceinfo_serial_number", 10, deviceinfo_test_get_serialnumber}, - {"mtp_deviceinfo_device_version", 11, deviceinfo_test_get_deviceversion}, + {"mtp_deviceinfo_manufacturer_name", 9, deviceinfo_test_get_manufacturername}, + {"mtp_deviceinfo_model_name", 10, deviceinfo_test_get_modelname}, + {"mtp_deviceinfo_serial_number", 11, deviceinfo_test_get_serialnumber}, + {"mtp_deviceinfo_device_version", 12, deviceinfo_test_get_deviceversion}, /* storage api */ - {"mtp_storageinfo_get_description", 12, storageinfo_test_get_description}, - {"mtp_storageinfo_get_freespace", 13, storageinfo_test_get_freespace}, - {"mtp_storageinfo_get_maxcapacity", 14, storageinfo_test_get_maxcapacity}, - {"mtp_storageinfo_get_storagetype", 15, storageinfo_test_get_storagetype}, - {"mtp_storageinfo_get_volumeidentifier", 16, storageinfo_test_get_volumeidentifier}, + {"mtp_storageinfo_get_description", 13, storageinfo_test_get_description}, + {"mtp_storageinfo_get_freespace", 14, storageinfo_test_get_freespace}, + {"mtp_storageinfo_get_maxcapacity", 15, storageinfo_test_get_maxcapacity}, + {"mtp_storageinfo_get_storagetype", 16, storageinfo_test_get_storagetype}, + {"mtp_storageinfo_get_volumeidentifier", 17, storageinfo_test_get_volumeidentifier}, /* object api */ - {"mtp_objectinfo_get_association_desc", 17, objectinfo_test_get_association_desc}, - {"mtp_objectinfo_get_association_type", 18, objectinfo_test_get_association_type}, - {"mtp_objectinfo_get_size", 19, objectinfo_test_get_size}, - {"mtp_objectinfo_get_date_created", 20, objectinfo_test_get_date_created}, - {"mtp_objectinfo_get_date_modified", 21, objectinfo_test_get_date_modified}, - {"mtp_objectinfo_get_file_type", 22, objectinfo_test_get_file_type}, - {"mtp_objectinfo_get_image_pix_depth", 23, objectinfo_test_get_image_bit_depth}, - {"mtp_objectinfo_get_image_pix_width", 24, objectinfo_test_get_image_pix_width}, - {"mtp_objectinfo_get_image_pix_height", 25, objectinfo_test_get_image_pix_height}, - {"mtp_objectinfo_get_thumbnail_size", 26, objectinfo_test_get_thumbnail_size}, - {"mtp_objectinfo_get_thumbnail_file_type", 27, objectinfo_test_get_thumbnail_file_type}, - {"mtp_objectinfo_get_thumbnail_pix_height", 28, objectinfo_test_get_thumbnail_pix_height}, - {"mtp_objectinfo_get_thumbnail_pix_width", 29, objectinfo_test_get_thumbnail_pix_width}, - {"mtp_objectinfo_get_filename", 30, objectinfo_test_get_filename}, - {"mtp_objectinfo_get_keywords", 31, objectinfo_test_get_keywords}, + {"mtp_objectinfo_get_association_desc", 18, objectinfo_test_get_association_desc}, + {"mtp_objectinfo_get_association_type", 19, objectinfo_test_get_association_type}, + {"mtp_objectinfo_get_size", 20, objectinfo_test_get_size}, + {"mtp_objectinfo_get_date_created", 21, objectinfo_test_get_date_created}, + {"mtp_objectinfo_get_date_modified", 22, objectinfo_test_get_date_modified}, + {"mtp_objectinfo_get_file_type", 23, objectinfo_test_get_file_type}, + {"mtp_objectinfo_get_image_pix_depth", 24, objectinfo_test_get_image_bit_depth}, + {"mtp_objectinfo_get_image_pix_width", 25, objectinfo_test_get_image_pix_width}, + {"mtp_objectinfo_get_image_pix_height", 26, objectinfo_test_get_image_pix_height}, + {"mtp_objectinfo_get_thumbnail_size", 27, objectinfo_test_get_thumbnail_size}, + {"mtp_objectinfo_get_thumbnail_file_type", 28, objectinfo_test_get_thumbnail_file_type}, + {"mtp_objectinfo_get_thumbnail_pix_height", 29, objectinfo_test_get_thumbnail_pix_height}, + {"mtp_objectinfo_get_thumbnail_pix_width", 30, objectinfo_test_get_thumbnail_pix_width}, + {"mtp_objectinfo_get_filename", 31, objectinfo_test_get_filename}, + {"mtp_objectinfo_get_keywords", 32, objectinfo_test_get_keywords}, /* application test */ - {"get Jpeg image from /DCIM folder", 32, application_test_get_image_from_DCIM}, - {"get object handle using ALL file type", 33, application_test_get_object_handle_using_all}, - {"get object handle using ALL Image file type", 34, application_test_get_object_handle_using_all_image}, - {"test add callback function", 35, application_test_add_event_callback}, - {"test remove callback function", 36, application_test_remove_event_callback}, + {"get Jpeg image from /DCIM folder", 33, application_test_get_image_from_DCIM}, + {"get object handle using ALL file type", 34, application_test_get_object_handle_using_all}, + {"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}, {"get object and get thumbnail test", TEST_CASE_MAX, NULL}, /*-----------*/ -- 2.7.4 From 1d51fe27e3a4838206859e8ea5a817496746a9e3 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Tue, 2 Feb 2016 15:34:05 +0900 Subject: [PATCH 15/16] Change native api implementation - Add condition check in mtp_remove_mtp_event_cb - Change doxygen correctly Change-Id: I5613ae94f6e1214c99a4a961e0ef6da42855b48b --- include/mtp.h | 3 ++- packaging/capi-network-mtp.spec | 2 +- src/mtp.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/mtp.h b/include/mtp.h index 4b5dc95..663a0fd 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -347,8 +347,9 @@ int mtp_add_mtp_event_cb(mtp_event_cb event_cb, void *user_data); * @retval #MTP_ERROR_NONE Successful * @retval #MTP_ERROR_NOT_SUPPORTED MTP is not supported * @retval #MTP_ERROR_NOT_INITIALIZED MTP is not initialized + * @retval #MTP_ERROR_INVALID_PARAMETER Invalid parameter * - * @see mtp_set_mtp_event_cb() + * @see mtp_add_mtp_event_cb() */ int mtp_remove_mtp_event_cb(mtp_event_cb event_cb); diff --git a/packaging/capi-network-mtp.spec b/packaging/capi-network-mtp.spec index da81659..3bbf9d2 100755 --- a/packaging/capi-network-mtp.spec +++ b/packaging/capi-network-mtp.spec @@ -1,6 +1,6 @@ Name: capi-network-mtp Summary: A MTP library in Native API -Version: 1.3.7 +Version: 1.3.8 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/mtp.c b/src/mtp.c index e1bd189..3ff4f7d 100755 --- a/src/mtp.c +++ b/src/mtp.c @@ -277,6 +277,7 @@ int mtp_remove_mtp_event_cb(mtp_event_cb callback) CHECK_SUPPORTED(); CHECK_INIT(); + cond_expr_ret(callback == NULL, MTP_ERROR_INVALID_PARAMETER); /* precondition check end */ -- 2.7.4 From bc70e71e6b1470d2268f0f1a22eb99f38a89244c Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Tue, 2 Feb 2016 16:23:15 +0900 Subject: [PATCH 16/16] Change error code Signed-off-by: Jihoon Jung Change-Id: I44e340e5495cb5aec05267324bdb9f17ccef080d --- include/mtp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mtp.h b/include/mtp.h index 663a0fd..333d17c 100755 --- a/include/mtp.h +++ b/include/mtp.h @@ -28,7 +28,7 @@ extern "C" { * @brief This file contains the MTP API */ #ifndef TIZEN_ERROR_MTP -#define TIZEN_ERROR_MTP -0x03000000 +#define TIZEN_ERROR_MTP -0x01CC0000 #endif /** -- 2.7.4