Track the Time You Waste on Social Media with Socials Addict

When you use your phone, you often don’t even realize how much time you … more

Document the Story of Your Social Life with 8tory

The different forms of social media are growing every day. It’s hard to imagine a day … more

Make Calling Your Loved Ones Easier and Cheaper this Diwali

Diwali, or Deepawali as some Indians call it, is the pride and joy of Indian … more

Big Android BBQ 5.0 Recap – XDA TV

This fifth annual Big Android BBQ has come and gone. The speakers have spoke, the sponsors have … more
Post Reply

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

OP thx1200

1st March 2010, 03:17 AM   |  #1  
thx1200's Avatar
OP Recognized Developer
Flag Raleigh, North Carolina
Thanks Meter: 54
 
873 posts
Join Date:Joined: Apr 2006
More
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/Sour...ist/changesets
Attached Thumbnails
Click image for larger version

Name:	BLS1.jpg
Views:	5386
Size:	14.3 KB
ID:	287586   Click image for larger version

Name:	BLS2.jpg
Views:	3912
Size:	13.7 KB
ID:	287587   Click image for larger version

Name:	BLS3.jpg
Views:	3876
Size:	13.7 KB
ID:	287588  
Last edited by thx1200; 9th March 2010 at 10:53 PM.
The Following 2 Users Say Thank You to thx1200 For This Useful Post: [ View ]
1st March 2010, 03:18 AM   |  #2  
thx1200's Avatar
OP Recognized Developer
Flag Raleigh, North Carolina
Thanks Meter: 54
 
873 posts
Join Date:Joined: Apr 2006
More
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 by thx1200; 29th March 2010 at 02:50 PM.
1st March 2010, 08:28 AM   |  #3  
Member
Thanks Meter: 0
 
98 posts
Join Date:Joined: Dec 2009
Thank you. It seems to work well on my HD2. How can I get rid of the original battery WM6 indicator?
1st March 2010, 08:36 AM   |  #4  
aiiro's Avatar
Senior Member
Thanks Meter: 28
 
310 posts
Join Date:Joined: Mar 2008
More
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!
1st March 2010, 10:27 AM   |  #5  
NLS's Avatar
Senior Member
Flag Piraeus
Thanks Meter: 45
 
2,389 posts
Join Date:Joined: May 2005
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
1st March 2010, 02:41 PM   |  #6  
timstephens11's Avatar
Member
Flag London
Thanks Meter: 0
 
79 posts
Join Date:Joined: Aug 2006
More
Thumbs up 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.
Attached Thumbnails
Click image for larger version

Name:	Screen02.jpg
Views:	1004
Size:	25.9 KB
ID:	287729  
1st March 2010, 03:32 PM   |  #7  
thx1200's Avatar
OP Recognized Developer
Flag Raleigh, North Carolina
Thanks Meter: 54
 
873 posts
Join Date:Joined: Apr 2006
More
Quote:
Originally Posted by NLS

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. :)
2nd March 2010, 12:11 PM   |  #8  
Senior Member
Thanks Meter: 212
 
260 posts
Join Date:Joined: Sep 2006
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?
2nd March 2010, 05:29 PM   |  #9  
tito12's Avatar
Senior Member
Flag Tel Aviv
Thanks Meter: 83
 
1,538 posts
Join Date:Joined: Feb 2008
More
Quote:
Originally Posted by thx1200

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
2nd March 2010, 05:53 PM   |  #10  
Member
Flag Kansas
Thanks Meter: 4
 
61 posts
Join Date:Joined: Dec 2007
More
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

Post Reply Subscribe to Thread

Tags
battery, service, status, title bar, titlebar
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes