1207 { |
1208 { |
1208 TInt event = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralEvent ); |
1209 TInt event = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralEvent ); |
1209 TInt type = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralType ); |
1210 TInt type = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralType ); |
1210 MPX_DEBUG3("--->CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type); |
1211 MPX_DEBUG3("--->CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type); |
1211 |
1212 |
|
1213 |
1212 if ( event == TMPXCollectionMessage::EBroadcastEvent |
1214 if ( event == TMPXCollectionMessage::EBroadcastEvent |
1213 && ( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )) |
1215 && ( type == EMcMsgUSBMassStorageStart || |
1214 { |
1216 type == EMcMsgUSBMTPStart || |
1215 iUSBOnGoing = ETrue; |
1217 type == EMcMsgRefreshStart )) |
1216 MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing ); |
1218 { |
|
1219 iBlockingOperationOngoing = ETrue; |
|
1220 MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iBlockingOperationOngoing changed to: %d", |
|
1221 iBlockingOperationOngoing ); |
1217 UpdateToolBarL( TBK::KSkeep_L_dimmed | |
1222 UpdateToolBarL( TBK::KSkeep_L_dimmed | |
1218 TBK::KPlay_dimmed | |
1223 TBK::KPlay_dimmed | |
1219 TBK::KSkeep_R_dimmed ); |
1224 TBK::KSkeep_R_dimmed ); |
1220 if ( IsOKToPublishData() ) |
1225 if ( IsOKToPublishData() ) |
1221 { |
1226 { |
1222 InstallGoToAlbumL(EMusicMenuMusicInfoTrigger); |
1227 InstallGoToAlbumL(EMusicMenuMusicInfoTrigger); |
1223 } |
1228 } |
1224 } |
1229 } |
1225 else if ( event == TMPXCollectionMessage::EBroadcastEvent |
1230 else if ( event == TMPXCollectionMessage::EBroadcastEvent |
1226 && ( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )) |
1231 && ( type == EMcMsgUSBMassStorageEnd || |
1227 { |
1232 type == EMcMsgUSBMTPEnd || |
1228 iUSBOnGoing = EFalse; |
1233 type == EMcMsgRefreshEnd )) |
1229 MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing ); |
1234 { |
|
1235 iBlockingOperationOngoing = EFalse; |
|
1236 MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iBlockingOperationOngoing changed to: %d", |
|
1237 iBlockingOperationOngoing ); |
1230 DoUpdatePlayerStateL( iEngine->PlayerState() ); |
1238 DoUpdatePlayerStateL( iEngine->PlayerState() ); |
1231 if ( IsOKToPublishData() ) |
1239 if ( IsOKToPublishData() ) |
1232 { |
1240 { |
1233 iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, |
1241 iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, |
1234 KEmpty ); |
1242 KEmpty ); |
1295 // Music Player opening timer callback |
1303 // Music Player opening timer callback |
1296 // ---------------------------------------------------------------------------- |
1304 // ---------------------------------------------------------------------------- |
1297 // |
1305 // |
1298 TInt CMCPMusicPlayer::MusicPlayerOpeningTimerCallback( TAny* aPtr ) |
1306 TInt CMCPMusicPlayer::MusicPlayerOpeningTimerCallback( TAny* aPtr ) |
1299 { |
1307 { |
1300 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback <---"); |
1308 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback <---"); |
1301 RWsSession wsSession; |
1309 if ( EMPlayerStatePlaying != static_cast<CMCPMusicPlayer*>(aPtr)->iEngine->PlayerState() ) |
1302 TInt error = wsSession.Connect(); |
1310 { |
1303 if ( error != KErrNone ) |
1311 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback Music Player not Playing"); |
1304 { |
1312 //Reset the widget and menu, music player is not running and playing. |
1305 return error; |
1313 static_cast<CMCPMusicPlayer*>(aPtr)->iActive = EFalse; |
1306 } |
|
1307 |
|
1308 TBool taskExists( EFalse ); |
|
1309 CAknTaskList* taskList( NULL ); |
|
1310 TRAPD( err, taskList = CAknTaskList::NewL( wsSession ) ); |
|
1311 if ( err == KErrNone ) |
|
1312 { |
|
1313 MPX_DEBUG2("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback " |
|
1314 "error = %d occur when creating CAknTaskList", err); |
|
1315 TApaTask task = taskList->FindRootApp( TUid::Uid( KMusicPlayerAppUidAsTInt ) ); |
|
1316 delete taskList; |
|
1317 taskExists = task.Exists(); |
|
1318 } |
|
1319 wsSession.Close(); |
|
1320 |
|
1321 if ( !taskExists ) |
|
1322 { |
|
1323 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback Music Player not opened"); |
|
1324 //Reset the widget and menu, music player is not running |
|
1325 TRAP_IGNORE( static_cast<CMCPMusicPlayer*>(aPtr)->ResetL() ); |
1314 TRAP_IGNORE( static_cast<CMCPMusicPlayer*>(aPtr)->ResetL() ); |
1326 } |
1315 } |
1327 static_cast<CMCPMusicPlayer*>(aPtr)->iMusicPlayerOpeningTimer->Cancel(); |
1316 static_cast<CMCPMusicPlayer*>(aPtr)->iMusicPlayerOpeningTimer->Cancel(); |
1328 |
1317 |
1329 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback --->"); |
1318 MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback --->"); |