accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/pdengine.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:
       
    15  * CPDEngine class declaration.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef PDENGINE_H
       
    20 #define PDENGINE_H
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 #include <AsyCommandHandlerBase.h>
       
    25 #include "pdefsm.h"
       
    26 #include "pdeconstants.h"
       
    27 
       
    28 // USER INCLUDE FILES
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class MPDAsyCmdHandler;
       
    32 class RAccessoryServer;
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39  * CPDEngine class provides the main functionality in the plugged dislay.
       
    40  *
       
    41  *  @code
       
    42  *   ?good_class_usage_example(s)
       
    43  *  @endcode
       
    44  *  
       
    45  * @lib pluggeddisplayengine.lib
       
    46  * @since S60 TB9.2
       
    47  */
       
    48 NONSHARABLE_CLASS( CPDEngine ): public CBase, public MFSMBody
       
    49     {
       
    50 public:
       
    51 
       
    52     /**
       
    53      * Symbian two phased constructors.
       
    54      *
       
    55      * @since S60 TB9.2
       
    56      * @param aAccessoryServer Accessory Server.
       
    57      * @return CPDEngine
       
    58      */
       
    59     IMPORT_C static CPDEngine* NewL( RAccessoryServer& aAccessoryServer );
       
    60     IMPORT_C static CPDEngine* NewLC( RAccessoryServer& aAccessoryServer );
       
    61 
       
    62     /**
       
    63      * C++ destructor.
       
    64      */
       
    65     virtual ~CPDEngine();
       
    66 
       
    67 public:
       
    68 
       
    69     /**
       
    70      * Process a command received from the Accessory FW.
       
    71      * Process command handled will be replied through the MPDAsyCmdHandler
       
    72      * interface when the command is fully handled.
       
    73      * 
       
    74      * @since TB9.2
       
    75      * @param aCommand Command to be processed.
       
    76      * @param aCmdParams Command parameters.
       
    77      * @param aAsyCmdHandler Call back interface to process command response.
       
    78      * @return None.
       
    79      */
       
    80     IMPORT_C void ProcessCommandL( const TProcessCmdId aCommand,
       
    81         const TASYCmdParams& aCmdParams,
       
    82         MPDAsyCmdHandler& aAsyCmdHandler );
       
    83 
       
    84 
       
    85     /**
       
    86      * Get Unique ID of a cable accessory if available.
       
    87      *
       
    88      * @since TB 9.2
       
    89      * @param aFSMId FSM identification.
       
    90      * @param aAccPolGenericID Object where to copy actual values.
       
    91      * @return Error code. KErrNotFound if don't exist.
       
    92      */
       
    93     virtual TInt GetAccPolGenericID( TFSMId aFSMId, TAccPolGenericID& aAccPolGenericID );
       
    94 
       
    95 // from base class MFSMBody
       
    96     /**
       
    97      * From MFSMBody.
       
    98      * Get the id of current state.
       
    99      *
       
   100      * @since TB 9.2
       
   101      * @param aFSMId FSM identification.
       
   102      * @return TFSMState Current state identification.
       
   103      */
       
   104     virtual TFSMState CurrentStateID( TFSMId aFSMId );
       
   105 
       
   106     /**
       
   107      * From MFSMBody.
       
   108      * Function is called whenever an event that might have impact 
       
   109      * on the state machine occurs.
       
   110      *
       
   111      * @since TB 9.2
       
   112      * @param aFSMId FSM identification.
       
   113      * @param aInterfaceId Interface identification.
       
   114      * @param aEvent Event identification.
       
   115      * @return none.
       
   116      */
       
   117     virtual void Input( 
       
   118             TFSMId aFSMId,
       
   119             TFSMInterfaceId aInterfaceId,
       
   120             TFSMEventId aEvent );
       
   121 
       
   122     /**
       
   123      * From MFSMBody.
       
   124      * Get the pointer of current state object.
       
   125      *
       
   126      * @since TB 9.2
       
   127      * @param aFSMId FSM identification.
       
   128      * @return MFSMState* Current state's interface pointer.
       
   129      */
       
   130     virtual MFSMState* CurrentState( TFSMId aFSMId );
       
   131 
       
   132     /**
       
   133      * From MFSMBody.
       
   134      * Get pointer of a given FSM.
       
   135      *
       
   136      * @since TB 9.2
       
   137      * @param aFSMId FSM identification. 
       
   138      * @return MFSMForBody Pointer of the identified FSM.
       
   139      */
       
   140     virtual MFSMForBody* GetFSM( TFSMId aFSMId = 0 );
       
   141 
       
   142     /**
       
   143      * From MFSMBody.
       
   144      * Get the ids of current main and substate id.
       
   145      *
       
   146      * @since TB 9.2
       
   147      * @param aFSMId FSM identification. 
       
   148      * @return TFSMMainAndSubState Current main- and substate ids.
       
   149      *         Substate id is zero if current state haven't any substates.
       
   150      */
       
   151     virtual TFSMMainAndSubState CurrentMainAndSubstateIDs( TFSMId aFSMId = 0 );
       
   152   
       
   153     /**
       
   154      * From MFSMBody.
       
   155      * Get the name of current state.
       
   156      *
       
   157      * @since TB 9.2
       
   158      * @param aFSMId FSM identification.
       
   159      * @return TPtrC Name of the current state.
       
   160      */
       
   161     virtual TPtrC CurrentStateName( TFSMId aFSMId );
       
   162 
       
   163 
       
   164 private:
       
   165 
       
   166     // from base class MFSMBody
       
   167 
       
   168     /**
       
   169       * From MFSMBody.
       
   170      * Function is called by host object to indicate that FSM can proceed to 
       
   171      * initial state and make necessary initialization actions.
       
   172      * 
       
   173      *  @since TB 9.2
       
   174      * @param none. 
       
   175      * @return void.
       
   176      */
       
   177     virtual void Start();
       
   178 
       
   179     CPDEngine();
       
   180     void ConstructL( RAccessoryServer& aAccessoryServer );
       
   181 
       
   182 private: // Data
       
   183     
       
   184     /**
       
   185      * An array for FSM pointers.
       
   186      * Own
       
   187      */
       
   188     MPdeFSM* iFSMPtr[ EPDEFSMIdNbrOfUsedIds ];
       
   189     
       
   190     };
       
   191 
       
   192 #endif // PDENGINE_H