contextframework/cfw/inc/cfserver/cfstarter.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:  CFStarter class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CFSTARTER_H
       
    20 #define C_CFSTARTER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "cfphasebase.h"
       
    25 #include "cfstartereventhandler.h"
       
    26 
       
    27 class MCFStarterObserver;
       
    28 
       
    29 /**
       
    30 * Asynchronous Context Framework starter which provides a simple
       
    31 * state machine.
       
    32 */
       
    33 NONSHARABLE_CLASS( CCFStarter ): public CActive,
       
    34                                  public MCFStarterEventHandler
       
    35     {
       
    36     public:
       
    37     
       
    38         // Symbian two phased constructors
       
    39         static CCFStarter* NewL( MCFContextInterface& aCF );
       
    40         static CCFStarter* NewLC( MCFContextInterface& aCF );
       
    41         
       
    42         // C++ destructor
       
    43         ~CCFStarter();
       
    44         
       
    45     public: // New methods
       
    46     
       
    47         /**
       
    48         * Adds a new observer.
       
    49         *
       
    50         * @since S60 4.0
       
    51         * @param aObserver New observer.
       
    52         * @return None.
       
    53         */
       
    54         void AddObserverL( MCFStarterObserver* aObserver );
       
    55 
       
    56         /**
       
    57         * Starts CF starter.
       
    58         * CF initialization will start and observers are informed to
       
    59         * initialize in phases.
       
    60         *
       
    61         * @since S60 4.0
       
    62         * @param None.
       
    63         * @return None.
       
    64         */
       
    65         void StartL();
       
    66         
       
    67     private: // From base classes
       
    68     
       
    69         // @see CActive
       
    70         void RunL();
       
    71 
       
    72         // @see CActive
       
    73         void DoCancel();
       
    74 
       
    75         // @see CActive
       
    76         TInt RunError( TInt aError );
       
    77         
       
    78         // @see MCFStarterEventHandler
       
    79         void HandleEvent( TCFStarterEvents aEvent );
       
    80         
       
    81     private: // New methods
       
    82     
       
    83         // Switch to next phase, returns previous phase
       
    84         CCFPhaseBase::TCFPhaseId SwitchToNextPhase();
       
    85         
       
    86         // Runs current phase
       
    87         void RunNextL();
       
    88     
       
    89     private:
       
    90     
       
    91         CCFStarter( MCFContextInterface& aCF );
       
    92         void ConstructL();
       
    93         
       
    94     private:
       
    95     
       
    96         // Own: Current init phase
       
    97         CCFPhaseBase::TCFPhaseId iCurrentPhase;
       
    98         
       
    99         // Own: Observers - pointers not owned
       
   100         RPointerArray<MCFStarterObserver> iObservers;
       
   101         
       
   102         // Own: Phases
       
   103         RPointerArray<CCFPhaseBase> iPhases;
       
   104         
       
   105         // Ref: Context Access API
       
   106         MCFContextInterface& iCF;
       
   107     };
       
   108 
       
   109 #endif