mpxplugins/serviceplugins/playbackplugins/progressdownload/inc/mpxprogressdownload.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:  This class manages progress download
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXPROGRESSDOWNLOAD_H
       
    21 #define CMPXPROGRESSDOWNLOAD_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <ProgressiveDownloadUtility.h>
       
    25 #include <MAudioPdPlayUtility.h>
       
    26 #include <mpxplaybackplugin.h>
       
    27 #include <mpxcenrepobserver.h>
       
    28 #include <mpxplaybackcommanddefs.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CMPXDrmMediaUtility;
       
    32 class CMPXCenRepWatcher;
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  CMPXProgressDownload class
       
    40 *
       
    41 *  Plug-in basically handles download via S60's progress download utility.
       
    42 *  @lib LocalAudioPlayback.lib
       
    43 */
       
    44 NONSHARABLE_CLASS(CMPXProgressDownload) : public CMPXPlaybackPlugin,
       
    45                                           public MAudioPdPlayUtilityCallback,
       
    46                                           public MMPXCenRepObserver
       
    47     {
       
    48     private:
       
    49         enum TMPXLocalAudioPlaybackState
       
    50             {
       
    51             EStateNotInitialised,
       
    52             EStateInitialising,
       
    53             EStateInitialised
       
    54             };
       
    55     public: // Constructors and destructor
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         * @param aInitParams, initialization parameter
       
    59         * @return a pointer to the created instance
       
    60         */
       
    61         static CMPXProgressDownload* NewL(TAny* aInitParams);
       
    62 
       
    63         /**
       
    64         * Destructor
       
    65         * Destroy the object and release all memory objects
       
    66         */
       
    67         ~CMPXProgressDownload();
       
    68 
       
    69     private: // Functions from base classes
       
    70         /**
       
    71         *  from CMPXPlaybackPlugin
       
    72         */
       
    73 
       
    74         /**
       
    75         * Initializes a song for playback
       
    76         * @param aSong the song path
       
    77         */
       
    78         void InitialiseL(const TDesC& aSong);
       
    79 
       
    80         /**
       
    81         * Initializes a song for playback
       
    82         * @param aFile file handle of a song
       
    83         */
       
    84         void InitialiseL(RFile& aFile);
       
    85 
       
    86         /**
       
    87         * Executes a command on the selected song
       
    88         * @param aCmd a command
       
    89         * @param aData data (optional)
       
    90         */
       
    91         void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
       
    92 
       
    93         /**
       
    94         * Executes a command
       
    95         * @param aCmd Command
       
    96         */
       
    97         void CommandL(CMPXCommand& aCmd);
       
    98 
       
    99         /**
       
   100         * Sets a property of the plugin
       
   101         * @param aProperty a property
       
   102         * @param aValue the value of the setting
       
   103         */
       
   104         void SetL(TMPXPlaybackProperty aProperty,TInt aValue);
       
   105 
       
   106         /**
       
   107         * Gets a property of the plugin (async)
       
   108         * @param aProperty a property
       
   109         */
       
   110         void PropertyL(TMPXPlaybackProperty aProperty) const;
       
   111 
       
   112         /**
       
   113         * Gets a list of sub players
       
   114         * @return a list of names of sub players
       
   115         */
       
   116         void SubPlayerNamesL();
       
   117 
       
   118         /**
       
   119         * Select a sub player
       
   120         * @param aIndex index to the sub player
       
   121         */
       
   122     	void SelectSubPlayerL(TInt aIndex);
       
   123 
       
   124         /**
       
   125         * Returns current sub player name
       
   126         * @return friendly name of the current the sub player
       
   127         */
       
   128         const TDesC& SubPlayerName();
       
   129 
       
   130         /**
       
   131         * Current sub player index
       
   132         * @return index to the sub player
       
   133         */
       
   134         TInt SubPlayerIndex() const;
       
   135 
       
   136         /**
       
   137         * Media properties of the current file (async)
       
   138         * @param aAttrs attributes requested
       
   139         */
       
   140         void MediaL(const TArray<TMPXAttribute>& aAttrs);
       
   141 
       
   142         /**
       
   143         * Cancel async request
       
   144         */
       
   145         void CancelRequest();
       
   146 
       
   147         /**
       
   148         *  From MMdaAudioPlayerCallback which is the base class of
       
   149         *  MAudioPdPlayUtilityCallback
       
   150         */
       
   151         void MapcInitComplete(TInt aError,
       
   152                               const TTimeIntervalMicroSeconds& aDuration);
       
   153 
       
   154         /**
       
   155         *  From MMdaAudioPlayerCallback which is the base class of
       
   156         *  MAudioPdPlayUtilityCallback
       
   157         */
       
   158         void MapcPlayComplete(TInt aError);
       
   159 
       
   160         /**
       
   161         * MProgressiveDownloadUtilityCallback which is the base class of
       
   162         * MAudioPdPlayUtilityCallback
       
   163         */
       
   164         void Paused();
       
   165 
       
   166         /**
       
   167         * MProgressiveDownloadUtilityCallback which is the base class of
       
   168         * MAudioPdPlayUtilityCallback
       
   169         */
       
   170         void Playing();
       
   171 
       
   172         /**
       
   173         * MAudioPdPlayUtilityCallback
       
   174         */
       
   175         void HandleDownloadEventL(TUint aTransactionID,
       
   176                                   TBrCtlDownloadEvent aEvent,
       
   177                                   TUint aValue);
       
   178 
       
   179         /**
       
   180         * From MMPXCenRepObserver
       
   181         * Handle a change in a setting value.
       
   182         *
       
   183         * @param aRepositoryUid Central repository UID containing the setting
       
   184         * @param aSettingId Id of the setting
       
   185         * @since 3.0
       
   186         */
       
   187         void HandleSettingChange( const TUid& aRepositoryUid,
       
   188                                   TUint32 aSettingId);
       
   189 
       
   190     private:
       
   191        /**
       
   192         * C++ default constructor
       
   193         */
       
   194         CMPXProgressDownload();
       
   195 
       
   196         /**
       
   197         * the second phase constructor ConstructL to safely construct things
       
   198         * that can leave
       
   199         */
       
   200         void ConstructL();
       
   201 
       
   202         /**
       
   203         * Sets the volume level in audio controller
       
   204         * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax
       
   205         */
       
   206         void SetVolume( TInt aVolume );
       
   207 
       
   208         /**
       
   209         * Sets the volume level in audio controller to mute.
       
   210         * @param aMute ETrue to indicated mute
       
   211         */
       
   212         void SetMute( TBool aMute );
       
   213 
       
   214         /**
       
   215         *  Consumes the rights for the current media according
       
   216         *  to the specified consume type
       
   217         *
       
   218         *  @param aType Type of consumption to execute
       
   219         */
       
   220         void ConsumeRightsL(ContentAccess::TIntent aIntent);
       
   221 
       
   222     private: // Data
       
   223         CMPXCenRepWatcher* iVolumeWatcher;
       
   224         CMPXCenRepWatcher* iMuteWatcher;
       
   225         CProgressiveDownloadUtility* iPdUtil; // owned
       
   226         MAudioPdPlayUtility* iPdPlayer; // owned
       
   227         HBufC* iPdPath;
       
   228         TUint iTransactionId;
       
   229         TInt iVolume;
       
   230         TInt iFeatureFlag;
       
   231         CMPXDrmMediaUtility* iDrmMediaUtility;
       
   232         TMPXPlaybackPdDownloadState iDownloadState;
       
   233         TInt iDownloadBytes;
       
   234         TInt iDownloadSize;
       
   235         TMPXLocalAudioPlaybackState iState;
       
   236         TBool iConsumeStarted;
       
   237     };
       
   238 
       
   239 #endif      // CMPXPROGRESSDOWNLOAD_H
       
   240 
       
   241