bluetoothengine/btmac/inc/btmonocmdhandler/btmcbattery.h
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Gets the Signal strength indications
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTMCBATTERY_H
       
    20 #define BTMCBATTERY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <etelmm.h>
       
    24 #include <e32property.h>
       
    25 #include <hwrmpowerstatesdkpskeys.h>
       
    26 
       
    27 class CBtmcPhoneStatus;
       
    28 
       
    29 /**
       
    30 *  CBtmcBattery for getting signal strength.
       
    31 */
       
    32 NONSHARABLE_CLASS(CBtmcBattery) : public CActive
       
    33     {
       
    34     public:
       
    35     
       
    36         /**
       
    37         * Two-phased constructor.
       
    38         */
       
    39         static CBtmcBattery* NewL(
       
    40             CBtmcPhoneStatus& aParent);
       
    41 
       
    42         static CBtmcBattery* NewLC(
       
    43             CBtmcPhoneStatus& aParent);
       
    44     
       
    45         /**
       
    46         * Destructor.
       
    47         */
       
    48         ~CBtmcBattery();
       
    49     
       
    50         void GoActive();
       
    51         
       
    52         /*
       
    53         * returns current battery charge
       
    54         */
       
    55         TInt GetBatteryCharge();
       
    56         
       
    57         
       
    58     protected:
       
    59     
       
    60         /**
       
    61         * From CActive. Called when asynchronous request completes.
       
    62         * @since 3.0
       
    63         * @param None
       
    64         * @return None
       
    65         */
       
    66         void RunL();
       
    67         
       
    68         void DoCancel();
       
    69 
       
    70         TInt RunError(TInt aErr);
       
    71 
       
    72     private:
       
    73     
       
    74         /**
       
    75         * C++ default constructor.
       
    76         */
       
    77         CBtmcBattery(
       
    78             CBtmcPhoneStatus& aParent);
       
    79     
       
    80         void ConstructL();
       
    81         
       
    82         void ConvertToHFPScale(TInt &aStrength);
       
    83 
       
    84     private:
       
    85         CBtmcPhoneStatus& iParent;
       
    86         RTimer iTimer;
       
    87         RProperty iProperty;
       
    88         EPSHWRMBatteryLevel iBatteryStrength;
       
    89         TInt iCharge;
       
    90     };
       
    91 
       
    92 
       
    93 #endif