×
Namespaces

Variants
Actions

Archived:How to get the battery strength of mobile using Symbian C++ before Symbian OS v9

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Compatibility
Device(s): S60 1st Edition, S60 2nd Edition
Article
Keywords: Battery
Created: Maxying (26 Mar 2007)
Reviewed: hamishwillee (21 Sep 2011)
Last edited: hamishwillee (06 May 2013)


Pre-Symbian OS v9 solution

These solutions can be used in S60 1st and 2nd Edition devices.

#include <saclient.h>
Link against: sysagt.lib
...
 
RSystemAgent systemAgent;
User::LeaveIfError(systemAgent.Connect());
TInt strength = systemAgent.GetState(KUidBatteryStrength);
systemAgent.Close();

It is also possible to read battery status using HAL:

// Remember to link against hal.lib
#include <hal_data.h>
#include <hal.h>
...
 
 
TInt battStatus = 0;
TInt result = HAL::Get(HALData::EPowerBatteryStatus, battStatus);

Post v9 solution

The article below describes the solution that should be used for S60 3rd Edition and later devices.

This page was last modified on 6 May 2013, at 14:12.
87 page views in the last 30 days.