积极答复者
wm6.0如何让程序在待机的情况也能运行

问题
答案
-
在xda-developers上,mligor提供了两种解决方法(主要看是否需要LCD一直亮着)。
链接地址如下:http://forum.xda-developers.com/archive/index.php/t-379366.html
I have tried and using GPSID works great.
basically to keep GPS signal alive there are two possibilities (depends what you need):
1) in case that you want to keep LCD ON
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- call SystemIdleTimerReset() often enough that LCD will not go OFF and/or device to go to sleep.
in this case when user Press Power button, your will get notification that device is going in Unattended mode, and you have to keep device alive with SystemIdleTimerReset() and to prevent never going in Sleep mode.
in this case user will be able to "switch off" device, but your application will continue running. You can also optimize application that in Unattended mode, nothing is updated on the screen, and less CPU to use (to save a bit battery)
2) in case that you do not want to keep LCD On all the time
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- but DO NOT call SystemIdleTimerReset() unless device is in Unattended mode
when user press Power button or device automatically switch off LCD after timeout, you will get notification about it and THEN call SystemIdleTimerReset to keep device alive. When device is again in ON mode, SystemIdleTimerReset should not be called.
This will ensure your application to work transparent, and it is perfect for some kind of GPS logger etc...
由于我手头没有GPS设备,所以没法测试,希望楼主可以试试看。
施炯- 已标记为答案 Guang-Ming Bian - MSFTModerator 2009年12月24日 3:29
全部回复
-
evanlee,
你好。
windows mobile设备在powering down模式下是无法和一些外设通信的(如串口,而GPS一般就是通过串口和WM设备通信)。
一般的方法是,在应用程序中,周期性的调用SystemIdleTimerReset() 函数,阻止设备进入powering down模式。
具体可以参考codeproject上的一篇文章:http://www.codeproject.com/KB/mobile/WiMoPower1.aspx
在Problem "Don't Let the Device Sleep"这节中作者详细描述了解决方法。
施炯 -
在xda-developers上,mligor提供了两种解决方法(主要看是否需要LCD一直亮着)。
链接地址如下:http://forum.xda-developers.com/archive/index.php/t-379366.html
I have tried and using GPSID works great.
basically to keep GPS signal alive there are two possibilities (depends what you need):
1) in case that you want to keep LCD ON
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- call SystemIdleTimerReset() often enough that LCD will not go OFF and/or device to go to sleep.
in this case when user Press Power button, your will get notification that device is going in Unattended mode, and you have to keep device alive with SystemIdleTimerReset() and to prevent never going in Sleep mode.
in this case user will be able to "switch off" device, but your application will continue running. You can also optimize application that in Unattended mode, nothing is updated on the screen, and less CPU to use (to save a bit battery)
2) in case that you do not want to keep LCD On all the time
- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- but DO NOT call SystemIdleTimerReset() unless device is in Unattended mode
when user press Power button or device automatically switch off LCD after timeout, you will get notification about it and THEN call SystemIdleTimerReset to keep device alive. When device is again in ON mode, SystemIdleTimerReset should not be called.
This will ensure your application to work transparent, and it is perfect for some kind of GPS logger etc...
由于我手头没有GPS设备,所以没法测试,希望楼主可以试试看。
施炯- 已标记为答案 Guang-Ming Bian - MSFTModerator 2009年12月24日 3:29
-
mvp回答的很好也很详细,我这里补充一下电源的知识的汇总,点击下面链接:
http://www.codeproject.com/KB/mobile/WiMoPower1.aspx
如果你不是很明白mvp的回答,看完这篇文章你会明白的。
Please remember to mark the replies as answers if they help and unmark them if they provide no help