idlefw/inc/framework/aipluginstatemachine.h
branchRCL_3
changeset 9 d0529222e3f0
parent 4 1a2a00e78665
child 10 5ef93ea513cb
child 18 bd874ee5e5e2
equal deleted inserted replaced
4:1a2a00e78665 9:d0529222e3f0
     1 /*
       
     2 * Copyright (c) 2005-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:  Plugin state mmchine base class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_AIPLUGINSTATEMACHINE_H
       
    20 #define M_AIPLUGINSTATEMACHINE_H
       
    21 
       
    22 #include <aicontentpublisher.h>
       
    23 
       
    24 class MAiPluginState;
       
    25 
       
    26 /**
       
    27  * TAiStateChanges state change enumeration for each separate monitored state.
       
    28  */
       
    29 enum TAiStateChanges
       
    30 	{
       
    31 	ESMAIInCall,
       
    32 	ESMAINoCall,
       
    33     ESMAIBacklightOn,
       
    34     ESMAIBacklightOff,
       
    35     ESMAIBackupOn,
       
    36     ESMAIBackupOff,
       
    37     ESMAIIdleForeground,
       
    38     ESMAIIdleBackground,
       
    39     ESMAISystemBoot,
       
    40     ESMAISystemShutdown,
       
    41     ESMAILocaleChanged,
       
    42     ESMAITimeChanged,
       
    43     ESMAIMidnightCrossover,
       
    44     ESMAIReportThemeChangeStarted,
       
    45     ESMAIReportThemeChangeReady,
       
    46     ESMAIRelayoutScreen,
       
    47     ESMAIGeneralThemeChanged,
       
    48     ESMAIT1Timeout,
       
    49     ESMAIKeylockEnabled,
       
    50     ESMAIKeylockDisabled,
       
    51     ESMAIUnknownState,
       
    52     ESMAIEnterEditMode,
       
    53     ESMAIExitEditMode,
       
    54     ESMAIOffLine,
       
    55     ESMAIOnLine,
       
    56     ESMAIPageSwitch
       
    57 	};
       
    58 	
       
    59 /**
       
    60  * Sate variable enumeration for querying the status of the monitored item.
       
    61  */
       
    62 enum TAiStateVariable
       
    63 	{
       
    64 	ESMAICallStatus,
       
    65 	ESMAILightStatus,
       
    66     ESMAIBackupRestoreStatus,
       
    67     ESMAIIdleFocusStatus
       
    68 	};
       
    69 	
       
    70 /**
       
    71  * Possible states of the state machine (and plugin).
       
    72  */
       
    73 enum TAiState
       
    74 	{
       
    75 	EAiIdle = 1,
       
    76 	EAiSuspended,
       
    77 	EAiAlive,
       
    78 	EAiAliveActive,
       
    79 	EAiAliveIncall,
       
    80 	EAiAliveInactive
       
    81 	};
       
    82 
       
    83 /**
       
    84  * Sub states of idle state.
       
    85  */
       
    86 enum TAiIdleSubState
       
    87     {
       
    88 	EAiIdleCreatingPlugins = EAiAliveInactive + 1,
       
    89 	EAiIdleBackupRestore
       
    90     };
       
    91 	
       
    92 /**
       
    93  * @ingroup group_aifw
       
    94  * 
       
    95  * Plugin state resource interface.
       
    96  * 
       
    97  *  @lib aifw
       
    98  *  @since S60 3.2
       
    99  */
       
   100 class MAiPluginStateResources
       
   101     {
       
   102 public:
       
   103     
       
   104     /*
       
   105      * Check whether the specified state variable is active or not.
       
   106      *
       
   107      * @param aStateVariable system variable state change that is to be checked.
       
   108      */
       
   109     virtual TBool StateVariable( TAiStateVariable aStateVariable ) = 0;
       
   110     
       
   111     /**
       
   112      * Translates system state change reason to plugin state state reason.
       
   113      *
       
   114      * @param aStateChange the system state variable change to be translated.
       
   115      * @return TAiTransitionReason plugin state transition reason.
       
   116      */    
       
   117     virtual TAiTransitionReason TranslateReason( TAiStateChanges aStateChange ) = 0;
       
   118     
       
   119     /**
       
   120      * Restart plugin suspend timer.
       
   121      */    
       
   122     virtual void RestartSuspendTimer() = 0;
       
   123 
       
   124 protected:
       
   125     ~MAiPluginStateResources() {}    
       
   126     };
       
   127     
       
   128 /**
       
   129  * Plugin state machine interface.
       
   130  * 
       
   131  *  @lib aifw
       
   132  *  @since S60 3.2
       
   133  */
       
   134 class MAiPluginStateMachine : public MAiPluginStateResources
       
   135     {
       
   136 public:
       
   137     
       
   138     /*
       
   139      * Method that changes this state machine to a state.
       
   140      *
       
   141      * @param aState state to change to.
       
   142      * @param aStateChange system variable state change that is the cause for this call.
       
   143      */
       
   144     virtual void SwitchToState( TAiState aState,
       
   145                                 TAiStateChanges aStateChange ) = 0;
       
   146     
       
   147     /*
       
   148      * Reference to the plugin that is managed by this state machine.
       
   149      *
       
   150      * @return CAiContentPublisher reference to the plugin.
       
   151      */
       
   152     virtual CAiContentPublisher& Plugin() const = 0;
       
   153 
       
   154     /**
       
   155      * Change plugin states.
       
   156      *
       
   157      * @param aReason for transition
       
   158      * @param aStateChangeMethod state change method to call
       
   159      * @param aLogOpCode operation code for logging
       
   160      */
       
   161     virtual void ChangePluginState(
       
   162                 TAiTransitionReason aReason, 
       
   163                 void (CAiContentPublisher::*aStateChangeMethod)(TAiTransitionReason) ) = 0;
       
   164     
       
   165 protected:
       
   166     ~MAiPluginStateMachine() {}
       
   167     };
       
   168 
       
   169 #endif // M_AIPLUGINSTATEMACHINE_H