accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/compositecablestateconnected.h
changeset 0 4e1aa6a622a0
child 27 4a5c47a50617
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2009 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:  HDMI Cable Status FSM's "Connected" state.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_COMPOSITECABLESTATECONNECTED_H
       
    20 #define C_COMPOSITECABLESTATECONNECTED_H
       
    21 
       
    22 
       
    23 #include "multifinitestatemachine.h"
       
    24 #include "centralrepositorywatch.h" 
       
    25 #include "tvoutconfigforcomposite.h"
       
    26 #include "compositecablestatusfsm.h"
       
    27 
       
    28 
       
    29 
       
    30 
       
    31 /**
       
    32  * "Connected" state implementation for Composite Cable Status FSM.
       
    33  * Composite Cable is connected in this state.
       
    34  *
       
    35  *  @code
       
    36  *   ?good_class_usage_example(s)
       
    37  *  @endcode
       
    38  *
       
    39  *  @lib none.
       
    40  *  @since TB 9.2
       
    41  */
       
    42 NONSHARABLE_CLASS( CCompositeCableStateConnected ): public CBase, 
       
    43     public MFSMState, public MCentralRepositoryObserver
       
    44     {
       
    45 
       
    46 
       
    47 public:
       
    48 
       
    49     
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aFSMForState Finite State Machine interface for State.
       
    53      * @param aTVOutConfigForHDMI TV Out Configurer.
       
    54      */
       
    55     static CCompositeCableStateConnected* NewL(
       
    56             MFSMForState& aFSMForState, 
       
    57             CTVOutConfigForComposite& aTVOutConfigForComposite,
       
    58             CCompositeCableStatusFSM& aCompositeCableStatusFSM);
       
    59     
       
    60 
       
    61     /**
       
    62     * Destructor.
       
    63     */
       
    64     virtual ~CCompositeCableStateConnected();
       
    65 
       
    66     
       
    67 // from base class MFSMState
       
    68 
       
    69 
       
    70     /**
       
    71      * From MFSMState.
       
    72      * Function is called when entering the state. State can perform
       
    73      * necessary entry actions if any.
       
    74      *
       
    75      * @since TB 9.2
       
    76      * @param none. 
       
    77      * @return aFSMBody Interface pointer of a FSM body.
       
    78      */
       
    79     virtual void Enter();
       
    80 
       
    81     /**
       
    82      * From MFSMState.
       
    83      * Function is called by FSM Body whenever an event that might have 
       
    84      * impact on the state has been fired. Implementation has to found
       
    85      * out what event has occurred and decide whether it enforces
       
    86      * transition to another state.
       
    87      *
       
    88      * @since TB 9.2
       
    89      * @param aInterfaceId Interface Id. 
       
    90      * @param aEvent Interface event Id.
       
    91      * @return none.
       
    92      */
       
    93     virtual void Input(
       
    94             TFSMInterfaceId aInterfaceId ,
       
    95             TFSMEventId aEvent );
       
    96 
       
    97     /**
       
    98      * From MFSMState.
       
    99      * Function returns state's identification.
       
   100      *
       
   101      * @since TB 9.2
       
   102      * @param none. 
       
   103      * @return TFSMState State's identification.
       
   104      */
       
   105     virtual TFSMState Id();
       
   106 
       
   107     /**
       
   108      * From MFSMState.
       
   109      * Function returns state's name.
       
   110      *
       
   111      * @since TB 9.2
       
   112      * @param none. 
       
   113      * @return TPtrC Name of the state.
       
   114      */
       
   115     virtual TPtrC Name();
       
   116 
       
   117     /**
       
   118      * Function returns substate's identification.
       
   119      *
       
   120      * @since TB 9.2
       
   121      * @param none. 
       
   122      * @return TFSMState Substate's identification.
       
   123      */
       
   124     virtual TFSMState SubId();
       
   125 
       
   126     
       
   127 protected:
       
   128 
       
   129 // from base class MCentralRepositoryObserver
       
   130 
       
   131     
       
   132     /**
       
   133      * Function is called by watcher every time when key value has changed
       
   134      * in CR.
       
   135      *
       
   136      * @since TB 9.2
       
   137      * @param aRepositoryId Changed repository. 
       
   138      * @param aRepositoryId Changed key. 
       
   139      * @return none
       
   140      */
       
   141     virtual void CentRepKeyChanged(
       
   142             TUid    aRepositoryId,
       
   143             TUint32 aId );
       
   144 
       
   145     /**
       
   146      * Function is called by property watcher when reading the integer property's
       
   147      * current value fails.
       
   148      *
       
   149      * @since TB 9.2
       
   150      * @param aRepositoryId Changed repository. 
       
   151      * @param aRepositoryId Changed key. 
       
   152      * @param aError Error code:
       
   153      *      KErrAbort if in a transaction that has previously failed, 
       
   154      *      KErrPermissionDenied if caller fails capability check, 
       
   155      *      KErrNotFound if the setting does not exist, 
       
   156      *      KErrArgument if the setting exists but is not an integer, plus other system-wide error codes. 
       
   157      * . 
       
   158      * @return none
       
   159      */
       
   160     virtual void CentRepGetKeyValueFailed( 
       
   161             TUid    aRepositoryId,
       
   162             TUint32 aId,
       
   163             TInt aError );
       
   164 
       
   165 
       
   166 private:
       
   167 
       
   168     /**
       
   169      * Input function for substate Enabling.
       
   170      *
       
   171      * @since TB 9.2
       
   172      * @param aInterfaceId Interface Id. 
       
   173      * @param aEvent Interface event Id.
       
   174      * @return none.
       
   175      */
       
   176     void SubStateEnablingInput( 
       
   177             TFSMInterfaceId aInterfaceId ,
       
   178             TFSMEventId aEvent );
       
   179 
       
   180     /**
       
   181      * Input function for substate Enabled.
       
   182      *
       
   183      * @since TB 9.2
       
   184      * @param aInterfaceId Interface Id. 
       
   185      * @param aEvent Interface event Id.
       
   186      * @return none.
       
   187      */
       
   188     void SubStateEnabledInput( 
       
   189             TFSMInterfaceId aInterfaceId ,
       
   190             TFSMEventId aEvent );
       
   191 
       
   192     /**
       
   193      * Input function for substate Disabling.
       
   194      *
       
   195      * @since TB 9.2
       
   196      * @param aInterfaceId Interface Id. 
       
   197      * @param aEvent Interface event Id.
       
   198      * @return none.
       
   199      */
       
   200     void SubStateDisablingInput( 
       
   201             TFSMInterfaceId aInterfaceId ,
       
   202             TFSMEventId aEvent );
       
   203 
       
   204     /**
       
   205      * Input function for substate Setting.
       
   206      *
       
   207      * @since TB 9.2
       
   208      * @param aInterfaceId Interface Id. 
       
   209      * @param aEvent Interface event Id.
       
   210      * @return none.
       
   211      */
       
   212     void SubStateSettingInput( 
       
   213             TFSMInterfaceId aInterfaceId ,
       
   214             TFSMEventId aEvent );
       
   215     
       
   216     /**
       
   217      * Input function for substate Start Listen 
       
   218      * Config Changes.
       
   219      *
       
   220      * @since TB 9.2
       
   221      * @param aInterfaceId Interface Id. 
       
   222      * @param aEvent Interface event Id.
       
   223      * @return none.
       
   224      */
       
   225     void SubStateStartListenConfigChangesInput( 
       
   226             TFSMInterfaceId aInterfaceId ,
       
   227             TFSMEventId aEvent );
       
   228     
       
   229     /**
       
   230      * Input function for substate Disabling for resetting
       
   231      * TV Out Configuration settings. 
       
   232      *
       
   233      * @since TB 9.2
       
   234      * @param aInterfaceId Interface Id. 
       
   235      * @param aEvent Interface event Id.
       
   236      * @return none.
       
   237      */
       
   238     void SubStateResettingDisableInput(
       
   239             TFSMInterfaceId aInterfaceId ,
       
   240             TFSMEventId aEvent );    
       
   241 
       
   242     /**
       
   243      * Input function for substate Resetting.
       
   244      *
       
   245      * @since TB 9.2
       
   246      * @param aInterfaceId Interface Id. 
       
   247      * @param aEvent Interface event Id.
       
   248      * @return none.
       
   249      */
       
   250     void SubStateResettingInput( 
       
   251             TFSMInterfaceId aInterfaceId ,
       
   252             TFSMEventId aEvent );
       
   253 
       
   254     /**
       
   255      * C++ default constructor.
       
   256      * @param aFSMForState Finite State Machine interface for State.
       
   257      * @param aTVOutConfigForHDMI TV Out Configurer.
       
   258      */
       
   259     CCompositeCableStateConnected(
       
   260             MFSMForState& aFSMForState, 
       
   261             CTVOutConfigForComposite& aTVOutConfigForComposite,
       
   262             CCompositeCableStatusFSM& aCompositeCableStatusFSM);
       
   263 
       
   264     /**
       
   265      * Resetting the available config in tvout config
       
   266      * 
       
   267      * @since TB 9.2
       
   268      * @return none.
       
   269      */
       
   270     void ClearAvailableTvOutConfig();
       
   271     
       
   272     /**
       
   273      * Transit to Idle state
       
   274      * 
       
   275      * @since TB 9.2
       
   276      * @return none.
       
   277      */
       
   278     void TransitStateIdle();
       
   279     
       
   280     /**
       
   281      * By default Symbian OS constructor is private.
       
   282      */
       
   283     void ConstructL();
       
   284 
       
   285 private: // data
       
   286 
       
   287     enum TSubState
       
   288       {
       
   289       ESubStateEnabling,
       
   290       ESubStateEnabled,
       
   291       ESubStateDisabling,
       
   292       ESubStateSetting,
       
   293       ESubStateStartListenSettingsChanges,
       
   294       ESubStateResettingDisable,
       
   295       ESubStateResetting
       
   296       };
       
   297 
       
   298     /**
       
   299      * FSM.
       
   300      * Not own.
       
   301      */
       
   302     MFSMForState& iFSMForState;
       
   303 
       
   304     /**
       
   305      * Central Repository Watchers.
       
   306      * Own
       
   307      */
       
   308     CCentralRepositoryWatch* iCRWatchForAspectRatio;
       
   309     CCentralRepositoryWatch* iCRWatchForFlickerFilter;
       
   310     CCentralRepositoryWatch* iCRWatchForTvSystem;
       
   311 
       
   312     /**
       
   313      * TV Out Configurer.
       
   314      * Not own
       
   315      */
       
   316     CTVOutConfigForComposite&   iTVOutConfigForComposite;
       
   317     
       
   318     /**
       
   319      * Composite Cable Status FSM.
       
   320      * Not own.
       
   321      */    
       
   322     CCompositeCableStatusFSM& iCompositeCableStatusFSM;
       
   323     
       
   324     /**
       
   325      * TV Out Configurer for listening setting changes.
       
   326      * Not own
       
   327      */
       
   328     CTVOutConfigForComposite* iTVOutConfigForSettingChanges;
       
   329     
       
   330     // Substate
       
   331     TSubState iSubState;
       
   332     
       
   333     // Flag
       
   334     TBool iCableDisconnectedWhileEnabling;
       
   335     
       
   336     // Flag
       
   337     TBool iCableConnectedWhileDisabling;
       
   338     
       
   339     // Flag
       
   340     TBool iCableDisconnectedWhileSetting;
       
   341 
       
   342     // Flag
       
   343     TBool iCableDisconnectedWhileResetting;
       
   344     
       
   345     // Flag
       
   346     TBool iCableDisconnectedWhileListening;
       
   347     
       
   348     // Flag
       
   349     TBool iCableDisconnectedWhileResettingDisable;
       
   350     
       
   351     // Flag
       
   352     TBool iResettingInput;
       
   353     
       
   354     // Flag
       
   355     TBool iClearConfig;
       
   356     
       
   357    };
       
   358 
       
   359 #endif // C_COMPOSITECABLESTATECONNECTED_H