bluetoothengine/btmac/inc/btmonocmdhandler/btmcbattery.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:59:05 +0300
changeset 52 4545c04e61e1
parent 0 f63038272f30
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2005 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:  Gets the Signal strength indications
*
*/


#ifndef BTMCBATTERY_H
#define BTMCBATTERY_H

#include <e32base.h>
#include <etelmm.h>
#include <e32property.h>
#include <hwrmpowerstatesdkpskeys.h>

class CBtmcPhoneStatus;

/**
*  CBtmcBattery for getting signal strength.
*/
NONSHARABLE_CLASS(CBtmcBattery) : public CActive
    {
    public:
    
        /**
        * Two-phased constructor.
        */
        static CBtmcBattery* NewL(
            CBtmcPhoneStatus& aParent);

        static CBtmcBattery* NewLC(
            CBtmcPhoneStatus& aParent);
    
        /**
        * Destructor.
        */
        ~CBtmcBattery();
    
        void GoActive();
        
        /*
        * returns current battery charge
        */
        TInt GetBatteryCharge();
        
        
    protected:
    
        /**
        * From CActive. Called when asynchronous request completes.
        * @since 3.0
        * @param None
        * @return None
        */
        void RunL();
        
        void DoCancel();

        TInt RunError(TInt aErr);

    private:
    
        /**
        * C++ default constructor.
        */
        CBtmcBattery(
            CBtmcPhoneStatus& aParent);
    
        void ConstructL();
        
        void ConvertToHFPScale(TInt &aStrength);

    private:
        CBtmcPhoneStatus& iParent;
        RTimer iTimer;
        RProperty iProperty;
        EPSHWRMBatteryLevel iBatteryStrength;
        TInt iCharge;
    };


#endif