The MTP Manager API provides functions for establish connection to access MTP responder device, and to Get/Delete files.
Required Header
#include <mtp.h>
Overview
The MTP manager api provides following functions :
- Create / destroy connection to access MTP responder device
- Get Device list
- Get Storage list
- Get Object handles
- Get thumbnail
- Get Object
- Delete Object
Related Features
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
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.
More details on featuring your application can be found from Feature Element.
Functions |
int | mtp_initialize (void) |
| Initializes for using MTP.
|
int | mtp_get_devices (mtp_device_h **mtp_devices, int *device_count) |
| Gets the mtp devices.
|
int | mtp_get_storages (mtp_device_h mtp_device, mtp_storage_h **mtp_storages, int *storage_count) |
| Gets mtp storages from the given device.
|
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_count) |
| Gets object handles from the given device and storage.
|
int | mtp_get_object (mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path) |
| Gets object for a given path from object handle.
|
int | mtp_get_thumbnail (mtp_device_h mtp_device, mtp_object_h object_handle, char *dest_path) |
| Gets thumbnail from the given object handle.
|
int | mtp_add_mtp_event_cb (mtp_event_cb event_cb, void *user_data) |
| Adds a callback function for receiving MTP event.
|
int | mtp_remove_mtp_event_cb (mtp_event_cb event_cb) |
| Removes the callback function.
|
int | mtp_deinitialize (void) |
| Deinitializes MTP operation.
|
Typedefs |
typedef int | mtp_device_h |
| The handle to the mtp device.
|
typedef int | mtp_storage_h |
| The handle to the mtp storage.
|
typedef int | mtp_object_h |
| The handle to the mtp object.
|
typedef void(* | mtp_event_cb )(mtp_event_e event, int event_parameter, void *user_data) |
| Called when mtp event is occured.
|
Typedef Documentation
The handle to the mtp device.
- Since :
- 3.0
Called when mtp event is occured.
- Since :
- 3.0
- Parameters:
-
[in] | event | The event |
[in] | event_parameter | The event parameter |
[in] | user_data | The user data passed from the callback registration function |
- See also:
- mtp_set_mtp_event_cb()
-
mtp_unset_mtp_event_cb()
The handle to the mtp object.
- Since :
- 3.0
The handle to the mtp storage.
- Since :
- 3.0
Enumeration Type Documentation
Error codes reported by the MTP API.
- Since :
- 3.0
- Enumerator:
MTP_ERROR_NONE |
Successful
|
MTP_ERROR_IO_ERROR |
I/O error
|
MTP_ERROR_INVALID_PARAMETER |
Invalid parameter
|
MTP_ERROR_OUT_OF_MEMORY |
Out of memory
|
MTP_ERROR_PERMISSION_DENIED |
Permission denied
|
MTP_ERROR_NOT_SUPPORTED |
Not supported
|
MTP_ERROR_COMM_ERROR |
MTP communication error
|
MTP_ERROR_CONTROLLER |
MTP controller error
|
MTP_ERROR_NO_DEVICE |
MTP have not any device
|
MTP_ERROR_NOT_INITIALIZED |
MTP is not initialized
|
MTP_ERROR_NOT_ACTIVATED |
MTP is not activated
|
MTP_ERROR_NOT_COMM_INITIALIZED |
MTP communication is not initialized
|
MTP_ERROR_PLUGIN_FAIL |
MTP Plugin failed
|
Enumerations for MTP event type.
- Since :
- 3.0
- Enumerator:
MTP_EVENT_UNKNOWN |
Unknown event type
|
MTP_EVENT_STORAGE_ADDED |
Storage is added
|
MTP_EVENT_STORAGE_REMOVED |
Storage is removed
|
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_TURNED_OFF |
MTP is turned off
|
Enumerations for MTP file type.
- Since :
- 3.0
- Enumerator:
MTP_FILETYPE_FOLDER |
FOLDER file type
|
MTP_FILETYPE_WAV |
WAV file type
|
MTP_FILETYPE_MP3 |
MP3 file type
|
MTP_FILETYPE_WMA |
WMA file type
|
MTP_FILETYPE_OGG |
OGG file type
|
MTP_FILETYPE_AUDIBLE |
AUDIBLE file type
|
MTP_FILETYPE_MP4 |
MP4 file type
|
MTP_FILETYPE_UNDEF_AUDIO |
UNDEF_AUDIO file type
|
MTP_FILETYPE_WMV |
WMV file type
|
MTP_FILETYPE_AVI |
AVI file type
|
MTP_FILETYPE_MPEG |
MPEG file type
|
MTP_FILETYPE_ASF |
ASF file type
|
MTP_FILETYPE_QT |
QT file type
|
MTP_FILETYPE_UNDEF_VIDEO |
UNDEF_VIDEO file type
|
MTP_FILETYPE_JPEG |
JPEG file type
|
MTP_FILETYPE_JFIF |
JFIF file type
|
MTP_FILETYPE_TIFF |
TIFF file type
|
MTP_FILETYPE_BMP |
BMP file type
|
MTP_FILETYPE_GIF |
GIF file type
|
MTP_FILETYPE_PICT |
PICT file type
|
MTP_FILETYPE_PNG |
PNG file type
|
MTP_FILETYPE_VCALENDAR1 |
VCALENDAR1 file type
|
MTP_FILETYPE_VCALENDAR2 |
VCALENDAR2 file type
|
MTP_FILETYPE_VCARD2 |
VCARD2 file type
|
MTP_FILETYPE_VCARD3 |
VCARD3 file type
|
MTP_FILETYPE_WINDOWSIMAGEFORMAT |
WINDOWSIMAGEFORMAT file type
|
MTP_FILETYPE_WINEXEC |
WINEXEC file type
|
MTP_FILETYPE_TEXT |
TEXT file type
|
MTP_FILETYPE_HTML |
HTML file type
|
MTP_FILETYPE_FIRMWARE |
FIRMWARE file type
|
MTP_FILETYPE_AAC |
AAC file type
|
MTP_FILETYPE_MEDIACARD |
MEDIACARD file type
|
MTP_FILETYPE_FLAC |
FLAC file type
|
MTP_FILETYPE_MP2 |
MP2 file type
|
MTP_FILETYPE_M4A |
M4A file type
|
MTP_FILETYPE_DOC |
DOC file type
|
MTP_FILETYPE_XML |
XML file type
|
MTP_FILETYPE_XLS |
XLS file type
|
MTP_FILETYPE_PPT |
PPT file type
|
MTP_FILETYPE_MHT |
MHT file type
|
MTP_FILETYPE_JP2 |
JP2 file type
|
MTP_FILETYPE_JPX |
JPX file type
|
MTP_FILETYPE_ALBUM |
ALBUM file type
|
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
|
Enumerations for MTP Storage type.
- Since :
- 3.0
- Enumerator:
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
|
Function Documentation
Adds a callback function for receiving MTP event.
- Since :
- 3.0
- Parameters:
-
[in] | event_cb | The callback |
[in] | user_data | The user data |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_remove_mtp_event_cb()
Deinitializes MTP operation.
- Since :
- 3.0
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_initialize()
Gets the mtp devices.
- Since :
- 3.0
- Parameters:
-
[out] | mtp_devices | The MTP device list |
[out] | device_count | Length of device list |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_initialize()
Gets object for a given path from object handle.
- Since :
- 3.0
- Parameters:
-
[in] | mtp_device | The MTP device |
[in] | object_handle | The object handle |
[in] | dest_path | The dest path |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_get_devices()
-
mtp_get_object_handles()
Gets object handles from the given device and storage.
- Since :
- 3.0
- Parameters:
-
[in] | mtp_device | The MTP device |
[in] | mtp_storage | The MTP storage |
[in] | file_type | The file type what you want |
[in] | parent | The parent object handle |
[out] | object_handles | The object handle list |
[out] | object_count | Length of object handle list |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_get_devices()
-
mtp_get_storages()
Gets mtp storages from the given device.
- Since :
- 3.0
- Parameters:
-
[in] | mtp_device | The MTP device |
[out] | mtp_storages | Current mtp storage list |
[out] | storage_count | Length of storage list |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_get_devices()
Gets thumbnail from the given object handle.
- Since :
- 3.0
- Parameters:
-
[in] | mtp_device | The MTP device |
[in] | object_handle | The object handle |
[in] | dest_path | The dest path |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_get_devices()
-
mtp_get_object_handles()
Initializes for using MTP.
- Since :
- 3.0
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_deinitialize()
Removes the callback function.
- Since :
- 3.0
- Parameters:
-
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- See also:
- mtp_add_mtp_event_cb()