videoplayback/videohelix/inc/mpxvideodlmgrif.h
changeset 0 96612d01cf9f
child 16 67eb01668b0e
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 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:  Header of CMPXVideoDownloadMgrInterface class.
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 9 %
       
    19 
       
    20 
       
    21 #ifndef __MPXVIDEODLMGRIF_H__
       
    22 #define __MPXVIDEODLMGRIF_H__
       
    23 
       
    24 #include <downloadmgrclientapiext.h>
       
    25 #include <mpxplaybackcommanddefs.h>
       
    26 
       
    27 //
       
    28 //  Forward Declaration
       
    29 //
       
    30 class CMPXVideoPlaybackController;
       
    31 
       
    32 /*
       
    33  *  CMPXVideoDlMgrIf
       
    34  *
       
    35  *  This class is the interface between the Media Player engine and
       
    36  *  the Download Manager
       
    37  *
       
    38  *  @lib mpengine.lib
       
    39  *  @since S60 3.2
       
    40  */
       
    41 class CMPXVideoDlMgrIf : public CBase,
       
    42                          public MHttpDownloadMgrObserver
       
    43 {
       
    44     public:
       
    45 
       
    46         /*
       
    47          *  NewL
       
    48          *
       
    49          *  Symbian 2 phase constructor
       
    50          *
       
    51          *  @since S60 3.2
       
    52          *  @param aEngine   reference to the Video Playback Controller
       
    53          *  @return reference to the class
       
    54          */
       
    55         static CMPXVideoDlMgrIf* NewL( CMPXVideoPlaybackController* aController );
       
    56 
       
    57         /*
       
    58          *  ~CMPDownloadMgrInterface
       
    59          *
       
    60          *  destructor
       
    61          *
       
    62          *  @since S60 3.2
       
    63          */
       
    64         virtual ~CMPXVideoDlMgrIf();
       
    65 
       
    66         /*
       
    67          *  ConnectToDownloadL
       
    68          *
       
    69          *  Connect to the Download Manager and attach to the download
       
    70          *
       
    71          *  @since S60 3.2
       
    72          *  @param aCmd        command with download information
       
    73          *  @return            error code
       
    74          */
       
    75         void ConnectToDownloadL( CMPXCommand& aCmd );
       
    76 
       
    77         /*
       
    78          *  ~CMPDownloadMgrInterface
       
    79          *
       
    80          *  MHttpDownloadMgrObserver Callback method
       
    81          *
       
    82          *  @since S60 3.2
       
    83          *  @param aDownload   reference to download
       
    84          *  @param aEvent      current state and event
       
    85          */
       
    86         void HandleDMgrEventL( RHttpDownload& aDownload,
       
    87                                THttpDownloadEvent aEvent );
       
    88 
       
    89         /*
       
    90          *  DoHandleOpenComplete
       
    91          *
       
    92          *  Performs the commands associated with the player being opened.
       
    93          *  It sets the current download id on the playback engine.
       
    94          *  Updates the current download size also.
       
    95          *
       
    96          *  @since S60 3.2
       
    97          */
       
    98         void DoHandleOpenComplete();
       
    99 
       
   100         /*
       
   101          *  GetPdlStatusL
       
   102          *
       
   103          *  Retrieves the status of the download.
       
   104          *
       
   105          *  @param   aCmd   Commands where the status will be written
       
   106          *
       
   107          *  @since 9.2 Timebox
       
   108          */
       
   109         void GetPdlStatusL( CMPXCommand& aCmd );
       
   110 
       
   111         /*
       
   112          *  HandleClose
       
   113          *
       
   114          *  Handles closing the Download Manager Interface
       
   115          *
       
   116          *  @since S60 3.2
       
   117          */
       
   118         void HandleClose();
       
   119 
       
   120         /*
       
   121          *  GetDownloadRatio
       
   122          *
       
   123          *  Retrieves the download ratio
       
   124          *
       
   125          *  @since S60 3.2
       
   126          */
       
   127         TReal GetDownloadRatio();
       
   128 
       
   129         /*
       
   130          *  IsDownloadPaused
       
   131          *
       
   132          *  Determines if the download is paused
       
   133          *
       
   134          *  @since S60 3.2
       
   135          */
       
   136         TBool IsDownloadPaused();
       
   137 
       
   138     private:
       
   139         /*
       
   140          *  CMPDownloadMgrInterface
       
   141          *  Constructor
       
   142          *  @since S60 3.2
       
   143          *
       
   144          */
       
   145         CMPXVideoDlMgrIf();
       
   146 
       
   147         /*
       
   148          *  ConstructL
       
   149          *  Symbian 2nd phase Constructor
       
   150          *  @since S60 3.2
       
   151          *
       
   152          */
       
   153         void ConstructL( CMPXVideoPlaybackController* aController );
       
   154 
       
   155         /*
       
   156          *  DoUpdateDownloadProgress
       
   157          *
       
   158          *  Updates the prog. download listener and playback engine with
       
   159          *  the current download size
       
   160          *
       
   161          *  @since S60 3.2
       
   162          */
       
   163         void DoUpdateDownloadProgress();
       
   164 
       
   165         /*
       
   166          *  HandleCustomCommand
       
   167          *
       
   168          *  Sends custom commands to the playback engine
       
   169          *
       
   170          *  @since S60 3.2
       
   171          *  @param   aCommand   custom command to send
       
   172          *  @param   aCmdValue  parameter for custom command
       
   173          *  @return  error code
       
   174          */
       
   175         TInt HandleCustomCommand( TUint32 aCommand, TUint32 aCmdValue );
       
   176 
       
   177         /*
       
   178          *  UpdateListenerWithState
       
   179          *
       
   180          *  Gets the current state of the download and updates the
       
   181          *  listener and member variables
       
   182          *
       
   183          *  @since S60 3.2
       
   184          *
       
   185          */
       
   186         void UpdateListenerWithState();
       
   187 
       
   188         /*
       
   189          *  CheckForMoveError
       
   190          *
       
   191          *  Gets the error status from the Download Manager after the
       
   192          *  move is complete
       
   193          *
       
   194          *  @since S60 3.2
       
   195          *
       
   196          */
       
   197         void CheckForMoveError();
       
   198 
       
   199         /*
       
   200          *  HandleDownloadComplete
       
   201          *
       
   202          *  Performs the logic for a completed download
       
   203          *
       
   204          *  @since S60 3.2
       
   205          *
       
   206          */
       
   207          void HandleDownloadComplete();
       
   208 
       
   209         /*
       
   210          *  UpdateDownloadProgress
       
   211          *
       
   212          *  Called by CIdle iUpdateDownload to update the download size
       
   213          *  @since 3.2
       
   214          *  @param aPtr Pointer to callback class
       
   215          *  @return KErrNone
       
   216          */
       
   217         static TInt UpdateDownloadProgress( TAny* aPtr );
       
   218 
       
   219         void CalculateDestinationFileNameL();
       
   220 
       
   221         void ConvertDMgrStatetoMpxState( TInt32 dmgrState );
       
   222 
       
   223         void UpdateDownloadSizeL();
       
   224 
       
   225         //
       
   226         //  Private Members
       
   227         //  Not Owned Data
       
   228         //
       
   229         RHttpDownloadMgrApiExt        iDlMgr;
       
   230         RHttpDownload*                iCurrentDl;
       
   231         CMPXVideoPlaybackController*  iController;
       
   232 
       
   233         HBufC*                        iClipName;
       
   234         TFileName                     iDestinationFileName;
       
   235         TInt                          iDlId;
       
   236         TInt32                        iDownloadProgress;
       
   237         TMPXPlaybackPdDownloadState   iDownloadState;
       
   238         TInt32                        iDlTotalSize;
       
   239         TBool                         iDlMgrConnected;
       
   240         TBool                         iMoveNeeded;
       
   241         TBool                         iMovePdlFile;
       
   242         TBool                         iPlayerOpened;
       
   243         TBool                         iCodDownload;
       
   244 
       
   245         //
       
   246         //  Private Members
       
   247         //  Owned Data
       
   248         //
       
   249         CIdle*                        iUpdateDownload;
       
   250 };
       
   251 
       
   252 #endif __MPXVIDEODLMGRIF_H__
       
   253 
       
   254 // End of file