accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/tvoutconfigforhdmi.h
changeset 0 4e1aa6a622a0
child 6 6bb05bdcbe09
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  * CTVOutConfigForHDMI class declaration.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef TVOUTCONFIGFORHDMI_H
       
    20 #define TVOUTCONFIGFORHDMI_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "multifinitestatemachine.h"
       
    25 #include "myasynconeshottimercallback.h"
       
    26 
       
    27 
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CTvOutConfig;
       
    39 class MFSMForBody;
       
    40 class CMyAsyncOneShotTimer;
       
    41 struct THdmiDviTimings;
       
    42 struct TTvSettings;
       
    43 class TSupportedHdmiDviMode;
       
    44 
       
    45 /** Returned struct for function CTVOutConfigForHDMI::ListenCopyProtectionIfNoMissedEvents(). */
       
    46 struct TCopyProtctListenRetValues
       
    47     {
       
    48     TInt iError;
       
    49     TFSMEventId iFSMEventId;
       
    50     };
       
    51 
       
    52 // CLASS DECLARATION
       
    53 /**
       
    54  *  TV Out Configurer for HDMI Cable Status FSM.
       
    55  *
       
    56  *  @code
       
    57  *   ?good_class_usage_example(s)
       
    58  *  @endcode
       
    59  *
       
    60  *  @lib none.
       
    61  *  @since TB 9.2
       
    62  */
       
    63 NONSHARABLE_CLASS( CTVOutConfigForHDMI ): public CActive, public MMyAsyncOneShotTimerCallback
       
    64     {
       
    65     public:  // Constructors and destructor
       
    66 
       
    67         /**
       
    68          * Symbian two phased constructor.
       
    69          * 
       
    70          * @since S60 TB9.2
       
    71          * @param aFSM A FSM.
       
    72          * @return CTVOutConfigForHDMI*
       
    73          */
       
    74         static CTVOutConfigForHDMI* NewL( MFSMForBody& aFSM );
       
    75 
       
    76         /**
       
    77         * Destructor.
       
    78         */
       
    79         virtual ~CTVOutConfigForHDMI();
       
    80         
       
    81     public: // New methods
       
    82         
       
    83         /**
       
    84          * Start listening HDMI Cable connected/disconnected situations if status
       
    85          * haven't changed while not listening.
       
    86          * 
       
    87          * @since TB9.2
       
    88          * @param None.
       
    89          * @return TFSMEventId Event that has occured while not listening:
       
    90          *          EIfTVOutConfigEventUndefined No event occurred,
       
    91          *          EIfTVOutConfigEventCableConnected Connection occurred,
       
    92          *          EIfTVOutConfigEventCableDisconnected Disconnection occurred
       
    93          *          
       
    94          */
       
    95         TFSMEventId ListenHDMICableStatusIfNoMissedEvents();
       
    96 
       
    97         /**
       
    98          * Set list of available Tv-configurations.
       
    99          * 
       
   100          * @since TB9.2
       
   101          * @param  aAnalogConfigs  Available Analog Tv configurations.
       
   102          * @param  aHdmiConfigs    Available HDMI/DVI Tv configurations
       
   103          * @return Symbian error code.
       
   104          */
       
   105         TInt SetAvailableTvConfigList(const RArray<TTvSettings>& aAnalogConfigs, const RArray<THdmiDviTimings>& aHdmiConfigs);
       
   106 
       
   107         /**
       
   108          *  Enables Tv-out. Latest SetConfig() settings are used.
       
   109          *
       
   110          * @since TB9.2
       
   111          * @param  None.
       
   112          * @return void.
       
   113          */
       
   114         void Enable();
       
   115 
       
   116         /**
       
   117          * Disables Tv-out.
       
   118          * 
       
   119          * @since TB9.2
       
   120          * @param  None.
       
   121          * @return void.
       
   122          */
       
   123         void Disable();
       
   124         
       
   125         /**
       
   126          * Start listening for disconnection of HDMI Cable. Connection has failed and
       
   127          * cable has been rejected. Now waiting for end user to disconnect.
       
   128          * 
       
   129          * @since TB9.2
       
   130          * @param None.
       
   131          * @return void
       
   132          *          
       
   133          */
       
   134         void ListenForDisconnection();
       
   135 
       
   136         /**
       
   137          * Get pointer of CTvOutConfig.
       
   138          * 
       
   139          * @since TB9.2
       
   140          * @param  None.
       
   141          * @return CTvOutConfig* Pointer to CTvOutConfig.
       
   142          */
       
   143         CTvOutConfig* GetTvOutConfig();
       
   144 
       
   145         /**
       
   146          * Start listening Copy Protection status if status
       
   147          * haven't changed while not listening.
       
   148          * 
       
   149          * @since TB9.2
       
   150          * @param None.
       
   151          * @return TCopyProtctListenRetValues
       
   152          *          iError error code, KErrNone if OK
       
   153          *          iFSMEventId Event that has occured while not listening:
       
   154          *          EIfTVOutConfigEventUndefined No event occurred,
       
   155          *          EIfTVOutConfigEventCopyProtectionOn Copy Protection set on,
       
   156          *          EIfTVOutConfigEventCableCopyProtectionOff Copy Protection set off
       
   157          *          
       
   158          */
       
   159         TCopyProtctListenRetValues ListenCopyProtectionIfNoMissedEvents();
       
   160 
       
   161         /**
       
   162          * Get latest recorded Copy Protection status.
       
   163          * 
       
   164          * @since TB9.2
       
   165          * @param  None.
       
   166          * @return TBool Copy Protection status.
       
   167          *           
       
   168          */
       
   169         TBool GetLatestRecordedCopyProtectionStatus() const;
       
   170 
       
   171         /**
       
   172          * Reset latest recorded Copy Protection status.
       
   173          * 
       
   174          * @since TB9.2
       
   175          * @param  None.
       
   176          * @return void.
       
   177          *           
       
   178          */
       
   179         void ResetLatestRecordedCopyProtectionStatus();
       
   180 
       
   181         /**
       
   182          * Listen for setting changes in TV Out Configuration.
       
   183          * 
       
   184          * @since TB9.2
       
   185          * @param  None.
       
   186          * @return void.
       
   187          *           
       
   188          */
       
   189         void ListenSettingsChanges();
       
   190 
       
   191         /**
       
   192          * Get the HW supported HDMI display modes
       
   193          * 
       
   194          * @since TB9.2
       
   195          * @param  asupportedModes   place holder for getting the list of display modes.
       
   196          * @return KErrNone if OK. KErrNotFound if the filtered list is empty.
       
   197          *           
       
   198          */
       
   199 		TInt GetSupportedHdmiModes( RArray<TSupportedHdmiDviMode>& asupportedModes );
       
   200 
       
   201     private:  // Constructors
       
   202 
       
   203         /**
       
   204         * C++ constructor.
       
   205         * @param aFSMForBody A FSM.
       
   206         */
       
   207         CTVOutConfigForHDMI( MFSMForBody& aFSM );
       
   208 
       
   209         /**
       
   210         * Symbian 2nd phase constructor.
       
   211         * 
       
   212         */
       
   213         void ConstructL();
       
   214 
       
   215         /**
       
   216         * Provides Hdmi Dvi Timings
       
   217         */
       
   218         void ReadHdmiDviTimings( THdmiDviTimings& aSetting );
       
   219 
       
   220         /**
       
   221          * From MMyAsyncOneShotTimerCallback
       
   222          * This is called when one shot asyncronous timer has elapsed.
       
   223          * 
       
   224          * @since TB9.2
       
   225          * @param  None.
       
   226          * @return void.
       
   227          *           
       
   228          */
       
   229         virtual void OneShotTimeout();
       
   230 
       
   231     private: // Functions from base classes        
       
   232         
       
   233         enum TOpt
       
   234           {
       
   235           EOptStartListenHdmiCable,
       
   236           EOptListenHdmiCable,
       
   237           EOptEnableTv,
       
   238           EOptDisableTv,
       
   239           EOptIdle,
       
   240           EOptListenCopyProtection,
       
   241           EOptStartListenForDisconnection,
       
   242           EOptListenForDisconnection,
       
   243           EOptStartListenForSettingsChanges,
       
   244           EOptListenForSettingsChanges
       
   245           };
       
   246 
       
   247         /**
       
   248         * RunL()
       
   249         */
       
   250         void RunL();
       
   251 
       
   252         /**
       
   253         * DoCancel()
       
   254         */
       
   255         void DoCancel();
       
   256 
       
   257         /**
       
   258         * RunError(aError)
       
   259         */
       
   260         TInt RunError(TInt aError);
       
   261         
       
   262     private: // Functions from base classes
       
   263 
       
   264 
       
   265     private:  // Data
       
   266         
       
   267         enum
       
   268         {
       
   269         EWaitTimeInMsForTvOutConfigBusyServer = 50000
       
   270         };
       
   271                 
       
   272         // Handle to TV-out config
       
   273         CTvOutConfig*     iTvConfig;
       
   274 
       
   275         // Next operation
       
   276         TOpt  iNextOpt;
       
   277         
       
   278         // A FSM Body.
       
   279         // Not own.
       
   280         MFSMForBody& iFSM;
       
   281         
       
   282         // Last recorded Copy Protection status value.
       
   283         // Read by calling function: 
       
   284         // TBool CTvOutConfig::CopyProtectionStatus() = 0
       
   285         TBool iLastRecordedCopyProtectEnabledStatus;
       
   286         
       
   287         // Asynchronous timer 
       
   288         CMyAsyncOneShotTimer* iMyAsyncOneShotTimer;
       
   289         
       
   290         // Time out reason and next opt after timer has 
       
   291         // elapsed
       
   292         TOpt  iTimeOutReason;
       
   293     };
       
   294 
       
   295 #endif // TVOUTCONFIGFORHDMI_H