upnpframework/upnpaiwengine/inc/upnpdrmfilter.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     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 file for the CUpnpDrmFilter class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_UPNPDRMFILTER_H
       
    20 #define C_UPNPDRMFILTER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 #include <e32cmn.h>
       
    25 #include <AknWaitNoteWrapper.h> 
       
    26 
       
    27 
       
    28 /**
       
    29  *  Class for filtering Drm files out from a list of files. 
       
    30  *  @since S60 3.2
       
    31  *  @lib upnpaiwengine.dll
       
    32  */
       
    33 class CUpnpDrmFilter  : public CActive,
       
    34                         public MAknBackgroundProcess
       
    35     {
       
    36     
       
    37 public:
       
    38 
       
    39     /** state for filtering DRM */
       
    40     enum TDrmFilterState
       
    41         {
       
    42         EIdle = 1,
       
    43         EFilter,
       
    44         EFilterComplete,
       
    45         EFilterStop
       
    46         };
       
    47      
       
    48     /**
       
    49      * Two-Phased Constructor
       
    50      * @param aFiles (RPointerArray<TDesC>&) Reference to an array of
       
    51      *        TDesC objects containing the list of file names. 
       
    52      * @param aDRMProtectedFiles (RPointerArray<TDesC>&) Reference to an
       
    53      *        empty array of TDesC objects, the method will append DRM
       
    54      *        protected files on this list.
       
    55      * @return new instance of CUpnpDrmFilter
       
    56      */
       
    57     IMPORT_C static CUpnpDrmFilter* NewL( RPointerArray<TDesC>& aFiles,
       
    58             RPointerArray<TDesC>& aDRMProtectedFiles );
       
    59 
       
    60     /**
       
    61      * Constructor
       
    62      * @param aFiles (RPointerArray<TDesC>&) Reference to an array of
       
    63      *        TDesC objects containing the list of file names. 
       
    64      * @param aDRMProtectedFiles (RPointerArray<TDesC>&) Reference to an
       
    65      *        empty array of TDesC objects, the method will append DRM
       
    66      *        protected files on this list.
       
    67      */
       
    68      CUpnpDrmFilter( RPointerArray<TDesC>& aFiles,
       
    69                      RPointerArray<TDesC>& aDRMProtectedFiles );
       
    70     /**
       
    71      * Virtual Destructor
       
    72      */
       
    73     virtual ~CUpnpDrmFilter();
       
    74     
       
    75     /**
       
    76      * Start filter music files.
       
    77      */
       
    78     IMPORT_C void FilterDrmL();
       
    79         
       
    80 private:
       
    81       
       
    82     /**
       
    83      * 2nd phase constructor
       
    84      */
       
    85     void ConstructL();
       
    86 
       
    87     /** 
       
    88      * Filter 20 files every time 
       
    89      */
       
    90     void Filter();
       
    91     
       
    92     /**
       
    93      *  From CActive
       
    94      *  Handles an active object's request completion event.
       
    95      */
       
    96     void RunL();
       
    97     
       
    98     /**
       
    99      *  From CActive
       
   100      *  Handles an active error.
       
   101      */    
       
   102     void RunError();
       
   103 
       
   104     /**
       
   105      * From CActive
       
   106      * Implements cancellation of an outstanding request.
       
   107      */
       
   108    void DoCancel();
       
   109 
       
   110     /**
       
   111      * Performs incremental filter operation.
       
   112      */
       
   113     void DoTaskStep();
       
   114 
       
   115     /**
       
   116      * End filter operation.
       
   117      */
       
   118     void Complete();    
       
   119 
       
   120     /**
       
   121      * Completes one cycle of the process.
       
   122      * From MProgressDialogCallback.
       
   123      */
       
   124     void StepL(); 
       
   125 
       
   126     /**
       
   127      * Return true when the process is done. 
       
   128      * From MProgressDialogCallback.
       
   129      */
       
   130     TBool IsProcessDone() const;    
       
   131  
       
   132     /**
       
   133      * Show the wait note when filtering files.
       
   134      */
       
   135     void ShowWaitNoteL();
       
   136      
       
   137 
       
   138 private: // data 
       
   139 
       
   140     /**
       
   141      * Reference to an array of TDesC objects containing 
       
   142      * the list of file names.
       
   143      */
       
   144     RPointerArray<TDesC>&     iFiles;               //Not own
       
   145     
       
   146    /**
       
   147     * Reference to an empty array of TDesC objects used to append DRM
       
   148     * protected files on this list.
       
   149     */
       
   150     RPointerArray<TDesC>&     iDRMProtectedFiles;   //Not own   
       
   151 
       
   152     
       
   153     /**
       
   154      * The state of current operation.
       
   155      */
       
   156     TDrmFilterState           iState;
       
   157     
       
   158     /**
       
   159      * The next start point to filter DRM file from iFiles array
       
   160      */
       
   161     TInt                      iStartPoint; 
       
   162     
       
   163     /**
       
   164      * The latest point has been filter 
       
   165      */
       
   166     TInt                      iCurrentPoint;
       
   167 
       
   168     /**
       
   169      * The total number of file need to filter.
       
   170      */
       
   171     TInt                      iTotalNum; 
       
   172     
       
   173     /**
       
   174      * Used to append the DRM file index in iFile array.
       
   175      */
       
   176     RArray<TInt>              iRemovedIndexArray;  
       
   177     
       
   178     /**
       
   179      * The total number of filtered files.
       
   180      */
       
   181     TInt                      iFilteredCount;
       
   182     
       
   183     /**
       
   184      * The total number of abnormal files except DRM files.
       
   185      */
       
   186     TInt                      iAbnormalFileCount;
       
   187     
       
   188     };
       
   189 
       
   190 #endif // C_UPNPDRMFILTER_H