Windows Mobile 6.5 On / Off Button

Recently this post inspired me, I also want to track my own life.

I look at my cell phone clock every time I go to bed or when I wake up, so I need some kind of program to connect to my cell phone on / off button and register the timestamp when I press it.

I am using WM6.5 on HTC TyTN II. If there is existing software that can do this with little tweaks and tweaks, it would be nice, but I can write code too. Any suggestions?

+2


a source to share


2 answers


You can use device power notifications with P / Invoking RequestPowerNotifications to know when the power state changes (there's a CodeProject article that also covers this). Keep in mind that the power outage notification does not wait for subscribers to run code, so in most cases, your app handler does not actually start until the device wakes up (meaning that if you write a timestamp or something that you get awake time, not sleep time).



Also keep in mind that different devices handle power management differently , hence YMMV.

+1


a source


It's more difficult than you might imagine!

On / Off button the OS is directly inaccessible (i.e. it is not visible in the keyboard driver), since it is connected to a rather complex power failure system (basically, the application processor is completely turned down when the phone is turned off - the modem wakes up in accordance with the paging cycle programmed over the network ).



The wake-up communication between the two CPUs is extremely complex and subject to race conditions. Even if you managed to get it plugged in (which would require deep kernel programming and a few security hackers), you will likely make your phone very unstable.

+1


a source







All Articles