本文介绍了Windows CE上的GPS电源管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我正在开发一个获取GPS数据的程序,并使用了Microsoft的GPS库.
我的问题是,当设备进入睡眠模式时,GPS设备会在7分钟内获得相同的位置,然后又没有获得任何位置,
为了解决这个问题,我使用了以下代码:
hello to every body
I`m developing a program that get the GPS data and i used the GPS library of Microsoft.
My problem is when the device into the sleep mode, the GPS device get the same position for 7 minute and then does not get any position,
for solve this i used this code :
<br />
<pre lang="cs">CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, -1);<br />
const int POWER_NAME = 0x00000000;<br />
int notify = CoreDLL.DevicePowerNotify(GpsDeviceName, CEDEVICE_POWER_STATE.D0, POWER_NAME);<br />
IntPtr power = CoreDLL.SetDevicePower(GpsDeviceName, DevicePowerFlags.POWER_NAME, CEDEVICE_POWER_STATE.D0);<br />
<br />
<br />
</pre>
和此代码:
and this code:
<br />
CEDEVICE_POWER_STATE state = CEDEVICE_POWER_STATE.D0;<br />
CoreDLL.GetDevicePower(GpsDeviceName, DevicePowerFlags.POWER_NAME, out state);<br />
CoreDLL.SetPowerRequirement(GpsDeviceName, CEDEVICE_POWER_STATE.D0,<br />
DevicePowerFlags.POWER_NAME | DevicePowerFlags.POWER_FORCE,<br />
IntPtr.Zero, 0);<br />
<br />
但这可以在HTC touch2和acer E101,s200和Xperia和.....
中使用但不适用于HTC HD2,...,
我该怎么办?
请帮忙..
谢谢
but this work in HTC touch2 and acer E101,s200 and Xperia and .....
but doesn`t work on HTC HD2,,,,
What can i do??
Please Help..
Thanks
推荐答案
<br />
CoreDLL.SetSystemPowerState(null, PowerState.POWER_STATE_ON, DevicePowerFlags.POWER_NAME);<br />
这篇关于Windows CE上的GPS电源管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!