Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 07:33, 6 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Check battery status using Symbian C++

From Wiki
Jump to: navigation, search

This snippet demonstrates how to check the battery power status using Symbian C++.

Article Metadata
Tested with
Devices(s): E60
Compatibility
Platform(s): S60 3rd
Platform Security
Signing Required: Self-signed
Article
Keywords: keywords=HAL::Get(),HALData
Created: lming (18 Nov 2008)
Last edited: hamishwillee (06 May 2013)

Use case

The application could notify the user when the battery is low.

Source file

//necessary library
LIBRARY HAL.LIB
//necessary header file
#include <HAL.h>
#include <hal_data.h>
 
TInt powerBatteryStatus;
//retrieve EPowerBatteryStatus value
HAL::Get( HALData::EPowerBatteryStatus, powerBatteryStatus );
 
if(powerBatteryStatus == HALData::EPowerBatteryStatus_Zero)
{
//battery status is zero.
//performing corresponding operation
....
}
else if(powerBatteryStatus == HALData::EPowerBatteryStatus_Low)
{
//battery status is low.
//performing corresponding operation
....
}
else if(powerBatteryStatus == HALData::EPowerBatteryStatus_Good)
{
//battery status is good.
//performing corresponding operation
....
 
}
This page was last modified on 6 May 2013, at 07:33.
65 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×