coreapplicationuis/SysAp/Src/Usb/sysapusbchargerdetector.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 18:49:38 +0300
branchRCL_3
changeset 57 5e7d68cc22e0
parent 0 2e3d3ce01487
permissions -rw-r--r--
Revision: 201025 Kit: 2010127

/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  This class offers USB charger detector service.
*
*/


#include <e32debug.h>
#include "sysapusbchargerdetector.h"
#include "SysAp.hrh"

// ======== MEMBER FUNCTIONS ========

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::TSysApUsbChargerDetector
// ---------------------------------------------------------------------------
//
TSysApUsbChargerDetector::TSysApUsbChargerDetector() :
    iUsbDeviceUsed( EFalse ),
    iChargingUsed( EFalse ),
    iUsbChargingEnabled( EFalse )
    {
    TRACES( RDebug::Print(
        _L( "TSysApUsbChargerDetector::TSysApUsbChargerDetector" ) ) );
    }

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::SetUsbDeviceUsed
// ---------------------------------------------------------------------------
//
void TSysApUsbChargerDetector::SetUsbDeviceUsed( TBool aUsbDeviceUsed )
    {
    TRACES( RDebug::Print(
        _L( "TSysApUsbChargerDetector::SetUsbDeviceUsed %d" ),
        aUsbDeviceUsed ) );

    iUsbDeviceUsed = aUsbDeviceUsed;
    }

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::SetChargingUsed
// ---------------------------------------------------------------------------
//
void TSysApUsbChargerDetector::SetChargingUsed( TBool aChargingUsed )
    {
    TRACES( RDebug::Print(
        _L( "TSysApUsbChargerDetector::SetChargingUsed %d" ),
        aChargingUsed ) );

    iChargingUsed = aChargingUsed;
    }

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::Reset
// ---------------------------------------------------------------------------
//
void TSysApUsbChargerDetector::Reset()
    {
    TRACES( RDebug::Print( _L( "TSysApUsbChargerDetector::Reset" ) ) );

    iUsbDeviceUsed = EFalse;
    iChargingUsed = EFalse;
    }

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::HostOnlyUsbChargingUsed
// ---------------------------------------------------------------------------
//
TBool TSysApUsbChargerDetector::HostOnlyUsbChargingUsed() const
    {
    TBool ret( iUsbChargingEnabled && iUsbDeviceUsed && iChargingUsed );

    TRACES( RDebug::Print(
        _L( "TSysApUsbChargerDetector::HostOnlyUsbChargingUsed %d" ),
        ret ) );

    return ret;
    }

// ---------------------------------------------------------------------------
// TSysApUsbChargerDetector::EnableUsbCharging
// ---------------------------------------------------------------------------
//
void TSysApUsbChargerDetector::EnableUsbCharging(
    TBool aUsbChargingEnabled )
    {
    TRACES(
        RDebug::Print( _L( "TSysApUsbChargerDetector::EnableUsbCharging %d" ),
        aUsbChargingEnabled ) );

    iUsbChargingEnabled = aUsbChargingEnabled;
    }