accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/compositecablestatusfsm.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 Composite Cable Status.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_COMPOSITECABLESTATUSFSM_H
       
    21 #define C_COMPOSITECABLESTATUSFSM_H
       
    22 
       
    23 
       
    24 
       
    25 #include "pdefsm.h"
       
    26 #include "pdengine.h"
       
    27 
       
    28 class CAccessoryConnectionIf;
       
    29 class CTVOutConfigForComposite;
       
    30 
       
    31 
       
    32 
       
    33 /**  Miscellanous constants of HDMI Cable Status FSM.  */
       
    34 enum TCompositeCableStatusFSM
       
    35     {
       
    36     ECompositeCableStatusFSMExample = 0
       
    37     };
       
    38 
       
    39 /**
       
    40  *  Finite State Machine class for HDMI Cable Status.
       
    41  *
       
    42  *  @code
       
    43  *   ?good_class_usage_example(s)
       
    44  *  @endcode
       
    45  *
       
    46  *  @lib none.
       
    47  *  @since TB 9.2
       
    48  */
       
    49 NONSHARABLE_CLASS( CCompositeCableStatusFSM ): public CBase, 
       
    50     public MPdeFSM, public MFSMForState
       
    51     {
       
    52 
       
    53 public:
       
    54 
       
    55     /**
       
    56      * Two-phased constructor.
       
    57      * @param aAccessoryServer Accessory Server.
       
    58      */
       
    59     static CCompositeCableStatusFSM* NewL(
       
    60             RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine );
       
    61     
       
    62 
       
    63     /**
       
    64     * Destructor.
       
    65     */
       
    66     virtual ~CCompositeCableStatusFSM();
       
    67 
       
    68     
       
    69 // from base class MPdeFSM
       
    70 
       
    71 
       
    72         /**
       
    73          * Process a command received from the Accessory FW.
       
    74          * Process command handled will be replied through the MPDAsyCmdHandler
       
    75          * interface when the command is fully handled.
       
    76          * 
       
    77          * @since TB9.2
       
    78          * @param aCommand Command to be processed.
       
    79          * @param aCmdParams Command parameters.
       
    80          * @param aAsyCmdHandler Call back interface to process command response.
       
    81          * @return TBool ETrue if command belonged to called FSM.
       
    82          */
       
    83         virtual TBool ProcessCommandL( const TProcessCmdId aCommand,
       
    84             const TASYCmdParams& aCmdParams,
       
    85             MPDAsyCmdHandler& aAsyCmdHandler );
       
    86         
       
    87         /**
       
    88          * Get the Generic ID of connected accessory.
       
    89          * 
       
    90          * @since TB9.2
       
    91          * @param aAccPolGenericID Object where to copy actual values.
       
    92          * @return Error code. KErrNotFound if don't exist.
       
    93          */
       
    94         virtual TInt GetAccPolGenericID( TAccPolGenericID& aAccPolGenericID );
       
    95         
       
    96         
       
    97 // from base class MFSMForBody
       
    98 
       
    99 
       
   100     /**
       
   101       * From MFSMForBody.
       
   102      * Function is called by host object to indicate that FSM can proceed to 
       
   103      * initial state and make necessary initialization actions.
       
   104      * 
       
   105      * @since TB 9.2
       
   106      * @param none. 
       
   107      * @return void.
       
   108      */
       
   109     virtual void Start();
       
   110 
       
   111     /**
       
   112      * Get the FSM's Id.
       
   113      *
       
   114      * @since TB 9.2
       
   115      * @param none. 
       
   116      * @return TFSMId FSM identification.
       
   117      */
       
   118     virtual TFSMId FSMID();
       
   119 
       
   120     /**
       
   121      * From MFSMForBody.
       
   122      * Get the id of current state.
       
   123      *
       
   124      * @since TB 9.2
       
   125      * @param none. 
       
   126      * @return TFSMState Current state identification.
       
   127      */
       
   128     virtual TFSMState CurrentStateID();
       
   129 
       
   130     /**
       
   131      * From MFSMForBody.
       
   132      * Function is called whenever an event that might have impact 
       
   133      * on the state machine occurs.
       
   134      *
       
   135      * @since TB 9.2
       
   136      * @param aInterfaceId Interface identification.
       
   137      * @param aEvent Event identification.
       
   138      * @return none.
       
   139      */
       
   140     virtual void Input(
       
   141             TFSMInterfaceId aInterfaceId ,
       
   142             TFSMEventId aEvent );
       
   143 
       
   144     /**
       
   145      * From MFSMForBody.
       
   146      * Get the pointer of current state object.
       
   147      *
       
   148      * @since TB 9.2
       
   149      * @param none. 
       
   150      * @return MFSMState* Current state's interface pointer.
       
   151      */
       
   152     virtual MFSMState* CurrentState();
       
   153 
       
   154     /**
       
   155      * From MFSMForBody.
       
   156      * Get the name of current state.
       
   157      *
       
   158      * @since TB 9.2
       
   159      * @param none. 
       
   160      * @return TPtrC Name of the current state.
       
   161      */
       
   162     virtual TPtrC CurrentStateName();
       
   163 
       
   164     /**
       
   165      * Get the ids of current main and substate id.
       
   166      *
       
   167      * @since TB 9.2
       
   168      * @param none. 
       
   169      * @return TFSMMainAndSubState Current main- and substate ids.
       
   170      *         Substate id is zero if current state havent any substates.
       
   171      */
       
   172     virtual TFSMMainAndSubState CurrentMainAndSubstateIDs();
       
   173 
       
   174 // from base class MFSMForState
       
   175 
       
   176     
       
   177     /**
       
   178      * From MFSMForState.
       
   179      * Function is called by  current state to indicate that FSM has to change
       
   180      * its state. Pervious state has performed necessary exit actions if any.
       
   181      *
       
   182      * @since TB 9.2
       
   183      * @param aNextState Next state where to transit. 
       
   184      * @return TBool True is transition valid. False if nextstate value invalid.
       
   185      */
       
   186     virtual TBool Transit( TFSMState aNextState );
       
   187 
       
   188 	  CPDEngine * GetPDEngine() { return iPdEngine; }
       
   189 
       
   190 protected:
       
   191 
       
   192 
       
   193 private:
       
   194 
       
   195     /**
       
   196      * C++ default constructor.
       
   197      */
       
   198     CCompositeCableStatusFSM();
       
   199 
       
   200     /**
       
   201      * By default Symbian OS constructor is private.
       
   202      * @param aAccessoryServer Accessory Server.
       
   203      */
       
   204     void ConstructL(
       
   205             RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine );
       
   206 
       
   207 
       
   208 private: // data
       
   209 
       
   210     /**
       
   211      * An array for state object pointers.
       
   212      * Own
       
   213      */
       
   214     MFSMState* iStateArray[ ECompositeCableStateNbrOfUsedStates ];
       
   215     
       
   216     /**
       
   217      * Identification of the current state. Used to point the 
       
   218      * corresponding state object in the above array. 
       
   219      * 0 <= a valid state id =< ECompositeCableStateMaxValue
       
   220      */
       
   221     TFSMState iCurrentStateId;
       
   222     
       
   223     /**
       
   224      * Accessory Connection Interface.
       
   225      * Own
       
   226      */
       
   227     CAccessoryConnectionIf* iAccessoryConnectionIf;
       
   228     
       
   229     /**
       
   230      * TV Out Config.
       
   231      * Own
       
   232      */
       
   233     CTVOutConfigForComposite*   iTVOutConfigForComposite;
       
   234     
       
   235     /**
       
   236      * Plugged Display Engine pointer.
       
   237      * Not own
       
   238      */    
       
   239     CPDEngine *iPdEngine;
       
   240     
       
   241     };
       
   242 
       
   243 
       
   244 #endif // C_COMPOSITECABLESTATUSFSM_H