Configuring the MTP Framework for Different Protocols

This section describe how to configure the MTP framework and data providers to operate in MTP, PTP and PictBridge modes.

Before you start, you must understand:

Introduction

The Symbian MTP implementation also supports the interoperability with hosts that only support Picture Transfer Protocol (PTP) or PictBridge. PTP is useful for transferring images files from digital cameras to computers and PictBridge is useful in printing images directly from digital cameras to a printer.

The required mode must be selected before the MTP framework is started. The framework retrieves the mode using a Publish and Subscribe property. By default, the framework starts in MTP mode. To select a different mode you must reset the Publish and Subscribe property in the MTP client application (RMTPClient) and restart the MTP framework. Starting in the appropriate mode saves file enumeration time and improves performance. The framework can use the mode property to decide which data provider plug-ins to load.

Procedure

  1. Grant the property KUidMTPModeKeyValue with the same capabilities as RMTPClient.

    Capabilities: All -TCB (that is all the capabilities are included except TCB).

  2. Publish the KUidMTPModeKeyValue property by definting it and setting its value:

    TInt err = RProperty::Define (
                                     KUidSystemCategory,
                                     KUidMTPModeKeyValue,
                                     RProperty::EInt);
    TInt err = RProperty::Set (
                                     KUidSystemCategory,
                                     KUidMTPModeKeyValue,
                                     RProperty::EInt);
    Parameter Description Values

    aMode

    The new property value of the mode that is set.

    KMTPModeMTP or KMTPModePTP or KMTPModePictBridge

  3. Configure Data Providers for different modes.

    Data providers are implemented as ECOM plug-ins, which are loaded by the MTP framework.

    You can use the supported_modes value in the configuration file of a data provider to instruct the MTP framework to load it for one or more specified modes.

     supported_modes = KMtpModeMTP|KMtpModePTP|KMtpModePictBridge; 

    For example, if the supported_modes field in a data provider’s configuration file contains only KMtpModePTP, then that data provider will be loaded only if the MTP mode is set to PTP when the framework starts up.

    The following example shows the supported_modes field in the mtpImagedp_config.rss configuration file. The Image data provider supports only PTP and PictBridge modes:

    
    RESOURCE MTP_DATA_PROVIDER dpConfig
      {
      type = EMtpDataTypeEcom;
      major_version = 1;
      object_enumeration_persistent = 0;
      supported_modes = KMtpModePTP|KMtpModePictBridge; //Supported modes 
      server_name = "";
      server_image_name = "";
      opaque_resource = fileConfig;
      }
    

    NOTE: The default data providers are all loaded irrespective of the mode that is set.