contextframework/cfw/inc/cfserver/cfphasebase.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-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:  CFPhaseBase class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CFPHASEBASE_H
       
    20 #define C_CFPHASEBASE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "cfstartereventhandler.h"
       
    24 
       
    25 class MCFContextInterface;
       
    26 
       
    27 /**
       
    28 * CF starter phase base class.
       
    29 * Note:
       
    30 * Do not use iCF in oncstruct phase. iCF is still being initiazlied.
       
    31 * iCF can be used when RunL is called.
       
    32 */
       
    33 NONSHARABLE_CLASS( CCFPhaseBase ): public CBase
       
    34     {
       
    35     public:
       
    36     
       
    37         // Currently supported phases
       
    38         enum TCFPhaseId
       
    39             {
       
    40             // Device start up
       
    41             ECFDeviceStarting,
       
    42             
       
    43             // Device start up completed
       
    44             ECFDeviceStarted,
       
    45             
       
    46             // Loading plugins
       
    47             ECFLoadingPlugins,
       
    48             
       
    49             // Loading rules
       
    50             ECFLoadingRules,
       
    51             
       
    52             // Context Framework initialized and ready
       
    53             ECFCfwReady,
       
    54             
       
    55             // Keep this last!
       
    56             ECFStartEnd
       
    57             };
       
    58     
       
    59     public:
       
    60     
       
    61         // C++ destructor
       
    62         ~CCFPhaseBase();
       
    63         
       
    64     public: // Implementation specific
       
    65         
       
    66         /**
       
    67         * States is allowed to run.
       
    68         * Complete aStatus when the phase has been fully completed.
       
    69         * 
       
    70         * @since S60 4.0
       
    71         * @param aStatus Client status to complete.
       
    72         * @return None.
       
    73         */
       
    74         virtual void ExecuteL( TRequestStatus* aStatus ) = 0;
       
    75         
       
    76         /**
       
    77         * Current phase instructions for next phase.
       
    78         *
       
    79         * @since S60 4.0
       
    80         * @param None.
       
    81         * @return TCFPhaseId
       
    82         */
       
    83         virtual TCFPhaseId NextPhase() const = 0;
       
    84         
       
    85         /**
       
    86         * Hanldes CFW starter events.
       
    87         *
       
    88         * @since S60 3.2
       
    89         * @param CFStarterEventHandler::TCFStarterEvents.
       
    90         * @return TCFPhaseId
       
    91         */
       
    92         virtual void HandleEvent( MCFStarterEventHandler::TCFStarterEvents /*aEvent*/ );
       
    93         
       
    94     public: // New methods
       
    95     
       
    96         /**
       
    97         * Returns phase id.
       
    98         *
       
    99         * @since S60 4.0
       
   100         * @param None.
       
   101         * @return TInt
       
   102         */
       
   103         TInt PhaseId() const;
       
   104 
       
   105         /**
       
   106          * Cancels the outgoing phase execution.
       
   107          * 
       
   108          * @since S60 5.1
       
   109          * @param None.
       
   110          * @return None.
       
   111          */
       
   112         void Cancel();
       
   113         
       
   114     protected: // New methods
       
   115     
       
   116         // Completes phase
       
   117         void Complete( TInt aError );
       
   118         
       
   119     protected:
       
   120     
       
   121         CCFPhaseBase( TCFPhaseId aId, MCFContextInterface& aCF );
       
   122         void ConstructL();
       
   123         
       
   124     protected: // Data
       
   125     
       
   126         /** Starter request status */
       
   127         TRequestStatus* iStarterRequest;
       
   128         
       
   129         /** Phase id */
       
   130         TCFPhaseId iId;
       
   131         
       
   132         /** Context Access API */
       
   133         MCFContextInterface& iCF;
       
   134     };
       
   135 
       
   136 #endif