imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailtask.h
changeset 0 2014ca87e772
child 5 82749d516180
equal deleted inserted replaced
-1:000000000000 0:2014ca87e772
       
     1 /*
       
     2 * Copyright (c) 2006-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 "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:  Base class for thumbnail server tasks
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef THUMBNAILTASK_H
       
    20 #define THUMBNAILTASK_H
       
    21 
       
    22 #include "thumbnailmanager.h"    // TThumbnailRequestId
       
    23 #include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
       
    24 
       
    25 
       
    26 class CThumbnailTaskProcessor;
       
    27 class CThumbnailServerSession;
       
    28 
       
    29 /**
       
    30  *  Base class for thumbnail server tasks.
       
    31  *
       
    32  *  @since S60 v5.0
       
    33  */
       
    34 class CThumbnailTask: public CActive
       
    35     {
       
    36 public:
       
    37     /**
       
    38      * Task state.
       
    39      * @since S60 v5.0
       
    40      */
       
    41     enum TTaskState
       
    42         {
       
    43         /**
       
    44          * This task is waiting to be run.
       
    45          */
       
    46         EIdle, 
       
    47 
       
    48         /**
       
    49          * This task is currently running.
       
    50          */
       
    51         ERunning, 
       
    52 
       
    53         /**
       
    54          * This task has completed and can be destroyed.
       
    55          */
       
    56         EComplete
       
    57     };
       
    58 
       
    59 public:
       
    60 
       
    61     /**
       
    62      * C++ default constructor
       
    63      *
       
    64      * @since S60 v5.0
       
    65      * @param aProcessor Processor object for running tasks.
       
    66      * @param aPriority Priority of the task.
       
    67      * @return New CThumbnailTask instance.
       
    68      */
       
    69     CThumbnailTask( CThumbnailTaskProcessor& aProcessor, TInt aPriority );
       
    70 
       
    71     /**
       
    72      * Destructor
       
    73      *
       
    74      * @since S60 v5.0
       
    75      */
       
    76     virtual ~CThumbnailTask();
       
    77 
       
    78 public:
       
    79 
       
    80     /**
       
    81      * Returns priority of task.
       
    82      *
       
    83      * @since S60 v5.0
       
    84      * @return Priority of the task.
       
    85      */
       
    86     TInt Priority()const;
       
    87 
       
    88     /**
       
    89      * Returns state of task.
       
    90      *
       
    91      * @since S60 v5.0
       
    92      * @return State.
       
    93      */
       
    94     TTaskState State()const;
       
    95 
       
    96     /**
       
    97      * SetMessageData
       
    98      *
       
    99      * @since S60 v5.0
       
   100      * @param aRequestId Request ID.
       
   101      * @param aMessage Message.
       
   102      */
       
   103     virtual void SetMessageData( const TThumbnailServerRequestId& aRequestId,
       
   104         const RMessage2& aMessage );
       
   105     
       
   106     /**
       
   107      * SetMessageData if message is not needed to complete
       
   108      *
       
   109      * @since S60 v5.0
       
   110      * @param aRequestId Request ID.
       
   111      */
       
   112      virtual void SetMessageData( const TThumbnailServerRequestId& aRequestId );
       
   113 
       
   114     /**
       
   115      * Resets message data.
       
   116      *
       
   117      * @since S60 v5.0
       
   118      */
       
   119     virtual void ResetMessageData();
       
   120 
       
   121     /**
       
   122      * Cancels message.
       
   123      *
       
   124      * @since S60 v5.0
       
   125      */
       
   126     virtual void CancelMessage();
       
   127 
       
   128     /**
       
   129      * Returns ID of specific task.
       
   130      *
       
   131      * @since S60 v5.0
       
   132      * @return Request ID.
       
   133      */
       
   134     virtual TThumbnailServerRequestId RequestId()const;
       
   135 
       
   136     /**
       
   137      * Changes priority of the task.
       
   138      *
       
   139      * @since S60 v5.0
       
   140      * @param aNewPriority New priority.
       
   141      */
       
   142     virtual void ChangeTaskPriority( TInt aNewPriority );
       
   143 
       
   144     /**
       
   145      * StartL
       
   146      *
       
   147      * @since S60 v5.0
       
   148      */
       
   149     virtual void StartL();
       
   150 
       
   151     /**
       
   152      * Implements cancellation of an outstanding request.
       
   153      *
       
   154      * @since S60 v5.0
       
   155      */
       
   156     virtual void DoCancel();    
       
   157     
       
   158     /**
       
   159      * StartError
       
   160      *
       
   161      * @since S60 v5.0
       
   162      * @param aError Error code.
       
   163      */
       
   164     virtual void StartError( TInt aError );
       
   165 
       
   166     /**
       
   167      * Complete
       
   168      *
       
   169      * @since S60 v5.0
       
   170      * @param aReason Status code.
       
   171      */
       
   172     virtual void Complete( TInt aReason );
       
   173     
       
   174     /**
       
   175      * Continue without deleting task
       
   176      *
       
   177      * @since S60 v5.0
       
   178      */
       
   179     virtual void Continue();
       
   180 
       
   181 protected:
       
   182     // data
       
   183 
       
   184     /**
       
   185      * Processor.
       
   186      */
       
   187     CThumbnailTaskProcessor& iProcessor;
       
   188 
       
   189     /**
       
   190      * Priority of the task.
       
   191      */
       
   192     TInt iPriority;
       
   193 
       
   194     /**
       
   195      * State of the task.
       
   196      */
       
   197     TTaskState iState;
       
   198 
       
   199     /**
       
   200      * Id of the request.
       
   201      */
       
   202     TThumbnailServerRequestId iRequestId;
       
   203 
       
   204     /**
       
   205      * Message.
       
   206      */
       
   207     RMessage2 iMessage;
       
   208 };
       
   209 
       
   210 #endif // THUMBNAILTASK_H