mtpfws/mtpfw/src/cmtpconnectionmgr.cpp
changeset 38 48c22c726cf9
parent 28 85e0c0339cc3
child 47 63cf70d3ecd8
equal deleted inserted replaced
33:883e91c086aa 38:48c22c726cf9
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <usbman.h>
       
    17 #include <usbstates.h>
       
    18 #include "cmtpconnectionmgr.h"
    16 #include "cmtpconnectionmgr.h"
    19 
    17 
    20 #include "cmtpconnection.h"
    18 #include "cmtpconnection.h"
    21 #include "cmtptransportplugin.h"
    19 #include "cmtptransportplugin.h"
    22 #include "mmtptransportconnection.h"
    20 #include "mmtptransportconnection.h"
   113     }
   111     }
   114 
   112 
   115 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
   113 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
   116     {
   114     {
   117     __FLOG(_L8("StartTransportL - Entry"));
   115     __FLOG(_L8("StartTransportL - Entry"));
   118   
       
   119     RUsb usb;
       
   120     User::LeaveIfError(usb.Connect());
       
   121     __FLOG(_L8("after connect, and before call get currentpersonalityid"));
       
   122     TInt usbMode;
       
   123     TUsbServiceState usbStat;
       
   124     TInt err = usb.GetCurrentPersonalityId(usbMode);
       
   125     __FLOG_1(_L8("The return value of GetCurrentPersonalityId is %d"), err);
       
   126     
       
   127     err = usb.GetServiceState(usbStat);
       
   128     __FLOG_1(_L8("The return value of GetServiceState is %d"), err);        
       
   129     
       
   130     usb.Close();
       
   131     
       
   132     __FLOG_1(_L8("The current usb mode is %d"), usbMode);
       
   133     __FLOG_1(_L8("The current usb service state is %d"), usbStat);
       
   134 
       
   135     TInt massStorageMode = 0x02;
       
   136     
       
   137     if(usbMode == massStorageMode && usbStat != EUsbServiceIdle)
       
   138         {
       
   139         __FLOG(_L8("StartTransportL without parameter!"));
       
   140         StartTransportL( aTransport, NULL );
       
   141         return;
       
   142         }
       
   143     
       
   144     
       
   145     
   116     
   146     //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection.
   117     //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection.
   147     if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
   118     if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
   148         {
   119         {
   149         __FLOG(_L8("StartTransportL with parameter!"));
   120         __FLOG(_L8("StartTransportL with parameter!"));