Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 :
C#
CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, -1);
 const int POWER_NAME = 0x00000000;
 int notify = CoreDLL.DevicePowerNotify(GpsDeviceName, CEDEVICE_POWER_STATE.D0, POWER_NAME);
 IntPtr power = CoreDLL.SetDevicePower(GpsDeviceName, DevicePowerFlags.POWER_NAME, CEDEVICE_POWER_STATE.D0);

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 />

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
Posted

I have to use this code for solve this... :

<br />
CoreDLL.SetSystemPowerState(null, PowerState.POWER_STATE_ON, DevicePowerFlags.POWER_NAME);<br />
 
Share this answer
 
Comments
Hossein Khalaj 19-Jul-11 6:46am    
But doesn`t performance,,,, :(
I found a solution....

When I deleted the IClass string out of the following keys:

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\GPSID]
IClass={A32942B7-920C-486b-B0E6-92A702A99B35};

[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\gpsdriver]
IClass={A32942B7-920C-486b-B0E6-92A702A99B35};



and work very well!!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900