WEB开发网
开发学院手机开发Windows Mobile 开发 Windows mobile gps 串口通信 NMEA命令和数据处理... 阅读

Windows mobile gps 串口通信 NMEA命令和数据处理

 2010-06-22 03:15:00 来源:WEB开发网   
核心提示:sat.SignalQuality = Convert.ToInt32(fields[6+iSat*4]);sat.Used = IsSatelliteUsed(sat.Id);GPGSV.Satellites.Add(sat);}GPGSV.Count ++;}private bool IsSatelliteUsed

sat.SignalQuality = Convert.ToInt32(fields[6+iSat*4]);

sat.Used = IsSatelliteUsed(sat.Id);

GPGSV.Satellites.Add(sat);

}

GPGSV.Count ++;

}

private bool IsSatelliteUsed(int satelliteId)

{

if(null == GPGSA.SatsInSolution) return false;

foreach(int satId in GPGSA.SatsInSolution)

{

if (satId == satelliteId) return true;

}

return false;

}

public void ProcessGPGSA(string data)

{

try

{

string[] fields = Regex.Split(data, ",");

GPGSA.Mode = Convert.ToChar(fields[0]);

GPGSA.mFixMode = Convert.ToByte(fields[1]);

GPGSA.SatsInSolution = new int[12];

for (int i = 2; i <= 13; i++)

{

int satId = -1;

if (int.TryParse(fields[i], out satId))

{

if (satId != -1)

{

GPGSA.SatsInSolution[i - 2] = satId;

}

}

}

GPGSA.PDOP = Convert.ToDouble(fields[14]);

GPGSA.HDOP = Convert.ToDouble(fields[15]);

GPGSA.VDOP = Convert.ToDouble(fields[16]);

GPGSA.Count++;

}

catch (Exception e)

{

System.Diagnostics.Trace.WriteLine("Chaos in ProcessGPGSA! " + e.ToString());

}

}

public void ProcessGPGGA(string data)

{

try

{

string[] fields = Regex.Split(data,",");

//Time: Hour, Minute, Second

//Time is Zulu

GPGGA.Hour = Convert.ToInt32( fields[0].Substring(0,2));

GPGGA.Minute = Convert.ToInt32(fields[0].Substring(2,2));

GPGGA.Second = Convert.ToInt32(fields[0].Substring(4,2));

//Latitude

GPGGA.Latitude = Convert.ToDouble(fields[1])/100;

if(fields[2]=="S")

上一页  1 2 3 4 5 6 7  下一页

Tags:Windows mobile gps

编辑录入:coldstar [复制链接] [打 印]
赞助商链接