Tizen Native API  6.0
MTP Object Information

The MTP Manager API provides functions for gets the object information of certain file in MTP responder.

Required Header

#include <mtp.h>

Overview

The MTP Object Information api provides following functions :

  • Get object file type
  • Get object name
  • Get object size
  • and, more object information

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_objectinfo_get_file_name (mtp_device_h mtp_device, mtp_object_h object_handle, char **file_name)
 Gets the filename of the object information.
int mtp_objectinfo_get_keywords (mtp_device_h mtp_device, mtp_object_h object_handle, char **keywords)
 Gets the keywords of the object information.
int mtp_objectinfo_get_association_desc (mtp_device_h mtp_device, mtp_object_h object_handle, int *asso_desc)
 Gets the association desc of the object information.
int mtp_objectinfo_get_association_type (mtp_device_h mtp_device, mtp_object_h object_handle, int *asso_type)
 Gets the association type of the object information.
int mtp_objectinfo_get_size (mtp_device_h mtp_device, mtp_object_h object_handle, int *size)
 Gets the size of the object information.
int mtp_objectinfo_get_parent_object_handle (mtp_device_h mtp_device, mtp_object_h object_handle, mtp_object_h *parent_object_handle)
 Gets the parent object handle of the object information.
int mtp_objectinfo_get_storage (mtp_device_h mtp_device, mtp_object_h object_handle, mtp_storage_h *mtp_storage)
 Gets the mtp storage of the object information.
int mtp_objectinfo_get_date_created (mtp_device_h mtp_device, mtp_object_h object_handle, int *date_created)
 Gets the object created time of the object information.
int mtp_objectinfo_get_date_modified (mtp_device_h mtp_device, mtp_object_h object_handle, int *date_modified)
 Gets the object modified time of the object information.
int mtp_objectinfo_get_file_type (mtp_device_h mtp_device, mtp_object_h object_handle, mtp_filetype_e *file_type)
 Gets the file type of the object information.
int mtp_objectinfo_get_image_bit_depth (mtp_device_h mtp_device, mtp_object_h object_handle, int *depth)
 Gets the image bit depth of the object information.
int mtp_objectinfo_get_image_pix_width (mtp_device_h mtp_device, mtp_object_h object_handle, int *width)
 Gets the image pixel width of the object information.
int mtp_objectinfo_get_image_pix_height (mtp_device_h mtp_device, mtp_object_h object_handle, int *height)
 Gets the image pixel height of the object information.
int mtp_objectinfo_get_thumbnail_size (mtp_device_h mtp_device, mtp_object_h object_handle, int *size)
 Gets the thumbnail size of the object information.
int mtp_objectinfo_get_thumbnail_file_type (mtp_device_h mtp_device, mtp_object_h object_handle, mtp_filetype_e *file_type)
 Gets the thumbnail file type of the object information.
int mtp_objectinfo_get_thumbnail_pix_height (mtp_device_h mtp_device, mtp_object_h object_handle, int *height)
 Gets the thumbnail pixel height of the object information.
int mtp_objectinfo_get_thumbnail_pix_width (mtp_device_h mtp_device, mtp_object_h object_handle, int *width)
 Gets the thumbnail pixel width of the object information.

Function Documentation

int mtp_objectinfo_get_association_desc ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  asso_desc 
)

Gets the association desc of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]asso_descThe association description of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_association_type ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  asso_type 
)

Gets the association type of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]asso_typeThe association type of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_date_created ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  date_created 
)

Gets the object created time of the object information.

Since :
3.0
Remarks:
When interpreted as an absolute time value,
date_created represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]date_createdThe object created time of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_date_modified ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  date_modified 
)

Gets the object modified time of the object information.

Since :
3.0
Remarks:
When interpreted as an absolute time value,
date_modified represents the number of seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]date_modifiedThe object modified time of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_file_name ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
char **  file_name 
)

Gets the filename of the object information.

Since :
3.0
Remarks:
The file_name should be freed using free().
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]file_nameThe file name of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_file_type ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
mtp_filetype_e file_type 
)

Gets the file type of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]file_typeThe file type of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_image_bit_depth ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  depth 
)

Gets the image bit depth of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]depthThe image bit depth of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_image_pix_height ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  height 
)

Gets the image pixel height of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]heightThe image pixel height of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_image_pix_width ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  width 
)

Gets the image pixel width of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]widthThe image pixel width of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_keywords ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
char **  keywords 
)

Gets the keywords of the object information.

Since :
3.0
Remarks:
The keywords should be freed using free().
The keywords are separated by comma.
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]keywordsThe keywords of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_parent_object_handle ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
mtp_object_h parent_object_handle 
)

Gets the parent object handle of the object information.

Since :
3.0
Remarks:
The parent_object_handle should not be released.
The parent_object_handle can be used until the MTP service stops.
The parent_object_handle is managed by the platform when the MTP service stop.
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]parent_object_handleThe parent of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_size ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  size 
)

Gets the size of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]sizeThe size of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_storage ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
mtp_storage_h mtp_storage 
)

Gets the mtp storage of the object information.

Since :
3.0
Remarks:
The mtp_storage should not be released.
The mtp_storage can be used until the MTP service stops.
The mtp_storage is managed by the platform when the MTP service stop.
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]mtp_storageThe MTP storage of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
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 
)

Gets the thumbnail file type of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]file_typeThe file type of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_thumbnail_pix_height ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  height 
)

Gets the thumbnail pixel height of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]heightThe thumbnail pixel height of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_thumbnail_pix_width ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  width 
)

Gets the thumbnail pixel width of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]widthThe thumbnail pixel width of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()
int mtp_objectinfo_get_thumbnail_size ( mtp_device_h  mtp_device,
mtp_object_h  object_handle,
int *  size 
)

Gets the thumbnail size of the object information.

Since :
3.0
Parameters:
[in]mtp_deviceThe MTP device
[in]object_handleThe object handle
[out]sizeThe thumbnail size of Object information
Returns:
0 on success, otherwise a negative error value.
Return values:
MTP_ERROR_NONESuccessful
MTP_ERROR_NOT_SUPPORTEDMTP is not supported
MTP_ERROR_INVALID_PARAMETERInvalid parameter
MTP_ERROR_NOT_INITIALIZEDMTP is not initialized
MTP_ERROR_NOT_ACTIVATEDMTP is not activated
MTP_ERROR_NOT_COMM_INITIALIZEDMTP communication is not initialized
MTP_ERROR_COMM_ERRORMTP communication error
MTP_ERROR_CONTROLLERMTP controller error
MTP_ERROR_OUT_OF_MEMORYOut of memory
MTP_ERROR_NO_DEVICEMTP have not any device
MTP_ERROR_PLUGIN_FAILPlugin failed
See also:
mtp_get_object_handles()