[APP][SVC][Mar 8, 2010] BattLineSvc V2.1 / Battery Indicator Line in Title Bar

Search This thread

thx1200

Inactive Recognized Developer
Overview
You've seen these before -- the little green line at the top of the screen that indicates the current battery level. This app is really nothing new or revolutionary. The main difference of BattLineSvc is that it's a true Windows Mobile service, so it does NOT use one of the precious few 32 slots available for processes. You can find more information about services here. This app has been tested on Windows Mobile 5, 6, 6.1, 6.5, and 6.5.3.

CodePlex
BattLineSvc development is hosted at Microsoft CodePlex! http://www.codeplex.com/BattLineSvc

License
Ms-RL

Tip Jar
Like this app? Want more like it or quicker updates? Tip a buck (or Euro or Pound or whatever) or two to help the author out! Click here to make a safe donation via PayPal.

Current features
- Shows a nice bar along the top of your screen to indicate battery status.
- Color changes based on 'warning' and 'critical' battery levels, as well as when the device is on AC power (configurable).
- Immediately correctly resizes when the screen orientiation changes.
- The battery level is updated immediately when the device notifies listeners that battery status has changed (or you can specify an interval if your device isn't sending notifications.
- Can show a bar at the bottom, left, and right sides of the battery bar (if you want it).
- Can be offset from the left and right, if you need it.
- Height of the bar can be changed.
- VERY low resources used -- runs as a TRUE service and uses as close as 0% CPU as is possible by an app like this. So it's good for even older snail devices. :-D
- Has a configuration app (requires .Net CF 3.5)
- AppToDate support!

Recent Changes (See CodePlex or changelog.txt for longer changelog)
- (2.1) Fixed a bug where on system start-up, it would pop up a notification box to let you know the service started. Annoying! And fixed!
- (2.1) Fixed the styles in the notification boxes for start/stop service.
- Fixed bug where sometimes the line would not show up, even with the 90 second boot-up delay. This was due to the window being created too early (not actually delayed, even though the subclassing was properly delayed. Oops!
- Boot delay was reduced to 30 seconds from system start-up; so far no issues with it starting too early!
- Added a "right side offset" which works as the left side offset, but for the right side.
- Added a "right line" which works the same as the left line.
- Added a new color setting for when the battery is charging. (Default is a light gray-blue.)
- Battery status, by default, no longer refreshes on an interval, but instead by waiting for battery notification events. This makes BattLineSvc even more efficient! The interval timer is still there in case your device does not work with events only.
- Reduced the number of subsequent refreshes by requesting a synchronous status refresh; previously it would wait asynchronously which was less efficient since the update could take anywhere from a few milliseconds to several seconds.
- Removed a redundant battery status checking method which monitored the registry (no longer needed because the new power event-based system works better and is more efficient).
- Removed a few other old segments of code that were inefficient.
- Added user notification for starting/stopping the service with the start/stop apps.
- Added a configuration program (yay). Requires .Net CF 3.5. You can still edit the registry manually.

Registry
Look in HKCU\Software\Avian Waves\BattLineSvc
Colors are best edited as hex, using the following pattern: BBGGRR (seems backwards, but it's due to the endedness of DWORDS in CE). Your registry editor may not show leading zeros either, keep that in mind.
- TaskbarClass = (string) Don't change this unless you are 100% positive the taskbar is not named standard.
- Height = (int) Number of pixels tall for the battery line.
- LeftOffset = (int) Number of pixels from the left edge that the battery line starts.
- LowPercent = (int 0-100) What percentage of battery charged is considered low (yellow).
- CriticalPercent = (int 0-100) What percentage of battery charged is considered critical (red).
- ShowLeftLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
- ShowRightLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
- ShowBottomLine = (bool) Show a line on the bottom of the battery bar
- ColorForegroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the foreground color, default is bright green.
- ColorBackgroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the background color, default is dark green.
- ColorForegroundSolidLow = (color) For low battery charge, this is the foreground color, default is bright yellow.
- ColorBackgroundSolidLow = (color) For low battery charge, this is the background color, default is dark yellow / brown.
- ColorForegroundSolidCritical = (color) For critical battery charge, this is the foreground color, default is red.
- ColorBackgroundSolidCritical = (color) For critical battery charge, this is the background color, default is dark red.
- ColorForegroundSolidCharging = (color) For when the device is charging (on AC), this is the foreground color, default is light gray-blue.
- ColorBackgroundSolidCharing = (color) For when the device is charging (on AC), this is the background color, default is dark gray-blue.
- ColorLeftLine = (color) Color of the left line.
- ColorRightLine = (color) Color of the right line.
- ColorBottomLine = (color) Color of the bottom line.
- TimerIntervalSeconds = (int) How often do we look to see if the battery level has changed (in seconds)? NOTE: As of V2, set this value to 0 unless BattLineSvc is not updating on your device. Zero means disabled. This settings is no longer necessary as BattLineSvc now waits for battery notification events, instead of updating on a timer.

Download
CAB Installer: http://battlinesvc.codeplex.com/releases
Source Code: http://battlinesvc.codeplex.com/SourceControl/list/changesets
 

Attachments

  • BLS1.jpg
    BLS1.jpg
    14.3 KB · Views: 5,543
  • BLS2.jpg
    BLS2.jpg
    13.7 KB · Views: 4,060
  • BLS3.jpg
    BLS3.jpg
    13.7 KB · Views: 4,021
Last edited:

thx1200

Inactive Recognized Developer
FAQ

Question: My battery life seems to be draining faster after installing BattLineSvc. Is BattLineSvc causing this?

Answer: Probably not. The current version of BattLineSvc has no active polling. This means that when there is no battery status change happening, BattLineSvc is 100% idle. In Windows Mobile, applications and services are event based. You can set up a "loop" type of system (loop over and over, constantly checking for something), but that's inefficient. Even in older versions of BattLineSvc that made use of TimerIntervalSeconds to update the battery status, the updates were done a timer. So, you see, when BattLineSvc starts, it sets itself up to listen to system events, then it explicitly goes to sleep and waits until it receives a message. This is all handled in the OS and it's the way efficient apps are written in WM.

Okay, so you are wondering, well maybe a lot of events are firing and it's causing more CPU and therefore more battery drain. BattLineSvc listens for battery events and also power change events (on to idle or idle to on). None of these fire very often, unless there is something wrong with your device or your ROM. :) Even if they did, it wouldn't matter unless they continued to fire when the device was asleep/idle. In WM, an app must request to stay awake when the device goes idle (users presses power button). BattLineSvc is set up to use unattended mode, which is the mode where WM goes into after you press power-off to turn off the screen, but before it's fully asleep. WM gives all apps requesting unattended mode 15 seconds to complete their task. If they need more time, the app must explicitly ask WM by reseting the idle counter timer. BattLineSvc never resets the idle timer! So unless another app is doing this, the device will fully sleep 15 seconds after you press the power button, which is normal WM operation.

Okay, so that's the long winded explanation. But you want answers! Well, I always would encourage you to A/B the situation by running BattLineSvc for a few days, then uninstall it and try it a few days without. I think this will persuade you in 99% of cases. Please don't post on this thread if you have done less than a week's worth of power testing. There are so many thousands of things that can cause battery drain, you can't tell with only a few hours worth of testing.

One thing that causes power drain, which is the TRUE reason most people think a new app did it, is your cellular radio. Sometimes, for random reasons (atmospheric interference, dead zones, cell tower glitchy/busy), your radio has to work harder to get a signal. In fact, sometimes you may notice your phone is warm while its idle and you know you aren't downloading or anything. That's the radio! I've had a fully charged phone go down while it was in my pocket doing nothing in half a day due to this. The next day, all is well. Zero changes on my part. It just happens. It sucks, but, well, there's nothing you can do short of turning off your cellular radio. :) Luckily its rare unless you know you are driving out of coverage area or something. Which is why apps are blamed sometimes. You install an app, then the power drains and you logically conclude it was that app. You uninstall it the next day, and all seems well. This is why you need several days of testing - to rule out these random things!

Finally, you must test from a full charge. You can't install BattLineSvc when your device is half full, then see the last half of the battery drain faster than your first half and come to any conclusions. Battery drain is not linear! It's subject to the nuances of the battery. Usually the last half of your battery will drain faster than the first half, but it all depends on the detection algorithm and the battery itself. The only true test is from full charge with exactly the same operating conditions (all other apps the same, usage the same, no background tasks like downloads/refreshes happening any different from the previous charge).

Good luck in finding your power drain and I do want to know if it is BattLineSvc, so please report it if you are having an issue, but don't post anything until you've done a full week of testing with BattLineSvc installed and BattLineSvc uninstalled.
 
Last edited:

aiiro

Senior Member
Mar 20, 2008
313
29
Stephen, search for reg settings called TBOpt and ShowTitleBarClock, You'd probably get Your answer.

What I really wanted to say is that the idea is REALLY nice, although I personally dismissed all the bars and stuck with QMenu's numeric display of battery and memory on the taskbar - tho it's a bit buggy. I guess I am a numbers' freak :) If someone could rewrite that to a reliable, small, resource-saving service, that I would really appreciate. To date I haven't found such app...

If You need any ideas what to develop, I would be glad to present my list :)

Good work and respect!
 

NLS

Senior Member
May 27, 2005
2,496
63
Piraeus
www.ilogic.gr
nice job - try to implement "breaks" in the line - like SPB Pocket Plus bar
(so that you actually get a feel of steps)
also looks nicer and feels like it measures something, not like there is something wrong with the pixels at the top of the screen :)
 

timstephens11

Senior Member
Aug 21, 2006
80
0
London
wm 6.5.5 (build 23540) Touch HD Blackstone

Works fine on said device and build, just changed height to 1 pixel.

Attached a screen shot but can't really see it that well, it's fine in reality.
 

Attachments

  • Screen02.jpg
    Screen02.jpg
    25.9 KB · Views: 1,034

thx1200

Inactive Recognized Developer
nice job - try to implement "breaks" in the line - like SPB Pocket Plus bar
(so that you actually get a feel of steps)
also looks nicer and feels like it measures something, not like there is something wrong with the pixels at the top of the screen :)

:)

I probably won't be doing that, at least not soon. I have too many other tasks on my plate at the moment. After creating a config app for this service, I will probably shelve it for a while. It is open source, so feel free to add that feature and I'll roll it into the next version. :)
 

arman68

Senior Member
Sep 22, 2006
286
230
Beautiful app. I always admire developers who make the effort to really optimize their application and minimize resource usage. Well done.

I was not able to find any information as to whether ibattery and lvmtopbat (which ibattery is based on), also run as a service. Anybody knows?
 

tito12

Senior Member
Feb 15, 2008
1,541
81
Tel Aviv
Overview
You've seen these before -- the little green line at the top of the screen that indicates the current battery level. This app is really nothing new or revolutionary. The main difference of BattLineSvc is that it's a true Windows Mobile service, so it does NOT use one of the precious few 32 slots available for processes. You can find more information about services here. This app has been tested on Windows Mobile 5, 6, 6.1, and 6.5, but NOT 6.5.3. (Can somebody test for me?) There's no configuration app yet, so I hope you like editing the registry if you don't like the default settings. ;-)

Hi thx1200

No issues so far on my device

Thank you :)
 

drfno1

Senior Member
Dec 11, 2007
61
4
Kansas
Currently running 6.5.5 with manila2d. It seems 90 seconds is not enough on my Tilt to startup correctly. If I restart the service it is great. Maybe it can be a parameter in the registry settings.

Thanks
 

gwinga

New member
Jan 7, 2010
2
0
I like it, works great on my Imagio so far. The only improvement I'd like to see would be an additional color to indicate that the battery is being charged.

Good job!
 

kensong

Senior Member
Nov 26, 2007
90
0
I like it, works great on my Imagio so far. The only improvement I'd like to see would be an additional color to indicate that the battery is being charged.

Good job!

Yes, this would be great. Thanks for making this so lean. Apart from this request, I wouldn't add anything else as it should be kept simple to be really useful.
 

mike2nl

Senior Member
Jul 24, 2009
3,965
670
64
Near Utrecht
A really tiny little tool. Will post a screenshot from mine...

One point i have:
It will be very helpfull when there is also a right side offset.
It means with newer skins we have round corners. And with
that the left side offset is wonderfull, but i need also the
right one.

Is this possible for the next version?
 
Last edited:

tito12

Senior Member
Feb 15, 2008
1,541
81
Tel Aviv
Hi

Being color blind, I want to change the colors to more contrast so I found a web Hex Color Chart but when I apply a color code the bar disappears, obviously I'm doing something wrong, can someone help me with this?
 

tobbbie

Senior Member
Jan 5, 2007
1,452
252
Stuttgart
Is it supposed to run on smartphones (aka "WM Standard") as well? I don't get it visible despite the service is started after reboot. Do I have to use a different class name for this?
 

mike2nl

Senior Member
Jul 24, 2009
3,965
670
64
Near Utrecht
Hi

Being color blind, I want to change the colors to more contrast so I found a web Hex Color Chart but when I apply a color code the bar disappears, obviously I'm doing something wrong, can someone help me with this?


@ tito,

you have seen the default colors after the installation and before you have changed something??? Next point from 1st posting:

as sample:
color = green
standard hex = #00FF00
BattLineSvc registry value = ff00

You have done this in this way? The leading zeros are not supported. Otherwise the light goes on now?

Hint:
If you need the hex information for a color and you have further problems with your hex calculator, publish an icon 90x90 pixel and you will receive them.

@thx1200:
i am working on a DUSK skin for your tiny app. Looks good at the moment, but not ready because the right side offset :D:D.
 

mike2nl

Senior Member
Jul 24, 2009
3,965
670
64
Near Utrecht
Is it supposed to run on smartphones (aka "WM Standard") as well? I don't get it visible despite the service is started after reboot. Do I have to use a different class name for this?

Hi tobbbie,

i don't think that the app is running on smartphones. So far as i understand the soucre code after reading, is this app not compiled for smartphones. I also have seen for the *.exe this resourceppc.h and this Windows Mobile 5.0 Pocket PC SDK (ARMV4I) and this Windows Mobile 6 Professional SDK (ARMV4I) is used. That means it is for powerpc, or i am wrong thx1200?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Overview
    You've seen these before -- the little green line at the top of the screen that indicates the current battery level. This app is really nothing new or revolutionary. The main difference of BattLineSvc is that it's a true Windows Mobile service, so it does NOT use one of the precious few 32 slots available for processes. You can find more information about services here. This app has been tested on Windows Mobile 5, 6, 6.1, 6.5, and 6.5.3.

    CodePlex
    BattLineSvc development is hosted at Microsoft CodePlex! http://www.codeplex.com/BattLineSvc

    License
    Ms-RL

    Tip Jar
    Like this app? Want more like it or quicker updates? Tip a buck (or Euro or Pound or whatever) or two to help the author out! Click here to make a safe donation via PayPal.

    Current features
    - Shows a nice bar along the top of your screen to indicate battery status.
    - Color changes based on 'warning' and 'critical' battery levels, as well as when the device is on AC power (configurable).
    - Immediately correctly resizes when the screen orientiation changes.
    - The battery level is updated immediately when the device notifies listeners that battery status has changed (or you can specify an interval if your device isn't sending notifications.
    - Can show a bar at the bottom, left, and right sides of the battery bar (if you want it).
    - Can be offset from the left and right, if you need it.
    - Height of the bar can be changed.
    - VERY low resources used -- runs as a TRUE service and uses as close as 0% CPU as is possible by an app like this. So it's good for even older snail devices. :-D
    - Has a configuration app (requires .Net CF 3.5)
    - AppToDate support!

    Recent Changes (See CodePlex or changelog.txt for longer changelog)
    - (2.1) Fixed a bug where on system start-up, it would pop up a notification box to let you know the service started. Annoying! And fixed!
    - (2.1) Fixed the styles in the notification boxes for start/stop service.
    - Fixed bug where sometimes the line would not show up, even with the 90 second boot-up delay. This was due to the window being created too early (not actually delayed, even though the subclassing was properly delayed. Oops!
    - Boot delay was reduced to 30 seconds from system start-up; so far no issues with it starting too early!
    - Added a "right side offset" which works as the left side offset, but for the right side.
    - Added a "right line" which works the same as the left line.
    - Added a new color setting for when the battery is charging. (Default is a light gray-blue.)
    - Battery status, by default, no longer refreshes on an interval, but instead by waiting for battery notification events. This makes BattLineSvc even more efficient! The interval timer is still there in case your device does not work with events only.
    - Reduced the number of subsequent refreshes by requesting a synchronous status refresh; previously it would wait asynchronously which was less efficient since the update could take anywhere from a few milliseconds to several seconds.
    - Removed a redundant battery status checking method which monitored the registry (no longer needed because the new power event-based system works better and is more efficient).
    - Removed a few other old segments of code that were inefficient.
    - Added user notification for starting/stopping the service with the start/stop apps.
    - Added a configuration program (yay). Requires .Net CF 3.5. You can still edit the registry manually.

    Registry
    Look in HKCU\Software\Avian Waves\BattLineSvc
    Colors are best edited as hex, using the following pattern: BBGGRR (seems backwards, but it's due to the endedness of DWORDS in CE). Your registry editor may not show leading zeros either, keep that in mind.
    - TaskbarClass = (string) Don't change this unless you are 100% positive the taskbar is not named standard.
    - Height = (int) Number of pixels tall for the battery line.
    - LeftOffset = (int) Number of pixels from the left edge that the battery line starts.
    - LowPercent = (int 0-100) What percentage of battery charged is considered low (yellow).
    - CriticalPercent = (int 0-100) What percentage of battery charged is considered critical (red).
    - ShowLeftLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
    - ShowRightLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
    - ShowBottomLine = (bool) Show a line on the bottom of the battery bar
    - ColorForegroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the foreground color, default is bright green.
    - ColorBackgroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the background color, default is dark green.
    - ColorForegroundSolidLow = (color) For low battery charge, this is the foreground color, default is bright yellow.
    - ColorBackgroundSolidLow = (color) For low battery charge, this is the background color, default is dark yellow / brown.
    - ColorForegroundSolidCritical = (color) For critical battery charge, this is the foreground color, default is red.
    - ColorBackgroundSolidCritical = (color) For critical battery charge, this is the background color, default is dark red.
    - ColorForegroundSolidCharging = (color) For when the device is charging (on AC), this is the foreground color, default is light gray-blue.
    - ColorBackgroundSolidCharing = (color) For when the device is charging (on AC), this is the background color, default is dark gray-blue.
    - ColorLeftLine = (color) Color of the left line.
    - ColorRightLine = (color) Color of the right line.
    - ColorBottomLine = (color) Color of the bottom line.
    - TimerIntervalSeconds = (int) How often do we look to see if the battery level has changed (in seconds)? NOTE: As of V2, set this value to 0 unless BattLineSvc is not updating on your device. Zero means disabled. This settings is no longer necessary as BattLineSvc now waits for battery notification events, instead of updating on a timer.

    Download
    CAB Installer: http://battlinesvc.codeplex.com/releases
    Source Code: http://battlinesvc.codeplex.com/SourceControl/list/changesets