Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to Control the MTP Framework

The MTP framework presents a standard Symbian Client/Server interface. A client must instantiate a service provider, RMTPSession, and connect to the MTP Server. If the Server is not already running the attempt to connect will cause it to be started.

class RMTPSession : public RSessionBase
    {
public:
    IMPORT_C RMTPSession();
    IMPORT_C TInt Connect();   
    IMPORT_C TInt StartTransport(TUid aTransport);    
    IMPORT_C TInt StopTransport(TUid aTransport);     

private:
    TVersion Version();       
    };

#endif

Once the session is connected the client may start communication with the PC by calling StartTransport() and specifying the transport plugin implementation UID. At present only a USB transport plugin exists, for which the UID is 0x102827B2;

RMTPSession iMTP ;

const TUid KUSBStillImage = { 0x102827B2 } ; 

TInt err = iMTP.Connect() ;
if ( err != KErrNone )
   {
   // there was a problem starting the MTP framework
   }
else ( err = iMTP.StartTransport( KUSBStillImage ) )
   {
   if ( err != KErrNone )
                            {
       // there was a problem starting the USB transport 
       }
   }

TInt err = iMTP.StopTransport( KUSBstillImage ) ) ;

iMTP.Close() ;