videoplayback/videoplaybackviews/src/mpxvideoplaybackuserinputhandler.cpp
branchRCL_3
changeset 10 ce5ada96ab30
parent 0 96612d01cf9f
child 11 5294c000a26d
equal deleted inserted replaced
6:7d91903f795f 10:ce5ada96ab30
    13 *
    13 *
    14 * Description:  Implementation of playback view's input handler
    14 * Description:  Implementation of playback view's input handler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 14 %
    18 // Version : %version: 15 %
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <w32std.h> // RWindowBase
    22 #include <w32std.h> // RWindowBase
    23 #include <e32base.h>
    23 #include <e32base.h>
    41 #include "videoplaybackcontrol_stub.h"
    41 #include "videoplaybackcontrol_stub.h"
    42 #include "hal_stub.h"
    42 #include "hal_stub.h"
    43 #else
    43 #else
    44 #include "mpxvideoplaybackcontainer.h"
    44 #include "mpxvideoplaybackcontainer.h"
    45 #include "mpxvideoplaybackcontrol.h"
    45 #include "mpxvideoplaybackcontrol.h"
    46 #include <hal.h>
    46 #include <hwrmlight.h> //light status
    47 #include <hal_data.h>
       
    48 #endif
    47 #endif
    49 
    48 
    50 #include "mpxvideoplaybackcontrol.hrh"
    49 #include "mpxvideoplaybackcontrol.hrh"
    51 #include "mpxvideoplaybackuserinputhandler.h"
    50 #include "mpxvideoplaybackuserinputhandler.h"
    52 
    51 
   102     iInterfaceSelector = CRemConInterfaceSelector::NewL();
   101     iInterfaceSelector = CRemConInterfaceSelector::NewL();
   103     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
   102     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
   104 
   103 
   105     iTVOutConnected = aTvOutConnected;
   104     iTVOutConnected = aTvOutConnected;
   106 
   105 
       
   106     iLight = CHWRMLight::NewL();
       
   107 
   107     // Start the timer if TV out is connected
   108     // Start the timer if TV out is connected
   108     if ( iTVOutConnected )
   109     if ( iTVOutConnected )
   109     {
   110     {
   110         // Get the display light time-out value from CenRep
   111         // Get the display light time-out value from CenRep
   111         CRepository* repository = CRepository::NewLC( KCRUidLightSettings  );
   112         CRepository* repository = CRepository::NewLC( KCRUidLightSettings  );
   156 
   157 
   157     // make sure that backlight enabled when
   158     // make sure that backlight enabled when
   158     // the view updates or deactivates
   159     // the view updates or deactivates
   159     EnableBacklight();
   160     EnableBacklight();
   160 
   161 
       
   162     if ( iLight )
       
   163     {
       
   164         delete iLight;
       
   165         iLight = NULL;
       
   166     }
   161 }
   167 }
   162 
   168 
   163 // -------------------------------------------------------------------------------------------------
   169 // -------------------------------------------------------------------------------------------------
   164 // CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
   170 // CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
   165 // -------------------------------------------------------------------------------------------------
   171 // -------------------------------------------------------------------------------------------------
   610 
   616 
   611     // cancel the timer
   617     // cancel the timer
   612     iDisplayTimer->Cancel();
   618     iDisplayTimer->Cancel();
   613 
   619 
   614     // disable the backlight
   620     // disable the backlight
   615     HAL::Set( HALData::EBacklightState, 0 );
   621     MPX_TRAPD( err, 
       
   622     {
       
   623         iLight->ReserveLightL( CHWRMLight::EPrimaryDisplay );
       
   624         iLight->LightOffL( CHWRMLight::EPrimaryDisplay );
       
   625     } );
   616 }
   626 }
   617 
   627 
   618 // -----------------------------------------------------------------------------
   628 // -----------------------------------------------------------------------------
   619 // CMPXVideoPlaybackUserInputHandler::EnableBacklight()
   629 // CMPXVideoPlaybackUserInputHandler::EnableBacklight()
   620 // -----------------------------------------------------------------------------
   630 // -----------------------------------------------------------------------------
   622 void CMPXVideoPlaybackUserInputHandler::EnableBacklight()
   632 void CMPXVideoPlaybackUserInputHandler::EnableBacklight()
   623 {
   633 {
   624     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::EnableBacklight"));
   634     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::EnableBacklight"));
   625 
   635 
   626     // enable the backlight
   636     // enable the backlight
   627     HAL::Set( HALData::EBacklightState, 1 );
   637     MPX_TRAPD( err,
       
   638     {
       
   639         iLight->LightOnL( CHWRMLight::EPrimaryDisplay );
       
   640         iLight->ReleaseLight(CHWRMLight::EPrimaryDisplay );
       
   641     } );
   628 }
   642 }
   629 
   643 
   630 
   644 
   631 // -------------------------------------------------------------------------------------------------
   645 // -------------------------------------------------------------------------------------------------
   632 //   CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent()
   646 //   CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent()
   689     }
   703     }
   690     else
   704     else
   691     {
   705     {
   692         // timeout has happened and the backlight is disabled
   706         // timeout has happened and the backlight is disabled
   693         // enable the backlight
   707         // enable the backlight
   694         HAL::Set( HALData::EBacklightState, 1 );
   708         EnableBacklight();
   695     }
   709     }
   696 
       
   697     TBool backlightState;
       
   698     TInt ret = HAL::Get( HALData::EBacklightState, backlightState );
       
   699 
   710 
   700     // Re start the display backlight timer
   711     // Re start the display backlight timer
   701     iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut,
   712     iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut,
   702                           TCallBack( CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) );
   713                           TCallBack( CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) );
   703 }
   714 }