mpviewplugins/mpplaybackviewplugin/src/mplightmonitor_p.cpp
changeset 61 3cd404d31176
equal deleted inserted replaced
58:ed94e1e8390e 61:3cd404d31176
       
     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: Light monitor for Playback - Private.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "mplightmonitor_p.h"
       
    19 #include "mplightmonitor.h"
       
    20 #include "mptrace.h"
       
    21 
       
    22 
       
    23 /*!
       
    24     \class MpLightMonitorPrivate
       
    25     \brief Wrapper for light monitor - private implementation.
       
    26 
       
    27     This is a private implementation of the light monitor interface.
       
    28 */
       
    29 
       
    30 /*!
       
    31  \internal
       
    32  */
       
    33 MpLightMonitorPrivate::MpLightMonitorPrivate( MpLightMonitor *qq )
       
    34     :q_ptr( qq ),
       
    35     iLightStatus( CHWRMLight::ELightStatusUnknown ),
       
    36     iLight( 0 )
       
    37 {
       
    38     TX_LOG
       
    39 }
       
    40 
       
    41 /*!
       
    42  \internal
       
    43  */
       
    44 void MpLightMonitorPrivate::init()
       
    45 {
       
    46     TX_ENTRY
       
    47     TRAPD(err, DoInitL());
       
    48     if ( err != KErrNone ) {
       
    49         TX_LOG_ARGS("Error: " << err << "; should never get here.");
       
    50     }
       
    51     TX_EXIT
       
    52 }
       
    53 
       
    54 /*!
       
    55  \internal
       
    56  */
       
    57 void MpLightMonitorPrivate::DoInitL()
       
    58 {
       
    59     TX_ENTRY
       
    60     iLight = CHWRMLight::NewL( this );
       
    61     TX_EXIT
       
    62 }
       
    63 
       
    64 /*!
       
    65  \internal
       
    66  */
       
    67 MpLightMonitorPrivate::~MpLightMonitorPrivate()
       
    68 {
       
    69     TX_ENTRY
       
    70     delete iLight; 
       
    71     TX_EXIT
       
    72 }
       
    73 
       
    74 /*!
       
    75  \internal
       
    76  */
       
    77 void MpLightMonitorPrivate::LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus )
       
    78 {
       
    79     TX_ENTRY
       
    80     if ( aTarget == CHWRMLight::EPrimaryDisplay && aStatus != iLightStatus ) {        
       
    81         if ( aStatus == CHWRMLight::ELightOn ) {
       
    82             q_ptr->emit lcdLightStatus ( true ); 
       
    83         }
       
    84         else if( aStatus == CHWRMLight::ELightOff ) {
       
    85             q_ptr->emit lcdLightStatus ( false );
       
    86         }             
       
    87         iLightStatus = aStatus;        
       
    88     }
       
    89     TX_EXIT
       
    90 }
       
    91