mpxmusicplayer/app/inc/mpxPDcommandhandler.h
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handles commands passed in by other appilcations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXPDCOMMANDHANDLER_H
       
    20 #define CMPXPDCOMMANDHANDLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <mpxplaybackobserver.h>
       
    25 #include <mpxplaybackframeworkdefs.h>
       
    26 #include <mpxplaybackcommanddefs.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MMPXPlaybackUtility;
       
    30 class MMPXViewUtility;
       
    31 class CMPXParameter;
       
    32 class CMPXDrmMediaUtility;
       
    33 class CMPXCommonUiHelper;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37  * Process commands passed in by other applications.
       
    38  *
       
    39  *  @lib mpx.exe
       
    40  *  @since 3.1
       
    41  */
       
    42 class CMPXPdCommandHandler : public CBase,
       
    43                              public MMPXPlaybackObserver
       
    44     {
       
    45     public: // Constructors and destructor
       
    46 
       
    47         /**
       
    48          * Two-phased constructor.
       
    49          *
       
    50          * @since 3.1
       
    51          * @param aPlaybackUtility Playback utility to use.
       
    52          * @param aCollectionMode The collection mode for current music player
       
    53          * @param aParameter The command to process.
       
    54          * @return Pointer to newly created object.
       
    55          */
       
    56         static CMPXPdCommandHandler * NewL( MMPXPlaybackUtility* aPlaybackUtility );
       
    57 
       
    58         /**
       
    59          * Two-phased constructor.
       
    60          *
       
    61          * @since 3.1
       
    62          * @param aPlaybackUtility Playback utility to use.
       
    63          * @param aCollectionMode The collection mode for current music player
       
    64          * @param aParameter The command to process.
       
    65          * @return Pointer to newly created object.
       
    66          */
       
    67         static CMPXPdCommandHandler * NewLC( MMPXPlaybackUtility* aPlaybackUtility );
       
    68 
       
    69         /**
       
    70          * Destructor.
       
    71          */
       
    72         virtual ~CMPXPdCommandHandler();
       
    73 
       
    74 
       
    75         TInt HandleCommandParametersL( const TDesC8& aParameter );
       
    76 
       
    77 	    /**
       
    78 	     * Handle media key commands.
       
    79 	     *
       
    80 	     * @param aCommand Media key commands. see mpxappui.hrh
       
    81 	     */
       
    82 	    void HandleCommandL( TMPXPlaybackCommand aCommand );
       
    83 
       
    84         /**
       
    85          *  Current state of player
       
    86          * 
       
    87          *  @since 3.1
       
    88          *  @return current PdPlaybackUtility state
       
    89          */
       
    90         TMPXPlaybackState PdStateL() const;
       
    91         
       
    92         TBool IsPlaybackCompleted();
       
    93         
       
    94     private:
       
    95 
       
    96         /**
       
    97          * C++ Constructor
       
    98          *
       
    99          */
       
   100         CMPXPdCommandHandler(MMPXPlaybackUtility* aPlaybackUtility);
       
   101 
       
   102         /**
       
   103          * By default Symbian 2nd phase constructor is private.
       
   104          *
       
   105          */
       
   106         void ConstructL();
       
   107 
       
   108 
       
   109         /**
       
   110          * From MMPXPlaybackObserver
       
   111          * Handle playback message
       
   112          *
       
   113          * @param aMessage playback message
       
   114          * @param aErr system error code.
       
   115          */
       
   116         void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
       
   117 
       
   118     private:  // New functions
       
   119 
       
   120         /**
       
   121          * Start processing the message
       
   122          *
       
   123          */
       
   124         void DoHandleMessageL();
       
   125 
       
   126         /**
       
   127          * Handle playback message
       
   128          *
       
   129          * @param aMessage playback message
       
   130          */
       
   131         void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
       
   132         
       
   133 	    /**
       
   134 	     *  Handle playback state changed.
       
   135 	     *
       
   136 	     *  @param aState New Playback state
       
   137 	     */
       
   138 	    void DoHandleStateChangedL(
       
   139 	        TMPXPlaybackState aState );
       
   140         
       
   141 
       
   142         void ActivatePlaybackViewL();
       
   143 
       
   144         void SendCustomCommandToMPXL( TUint aTransactionID, TMPXPlaybackPdCommand aCustomCmd );
       
   145 
       
   146 
       
   147     private:
       
   148 
       
   149         MMPXPlaybackUtility* iPdPlaybackUtility; // owned
       
   150         MMPXPlaybackUtility* iPlaybackUtility; // owned
       
   151 
       
   152         MMPXViewUtility* iViewUtility; // owned
       
   153 		CMPXDrmMediaUtility* iDrmMediaUtility; // owned
       
   154 		CMPXCommonUiHelper* iCommonUiHelper; // owned
       
   155 		TBool iPlaybackCompleted;
       
   156 		TBufC<KMaxFileName> iCurrentFileName;
       
   157 		TMPXPlaybackState iPrevousPlaybackState;
       
   158 
       
   159     };
       
   160 
       
   161 #endif // CMPXPDCOMMANDHANDLER_H
       
   162 
       
   163 // End of File
       
   164