ncdengine/inc/ncddownloadoperation.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   Download operation interface definition
       
    15 *
       
    16 */
       
    17 	
       
    18 
       
    19 #ifndef M_NCD_DOWNLOAD_OPERATION_H
       
    20 #define M_NCD_DOWNLOAD_OPERATION_H
       
    21 
       
    22 #include <e32cmn.h>
       
    23 
       
    24 #include "ncdoperation.h"
       
    25 #include "ncdinterfaceids.h"
       
    26 #include "ncdoperationdatatypes.h"
       
    27 
       
    28 class MNcdDownloadOperationObserver;
       
    29 
       
    30 /**
       
    31  *  Download operation interface.
       
    32  *
       
    33  *  A download operation handles the downloading of one or more files.
       
    34  *
       
    35  *  The files are downloaded consecutively and in a predefined order.
       
    36  *  If parallel downloading is desired, multiple operations can be started.
       
    37  *
       
    38  *  Common uses for download operatios are downloading a downloadable node's 
       
    39  *  content and downloading graphics for nodes.
       
    40  *
       
    41  *  Download operations can be queried for the number of the download that is 
       
    42  *  currently being downloaded. The progress information is always relative
       
    43  *  to the current download.
       
    44  *  
       
    45  *  
       
    46  *  @see MNcdDownloadOperationObserver
       
    47  *  @see MNcdNodeDownload
       
    48  */
       
    49 class MNcdDownloadOperation : public MNcdOperation
       
    50     {
       
    51     
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Unique identifier for the interface, required for all MCatalogsBase interfaces.
       
    56      *
       
    57      * 
       
    58      */
       
    59     enum { KInterfaceUid = ENcdDownloadOperationUid };    
       
    60     
       
    61 
       
    62     /**
       
    63      * Getter for file count. This is the total number of files this operation
       
    64      * is downloading.
       
    65      *
       
    66      * 
       
    67      * @return Total number of files to be downloaded.
       
    68      */
       
    69     virtual TInt FileCount() = 0;
       
    70     
       
    71 
       
    72     /**
       
    73      * Getter for current file number. This is the number of the
       
    74      * file that is currently being downloaded.
       
    75      *
       
    76      * 
       
    77      * @return Number of the file currently being downloaded.
       
    78      */
       
    79     virtual TInt CurrentFile() = 0;
       
    80     
       
    81 
       
    82     /**
       
    83      * Pause the download.
       
    84      *
       
    85      * @note Does nothing if the download was already paused, or if the
       
    86      *  operation is not yet started.
       
    87      *
       
    88      * 
       
    89      * @exception Leave System wide error code.
       
    90      */
       
    91     virtual void PauseL() = 0;
       
    92 
       
    93 
       
    94     /**
       
    95      * Resume a paused download.
       
    96      *
       
    97      * @note Does nothing if the download has not been paused, or if the
       
    98      *  operation is not yet started.
       
    99      *
       
   100      * 
       
   101      * @exception Leave System wide error code.
       
   102      */
       
   103     virtual void ResumeL() = 0;
       
   104 
       
   105 
       
   106     /**
       
   107      * Return the paused state of the download.
       
   108      *
       
   109      * 
       
   110      * @return ETrue, if the operation has been started and PauseL() has
       
   111      *  been called successfully, pausing the download. EFalse otherwise.
       
   112      */
       
   113     virtual TBool IsPaused() = 0;
       
   114     
       
   115     
       
   116     /**
       
   117      * Can download be paused
       
   118      *
       
   119      * @return ETrue if the operation can be paused, EFalse if pausing is not
       
   120      * allowed
       
   121      * @leave Symbian error code
       
   122      * @note Some DRM content is not pausable
       
   123      * @note Pausable state may change during the operation
       
   124      */
       
   125     virtual TBool IsPausableL() = 0;
       
   126 
       
   127     /**
       
   128      * Add a new observer for this download operation.
       
   129      *
       
   130      * If the observer has already been added, this function doesn't do anything.
       
   131      *
       
   132      * 
       
   133      * @exception Leave System wide error code.
       
   134      */
       
   135     virtual void AddObserverL( MNcdDownloadOperationObserver& aObserver ) = 0;
       
   136 
       
   137     /**
       
   138      * Remove an observer previously added with AddObserverL().
       
   139      *
       
   140      * @return ETrue if an observer was removed
       
   141      * 
       
   142      */
       
   143     virtual TBool RemoveObserver( MNcdDownloadOperationObserver& aObserver ) = 0;
       
   144 
       
   145 
       
   146     /**
       
   147      * Download data type getter
       
   148      *
       
   149      * @return Type of the data the operation is downloading
       
   150      * @see ncdoperationdatatypes.h
       
   151      */
       
   152     virtual TNcdDownloadDataType DownloadDataType() const = 0;
       
   153 
       
   154 protected:
       
   155 
       
   156     /**
       
   157     * Destructor.
       
   158     *
       
   159     * @see MCatalogsBase::~MCatalogsBase
       
   160     */
       
   161     virtual ~MNcdDownloadOperation() {}
       
   162 
       
   163     };
       
   164 	
       
   165 	
       
   166 #endif //  M_NCD_DOWNLOAD_OPERATION_H