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.
- 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.
- 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!