Read-only archive of the All About Symbian forum (2001–2013) · About this archive

Extended Battery Info

4 replies · 4,970 views · Started 15 April 2004

Hello!

I would like to have extended battery info... the normal is easy, I use this now:

TDriveInfo info;
RFs fs;
fs.Connect();
fs.Drive(info);
return (info.iBattery==EBatLow);

I have found a method for the extended battery info... just it doesn't want to work correctly:

TSupplyInfoV1 iSupplyInfo;
TPckg<TSupplyInfoV1> sI(iSupplyInfo);

UserSvr::HalGet(ESupplyInfo,&sI);

Now the iSupplyInfo contains interesting members: iMainBatteryMaxMilliVolts, iMainBatteryMilliVolts. The problem is the "iMainBatteryMilliVolts" is always 0, while the "iMainBatteryMaxMilliVolts" is filled with a correct number (probably: 3000).

Do you know a solution?

Stewe

redshift wrote:Hello!

I would like to have extended battery info... the normal is easy, I use this now:

TDriveInfo info;
RFs fs;
fs.Connect();
fs.Drive(info);
return (info.iBattery==EBatLow);

I have found a method for the extended battery info... just it doesn't want to work correctly:

TSupplyInfoV1 iSupplyInfo;
TPckg<TSupplyInfoV1> sI(iSupplyInfo);

UserSvr::HalGet(ESupplyInfo,&sI);

Now the iSupplyInfo contains interesting members: iMainBatteryMaxMilliVolts, iMainBatteryMilliVolts. The problem is the "iMainBatteryMilliVolts" is always 0, while the "iMainBatteryMaxMilliVolts" is filled with a correct number (probably: 3000).

Do you know a solution?

Stewe

This sounds very interesting, but which .h and which .lib files do I need to link to get these methods working?

Hey,

I saw your post on the nokia forum, I just can't answer there... (cannot login, while the user and password are both correct).

So...
I found the right headers in the 6.0 SDK... M32HAL.h and U32STD.h.
I checked the 7.0s, but can't find anything like TSupplyInfo - probably isn't supported.

We don't really support the S80 series any more 😞
As I remember, none of these worked... the TDriveInfo and TSupplyInfo.

I found another possible solution, but simply can't remember which of them worked...

TInt batStatus=HAL::EPowerBatteryStatus_Zero;
TInt err=HAL::Get(HAL::EPowerBatteryStatus, batStatus);
TInt strength=batStatus;

/* this one works on UIQ, f.e. */
RSystemAgent systemAgent;
User::LeaveIfError(systemAgent.Connect());
TInt strength = systemAgent.GetState(KUidBatteryStrength);

Stewe

redshift wrote:Hey,

I saw your post on the nokia forum, I just can't answer there... (cannot login, while the user and password are both correct).

So...
I found the right headers in the 6.0 SDK... M32HAL.h and U32STD.h.
I checked the 7.0s, but can't find anything like TSupplyInfo - probably isn't supported.

We don't really support the S80 series any more 😞
As I remember, none of these worked... the TDriveInfo and TSupplyInfo.

I found another possible solution, but simply can't remember which of them worked...

TInt batStatus=HAL::EPowerBatteryStatus_Zero;
TInt err=HAL::Get(HAL::EPowerBatteryStatus, batStatus);
TInt strength=batStatus;


Sound interesting. Which .h/.lib do I need?


/* this one works on UIQ, f.e. */
RSystemAgent systemAgent;
User::LeaveIfError(systemAgent.Connect());
TInt strength = systemAgent.GetState(KUidBatteryStrength);
Stewe

I guess this will only return the same valkue displayed in the status pane... :frown:

I think we should look for "volt" around int the .h ...
I found some interesting functions about "volt", but they always return same values; I wonder if we should initialize something before querying for battery strength?

cassioli wrote:Sound interesting. Which .h/.lib do I need?

I guess this will only return the same valkue displayed in the status pane... :frown:

I think we should look for "volt" around int the .h ...
I found some interesting functions about "volt", but they always return same values; I wonder if we should initialize something before querying for battery strength?

#include "CommonFramework.h" // standard example stuff

#include <saclient.h> // RSAgent
#include <sacls.h> // Costanti
//#include <e32cons.h> // Per creare la console su cui stampare i risultati per il ***DEBUG***
//CConsoleBase* consoleFM; //La console
#include <U32STD.H> // TSupplyInfoV1
#include <D32RCHG.H> //TChargeInfoV1


LOCAL_C void doExampleL()
{
//consoleFM=Console::NewL(_L("Console FM"😉,TSize(KConsFullScreen,KConsFullScreen)); // crea console

TTime time; // time in microseconds since 0AD nominal Gregorian
TDateTime dateTime; // year-month-day-hour-minute-second-microsecond

TSupplyInfoV1 test;
TChargeInfoV1 test2;
RSystemAgent agent;
agent.Connect();
TInt outboxStatus = agent.GetState(KUidOutboxStatus);
agent.Close();
while (1)
{
console->Printf(_L("OUTBOX status: &#37;d\n"😉,outboxStatus);
console->Printf(_L("Batt - mV: %d\n"😉,test.iMainBatteryMilliVolts);
console->Printf(_L("Batt - MilliAmps: %d\n"😉,test.iCurrentConsumptionMilliAmps);
console->Printf(_L("Batt - MilliAmpSeconds: %d\n"😉,test.iMainBatteryConsumedMilliAmpSeconds);
console->Printf(_L("Batt - MaxMilliVolts: %d\n"😉,test.iMainBatteryMaxMilliVolts);
console->Printf(_L("Batt - MilliVolts: %d\n"😉,test.iBackupBatteryMilliVolts);
console->Printf(_L("Batt - MaxMilliVolts: %d\n"😉,test.iBackupBatteryMaxMilliVolts);
console->Printf(_L("EXTERNAL = %b\n"😉,test.iExternalPowerPresent);
console->Printf(_L("Temp - iRawTemperature: %d\n"😉,test2.iRawTemperature);
console->Printf(_L("Temp - iTemperatureTicks: %d\n"😉,test2.iTemperatureTicks);
console->Printf(_L("Temp - iSmoothedTemperature: %d\n"😉,test2.iSmoothedTemperature);
console->Printf(_L("Temp - iPreviousTemperature: %d\n"😉,test2.iPreviousTemperature);
console->Printf(_L("Temp - iVoltage: %d\n"😉,test2.iVoltage);
console->Printf(_L("Temp - iReferenceVoltage: %d\n"😉,test2.iReferenceVoltage);
console->Printf(_L("Temp - BATTPACK: %b\n"😉,test2.iBatteryPack);
console->Getch();
console->ClearScreen();
}
}


It WORKS.... but values are constant! :con? What should I "start" or "initialize" before querying values?:con?