accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestatusfsm.cpp
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 #include <f32file.h>
       
    19 #include <e32std.h>
       
    20 #include <accpolhdmiobjectcon.h>
       
    21 #include <accpolhdmisink.h>
       
    22 #include <accpolhdmiaudioformat.h>
       
    23 #include <accpolhdmivideoformat.h>
       
    24 #include <accpolhdmilatency.h>
       
    25 #include <accpolhdmispeakerallocation.h>
       
    26 #include <data_caging_path_literals.hrh>
       
    27 
       
    28 #include "pdeconstants.h"
       
    29 #include "accessorycontrolif.h"
       
    30 #include "hdmicablestateidle.h"
       
    31 #include "hdmicablestateconnected.h"
       
    32 #include "hdmicablestaterejected.h"
       
    33 #include "hdmicablestatusfsm.h"
       
    34 #include "tvoutconfigforhdmi.h"
       
    35 #include "pdasycmdhandlerinterface.h"
       
    36 #include "edidhandler.h"
       
    37 #include "trace.h"
       
    38 #include "cleanupresetanddestroy.h"
       
    39 #include "tvstandbyfigure.h"
       
    40 #include "TVOutStandbyFigure.mbg"  //located in \Data folder
       
    41 
       
    42 
       
    43 //The standby image
       
    44 _LIT(KHDMIStandbyFigureName,"z:tvoutstandbyfigure.mbm");
       
    45 
       
    46 // ======== LOCAL FUNCTIONS ========
       
    47 
       
    48 
       
    49 // ======== MEMBER FUNCTIONS ========
       
    50 
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // Symbian two-phased constructor
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CHDMICableStatusFSM* CHDMICableStatusFSM::NewL(
       
    57         RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine )
       
    58     {
       
    59     FUNC_LOG;
       
    60     CHDMICableStatusFSM* self = new ( ELeave ) CHDMICableStatusFSM();
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL( aAccessoryServer, aPdEngine );
       
    63     CleanupStack::Pop( self );    
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Destructor
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CHDMICableStatusFSM::~CHDMICableStatusFSM()
       
    72     {
       
    73     FUNC_LOG;
       
    74     iCurrentStateId = EHDMICableStateUndefined;
       
    75     // Delete state objects
       
    76     for (TInt i = 0; i < EHDMICableStateMaxValue; i++ )
       
    77         {
       
    78         delete iStateArray[i];
       
    79         }
       
    80     if ( iAccessoryControlIf )
       
    81         {
       
    82         iAccessoryControlIf->Cancel();
       
    83         delete iAccessoryControlIf;
       
    84         }
       
    85     if ( iTVOutConfigForHDMI )
       
    86         {
       
    87         iTVOutConfigForHDMI->Cancel();
       
    88         delete iTVOutConfigForHDMI;
       
    89         }
       
    90     if ( iEDIDHandler )
       
    91         {
       
    92         iEDIDHandler->Cancel();
       
    93         delete iEDIDHandler;        
       
    94         }
       
    95     }
       
    96 
       
    97 
       
    98 //------------------------------------------------------------------------------
       
    99 //  From MPdeFSM.
       
   100 //------------------------------------------------------------------------------
       
   101 //
       
   102 TBool CHDMICableStatusFSM::ProcessCommandL( 
       
   103     const TProcessCmdId aCommand,
       
   104     const TASYCmdParams& aCmdParams,
       
   105     MPDAsyCmdHandler& aAsyCmdHandler )
       
   106     {
       
   107     FUNC_LOG;
       
   108     TBool commandHandled( EFalse );
       
   109     TASYCommandParamRecord cmdParams( aCmdParams());
       
   110     if ( iAccessoryControlIf->GetUniqueID() ==  cmdParams.iGenericID.UniqueID() )
       
   111         {
       
   112         commandHandled = ETrue;
       
   113         iAsyCmdHandler = &aAsyCmdHandler;
       
   114         TUint32 name;
       
   115         cmdParams.iNameRecord.GetName( name);
       
   116         TInt retVal( KErrNotFound );
       
   117         TFSMMainAndSubState currentStates = CurrentMainAndSubstateIDs();
       
   118         switch ( aCommand )
       
   119             {
       
   120             case ECmdGetObjectValue:
       
   121                 {
       
   122                 INFO( "Received command ECmdGetObjectValue" );
       
   123                 CAccPolHdmiObjectCon* hdmiObjectCon = CAccPolHdmiObjectCon::NewLC();
       
   124                 
       
   125                 if (    ( EHDMICableStateConnected == currentStates.iMainState ) &&
       
   126                         ( CHDMICableStateConnected::ESubStateConnected == currentStates.iSubstate ) )
       
   127                     {                    
       
   128                     if ( KAccVideoHdmiAttributes == name )
       
   129                         {
       
   130                         INFO( "Object name KAccVideoHdmiAttributes" );
       
   131                         retVal = KErrNone;
       
   132                         }
       
   133                     else if ( KAccVideoFormat == name )
       
   134                         {
       
   135                         INFO( "Object name KAccVideoFormat" );
       
   136                         retVal = KErrNone;
       
   137                         }
       
   138                     else
       
   139                         {
       
   140                         INFO_1( "Unexpected capability name %i", name );
       
   141                         }
       
   142                     if ( KAccVideoHdmiAttributes == name )
       
   143                         {
       
   144                         CAccPolHdmiSink* hdmiSink = iEDIDHandler->CreateHdmiSinkL();
       
   145                         if( hdmiSink )
       
   146                             {
       
   147                             CleanupStack::PushL( hdmiSink );
       
   148                             hdmiObjectCon->AddL( *hdmiSink );
       
   149                             CleanupStack::PopAndDestroy( hdmiSink );
       
   150                             }
       
   151                         }
       
   152                     
       
   153                     if ( ( KAccVideoHdmiAttributes == name ) ||
       
   154                          ( KAccVideoFormat == name ) )
       
   155                         {
       
   156                         RAccPolHdmiVideoFormatArray hdmiVideoFormatArray;
       
   157                         CleanupResetAndDestroyPushL( hdmiVideoFormatArray );
       
   158                         iEDIDHandler->CreateHdmiVideoFormatL( hdmiVideoFormatArray );
       
   159                         TInt count = hdmiVideoFormatArray.Count();
       
   160                         for ( TInt i = 0; i < count; ++i )
       
   161                             {
       
   162                             hdmiObjectCon->AddL( *hdmiVideoFormatArray[i] );
       
   163                             }
       
   164                         CleanupStack::PopAndDestroy( &hdmiVideoFormatArray );
       
   165                         }
       
   166                     
       
   167                     if ( KAccVideoHdmiAttributes == name )
       
   168                         {
       
   169                         RAccPolHdmiLatencyArray hdmiLatencyArray;
       
   170                         CleanupResetAndDestroyPushL( hdmiLatencyArray );
       
   171                         iEDIDHandler->CreateHdmiLatencyL( hdmiLatencyArray );
       
   172                         TInt count = hdmiLatencyArray.Count();
       
   173                         for( TInt i = 0; i < count; i++ )
       
   174                             {
       
   175                             hdmiObjectCon->AddL( *hdmiLatencyArray[i] );
       
   176                             }
       
   177                         CleanupStack::PopAndDestroy( &hdmiLatencyArray );
       
   178                         }
       
   179                     
       
   180                     if ( KAccVideoHdmiAttributes == name )
       
   181                         {
       
   182                         RAccPolHdmiAudioFormatArray hdmiAudioFormatArray;
       
   183                         CleanupResetAndDestroyPushL( hdmiAudioFormatArray );
       
   184                         iEDIDHandler->CreateHdmiAudioFormatL( hdmiAudioFormatArray );
       
   185                         TInt count = hdmiAudioFormatArray.Count();
       
   186                         for ( TInt i = 0; i < count; ++i )
       
   187                             {
       
   188                             hdmiObjectCon->AddL( *hdmiAudioFormatArray[i] );
       
   189                             }
       
   190                         CleanupStack::PopAndDestroy( &hdmiAudioFormatArray );
       
   191                         }
       
   192                     
       
   193                     if ( KAccVideoHdmiAttributes == name )
       
   194                         {
       
   195                         CAccPolHdmiSpeakerAllocation* hdmiSpeakerAllocation =
       
   196                             iEDIDHandler->CreateHdmiSpeakerAllocationL();
       
   197                         if( hdmiSpeakerAllocation )
       
   198                             {
       
   199                             CleanupStack::PushL( hdmiSpeakerAllocation );
       
   200                             hdmiObjectCon->AddL( *hdmiSpeakerAllocation );
       
   201                             CleanupStack::PopAndDestroy( hdmiSpeakerAllocation );
       
   202                             }
       
   203                         }                    
       
   204                     aAsyCmdHandler.ProcessResponse( *hdmiObjectCon, retVal );
       
   205                     }
       
   206                 else
       
   207                     {
       
   208                     INFO( "HDMI Cable is not connected" );
       
   209                     aAsyCmdHandler.ProcessResponse( *hdmiObjectCon, KErrHardwareNotAvailable );                   
       
   210                     }
       
   211                 CleanupStack::PopAndDestroy( hdmiObjectCon );
       
   212                 }
       
   213                 break;
       
   214             case ECmdGetValueBool:
       
   215                 {
       
   216                 INFO( "Received command ECmdGetValueBool" );
       
   217                 TAccValueTypeTBool typeTBool;
       
   218                 typeTBool.iValue = EFalse;
       
   219                 if ( KAccVideoHdcpSupportStatus == name )
       
   220                     {
       
   221                     if (    ( EHDMICableStateConnected == currentStates.iMainState ) &&
       
   222                             ( CHDMICableStateConnected::ESubStateConnected == currentStates.iSubstate ) )
       
   223                          {
       
   224                          Input( EPDEIfAsyCommandHandler, EIfAsyCommandHandlerEventGetCopyProtectStatus );
       
   225                          // CopyProtectionStatusGot() will be called later and command is responded there
       
   226                          }
       
   227                     else
       
   228                          {
       
   229                          INFO( "HDMI Cable is not connected" );
       
   230                          iAsyCmdHandler->ProcessResponse( typeTBool, KErrHardwareNotAvailable );
       
   231                          }
       
   232                     }
       
   233                 else
       
   234                     {
       
   235                     INFO( "Unsupported cabability name" );
       
   236                     iAsyCmdHandler->ProcessResponse( typeTBool, KErrNotSupported );                   
       
   237                     }
       
   238                 }
       
   239                 break;
       
   240             case ECmdSetValueBool:
       
   241                 INFO( "Received command ECmdSetValueBool" );
       
   242                 TAccValueTypeTBool typeTBool;
       
   243                 typeTBool.iValue = EFalse;
       
   244                 if ( KAccVideoHdcpSupport == name )
       
   245                     {
       
   246                     if (    ( EHDMICableStateConnected == currentStates.iMainState ) &&
       
   247                             ( CHDMICableStateConnected::ESubStateConnected == currentStates.iSubstate ) )
       
   248                         {
       
   249                         TBool requestedCopyProtectStatus = (TBool)cmdParams.iCmdValue;
       
   250                         if ( requestedCopyProtectStatus )
       
   251                             {
       
   252                             Input( EPDEIfAsyCommandHandler, EIfAsyCommandHandlerEventSetCopyProtectionOn );
       
   253                             }
       
   254                         else
       
   255                             {
       
   256                             Input( EPDEIfAsyCommandHandler, EIfAsyCommandHandlerEventSetCopyProtectionOff );                    
       
   257                             }
       
   258                         // CopyProtectionSettingDone() will be called later and command is responded there
       
   259                         }
       
   260                     else
       
   261                         {
       
   262                         INFO( "HDMI Cable is not connected" );
       
   263                         iAsyCmdHandler->ProcessResponse( typeTBool, KErrHardwareNotAvailable );
       
   264                         }
       
   265                     }
       
   266                 else
       
   267                     {
       
   268                     INFO( "Unsupported cabability name" );
       
   269                     iAsyCmdHandler->ProcessResponse( typeTBool, KErrNotSupported );                   
       
   270                     }
       
   271                 break;
       
   272             default:
       
   273                 {
       
   274                 INFO_1( "Unknown command %i", aCommand );
       
   275                 }
       
   276                 break;
       
   277             }        
       
   278         }
       
   279     return commandHandled;
       
   280     }
       
   281 
       
   282 //------------------------------------------------------------------------------
       
   283 //  From MPdeFSM.
       
   284 //------------------------------------------------------------------------------
       
   285 //
       
   286 TInt CHDMICableStatusFSM::GetAccPolGenericID( TAccPolGenericID& aAccPolGenericID )
       
   287     {
       
   288     FUNC_LOG;
       
   289     return iAccessoryControlIf->GetAccPolGenericID( aAccPolGenericID );
       
   290     }
       
   291 
       
   292 
       
   293 // ---------------------------------------------------------------------------
       
   294 // From MFSMForBody.
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 void CHDMICableStatusFSM::Start()
       
   298     {
       
   299     FUNC_LOG;
       
   300     // Step to the initial state.
       
   301     iCurrentStateId = EHDMICableStateIdle;
       
   302     iStateArray[iCurrentStateId]->Enter();
       
   303     return;
       
   304     }
       
   305 
       
   306 
       
   307 // ---------------------------------------------------------------------------
       
   308 // From MFSMForBody.
       
   309 // ---------------------------------------------------------------------------
       
   310 //
       
   311 TFSMId CHDMICableStatusFSM::FSMID()
       
   312     {
       
   313     FUNC_LOG;
       
   314     TFSMId aFSMID( EPDEFSMIdHDMICableStatus );
       
   315     return aFSMID;   
       
   316     }
       
   317 
       
   318 
       
   319 // ---------------------------------------------------------------------------
       
   320 // From MFSMForBody.
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 TFSMState CHDMICableStatusFSM::CurrentStateID()
       
   324     {
       
   325     FUNC_LOG;
       
   326     TFSMState currentState( EHDMICableStateUndefined );
       
   327     if (    ( 0 <= iCurrentStateId ) && 
       
   328             ( EHDMICableStateMaxValue > iCurrentStateId ))
       
   329         {
       
   330         currentState = iCurrentStateId;
       
   331         }
       
   332     INFO_1( "iCurrentStateId %i", iCurrentStateId );
       
   333     return currentState;
       
   334     }
       
   335 
       
   336 // ---------------------------------------------------------------------------
       
   337 // From MFSMForBody.
       
   338 // ---------------------------------------------------------------------------
       
   339 //
       
   340 void CHDMICableStatusFSM::Input(
       
   341         TFSMInterfaceId aInterfaceId ,
       
   342         TFSMEventId aEvent )
       
   343     {
       
   344     FUNC_LOG;
       
   345     if ( EHDMICableStateUndefined != iCurrentStateId )
       
   346         {
       
   347         if ( NULL != iStateArray[iCurrentStateId] )
       
   348             {
       
   349             iStateArray[iCurrentStateId]->Input( aInterfaceId, aEvent );
       
   350             }
       
   351         }  
       
   352     return;
       
   353     }
       
   354 
       
   355 // ---------------------------------------------------------------------------
       
   356 // From MFSMForBody.
       
   357 // ---------------------------------------------------------------------------
       
   358 //
       
   359 MFSMState* CHDMICableStatusFSM::CurrentState()
       
   360     {
       
   361     FUNC_LOG;
       
   362     MFSMState* currentState( NULL );
       
   363     if (    ( 0 <= iCurrentStateId ) && 
       
   364             ( EHDMICableStateMaxValue > iCurrentStateId ))
       
   365         {
       
   366         currentState = iStateArray[iCurrentStateId];
       
   367         }
       
   368     return currentState;
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // From MFSMForBody.
       
   373 // ---------------------------------------------------------------------------
       
   374 //
       
   375 TPtrC CHDMICableStatusFSM::CurrentStateName()
       
   376     {
       
   377     FUNC_LOG;
       
   378     TPtrC currentStateName( KNullDesC );
       
   379     if ( (  0 <= iCurrentStateId ) && 
       
   380          (  EHDMICableStateMaxValue > iCurrentStateId ))
       
   381         {
       
   382         if ( NULL != iStateArray[iCurrentStateId] )
       
   383              {
       
   384              currentStateName.Set( iStateArray[iCurrentStateId]->Name() );
       
   385              }
       
   386         }
       
   387     return currentStateName;
       
   388     }
       
   389 
       
   390 // ---------------------------------------------------------------------------
       
   391 // From MFSMForBody.
       
   392 // ---------------------------------------------------------------------------
       
   393 //
       
   394 TFSMMainAndSubState CHDMICableStatusFSM::CurrentMainAndSubstateIDs()
       
   395     {
       
   396     FUNC_LOG;
       
   397     TFSMMainAndSubState state;
       
   398     state.iMainState = EHDMICableStateUndefined;
       
   399     state.iSubstate = 0;
       
   400     if ( ( 0 <= iCurrentStateId ) && 
       
   401             ( EHDMICableStateMaxValue > iCurrentStateId ))
       
   402         {
       
   403         state.iMainState = iCurrentStateId;
       
   404         state.iSubstate = iStateArray[iCurrentStateId]->SubId();
       
   405         }
       
   406     INFO_2( "Main state id: %i, substate id: %i", state.iMainState, state.iSubstate );
       
   407     return state;
       
   408     }
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // From MFSMForState.
       
   412 // ---------------------------------------------------------------------------
       
   413 //
       
   414 TBool CHDMICableStatusFSM::Transit( TFSMState aNextState )
       
   415     {
       
   416     FUNC_LOG;
       
   417     TBool retVal(EFalse);
       
   418     if ( (  0 <= aNextState ) && 
       
   419          (  EHDMICableStateMaxValue > aNextState ) )
       
   420         {
       
   421         iCurrentStateId = aNextState;
       
   422         if ( NULL != iStateArray[iCurrentStateId])
       
   423             {
       
   424             retVal = ETrue;
       
   425             iStateArray[iCurrentStateId]->Enter();
       
   426             }
       
   427         }
       
   428     if ( EFalse == retVal )
       
   429         {
       
   430         //Something is wrong
       
   431         INFO( "Incorrect nextstate");
       
   432         }   
       
   433     INFO_1( "TBool retVal %i", retVal );
       
   434     return retVal;
       
   435     }
       
   436 
       
   437 // ---------------------------------------------------------------------------
       
   438 // CopyProtectionSettingDone
       
   439 // ---------------------------------------------------------------------------
       
   440 //
       
   441 void CHDMICableStatusFSM::CopyProtectionSettingDone(
       
   442         TInt aError,
       
   443         TBool aCurrentStatus )
       
   444     {
       
   445     FUNC_LOG;
       
   446     if ( iAsyCmdHandler )
       
   447         {
       
   448         INFO_1( "Copy Protection setting returned error code %i", aError );
       
   449         TAccValueTypeTBool typeTBool;
       
   450         typeTBool.iValue = aCurrentStatus;
       
   451         iAsyCmdHandler->ProcessResponse( typeTBool, aError );        
       
   452         iAsyCmdHandler = NULL;
       
   453         }    
       
   454     if ( KErrNone == aError )
       
   455         {
       
   456         CopyProtectionStatusChanged( aCurrentStatus );
       
   457         }        
       
   458     }   
       
   459 
       
   460 // ---------------------------------------------------------------------------
       
   461 // CopyProtectionStatusChanged
       
   462 // ---------------------------------------------------------------------------
       
   463 //
       
   464 void CHDMICableStatusFSM::CopyProtectionStatusChanged( TBool aNewStatus )
       
   465     {
       
   466     FUNC_LOG;
       
   467     INFO_1( "Copy Protection new status %i", aNewStatus );
       
   468     TUint32 name( KAccVideoHdcpSupportStatus );
       
   469     TAccValueTypeTBool typeTBool;
       
   470     typeTBool.iValue = aNewStatus;
       
   471     iAccessoryControlIf->NotifyValueChange( name, typeTBool);
       
   472     }   
       
   473 
       
   474 // ---------------------------------------------------------------------------
       
   475 // CopyProtectionListenFailed
       
   476 // ---------------------------------------------------------------------------
       
   477 //
       
   478 void CHDMICableStatusFSM::CopyProtectionListenFailed( TInt aError )
       
   479     {
       
   480     FUNC_LOG;
       
   481     TInt error( aError ); // Just to get rid of a compiler warning.
       
   482     if ( KErrNone != error )
       
   483         {
       
   484         INFO_1( "Copy Protection listening returned error code %i", error );        
       
   485         }
       
   486     }   
       
   487 
       
   488 // ---------------------------------------------------------------------------
       
   489 // CopyProtectionStatusGot
       
   490 // ---------------------------------------------------------------------------
       
   491 //
       
   492 void CHDMICableStatusFSM::CopyProtectionStatusGot( TBool aCopyProtectionStatus )
       
   493     {
       
   494     FUNC_LOG;
       
   495     if ( iAsyCmdHandler )
       
   496         {
       
   497         INFO_1( "Copy Protection status %i", aCopyProtectionStatus );
       
   498         TAccValueTypeTBool typeTBool;
       
   499         typeTBool.iValue = aCopyProtectionStatus;
       
   500         iAsyCmdHandler->ProcessResponse( typeTBool, KErrNone );
       
   501         iAsyCmdHandler = NULL;
       
   502         }    
       
   503     }   
       
   504 
       
   505 // ---------------------------------------------------------------------------
       
   506 // SettingsChangedL
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 void CHDMICableStatusFSM::SettingsChangedL()
       
   510     {
       
   511     FUNC_LOG;
       
   512     TUint32 name( KAccVideoFormat );
       
   513     CAccPolHdmiObjectCon* hdmiObjectCon = CAccPolHdmiObjectCon::NewLC();
       
   514     TFSMMainAndSubState currentStates = CurrentMainAndSubstateIDs();
       
   515     if (    (hdmiObjectCon) &&
       
   516             ( EHDMICableStateConnected == currentStates.iMainState ) &&
       
   517             ( CHDMICableStateConnected::ESubStateConnected == currentStates.iSubstate ) )
       
   518         {
       
   519         RAccPolHdmiVideoFormatArray hdmiVideoFormatArray;
       
   520         CleanupResetAndDestroyPushL( hdmiVideoFormatArray );
       
   521         iEDIDHandler->CreateHdmiVideoFormatL( hdmiVideoFormatArray );
       
   522         for ( TInt i = 0; i < hdmiVideoFormatArray.Count(); ++i )
       
   523             {
       
   524             hdmiObjectCon->AddL( *hdmiVideoFormatArray[i] );
       
   525             }
       
   526         CleanupStack::PopAndDestroy( &hdmiVideoFormatArray );
       
   527         iAccessoryControlIf->NotifyValueChange( name, *hdmiObjectCon );
       
   528         }                
       
   529     CleanupStack::PopAndDestroy( hdmiObjectCon );
       
   530     }
       
   531 
       
   532 
       
   533 // ---------------------------------------------------------
       
   534 // C++ constructor
       
   535 // ---------------------------------------------------------
       
   536 //
       
   537 CHDMICableStatusFSM::CHDMICableStatusFSM()
       
   538     {
       
   539     FUNC_LOG;
       
   540     }
       
   541 
       
   542 
       
   543 // ----------------------------------------------------------------------------
       
   544 // CHDMICableStatusFSM::SetStandbyFiguresSettingsL
       
   545 //
       
   546 // ----------------------------------------------------------------------------
       
   547 //
       
   548 void CHDMICableStatusFSM::SetStandbyFiguresSettingsL()
       
   549     {
       
   550     FUNC_LOG;
       
   551     
       
   552     TInt err(KErrNone);
       
   553     
       
   554     if( iTVOutConfigForHDMI->GetTvOutConfig() )
       
   555         {
       
   556         //Standby figure
       
   557         TParse parse;
       
   558         TSize figureSize;
       
   559         TStandByFigure figureSettings;
       
   560         
       
   561         parse.Set( KHDMIStandbyFigureName, &KDC_BITMAP_DIR, NULL );
       
   562         TFileName fileName( parse.FullName() );
       
   563     
       
   564         //  Create converter for main standby figure
       
   565         CTvStandbyFigure* mainImage = CTvStandbyFigure::NewLC(
       
   566                     fileName, EMbmGSTvoutStandbyFigureQgn_graf_tvout_logo );
       
   567                     
       
   568         //  Fill the data structure for main standby figure
       
   569         mainImage->GetFigureSize( figureSize );
       
   570     
       
   571         TUint16* RGBData = mainImage->RgbConvertL();
       
   572         figureSettings.iTable = RGBData;
       
   573         
       
   574         figureSettings.iColumns = figureSize.iWidth;
       
   575         figureSettings.iRows = figureSize.iHeight;
       
   576         
       
   577         CleanupStack::PushL(RGBData);
       
   578         figureSettings.iFigureType = TStandByFigure::EStandByFigure;
       
   579         err = iTVOutConfigForHDMI->GetTvOutConfig()->StandByFigure( figureSettings );
       
   580         INFO_1( "iTVOutConfigForHDMI->StandByFigure( figureSettings ) return code %i", err );        
       
   581         figureSettings.iFigureType = TStandByFigure::EProtectedContentFigure;    
       
   582         err = iTVOutConfigForHDMI->GetTvOutConfig()->StandByFigure( figureSettings );
       
   583         INFO_1( "iTVOutConfigForHDMI->StandByFigure( figureSettings ) return code %i", err );        
       
   584 
       
   585         CleanupStack::PopAndDestroy( 2 );        
       
   586         }
       
   587     User::LeaveIfError(err);    
       
   588     }
       
   589 
       
   590 // ---------------------------------------------------------
       
   591 // ConstructL
       
   592 // ---------------------------------------------------------
       
   593 //
       
   594 void CHDMICableStatusFSM::ConstructL(
       
   595         RAccessoryServer& aAccessoryServer, CPDEngine *aPdEngine )
       
   596     {
       
   597     FUNC_LOG;
       
   598     
       
   599     iPdEngine = aPdEngine;
       
   600     
       
   601     // Create interface objecs
       
   602     iAccessoryControlIf = CAccessoryControlIf::NewL( *this, aAccessoryServer );
       
   603     iTVOutConfigForHDMI = CTVOutConfigForHDMI::NewL( *this );
       
   604     iEDIDHandler = CEDIDHandler::NewL( *this, *iTVOutConfigForHDMI );
       
   605     // Create state objects here.
       
   606     iStateArray[ EHDMICableStateIdle ] = CHDMICableStateIdle::NewL( 
       
   607             *this, *iTVOutConfigForHDMI, *iEDIDHandler );
       
   608     iStateArray[ EHDMICableStateConnected ] = CHDMICableStateConnected::NewL( 
       
   609             *iTVOutConfigForHDMI, *iEDIDHandler, *iAccessoryControlIf, *this );
       
   610     iStateArray[ EHDMICableStateRejected ] = CHDMICableStateRejected::NewL( 
       
   611                 *this, *iTVOutConfigForHDMI, *iEDIDHandler  );
       
   612     
       
   613     SetStandbyFiguresSettingsL();
       
   614     
       
   615     return;
       
   616     }
       
   617 
       
   618 // ======== GLOBAL FUNCTIONS ========
       
   619