accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/hdmicablestatusfsm.h
changeset 0 4e1aa6a622a0
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:  Finite State Machine class for HDMI Cable Status.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_HDMICABLESTATUSFSM_H
       
    21 #define C_HDMICABLESTATUSFSM_H
       
    22 
       
    23 
       
    24 
       
    25 #include "pdefsm.h"
       
    26 
       
    27 
       
    28 class CTVOutConfigForHDMI;
       
    29 class CEDIDHandler;
       
    30 class CAccessoryControlIf;
       
    31 class CPDEngine;
       
    32 
       
    33 
       
    34 
       
    35 /**
       
    36  *  Finite State Machine class for HDMI Cable Status.
       
    37  *
       
    38  *  @code
       
    39  *   ?good_class_usage_example(s)
       
    40  *  @endcode
       
    41  *
       
    42  *  @lib none.
       
    43  *  @since TB 9.2
       
    44  */
       
    45 NONSHARABLE_CLASS( CHDMICableStatusFSM ): public CBase, public MPdeFSM, public MFSMForState
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aAccessoryServer Accessory Server.
       
    53      */
       
    54     static CHDMICableStatusFSM* NewL(
       
    55             RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine );
       
    56     
       
    57 
       
    58     /**
       
    59     * Destructor.
       
    60     */
       
    61     virtual ~CHDMICableStatusFSM();
       
    62 
       
    63 public: // New methods
       
    64 
       
    65 
       
    66     /**
       
    67      * This called after copy protection status change is done/tried
       
    68      * in TV Out Configuration interface.
       
    69      *
       
    70      * @since TB 9.2
       
    71      * @param aError Symbian error code. 
       
    72      * @param aCurrentStatus Current status after setting (trial). 
       
    73      * @return void.
       
    74      */
       
    75     void CopyProtectionSettingDone(
       
    76             TInt aError = KErrNone,
       
    77             TBool aCurrentStatus = EFalse );
       
    78 
       
    79     /**
       
    80      * This called after copy protection status change is notified
       
    81      * from TV Out Configuration interface.
       
    82      *
       
    83      * @since TB 9.2
       
    84      * @param aNewStatus New Copy Protection status. 
       
    85      * @return void.
       
    86      */
       
    87     void CopyProtectionStatusChanged( TBool aNewStatus );
       
    88 
       
    89     /**
       
    90      * This called after copy protection status listening has failed
       
    91      * in TV Out Configuration interface.
       
    92      *
       
    93      * @since TB 9.2
       
    94      * @param aError Symbian error code. 
       
    95      * @return void.
       
    96      */
       
    97     void CopyProtectionListenFailed( TInt aError );
       
    98 
       
    99     /**
       
   100      * This called after current copy protection status is read from
       
   101      * TV OU Config interface.
       
   102      *
       
   103      * @since TB 9.2
       
   104      * @param aCopyProtectionStatus Current status. 
       
   105      * @return void.
       
   106      */
       
   107     void CopyProtectionStatusGot( TBool aCopyProtectionStatus );
       
   108     
       
   109     /**
       
   110      * This called after setting change is notified
       
   111      * from TV Out Configuration interface.
       
   112      *
       
   113      * @since TB 9.2
       
   114      * @param None. 
       
   115      * @return void.
       
   116      */
       
   117     void SettingsChangedL();
       
   118     
       
   119 
       
   120     // from base class MPdeFSM
       
   121 
       
   122 
       
   123     /**
       
   124      * Process a command received from the Accessory FW.
       
   125      * Process command handled will be replied through the MPDAsyCmdHandler
       
   126      * interface when the command is fully handled.
       
   127      * 
       
   128      * @since TB9.2
       
   129      * @param aCommand Command to be processed.
       
   130      * @param aCmdParams Command parameters.
       
   131      * @param aAsyCmdHandler Call back interface to process command response.
       
   132      * @return TBool ETrue if command belonged to called FSM.
       
   133      */
       
   134     virtual TBool ProcessCommandL( const TProcessCmdId aCommand,
       
   135         const TASYCmdParams& aCmdParams,
       
   136         MPDAsyCmdHandler& aAsyCmdHandler );    
       
   137     
       
   138     /**
       
   139      * Get the Generic ID of connected accessory.
       
   140      * 
       
   141      * @since TB9.2
       
   142      * @param aAccPolGenericID Object where to copy actual values.
       
   143      * @return Error code. KErrNotFound if don't exist.
       
   144      */
       
   145     virtual TInt GetAccPolGenericID( TAccPolGenericID& aAccPolGenericID );
       
   146 
       
   147     
       
   148 // from base class MFSMForBody
       
   149 
       
   150 
       
   151     /**
       
   152       * From MFSMForBody.
       
   153      * Function is called by host object to indicate that FSM can proceed to 
       
   154      * initial state and make necessary initialization actions.
       
   155      * 
       
   156      * @since TB 9.2
       
   157      * @param none. 
       
   158      * @return void.
       
   159      */
       
   160     virtual void Start();
       
   161 
       
   162     /**
       
   163      * Get the FSM's Id.
       
   164      *
       
   165      * @since TB 9.2
       
   166      * @param none. 
       
   167      * @return TFSMId FSM identification.
       
   168      */
       
   169     virtual TFSMId FSMID();
       
   170 
       
   171     /**
       
   172      * From MFSMForBody.
       
   173      * Get the id of current state.
       
   174      *
       
   175      * @since TB 9.2
       
   176      * @param none. 
       
   177      * @return TFSMState Current state identification.
       
   178      */
       
   179     virtual TFSMState CurrentStateID();
       
   180 
       
   181     /**
       
   182      * From MFSMForBody.
       
   183      * Function is called whenever an event that might have impact 
       
   184      * on the state machine occurs.
       
   185      *
       
   186      * @since TB 9.2
       
   187      * @param aInterfaceId Interface identification.
       
   188      * @param aEvent Event identification.
       
   189      * @return none.
       
   190      */
       
   191     virtual void Input(
       
   192             TFSMInterfaceId aInterfaceId ,
       
   193             TFSMEventId aEvent );
       
   194 
       
   195     /**
       
   196      * From MFSMForBody.
       
   197      * Get the pointer of current state object.
       
   198      *
       
   199      * @since TB 9.2
       
   200      * @param none. 
       
   201      * @return MFSMState* Current state's interface pointer.
       
   202      */
       
   203     virtual MFSMState* CurrentState();
       
   204 
       
   205     /**
       
   206      * From MFSMForBody.
       
   207      * Get the name of current state.
       
   208      *
       
   209      * @since TB 9.2
       
   210      * @param none. 
       
   211      * @return TPtrC Name of the current state.
       
   212      */
       
   213     virtual TPtrC CurrentStateName();
       
   214 
       
   215     /**
       
   216      * Get the ids of current main and substate id.
       
   217      *
       
   218      * @since TB 9.2
       
   219      * @param none. 
       
   220      * @return TFSMMainAndSubState Current main- and substate ids.
       
   221      *         Substate id is zero if current state havent any substates.
       
   222      */
       
   223     virtual TFSMMainAndSubState CurrentMainAndSubstateIDs();
       
   224 
       
   225 // from base class MFSMForState
       
   226 
       
   227     /**
       
   228      * From MFSMForState.
       
   229      * Function is called by  current state to indicate that FSM has to change
       
   230      * its state. Pervious state has performed necessary exit actions if any.
       
   231      *
       
   232      * @since TB 9.2
       
   233      * @param aNextState Next state where to transit. 
       
   234      * @return TBool True is transition valid. False if nextstate value invalid.
       
   235      */
       
   236     virtual TBool Transit( TFSMState aNextState );
       
   237     
       
   238     CPDEngine * GetPDEngine() { return iPdEngine; }
       
   239     
       
   240 protected:
       
   241 
       
   242 
       
   243 private:
       
   244 
       
   245     /**
       
   246      * C++ default constructor.
       
   247      */
       
   248     CHDMICableStatusFSM();
       
   249 
       
   250     /**
       
   251      * By default Symbian OS constructor is private.
       
   252      * @param aAccessoryServer Accessory Server.
       
   253      */
       
   254     void ConstructL(
       
   255             RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine );
       
   256 
       
   257     /**
       
   258      * Initialize the Standby Figure settings
       
   259      * 
       
   260      * @param None
       
   261      * @return None
       
   262      */
       
   263     void SetStandbyFiguresSettingsL();
       
   264     
       
   265 private: // data
       
   266 
       
   267     /**
       
   268      * An array for state object pointers.
       
   269      * Own
       
   270      */
       
   271     MFSMState* iStateArray[ EHDMICableStateNbrOfUsedStates ];
       
   272     
       
   273     /**
       
   274      * Identification of the current state. Used to point the 
       
   275      * corresponding state object in the above array. 
       
   276      * 0 <= a valid state id =< EHDMICableStateMaxValue
       
   277      */
       
   278     TFSMState iCurrentStateId;
       
   279 
       
   280     /**
       
   281      * TV Out Configuration's Listener.
       
   282      * Own
       
   283      */
       
   284     CTVOutConfigForHDMI* iTVOutConfigForHDMI; 
       
   285 
       
   286     /**
       
   287      * EDID data Handler.
       
   288      * Own
       
   289      */
       
   290     CEDIDHandler* iEDIDHandler;
       
   291 
       
   292     /**
       
   293      * Accessory Control Interface.
       
   294      * Own
       
   295      */
       
   296     CAccessoryControlIf* iAccessoryControlIf;
       
   297 
       
   298     /**
       
   299      * ASY Command Handler pointer.
       
   300      * Not own
       
   301      */
       
   302     MPDAsyCmdHandler* iAsyCmdHandler;
       
   303     
       
   304     /**
       
   305      * Plugged Display Engine pointer.
       
   306      * Not own
       
   307      */    
       
   308     CPDEngine *iPdEngine;
       
   309     
       
   310     };
       
   311 
       
   312 
       
   313 #endif // C_HDMICABLESTATUSFSM_H