Menu

MTP Daemon - DBus Interface Requirements

DBus Interface Specifications

1. General

The exact interface specification including elaborate comments can be found in the "org.libmtp.mtpd.xml" file which is located in the "daemon/dbus" directory.

  1. The DBus interface shall provide the following APIs:
    • device management
    • file management
    • folder management
    • object management
  2. The following APIs shall be optional in a first version, but be implemented afterwards. They are therefore not detailed in the initial version of this document.
    • track management
    • playlist management
    • album management
  3. The APIs shall be modelled as close as possible to the LIBMTP APIs
  4. If something cannot be modelled using DBus or a significantly better alternative exists another approach should be used
    • For example callbacks are not possible: use DBus signals
    • Filetypes should be matched and presented as mime-types and not MTP-internal filetypes
  5. If an operation cannot be executed due to another long-running operation all waiting programs shall be notified
    • Client programs can then notify their users like this: "There is currently another operation active on the device. Please be patient!"
  6. Information about the daemon shall be made available as properties
    • e.g. API version
  7. Optional information that is not part of the specification shall be made available, but marked as such
    • e.g. If the daemon does internal caching the status can be exported as a property

2. Device Management

  1. The device access shall be neartly completely rewritten in contrast to the LIBMTP device management API to ensure useful usage of it
    • As the daemon abstracts all device handling for the client the direct access API is not necessary
  2. The following interfaces shall be available
    • listDevices
      List all devices currently connected
    • renameDevice
      Set the friendlyName of the device to something else
    • listStorages
      List all storages for a device
    • getMetadataforDevice
    • getMetadataforStorage
    • formatStorage
  3. The following interfaces for accessing device properties shall be modelled closely to the existing API
    • LIBMTP_Get_String_From_Object
    • LIBMTP_Get_u64_From_Object
    • LIBMTP_Get_u32_From_Object
    • LIBMTP_Get_u16_From_Object
    • LIBMTP_Get_u8_From_Object
    • LIBMTP_Set_Object_String
    • LIBMTP_Set_Object_u32
    • LIBMTP_Set_Object_u16
    • LIBMTP_Set_Object_u8
    • LIBMTP_Get_Property_Description
    • LIBMTP_Is_Property_Supported
    • LIBMTP_Get_Allowed_Property_Values
  4. The following interfaces still need to be discussed
    • LIBMTP_Get_Syncpartner
    • LIBMTP_Set_Syncpartner

3. File Management

  1. The following interfaces shall be adapted as closely as possible
    • LIBMTP_Get_Files_And_Folders
      Return type shall be a list
    • LIBMTP_Get_Filelisting
      Return type shall be a list
    • LIBMTP_Get_Filemetadata
    • LIBMTP_Set_File_Name
    • LIBMTP_Get_Thumbnail
  2. The following interfaces shall be altered for easier access or usage of DBus simplifications
    • LIBMTP_Get_File_To_File_Descriptor
      Progress function shall be implemented as a signal. The get-function itself shall return a transaction-id that will be included in the progress signal. It shall be the applications responsibility to filter for transactions issued by it.
    • LIBMTP_Send_File_From_File_Descriptor
      Progress function shall be implemented as a signal. The send-function itself shall return a transaction-id that will be included in the progress signal. It shall be the applications responsibility to filter for transactions issued by it.
  3. The following interfaces shall not be implemented
    • LIBMTP_new_file_t
    • LIBMTP_destroy_file_t
    • LIBMTP_Get_File_To_File
    • LIBMTP_Send_File_From_File
    • LIBMTP_new_filesampledata_t
    • LIBMTP_destroy_filesampledata_t
    • LIBMTP_Get_Filetype_Description
    • LIBMTP_Get_Filelisting_With_Callback
  4. The following interfaces still need to be discussed
    • LIBMTP_Get_File_To_Handler
    • LIBMTP_Send_File_From_Handler
    • LIBMTP_Get_Representative_Sample_Format
    • LIBMTP_Send_Representative_Sample
    • LIBMTP_Get_Representative_Sample
    • LIBMTP_Read_Event

4. Folder Management

  1. The following interfaces shall be adapted as closely as possible
    • LIBMTP_Get_Folder_List
    • LIBMTP_Get_Folder_List_For_Storage
    • LIBMTP_Create_Folder
    • LIBMTP_Set_Folder_Name
  2. The following interfaces shall not be implemented
    • LIBMTP_new_folder_t
    • LIBMTP_destroy_folder_t

5. Object Management

  1. The following interfaces shall be adapted as closely as possible
    • LIBMTP_Delete_Object
      Shall ensure that objects are deleted recursively
    • LIBMTP_Set_Object_Filename
    • LIBMTP_GetPartialObject
    • LIBMTP_SendPartialObject
    • LIBMTP_BeginEditObject
    • LIBMTP_EndEditObject
    • LIBMTP_TruncateObject

Related

Wiki: MTP Daemon