mpxmusicplayer/app/src/mpxappui.cpp
branchRCL_3
changeset 49 455f89b7fcc5
parent 31 a12246c97fcc
--- a/mpxmusicplayer/app/src/mpxappui.cpp	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxmusicplayer/app/src/mpxappui.cpp	Thu Jul 15 18:35:42 2010 +0300
@@ -120,13 +120,18 @@
 #include <iaupdateparameters.h>
 #include <iaupdateresult.h>
 
+#include <mpxparameter.h>               // CMPXParameter
+
 // CONSTANTS
 _LIT( KMPXLineChange, "\n" );
 _LIT(KMPXMusicplayerPrivateFolder, "\\private\\");
 _LIT(KMPXMusicPlayerExec, "mpx.exe" );
+_LIT8(KRemConTspControllerPlayParam, "play");
 
 const TInt KMPXMusicPlayerAlreadySaved( -5000 );
 
+const TInt KPlayerMusicPlayerParameterGranularity = 50;
+
 // Application Uid for Active Idle app
 #ifdef __ACTIVE_IDLE
 const TUid KMPXUidIdleApp = { 0x101FD64C };
@@ -4099,7 +4104,35 @@
     const TPtrC8 command = aCommandLine.TailEnd();
         if ( command.Size() > 0 )
         {
-        HandleCommandParametersL( command );
+        // Play command from RemConTspController
+        if (command.Compare(KRemConTspControllerPlayParam) == 0) 
+            {
+            RWsSession wsSession = iEikonEnv->WsSession();
+            CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+            CleanupStack::PushL( taskList );
+            TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+            CMPXParameter* param = new ( ELeave ) CMPXParameter();
+            CleanupStack::PushL( param );
+            param->iType.iUid = KMPXPluginTypeLastPlayedUid; 
+            param->iCmdForward = EMPXCmdFwdNone;
+            CBufBase* buffer = CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+            CleanupStack::PushL( buffer );
+            RBufWriteStream writeStream( *buffer );
+            CleanupClosePushL( writeStream );
+            param->ExternalizeL( writeStream );
+            writeStream.CommitL();
+            buffer->Compress();
+            CleanupStack::PopAndDestroy( &writeStream );
+            wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                             buffer->Ptr( 0 ) );
+            CleanupStack::PopAndDestroy( buffer);
+            CleanupStack::PopAndDestroy( param );
+            CleanupStack::PopAndDestroy( taskList );
+            } 
+        else 
+            {
+            HandleCommandParametersL( command );
+            }
         }
     return ETrue;
     }