phoneapp/phoneuicontrol/inc/cphonestatemachine.h
changeset 0 5f000ab63145
child 5 2a26698d78ba
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 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: 
       
    15 *     Class for handling states and their transitions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPHONESTATEMACHINE_H
       
    21 #define CPHONESTATEMACHINE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <pevirtualengine.h>
       
    27 #include "mphonestatemachine.h"
       
    28 #include "mphonestate.h"
       
    29 #include "mphoneviewcommandhandle.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class MPhoneState;
       
    33 class MPhoneStorage;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Class for handling states and their transitions
       
    39 */
       
    40 class CPhoneStateMachine : 
       
    41     public CBase, 
       
    42     public MPhoneStateMachine
       
    43     {
       
    44     public:  
       
    45 
       
    46         /**
       
    47         * Destructor.
       
    48         */
       
    49         IMPORT_C virtual ~CPhoneStateMachine();
       
    50 
       
    51     public: // From MPhoneStateMachine
       
    52 
       
    53         /**
       
    54         * Sets the next state to be set.
       
    55         * New state will be constructed and old one destructed in next
       
    56         * State() call.
       
    57         * @param aState to be set
       
    58         */
       
    59         IMPORT_C void ChangeState( TInt aState );
       
    60 
       
    61         /**
       
    62         * Returns active state
       
    63         */
       
    64         IMPORT_C MPhoneState* State();
       
    65 
       
    66         /**
       
    67         * Sets pointer to Phone Engine
       
    68         * @param aPhoneEngine pointer to Phone Engine instance
       
    69         */
       
    70         IMPORT_C void SetPhoneEngine( MPEPhoneModel* aPhoneEngine );
       
    71 
       
    72         /**
       
    73         * Gets pointer to Phone Engine
       
    74         * @returns pointer to Phone Engine
       
    75         */
       
    76         IMPORT_C MPEPhoneModel* PhoneEngine();
       
    77 
       
    78         /**
       
    79         * Gets pointer to Phone Engine Info
       
    80         * @return pointer to Phone Engine Info
       
    81         */
       
    82         IMPORT_C MPEEngineInfo* PhoneEngineInfo();
       
    83         
       
    84         /**
       
    85         * Instantiates protocol specific Phone Engine
       
    86         * @param reference to Engine Monitor
       
    87         * @return Phone Engine instance
       
    88         */
       
    89         IMPORT_C MPEPhoneModel* CreatePhoneEngineL(
       
    90             MEngineMonitor& aEngineMonitor );
       
    91         /**
       
    92         * Send message to phoneEngine
       
    93         * @param aMessage
       
    94         */     
       
    95         IMPORT_C void SendPhoneEngineMessage( 
       
    96             TInt aMessage );
       
    97 
       
    98         /**
       
    99         * Set callId to phoneEngineinfo
       
   100         * @param aCallId
       
   101         */    
       
   102         IMPORT_C void SetCallId( const TInt aCallId );
       
   103 
       
   104        
       
   105         /**
       
   106         * Instantiates phone storage.
       
   107         * @return storage instance    
       
   108         */    
       
   109         IMPORT_C MPhoneStorage* PhoneStorage();        
       
   110 
       
   111     protected:
       
   112 
       
   113         /**
       
   114         * By default EPOC constructor is private.
       
   115         */
       
   116         IMPORT_C CPhoneStateMachine(
       
   117             MPhoneViewCommandHandle* aViewCommandHandle );
       
   118 
       
   119     protected: // Data   
       
   120 
       
   121         /**
       
   122         * Currently active state
       
   123         */
       
   124         MPhoneState* iState; 
       
   125 
       
   126         /**
       
   127         * Old state ID - needed in state transitions
       
   128         */
       
   129         TInt iOldStateId;
       
   130 
       
   131         /**
       
   132         * New state ID to be used - needed in state transitions
       
   133         */
       
   134         TInt iNewStateId;
       
   135 
       
   136         /**
       
   137         * View's command handle
       
   138         */
       
   139         MPhoneViewCommandHandle* iViewCommandHandle;
       
   140 
       
   141         /**
       
   142         * Pointer to Phone Engine - uses relation
       
   143         */
       
   144         MPEPhoneModel* iPhoneEngine;
       
   145 
       
   146         // Idle state which is hold in memory all the time
       
   147         MPhoneState* iIdleState;
       
   148 
       
   149         // Phone's storage
       
   150         MPhoneStorage* iPhoneStorage;
       
   151     };
       
   152 
       
   153 #endif      // CPHONESTATEMACHINE_H
       
   154             
       
   155 // End of File