GPS信息不正确 [英] Incorrect GPS information
问题描述
我面临一个奇怪的问题。我正在使用原生gpsapi.dll的GPSGetPosition()API,它在大多数情况下工作正常。但是,在某些情况下,它会给出一个非常错误的位置,可能是100英里或500英里远,然后在一段时间之后再次
开始给出准确的位置。我最初用HTC手机观察了这种行为,并认为这可能是HTC问题。现在我也可以看到与motorola MC65手机相同的问题。它有windows mobile 6.5。
其他人都注意到了这个问题,微软的家伙,请放下一些内容。
最好的问候,
B
您需要检查GPS_POSITION :: dwValid中的
GPS_VALID_标志。
GPS_POSITION pos = {0} ;
pos.dwSize = sizeof (pos);
pos.dwVersion = GPS_VERSION_1;
//根据需要调整
DWORD max_age = 0;
if (GPSGetPosition(句柄,& pos,max_age,0)== ERROR_SUCCESS)
{
if (pos.dwValid& GPS_VALID_LATITUDE!= 0&&
pos.dwValid& GPS_VALID_LONGITUDE!= 0)
{
//祝贺你有一个有效的职位。
}
}
Hi,
I am facing a strange problem. I am using GPSGetPosition() API from native gpsapi.dll which is working fine most of the time. However, in some instances, it gives a very wrong position, may be 100 miles a way or 500 miles away and then after a while it again starts giving accurate position. I initialy observed this behaviour with HTC phone and thought it could be HTC problem. Now I can see same problem with motorola MC65 phone as well. It has got windows mobile 6.5.
Anyone else noticed this problem, Microsoft guys, please drop some lines.
Best Regards,
B
解决方案You need to check for the GPS_VALID_ flags in GPS_POSITION::dwValid.
GPS_POSITION pos = { 0 }; pos.dwSize = sizeof( pos ); pos.dwVersion = GPS_VERSION_1; // adjust as necessary DWORD max_age = 0; if( GPSGetPosition( handle, &pos, max_age, 0 ) == ERROR_SUCCESS ) { if( pos.dwValid & GPS_VALID_LATITUDE != 0 && pos.dwValid & GPS_VALID_LONGITUDE != 0 ) { // congratulations, you have a valid position. } }
这篇关于GPS信息不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文