Description

Battery Guard is an finger-friendly application that manage powering for each subdevices on PocketPC machine.This application should be usefull for someone who want to track what eating battery and make it under control.

Requirements:

  • Microsoft Windows Mobile Professional 6.1 (should work on WM 6.5, 6.0 , 5.0, PocketPC 2003)
  • Microsoft .Net Compact Framework 3.5 (download from Microsoft)

Development thread you will find on XDA-Developers.

Windows Mobile Professional Power management  and Battery Guard - more description

There are usually 9 power states in  Windows Mobile Professional (MSDN):

  • On – Normal operating state when a user is interacting with the device,
  • Resuming – Initial state after the device wakes up from the Suspended state. This state has a fifteen-second timeout before it transitions to another state. The system must transition to another state, or it reverts to the Suspended state. There is no way to reset the timer.
  • BacklightOff – State after a user defined period of inactivity. The backlight is off. Other things could be turned off, as well.
  • UserIdle – State after a user defined period of inactivity. The screen is either in low-power mode or off (depending on the OEM configuration). Other things could be turned off, as well.
  • Unattended – State in which a program runs without the user's knowledge or the need for interaction with the user, such as the Always-Up-to-Date synchronization program. It has a reference count (UREF). Upon exiting such an application, the device goes directly to the Suspended state without waiting for the system idle timer.
  • Suspend – Sleep state. No threads are running. The CPU is idle. The system can wake up only by means of a hardware wake-source interrupt. GSM module (if exist) are independent of system power states
  • ScreenOff - Backward-compatible state for applications that must turn off the screen through the display driver ExtEscape function. A typical case is Windows Media Player, which can turn off the screen through a user-defined key press.
  • Reboot – system reboot time
  • ColdReboot – system boot time after power off

With user point of view there is another power state, no power ;). There is a diagram of transitions between states : MSDN

As we see, screen state and backlight are the only system power state indicator visible to the naked eye. For system, screen and backlight are two different subdevices. There are many subdevices on PocketPC device like camera (or two), card reader, network card, hardware keyboard, GPS, audio device and many more. Sometimes one device (from user point of view) is defined as more than one subdevice. Subdevices are visible to applications as three-letters codes with number and colon, e.g. cif1: means camera and wav1: is audio device. As wee see in BatteryGuard, there are many registered subdevices and it's hard to say what all they mean. Probably not all registered subdevices are really physically exists. In main folder of Battery Guard you will find file fnames.txt. There are definitions of friendly name for subdevices. If you don't specify name with colon, then text will be threat like a start pattern.

For subdevice there are five power states (MSDN):

  • Power On – Device is on and running. It is receiving full power from the system and is delivering full functionality to the user
  • Power Save – Device is fully functional at a lower power or performance state than Power On. This state is applicable when the device is being used, but peak performance is unnecessary and power is at a premium.
  • Standby – Device is partially powered, with automatic wakeup on request.
  • Sleep – Device is partially powered, with device-initiated wakeup, if available. A device in this state is sleeping but capable of raising the system power state on its own. It consumes only enough power to be able to do so; which must be less than or equal to the amount of power used in state Standby.
  • Power Off – Device has no power. A device in this state should not be consuming any significant power. Some peripheral busses require static terminations that intrinsically use non-zero power when a device is physically connected to the bus. A device on such a bus can still support Power Off.

A physical device does not have to support all of the device power states. The only device power state that all devices must support is the full on state, Power On. A driver that is issued a request to enter a power state not supported by its device enters the next available power state supported.

Now we can define what Battery Guard doing.
First of all, we must now, that screen and backlight state are really don't define device power state. Why ? Because powering of each subdevice in each system power state is not hardcoded.In Power Template Editor we can define power state of each subdevice for every system power state. In that way we can affect power consumption of the device. We can e.g. turn off power of camera if we don't use it.

Main window of Battery Guard let us observe actual power states of subdevices. We can change powering subdevices and observe how it affect battery draining. You should know, that power template still takes effect so if power state of device change, then powering of subdevices will also change. When in template, camera is on for On state, then after we turn off and on device camera will be on again, even if we previously set it off in main screen.
Remeber, battery draining and battery life are refreshed every 2 seconds, but subdevices states list must be refreshed manually.

Usefull informations

  • Always do a backup before any changes in power template,
  • Battery Guard changes power template for the operating system so, you don't have to keep it in memory or runing it on startup
  • Most important power states for user are On and especially Unattended, cos often we don't know that our device is currently in this state (it depends on installed software),
  • running programs can change power template to achieve functionality (e.g. playing music in background),
  • all what you read there are theory, everything depends on software and hardware implementation in your device
  • Battery Guard is under development, knowledge of author also is ;)
  • Your experience in Battery Guard and achieved effects can be usefull for others, share it!
Features
  • set powering template for each power state of WinMo Professional device
  • set current power mode for each subdevice
  • backup/restore powering template
  • support user-defined friendly names of subdevices
  • multilanguage support (English, Polish, Greek)
  • skin support
  • AppToDate support

Tested devices: HTC Touch HD, HTC BlueAngle.

Confirmed devices: Polaris, Touch Pro, ATT Tilt, Kaiser TyTn II, Diamond 2

Screenshots

Battery Guard main screen Battery Guard Power Template editor Battery Guard Add subdevice setting to template Battery Guard Battery Info

1. Main screen

1.1 Toolbar

1.2 Rest of window

Main window lists info about charging/discharging value, current battery life and currently powered subdevices. To change powering of subdevice you must tap on his status, and then select power mode (subdevice often doesn't support all states).

1.3 Adding settings

To setuo powering for devices which are not currently powered you must tap Power New Device tool on toolbar, then you will see window where you can multiselect subdevices to add. Tap element on list to select it. Tap again to unselect. Available toolbar actions:

2. Power Template editor

2.1 Toolbar

2.2  Page changer

Each page of editor response for specific powering mode defined in operating system. To change view to other state you can do slide, tap arrows or tap on middle of pager to show menu with all available states.

2.3 Template settings area.

There you can set power mode for class of subdevices, individual subdevice and default power mode for rest subdevices and class. Order of settings: interfaces, default value (can't be deleted), subdevices.

2.4 Adding settings

To add settings for unlisted subdevices you must tap Add devices tool on toolbar, then you will see window where you can multiselect subdevices and/or interfaces to add. Tap element on list to select it. Tap again to unselect. Available toolbar actions:

 

To Do
  • battery monitoring with full report (about subdevices power mode, cpu usage, running process, power state)
  • reporting battery draining causes, based on internal battery monitoring
Available downloads
 TitleDescriptionSize Clicks
Greek language pack 0.0.1.2By geogeo. Contains language file and greek translation of friendly names. For version 0.0.1.21.48 KBDownload17562
Greek language pack 0.0.1.3By geogeo. Contains language file and greek translation of friendly names. For version 0.0.1.31.47 KBDownload2789
Battery Guard v0.0.1.3Installation cab, copy to device and run.374.54 KBDownload27088
Battery Guard v0.0.1.1Installation cab, copy to device and run.646.25 KBDownload4930
Battery Guard v0.0.1.2Installation cab, copy to device and run.364.94 KBDownload16756
Change log

version 0.0.1.3 (06-07-2009)

  • added window's captions
  • added support for provisioning xml (export/import)
  • added driver registry name for subdevices
  • little less memory usage 
  • improve windows loading time
  • more compatuble backup/restore process
  • fixed landscape mode

 version 0.0.1.2 (10-06-2009)

  • expand Power Status window with battery life and charge/draining indicator
  • change windows hierarchy, Power Status is now main window
  • add Battery Info page in Settings window
  • add ask about changes on exit from Power Template window
  • fix scroll painting after add/remove elements (GUI)
  • fix saving for new items in power template editor
  • fix handle of fullscreen setting (GUI)
  • fix background image for power switch (QVGA skin)

 version 0.0.1.1 (30-05-2009)

  • fixed skin for QVGA devices (install cab fix only)

version 0.0.1.0 (30-05-2009)

  • first release

 

Donations

This program is free but time is not, so if you can, charge me as you can.

Share on Facebook