videocollection/mpxmyvideoscollection/inc/vcxmyvideosactivetask.h
changeset 0 96612d01cf9f
child 15 cf5481c2bc0b
child 26 67eb01668b0e
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:   Active object to split up long running tasks*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef VCXMYVIDEOSACTIVETASK_H
       
    20 #define VCXMYVIDEOSACTIVETASK_H
       
    21 
       
    22 #include <mpxcommand.h>
       
    23 #include <mpxmessage2.h>
       
    24 
       
    25 /**
       
    26 * Observer class to the active task object
       
    27 */
       
    28 NONSHARABLE_CLASS( MVcxMyVideosActiveTaskObserver )
       
    29     {
       
    30 public:
       
    31     /**
       
    32     * Handle the execution of a step
       
    33     * @return ETrue if complete, EFalse if more to do
       
    34     */
       
    35     virtual TBool HandleStepL() = 0;
       
    36     /**
       
    37     * Handle the completion of the operation
       
    38     */
       
    39     virtual void HandleOperationCompleted( TInt aErr ) = 0;
       
    40     };
       
    41 
       
    42 /**
       
    43  *  Active object to execute tasks in multiple steps.
       
    44  *  Each collection plugin has its own task queue, which serializes all
       
    45  *  operations for a plugin.
       
    46  */
       
    47 NONSHARABLE_CLASS( CVcxMyVideosActiveTask ) : public CActive
       
    48     {
       
    49 public:
       
    50     /**
       
    51     * Two-phased constructor
       
    52     */
       
    53     static CVcxMyVideosActiveTask* NewL( MVcxMyVideosActiveTaskObserver& aObserver );
       
    54 
       
    55     /**
       
    56     * Destructor
       
    57     */
       
    58     virtual ~CVcxMyVideosActiveTask();
       
    59 
       
    60 public:    // Accessor functions
       
    61 
       
    62     /**
       
    63     * Start the async command task
       
    64     * @param aTask task id
       
    65     * @param aCommand command for the operation
       
    66     */
       
    67     void StartL( TMPXCommandId aTask, const CMPXCommand& aCommand );
       
    68 
       
    69     /**
       
    70     * Get the current step for the current task
       
    71     * @return the current step
       
    72     */
       
    73     TInt GetStep();
       
    74 
       
    75     /*
       
    76     * Get the command for the current task
       
    77     * @return the current task
       
    78     */
       
    79     TMPXCommandId GetTask();
       
    80 
       
    81     /**
       
    82     * Get the command for the current task
       
    83     * @return the current command
       
    84     */
       
    85     CMPXCommand& GetCommand();
       
    86 
       
    87 
       
    88 protected: // From base class
       
    89 
       
    90     /**
       
    91     * From CActive
       
    92     */
       
    93     void RunL();
       
    94 
       
    95     /**
       
    96     * From CActive
       
    97     */
       
    98     void DoCancel();
       
    99 
       
   100     /**
       
   101     * From CActive
       
   102     */
       
   103     TInt RunError( TInt aError );
       
   104 
       
   105 private:
       
   106 
       
   107     /**
       
   108     * Default Constructor
       
   109     */
       
   110     CVcxMyVideosActiveTask(MVcxMyVideosActiveTaskObserver& aObserver);
       
   111 
       
   112     /**
       
   113     * 2nd-phase Constructor
       
   114     */
       
   115     void ConstructL();
       
   116 
       
   117 private: // data
       
   118 
       
   119     CMPXCommand*  iCurCommand;  // Current Command
       
   120     TMPXCommandId iCurTask;  // The task command id
       
   121     TInt          iCurStep;  // The n-th stop in the operation
       
   122     MVcxMyVideosActiveTaskObserver& iObserver; // Observer
       
   123     };
       
   124 
       
   125 #endif // VCXMYVIDEOSACTIVETASK_H