systemswstubs/startupadaptationstub/inc/CommandProcessingEngine.h
branchRCL_3
changeset 44 b5894bb67e73
parent 35 37b610eb7fe3
equal deleted inserted replaced
35:37b610eb7fe3 44:b5894bb67e73
     1 /*
       
     2 * Copyright (c) 2004-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:  CCommandProcessingEngine class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __COMMANDPROCESSINGENGINE_H__
       
    21 #define __COMMANDPROCESSINGENGINE_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MCommandProcessingObserver;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  ?one_line_short_description. CCommandProcessingEngine
       
    33 *  ?other_description_lines
       
    34 *
       
    35 *  @lib ?library
       
    36 *  @since Series ?XX ?SeriesXX_version
       
    37 */
       
    38 class CCommandProcessingEngine : public CActive
       
    39     {
       
    40     public:  // Constructors and destructor
       
    41 
       
    42         /**
       
    43         * Two-phased constructor.
       
    44         * @param aObserver Command processing completion observer.
       
    45         */
       
    46         static CCommandProcessingEngine* NewL(
       
    47             MCommandProcessingObserver& aObserver );
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CCommandProcessingEngine();
       
    53 
       
    54     public: // New functions
       
    55 
       
    56         /**
       
    57         * Append command to queue.
       
    58         *
       
    59         * @param aCommandId Command ID from the client.
       
    60         * @param aDuration Timeout value in milliseconds.
       
    61         */
       
    62         void ExecuteCommandL( const TInt aCommandId, const TInt aDuration );
       
    63 
       
    64     public: // Functions from base classes
       
    65 
       
    66         /**
       
    67         * From CActive.
       
    68         * Handles an active object’s request completion event.
       
    69         */
       
    70         void RunL();
       
    71 
       
    72         /**
       
    73         * From CActive.
       
    74         * Handles a leave occurring in the request completion event handler
       
    75         * RunL().
       
    76         * @param aError The leave code.
       
    77         */
       
    78         TInt RunError( TInt aError );
       
    79 
       
    80         /**
       
    81         * From CActive.
       
    82         * Implements cancellation of an outstanding request.
       
    83         */
       
    84         void DoCancel();
       
    85 
       
    86     private:
       
    87 
       
    88         /**
       
    89         * C++ default constructor.
       
    90         * @param aObserver Command processing completion observer.
       
    91         */
       
    92         CCommandProcessingEngine( MCommandProcessingObserver& aObserver );
       
    93 
       
    94         /**
       
    95         * By default Symbian 2nd phase constructor is private.
       
    96         */
       
    97         void ConstructL();
       
    98 
       
    99         /**
       
   100         * Set the timer and activate.
       
   101         *
       
   102         * @param aDuration Timeout value in milliseconds.
       
   103         */
       
   104         void ActivateWithTimeout( const TInt aDuration );
       
   105 
       
   106     private:    // Data
       
   107 
       
   108         struct TCommandInfo
       
   109             {
       
   110             TInt iCommandId;
       
   111             TInt iDuration;
       
   112             };
       
   113 
       
   114         typedef RArray<TCommandInfo> RCommandArray;
       
   115 
       
   116         RCommandArray iCommands; // List of commands to process.
       
   117 
       
   118         RTimer iTimer; // A timer for emulating command processing time.
       
   119 
       
   120         // Command processing completion observer.
       
   121         MCommandProcessingObserver& iObserver;
       
   122     };
       
   123 
       
   124 #endif // __COMMANDPROCESSINGENGINE_H__
       
   125 
       
   126 // End of File