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!")); |