musichomescreen_multiview/mcpmusicplayer/inc/mcpmusicplayer.h
branchRCL_3
changeset 26 3de6c4cf6b67
equal deleted inserted replaced
25:14979e23cb5e 26:3de6c4cf6b67
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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:  Updates Music Content Plublisher
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MCPMUSICPLAYER_H
       
    20 #define C_MCPMUSICPLAYER_H 
       
    21 
       
    22 #include <mpxplaybackcommanddefs.h> //for TMPXPlaybackCommand
       
    23 #include <e32std.h> // for TExitType
       
    24 #include <mcpplugin.h>
       
    25 #include <mcppluginobserver.h>
       
    26 #include <mpxcollectionobserver.h>
       
    27 #include <mpxharvesterutilityobserver.h>
       
    28 #include "aiplayerpluginengineobserver.h"
       
    29 #include "filemonitorobserver.h"
       
    30 #include "applicationmonitorobserver.h"
       
    31 #include "pnsmonitorobserver.h"
       
    32 
       
    33 class MLiwInterface;
       
    34 class CLiwGenericParamList;
       
    35 class CAiPlayerPluginEngine;
       
    36 class CFileMonitor;
       
    37 class CApplicationMonitor;
       
    38 class CPNSMonitor;
       
    39 class RResourceFile;
       
    40 class MMPXCollectionUtility;
       
    41 class MMPXHarvesterUtility;
       
    42 
       
    43 /**
       
    44  *  Music Player MCP plugin.
       
    45  *  CMCPMusicPlayer implements CMCPPlugin
       
    46  *
       
    47  *  @since S60 S60 v5.0
       
    48  */
       
    49 class CMCPMusicPlayer : public CMCPPlugin,
       
    50                                 public MAiPlayerPluginEngineObserver,
       
    51                                 public MFileMonitorObserver,
       
    52                                 public MApplicationMonitorObserver,
       
    53                                 public MMPXCollectionObserver,
       
    54                                 public MPNSMonitorObserver
       
    55     {
       
    56 public:
       
    57     /**
       
    58      * Standard Symbian 2 phase constructor
       
    59      */
       
    60     static CMCPMusicPlayer* NewL(
       
    61             MMCPPluginObserver* aObserver);
       
    62 
       
    63     /**
       
    64      * Standard C++ destructor.
       
    65      */
       
    66     virtual ~CMCPMusicPlayer();
       
    67 
       
    68  // from base class CMCPPlugin
       
    69 
       
    70     /**
       
    71      * From CMCPPlugin
       
    72      * @since S60 5.0
       
    73      */
       
    74     void Deactivate();
       
    75     
       
    76     /**
       
    77      * From CMCPPlugin
       
    78      * @since S60 5.0
       
    79      */
       
    80     void SkinChanged();
       
    81         
       
    82 
       
    83 // from base class MAiPlayerPluginEngineObserver
       
    84     
       
    85     /**
       
    86      * From MAiPlayerPluginEngineObserver
       
    87      * @since S60 5.0
       
    88      * See aiplayerpluginengineobserver.h for detailed description.
       
    89      */
       
    90     void PlayerStateChanged(TMPlayerState aState);
       
    91     
       
    92     /**
       
    93      * From MAiPlayerPluginEngineObserver
       
    94      * @since S60 5.0
       
    95      * See aiplayerpluginengineobserver.h for detailed description.
       
    96      */
       
    97     void TrackInfoChanged(const TDesC& aTitle, const TDesC& aArtist);
       
    98     
       
    99     /**
       
   100      * From MAiPlayerPluginEngineObserver
       
   101      * @since S60 5.0
       
   102      * See aiplayerpluginengineobserver.h for detailed description.
       
   103      */
       
   104     void PlaybackPositionChanged(TInt aPosition);
       
   105     
       
   106     /**
       
   107      * From MAiPlayerPluginEngineObserver
       
   108      * @since S60 5.0
       
   109      * See aiplayerpluginengineobserver.h for detailed description.
       
   110      */
       
   111     void AlbumArtChanged( CFbsBitmap* aBitmap );
       
   112     
       
   113     /**
       
   114      * From MAiPlayerPluginEngineObserver
       
   115      * @since S60 5.0
       
   116      * See aiplayerpluginengineobserver.h for detailed description.
       
   117      */
       
   118     void Opening();
       
   119     
       
   120     /**
       
   121      * From MAiPlayerPluginEngineObserver
       
   122      * @since S60 5.0
       
   123      * See aiplayerpluginengineobserver.h for detailed description.
       
   124      */
       
   125     void PlaylisIsEmpty();
       
   126     
       
   127 // from base class MFileMonitorObserver
       
   128     /**
       
   129      * from MFileMonitorObserver
       
   130      * Handle a file system change notification
       
   131      *
       
   132      */
       
   133     void HandleFileRemovedL();
       
   134        
       
   135 // from base class MApplicationMonitorObserver
       
   136     /**
       
   137      * from MApplicationMonitorObserver
       
   138      * Handle an application close event.
       
   139      */
       
   140     void HandleApplicationClosedL(TExitType aReason);
       
   141     
       
   142 //from base class MMPXCollectionObserver  
       
   143     /** 
       
   144      *  Handle collection message
       
   145      * 
       
   146      *  @param aMsg collection message, ownership not transferred. 
       
   147      *         Please check aMsg is not NULL before using it. 
       
   148      *         If aErr is not KErrNone, plugin might still call back with more
       
   149      *         info in the aMsg.
       
   150      *  @param aErr system error code.
       
   151      */
       
   152     void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
       
   153 
       
   154     /**
       
   155      *  Handles the collection entries being opened. Typically called
       
   156      *  when client has Open()'d a folder.
       
   157      *
       
   158      *  @since S60 3.2.3
       
   159      *  @param aEntries collection entries opened
       
   160      *  @param aIndex focused entry
       
   161      *  @param aComplete ETrue no more entries. EFalse more entries
       
   162      *                   expected
       
   163      *  @param aError error code   
       
   164      */
       
   165     void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete,
       
   166             TInt aError );
       
   167 
       
   168     /**
       
   169      *  Handles the item being opened. Typically called
       
   170      *  when client has Open()'d an item. Client typically responds by
       
   171      *  'playing' the item via the playlist.
       
   172      *
       
   173      *  @since S60 3.2.3
       
   174      *  @param aPlaylist collection playlist
       
   175      *  @param aError error code
       
   176      */
       
   177     void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
       
   178 
       
   179     /**
       
   180      * From MMPXCollectionMediaObserver 
       
   181      * It handles MediaL event.
       
   182      *
       
   183      * @param aMedia object containing collection's informations
       
   184      * @param aError error code
       
   185      */
       
   186     void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
       
   187 
       
   188     /**
       
   189      * from MPNSMonitorObserver
       
   190      * Handle launching music player on the background.
       
   191      */
       
   192     void OpeningMusicPlayer();
       
   193 
       
   194 private:
       
   195 
       
   196     /**
       
   197      * Standard C++ constructor.
       
   198      */
       
   199     CMCPMusicPlayer( MMCPPluginObserver* aObserver );
       
   200 
       
   201     /**
       
   202      * Standard Symbian 2nd phase constructor.
       
   203      */
       
   204     void ConstructL();
       
   205 
       
   206     /**
       
   207      * returns ETrue if data can be propagated to the Music Content Publisher.
       
   208      */
       
   209     TBool IsOKToPublishData();
       
   210      
       
   211     /**
       
   212      * Installs Playback command action, the puppose of this is to improve
       
   213      * readability.
       
   214      */
       
   215     void InstallPlaybackCommandActionL( TMPXPlaybackCommand aCmd,
       
   216             TMCPTriggerDestination aDestination );
       
   217     /**
       
   218      * Installs Launch Music Player action, the puppose of this is to improve
       
   219      * readability.
       
   220      */
       
   221     void InstallLaunchMusicPlayerL( TMCPTriggerDestination aDestination );
       
   222     
       
   223     /**
       
   224      * Installs Go To Now playing action, the puppose of this is to improve
       
   225      * readability.
       
   226      */
       
   227     void InstallGoToNowPlayingL( TMCPTriggerDestination aDestination );
       
   228         
       
   229     /**
       
   230      * Installs Go To Last Played action, the puppose of this is to improve
       
   231      * readability.
       
   232      */
       
   233     void InstallGoToLastPlayedL( TMCPTriggerDestination aDestination ); 
       
   234    
       
   235     /**
       
   236      * Installs an action, mainly for readability purposes.
       
   237      *
       
   238      * @since S60 5.0
       
   239      * @param aDestination Destination trigger that should launch the action.
       
   240      */
       
   241     void InstallGoToMusicL(TMCPTriggerDestination aDestination);
       
   242     
       
   243     /**
       
   244      * Installs an action, mainly for readability purposes.
       
   245      *
       
   246      * @since S60 5.0
       
   247      * @param aDestination Destination trigger that should launch the action.
       
   248      */
       
   249     void InstallGoToAlbumL(TMCPTriggerDestination aDestination);
       
   250     
       
   251     /**
       
   252      * Installs an empty action, mainly for readability purposes.
       
   253      *
       
   254      * @since S60 5.0
       
   255      * @param aDestination Destination trigger that should launch the action.
       
   256      */
       
   257     void InstallEmptyActionL(TMCPTriggerDestination aDestination);
       
   258     
       
   259     /**
       
   260      * Installs actions and icons in the toolbar.
       
   261      *
       
   262      * @since S60 5.0
       
   263      */
       
   264     void UpdateToolBarL(TUint aToolBarState);
       
   265     
       
   266     /**
       
   267      * Resets the widget an Music Suite.
       
   268      *
       
   269      * @since S60 5.0
       
   270      */
       
   271     void ResetL();
       
   272 
       
   273     /**
       
   274      * Get a heap descriptor from the resource file
       
   275      *
       
   276      * @since S60 5.0
       
   277      */
       
   278     void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
       
   279             TInt aResourceId);
       
   280     
       
   281     
       
   282     /**
       
   283      * @since S60 5.0
       
   284      */
       
   285     void ActivateL();
       
   286     void DoUpdatePlayerStateL(TMPlayerState aState);
       
   287     void DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist);
       
   288     void DoUpdatePlaybackPositionL(TInt aPosition);
       
   289     void DoUpdateAlbumArtL( CFbsBitmap* aBitmap );
       
   290     void DoHandleOpeningL();
       
   291     void DoHandlePlaylisIsEmptyL();
       
   292     void DoHandleSkinChangedL();
       
   293     
       
   294     /**
       
   295      * Logic of HandleCollectionMessageL, to avoid the function leaves
       
   296      * 
       
   297      * @param aMsg collection message
       
   298      */
       
   299     void HandleCollectionMessageL( CMPXMessage* aMsg );
       
   300 
       
   301     /**
       
   302      * Logic of HandleCollectionMessage, to avoid the function leaves
       
   303      * 
       
   304      * @param aMsg collection message
       
   305      */
       
   306     void DoHandleGeneralMessageL( const CMPXMessage& aMsg );
       
   307        
       
   308     /**
       
   309     *  Music Player opening timer callback
       
   310     *
       
   311     *  @param aPtr pointer the this
       
   312     */
       
   313     static TInt MusicPlayerOpeningTimerCallback( TAny* aPtr );
       
   314 
       
   315 private: // data
       
   316 
       
   317     /**
       
   318      * Instance of MCP plugin observer
       
   319      * Not owned.
       
   320      */
       
   321     MMCPPluginObserver* iMHObserver;
       
   322     
       
   323     /**
       
   324      * Instance of CAiPlayerPluginEngine used to observe Music player via 
       
   325      * MAiPlayerPluginEngineObserver.
       
   326      * Owned.
       
   327      */
       
   328     CAiPlayerPluginEngine* iEngine;
       
   329     
       
   330     /**
       
   331      * State indicator, the plugin can be active or inactive. 
       
   332      */
       
   333     TBool iActive;
       
   334     
       
   335     /**
       
   336      * art cached indicator. 
       
   337      */
       
   338     TBool iArtCached;
       
   339     
       
   340     /**
       
   341      * Used to monitor last played song. 
       
   342      */
       
   343     CFileMonitor* iFileMonitor;
       
   344 
       
   345     /**
       
   346      * Used to monitor if music player closes. 
       
   347      */
       
   348     CApplicationMonitor* iAppMonitor;
       
   349     
       
   350     /**
       
   351      * Used to monitor publish and subscribe property. 
       
   352      */
       
   353     CPNSMonitor* iPNSMonitor;
       
   354 
       
   355     /**
       
   356      * Current Album Art. 
       
   357      */
       
   358     CFbsBitmap* iArtBitmap;
       
   359     
       
   360     /**
       
   361      * The art that was extracted but not used due to the current stateof
       
   362      * the plugin (acctive, not active) 
       
   363      */
       
   364     CFbsBitmap* iCachedArtBitmap;
       
   365     
       
   366     /**
       
   367      * Album Art mask. 
       
   368      */
       
   369     CFbsBitmap* iArtBitmapMask;
       
   370     
       
   371     /**
       
   372      * Current Toolbar State.
       
   373      */  
       
   374     TUint iToolBarState;
       
   375     
       
   376     /**
       
   377     * Buffers for the localized strings
       
   378     */
       
   379     HBufC* iGoToMusicBuffer;
       
   380     HBufC* iOpeningBuffer;
       
   381     
       
   382     /**
       
   383      * Flag of Mass Storage mode or MTP mode
       
   384      */
       
   385     TBool iBlockingOperationOngoing;
       
   386    
       
   387     /**
       
   388      * collection utility
       
   389      */
       
   390     MMPXCollectionUtility* iCollectionUtility;
       
   391 
       
   392     /**
       
   393      * harvester utility
       
   394      */
       
   395     MMPXHarvesterUtility* iHarvester;
       
   396     
       
   397     CPeriodic* iMusicPlayerOpeningTimer;
       
   398     };
       
   399 
       
   400 #endif // C_MCPMUSICPLAYER_H
       
   401 
       
   402 //  End of File