25 #include <mpxplaybackutility.h> // MMPXPlaybackUtility |
25 #include <mpxplaybackutility.h> // MMPXPlaybackUtility |
26 #include <mpxconstants.h> // KAppUidMusicPlayerX |
26 #include <mpxconstants.h> // KAppUidMusicPlayerX |
27 #include <mpxmusicplayerviewplugin.hrh> // KMPXPluginTypePlaybackUid |
27 #include <mpxmusicplayerviewplugin.hrh> // KMPXPluginTypePlaybackUid |
28 #include <AknTaskList.h> // CAknTaskList |
28 #include <AknTaskList.h> // CAknTaskList |
29 |
29 |
|
30 #include <mpxcommandgeneraldefs.h> |
30 #include <mpxcommonuihelper.h> |
31 #include <mpxcommonuihelper.h> |
31 #include <mpxcollectionhelperfactory.h> |
32 #include <mpxcollectionhelperfactory.h> |
32 #include "musicplayeractionhandler.h" |
33 #include "musicplayeractionhandler.h" |
33 #include <mpxcollectionpath.h> |
34 #include <mpxcollectionpath.h> |
34 |
35 |
36 |
37 |
37 |
38 |
38 const TInt KPlayerMusicPlayerParameterGranularity = 50; |
39 const TInt KPlayerMusicPlayerParameterGranularity = 50; |
39 const TUid KMusicPlayerAppUid = { 0x102072C3 }; |
40 const TUid KMusicPlayerAppUid = { 0x102072C3 }; |
40 |
41 |
|
42 const TInt KMPXStandAloneProcessIDTop32( 1 ); |
|
43 const TInt KMPXStandAloneProcessIDBottom32( 2 ); |
41 // RProperty key to identify the case when Music Player launching |
44 // RProperty key to identify the case when Music Player launching |
42 // in the background |
45 // in the background |
43 const TInt KMPXLaunchingOnBackground( 100 ); |
46 const TInt KMPXLaunchingOnBackground( 100 ); |
44 |
47 |
45 //map values |
48 //map values |
120 TLiwVariant variant; |
123 TLiwVariant variant; |
121 variant.PushL(); |
124 variant.PushL(); |
122 errCode = ExtractVariantL( aMap, variant, KCommand ); |
125 errCode = ExtractVariantL( aMap, variant, KCommand ); |
123 if ( errCode == KErrNone ) |
126 if ( errCode == KErrNone ) |
124 { |
127 { |
125 if ( !iPlaybackUtility ) // Ensure that the utility exists |
|
126 { |
|
127 iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid); |
|
128 } |
|
129 TMPXPlaybackCommand Command; |
128 TMPXPlaybackCommand Command; |
130 Command = static_cast<TMPXPlaybackCommand>( variant.AsTInt32() ); |
129 Command = static_cast<TMPXPlaybackCommand>( variant.AsTInt32() ); |
131 iPlaybackUtility->CommandL( Command ); |
130 SetPlaybackCommandL( Command ); |
132 } |
131 } |
133 CleanupStack::PopAndDestroy( &variant); |
132 CleanupStack::PopAndDestroy( &variant); |
134 MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecutePlaybackCommandL()"); |
133 MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecutePlaybackCommandL()"); |
135 return errCode; |
134 return errCode; |
136 } |
135 } |
499 CleanupStack::PopAndDestroy( &type ); |
498 CleanupStack::PopAndDestroy( &type ); |
500 MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecuteActionL()"); |
499 MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecuteActionL()"); |
501 return errCode; |
500 return errCode; |
502 } |
501 } |
503 |
502 |
|
503 // --------------------------------------------------------------------------- |
|
504 // Set the command to playbackUtility |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 void CMusicPlayerActionHandler::SetPlaybackCommandL( TMPXPlaybackCommand aCommand ) |
|
508 { |
|
509 MPX_DEBUG1("-->CMusicPlayerActionHandler::SetPlaybackCommandL()"); |
|
510 //Try to get musicplay StandAloneMode process id |
|
511 TInt procId( 0 ); |
|
512 TUint64 mpProcId( 0 ); |
|
513 TInt err( RProperty::Get( KMusicPlayerAppUid, KMPXStandAloneProcessIDTop32, procId ) ); |
|
514 if ( err == KErrNone ) |
|
515 { |
|
516 mpProcId = TUint64( procId ) << 32; |
|
517 err = RProperty::Get( KMusicPlayerAppUid, KMPXStandAloneProcessIDBottom32, procId ); |
|
518 if ( err == KErrNone ) |
|
519 { |
|
520 mpProcId += procId; |
|
521 } |
|
522 else |
|
523 { |
|
524 mpProcId = 0; |
|
525 } |
|
526 } |
|
527 |
|
528 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
529 CleanupStack::PushL( cmd ); |
|
530 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
531 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
532 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCommand ); |
|
533 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralData, 0 ); |
|
534 if ( mpProcId ) |
|
535 { |
|
536 //This attribute will be used by playbckEngine->iLastActiveProcess |
|
537 cmd->SetTObjectValueL<TProcessId> ( KMPXCommandPlaybackGeneralClientPid, mpProcId ); |
|
538 } |
|
539 if ( !iPlaybackUtility ) // Ensure that the utility exists |
|
540 { |
|
541 iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid); |
|
542 } |
|
543 |
|
544 iPlaybackUtility->CommandL( *cmd ); |
|
545 CleanupStack::PopAndDestroy( cmd ); |
|
546 MPX_DEBUG1("<--CMusicPlayerActionHandler::SetPlaybackCommandL()"); |
|
547 } |
504 // End of File |
548 // End of File |
505 |
549 |