devicesrv_plat/tv_out_config_api/inc/tvoutconfig.h
changeset 83 11da52d4c847
parent 78 3f0699f2e14c
child 84 db3d1bc2aa9c
equal deleted inserted replaced
78:3f0699f2e14c 83:11da52d4c847
     1 /*
       
     2 * Copyright (c) 2007-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:  This API provides access to the display driver.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __TVOUTCONFIG_H__
       
    19 #define __TVOUTCONFIG_H__
       
    20 
       
    21 //- Include Files  ----------------------------------------------------------
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <tvoutconfigdef.h>
       
    25 
       
    26 //- Class and Enumeration Definitions ---------------------------------------
       
    27 
       
    28 /** API version number:
       
    29  2:  Symbian PREQ2102 changes. SettingsChangedListener, SetAvailableTvConfigList and PAR for CVBS
       
    30  1:  First version, which have ApiVersion method. @see ApiVersion. */
       
    31 const TUint KTvOutConfigVersion = 2;
       
    32 
       
    33 /**
       
    34 Adaptation API for Tv-out settings
       
    35 */
       
    36 class CTvOutConfig : public CBase
       
    37     {
       
    38     public:
       
    39 
       
    40         /** Gets API version number. Compare this to KTvOutConfigVersion, must match.
       
    41             @return  KTvOutConfigVersion which is used for implementation */
       
    42         IMPORT_C static TUint ApiVersion();
       
    43 
       
    44         ///Destructor
       
    45         virtual ~CTvOutConfig(){};
       
    46 
       
    47         /** Creates object.
       
    48             Method requires ECapabilityReadDeviceData capability.
       
    49             @return  new CTvOutConfig, NULL if there is error, otherwise CTvOutConfig */
       
    50         IMPORT_C static CTvOutConfig* NewL();
       
    51 
       
    52         //-- Capability and Settings ------------------------------------------
       
    53 
       
    54         /** Reads number of supported modes what to be called with GetSupportedHdmiMode.
       
    55             @see GetSupportedHdmiMode
       
    56             @param  aNumberOfModes  Method fills these for caller
       
    57             @return  KErrNone if success, KErrNotSupported if not supported. */
       
    58         virtual TInt GetNumberOfHdmiModes(TUint& aNumberOfModes) = 0;
       
    59 
       
    60         /** Reads supported modes of HDMI hardware
       
    61             @see GetNumberOfHdmiModes
       
    62             @param  aModeNumber  Mode number, begins from 0, up to GetNumberOfHdmiModes.
       
    63             @param  aReadMode    Method fills these for caller
       
    64             @return  KErrNone if success, KErrNotSupported if not supported. */
       
    65         virtual TInt GetSupportedHdmiMode(TUint aModeNumber, TSupportedHdmiDviMode& aReadMode) = 0;
       
    66 
       
    67         /** Reads capabilities of own HDMI hardware.
       
    68             @param  aConnector  Capabilities to be fetched for this connector type
       
    69             @param  aReadCapabilities  Method fills these for caller
       
    70             @return  KErrNone if success, KErrNotSupported if not supported. */
       
    71         virtual TInt GetTvHwCapabilities(TTvSettings::TOutput aConnector, THwCapabilities& aReadCapabilities) = 0;
       
    72 
       
    73         /** Before Tv-out using, SetConfig must be called (during boot and always
       
    74             when settings or connector are changed).
       
    75             Fill correct values to TTvSettings object and give it by parameter.
       
    76 
       
    77             Some settings can be changed on the fly (while tv-out enabled, some settings
       
    78             will be in use only after Tv-out Disable()/Enable() sequency. For example,
       
    79             if e.g. overscan is changed on the fly, client gives same early filled struct but only
       
    80             overscan members are different. KErrNone will be returned if change was success,
       
    81             if HW cannot change settings on the fly (without Disable()/Enable()) then
       
    82             KErrNotReady is returned. When KErrNotReady is returned, settings are needed
       
    83             to write with KErrNone after Disable() and before Enable()
       
    84 
       
    85             If this is called, THdmiDviTimings will not be used anymore and vice versa.
       
    86 
       
    87             @param  aTvSettings  Object which contains wanted setting (e.g. PAL/NTSC/...)
       
    88             @return Symbian error code, KErrNotSupported if not supported,
       
    89                                         KErrArgument if aTvSettings was ignored,
       
    90                                         KErrNotFound when Tv-out driver not found.
       
    91                                         KErrNotReady - Disable()/Enable() sequence is needed */
       
    92         virtual TInt SetConfig(const TTvSettings& aTvSettings) = 0;
       
    93 
       
    94         /** Sets HDMI settings to Hw
       
    95             @see SetConfig(const TTvSettings& aTvSettings) */
       
    96         virtual TInt SetConfig(const THdmiDviTimings& aTvSettings) = 0;
       
    97 
       
    98         /** Use CTvOutConfig::OnOffListener method, when Tv is enabled, then new
       
    99             settings can be read using this method.
       
   100 
       
   101             If this read fails, try also read overloaded version for THdmiDviTimings reading, and vice versa.
       
   102             Latest set version of GetConfig can only return without error, that is the version
       
   103             what is currently used in HW (TTvSettings/THdmiDviTimings)
       
   104 
       
   105             @pre SetConfig is called without errors
       
   106             @param  aTvSettings  Object which contains wanted setting (e.g. PAL/NTSC/...)
       
   107             @return Symbian error code, KErrNotSupported if not supported,
       
   108                                         KErrArgument if aTvSettings was ignored,
       
   109                                         KErrNotFound when Tv-out driver not found. */
       
   110         virtual TInt GetConfig(TTvSettings& aTvSettings) = 0;
       
   111 
       
   112         ///@see GetConfig(TTvSettings& aTvSettings)
       
   113         virtual TInt GetConfig(THdmiDviTimings& aTvSettings) = 0;
       
   114 
       
   115         /** Adds listener for changed settings
       
   116             Check always aListenerRequest.Int(), it is KErrNone when normal operation.
       
   117             @param  aListenerRequest Will be completed without errors when HDMI cable connected/disconnected
       
   118             @return Symbian error code */
       
   119         virtual TInt SettingsChangedListener(TRequestStatus& aListenerRequest) = 0;
       
   120 
       
   121         /** Cancels listener, @see SettingsChangedListener
       
   122             @return Symbian error code */
       
   123         virtual TInt SettingsChangedListenerCancel() = 0;
       
   124 
       
   125         //-- Standby Figure ---------------------------------------------------
       
   126 
       
   127         /** Returns maximum size of TStandByFigure.iTable in bytes. Deprecated since TB10.2.
       
   128             @param  aMaxFigureSize  Max size of standByFigure in bytes
       
   129             @return  KErrNotSupported if not supported. */
       
   130         virtual TInt StandByFigureMaxSizeInBytes(TUint& aMaxFigureSize) = 0;
       
   131 
       
   132         /** Sets user defined figure to show on tv. Deprecated since TB10.2.
       
   133             @pre SetConfig() is called without errors.
       
   134             @param  aStandByFigure  TStandByFigure object.
       
   135             @return KErrNone if all success */
       
   136         virtual TInt StandByFigure(const TStandByFigure& aStandByFigure) = 0;
       
   137 
       
   138         /** Gets user defined figure to show on tv. Deprecated since TB10.2.
       
   139             @see CTvOutConfig::StandByFigureMaxSizeInBytes for getting size of TStandByFigure.iTable.
       
   140             @pre StandByFigure() is called without errors.
       
   141             @param  aStandByFigure  TStandByFigure object.
       
   142             @return KErrNone if all success */
       
   143         virtual TInt GetStandByFigure(TStandByFigure& aStandByFigure) = 0;
       
   144 
       
   145         //-- Enable and Disable -----------------------------------------------
       
   146 
       
   147         /** Enables Tv-out. Latest SetConfig() settings are used.
       
   148             @pre SetConfig() is called without errors.
       
   149             @return Symbian Error Code, KErrNotSupported if not supported,
       
   150                                         KErrNotReady if SetConfig() failed,
       
   151                                         KErrAlreadyExists if was enabled,
       
   152                                         KErrServerBusy if previous task is going,
       
   153                                                        try again later, not immediately */
       
   154         virtual TInt Enable() = 0;
       
   155 
       
   156         /** Disables Tv-out.
       
   157             @pre Enable() is called without errors.
       
   158             @return Symbian Error Code, KErrNotSupported if not supported,
       
   159                                         KErrNotReady if SetConfig() failed,
       
   160                                         KErrAlreadyExists if was disabled,
       
   161                                         KErrServerBusy if previous task is going,
       
   162                                                        try again later, not immediately */
       
   163         virtual TInt Disable() = 0;
       
   164 
       
   165         //-- Listeners and Status ---------------------------------------------
       
   166 
       
   167         /** Adds listener for tv-out enable/disable situations.
       
   168             Check always aListenerRequest.Int(), it is KErrNone when normal operation.
       
   169             @param  aListenerRequest Will be completed without errors when tv-out
       
   170                                      changing state to on or off.
       
   171             @return Symbian error code */
       
   172         virtual TInt OnOffListener(TRequestStatus& aListenerRequest) = 0;
       
   173 
       
   174         /** Cancels listener, @see OnOffListener
       
   175             @return Symbian error code */
       
   176         virtual TInt OnOffListenerCancel() = 0;
       
   177 
       
   178         /** Asks is TV-out enabled or not
       
   179             @return State of TV-out, EFalse when TV-out is disabled or if not supported (or error occured),
       
   180                                      ETrue when TV-out is enabled */
       
   181         virtual TBool Enabled() = 0;
       
   182 
       
   183         /** Adds listener for HDMI connected/disconnected situations.
       
   184             Check always aListenerRequest.Int(), it is KErrNone when normal operation.
       
   185             @param  aListenerRequest Will be completed without errors when HDMI cable connected/disconnected
       
   186             @return Symbian error code */
       
   187         virtual TInt HdmiCableListener(TRequestStatus& aListenerRequest) = 0;
       
   188 
       
   189         /** Cancels listener, @see HdmiCableListener
       
   190             @return Symbian error code */
       
   191         virtual TInt HdmiCableListenerCancel() = 0;
       
   192 
       
   193         /** Asks is HDMI-cable connected or not
       
   194             @return State of HDMI-cable, EFalse when HDMI cable is not connected or if not supported
       
   195                                          ETrue when HDMI cable is connected */
       
   196         virtual TBool HdmiCableConnected() = 0;
       
   197 
       
   198         // Following functions are needed for discussion with Tv-Manager:
       
   199 
       
   200         /** Set list of available Tv-configurations
       
   201             @param  aAnalogConfigs  Available Analog Tv configurations
       
   202             @param  aHdmiConfigs    Available HDMI/DVI Tv configurations
       
   203             @return Symbian error code */
       
   204         virtual TInt SetAvailableTvConfigList(const RArray<TTvSettings>& aAnalogConfigs, const RArray<THdmiDviTimings>& aHdmiConfigs) = 0;
       
   205 
       
   206         /** Get list of available Tv-configurations
       
   207             @param  aAnalogConfigs  Available Analog Tv configurations
       
   208             @param  aHdmiConfigs    Available HDMI/DVI Tv configurations
       
   209             @return Symbian error code */
       
   210         virtual TInt GetAvailableTvConfigList(RArray<TTvSettings>& aAnalogConfigs, RArray<THdmiDviTimings>& aHdmiConfigs) = 0;
       
   211 
       
   212         /** Listener for SetAvailableTvConfigList()
       
   213             Check always aListenerRequest.Int(), it is KErrNone when normal operation.
       
   214             @param  aListenerRequest Will be completed without errors when SetAvailableTvConfigList is called
       
   215             @return Symbian error code */
       
   216         virtual TInt AvailableTvConfigListListener(TRequestStatus& aListenerRequest) = 0;
       
   217 
       
   218         /** Cancels listener, @see AvailableTvConfigListListener
       
   219             @return Symbian error code */
       
   220         virtual TInt AvailableTvConfigListListenerCancel() = 0;
       
   221 
       
   222         //-- Protection -------------------------------------------------------
       
   223 
       
   224         /** Listener for status of copy protection (e.g. HDCP). After this, check newest status with CopyProtectionStatus()
       
   225             HDCP may drop off with CopyProtection(EFalse) or when authentication is failed.
       
   226             @see CopyProtectionStatus()
       
   227             @param  aListenerRequest Will be completed without errors when HDCP status in output will change (ESS)
       
   228             @return Symbian error code */
       
   229         virtual TInt CopyProtectionStatusListener(TRequestStatus& aListenerRequest) = 0;
       
   230 
       
   231         /** Cancels listener, @see CopyProtectionStatusListener
       
   232             @return Symbian error code */
       
   233         virtual TInt CopyProtectionStatusCancel() = 0;
       
   234 
       
   235         /** Asks is HDCP/macrovision enabled or not at the moment in Tv-output.
       
   236             @pre Tv-out is enabled (Enabled() returns ETrue)
       
   237             @return ETrue when protection is enabled on Tv-output, EFalse otherwise */
       
   238         virtual TBool CopyProtectionStatus() = 0;
       
   239 
       
   240         /** Enables/disables HDCP/Macrovision on Tv-output. All clients of CTvOutConfig has to
       
   241             disable protection, before protection on output can be disabled.
       
   242             CopyProtectionStatus() will be completed when protection state is changed (not necessarily ever).
       
   243 
       
   244             ETrue = When client wants to enable protection.
       
   245             Protection is enabled after CopyProtectionStatus() returns ETrue (after listener).
       
   246             If sink does not support e.g. the HDCP, adaptation will try to enable that periodically
       
   247             and will trigger the listener when success and state changes.
       
   248 
       
   249             EFalse = When client wants to disable protection. If any other CTvOutConfig's client is not
       
   250             called this method with ETrue, output will be unprotected after CopyProtectionStatusListener().
       
   251             When HDCP is dropped out (CopyProtectionStatusListener()), this method should be called
       
   252             with EFalse (before next try with ETrue), that tells for adaptation that buffer content
       
   253             can be shown on Tv without protection.
       
   254 
       
   255             @param  aCopyProtectEnabled  ETrue when output is wanted to be protected
       
   256             @return Symbian error code, KErrNotSupported if feature is missing. */
       
   257         virtual TInt CopyProtection(TBool aCopyProtectEnabled) = 0;
       
   258 
       
   259     protected:
       
   260         ///Constructor
       
   261         CTvOutConfig(){};
       
   262         ///Second phase constructor
       
   263         virtual void ConstructL() = 0;
       
   264     };
       
   265 
       
   266 //- Inline Functions --------------------------------------------------------
       
   267 
       
   268 #endif //__TVOUTCONFIG_H__
       
   269 
       
   270 // End of File
       
   271 
       
   272