159 // Handle the Key event |
159 // Handle the Key event |
160 TInt usbStatus; |
160 TInt usbStatus; |
161 iUSBKeyWatcher->GetValue( usbStatus ); |
161 iUSBKeyWatcher->GetValue( usbStatus ); |
162 |
162 |
163 TInt mtpStatus; |
163 TInt mtpStatus; |
164 iMTPKeyWatcher->GetValue(mtpStatus); |
164 TInt err = iMTPKeyWatcher->GetValue(mtpStatus); |
165 |
165 |
166 MPX_DEBUG3("CMPXConnectionEventHandler::DoHandlePSEventL, usbStatus = %d, mtpStatus = %d", usbStatus, mtpStatus); |
166 MPX_DEBUG3("CMPXConnectionEventHandler::DoHandlePSEventL, usbStatus = %d, mtpStatus = %d", usbStatus, mtpStatus); |
167 MPX_DEBUG2("CMPXConnectionEventHandler::DoHandlePSEventL, iState = %d", iState); |
167 MPX_DEBUG2("CMPXConnectionEventHandler::DoHandlePSEventL, iState = %d", iState); |
168 MPX_DEBUG4("CMPXConnectionEventHandler::DoHandlePSEventL, iDeviceState = %d, EUsbDeviceStateAddress(%d), EUsbDeviceStateConfigured(%d)", iDeviceState, EUsbDeviceStateAddress, EUsbDeviceStateConfigured); |
168 MPX_DEBUG4("CMPXConnectionEventHandler::DoHandlePSEventL, iDeviceState = %d, EUsbDeviceStateAddress(%d), EUsbDeviceStateConfigured(%d)", iDeviceState, EUsbDeviceStateAddress, EUsbDeviceStateConfigured); |
169 |
169 |
194 } |
194 } |
195 |
195 |
196 // after MassStorage End, it is possible that MTP is still connected |
196 // after MassStorage End, it is possible that MTP is still connected |
197 if (iState != EMPXConnectionMassStorage) |
197 if (iState != EMPXConnectionMassStorage) |
198 { |
198 { |
199 if ((mtpStatus == EMtpPSStatusUninitialized) && (iState != EMPXConnectionNone)) |
199 if (err == KErrNone) |
200 { |
200 { |
201 MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End"); |
201 if ((mtpStatus == EMtpPSStatusUninitialized) && (iState != EMPXConnectionNone)) |
202 iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 ); |
202 { |
203 iState = EMPXConnectionNone; |
203 MPX_DEBUG1("CMPXConnectionEventHandler::DoHandlePSEvent - MTP End"); |
204 } |
204 iObserver.HandleSystemEventL( EUSBMTPEndEvent, -1 ); |
205 else if ((mtpStatus == EMtpPSStatusActive) && (iState != EMPXConnectionMTPActive) |
205 iState = EMPXConnectionNone; |
206 && ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP))) // only trigger MusicPlayer fully block and RAM Drive if USB MTP/PCSuiteMTP is connected |
206 } |
207 { |
207 else if ((mtpStatus == EMtpPSStatusActive) && (iState != EMPXConnectionMTPActive) |
208 DoMTPStartEventL(); |
208 && ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP))) // only trigger MusicPlayer fully block and RAM Drive if USB MTP/PCSuiteMTP is connected |
209 } |
209 { |
210 else if ((mtpStatus == EMtpPSStatusReadyToSync) && (iState != EMPXConnectionMTPIdle) && (iState != EMPXConnectionMTPActive)) |
210 DoMTPStartEventL(); |
211 { |
211 } |
212 DoMTPNotActiveEventL(); |
212 else if ((mtpStatus == EMtpPSStatusReadyToSync) && (iState != EMPXConnectionMTPIdle) && (iState != EMPXConnectionMTPActive)) |
|
213 { |
|
214 DoMTPNotActiveEventL(); |
|
215 } |
|
216 } |
|
217 else |
|
218 { |
|
219 // mtpwatcher can err out because the mtp ps key would only be defined and default after first use, |
|
220 // and this logic here might hit before that |
|
221 MPX_DEBUG2("CMPXConnectionEventHandler::DoHandlePSEvent - MTPWatcher err = %d", err); |
213 } |
222 } |
214 } |
223 } |
215 } |
224 } |
216 |
225 |
217 void CMPXConnectionEventHandler::DoMSStartEventL() |
226 void CMPXConnectionEventHandler::DoMSStartEventL() |