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

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

 2010-06-22 03:15:00 来源:WEB开发网   
核心提示:GPGGA.LatitudeHemisphere = Cardinal.South;elseGPGGA.LatitudeHemisphere = Cardinal.North;//LongitudeGPGGA.Longitude = Convert.ToDouble(fields[3])/100;if(fields[4

GPGGA.LatitudeHemisphere = Cardinal.South;

else

GPGGA.LatitudeHemisphere = Cardinal.North;

//Longitude

GPGGA.Longitude = Convert.ToDouble(fields[3])/100;

if(fields[4]=="E")

GPGGA.LatitudeHemisphere = Cardinal.East;

else

GPGGA.LatitudeHemisphere = Cardinal.West;

//GPS Signal Quality

GPGGA.GPSQuality = (GPSQuality)Convert.ToUInt32( fields[5] );

//Satellites

GPGGA.NumberOfSatellitesInUse = Convert.ToInt32(fields[6]);

//HDOP

GPGGA.HDOP = Convert.ToDouble( fields[7] );

//Altitude

GPGGA.Altitude = Convert.ToDouble(fields[8]);

//increase message count

GPGGA.Count ++;

}

catch(Exception e)

{

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

}

}

public bool IsSatUsedInSolution(int SatelliteID)

{

return IsSatelliteUsed(SatelliteID);

}

public void Reset()

{

// TODO: Add NMEAProtocol.Reset implementation

}

private string EncodeToString(byte[] buffer)

{

string s = System.Text.ASCIIEncoding.GetEncoding(1252).GetString(buffer);

// TRIM OFF NULLS!

//s = s.TrimEnd((char)'');

//return s;

//TRIM at the FIRST NULL

string[] strings = s.Split('');

return strings[0];

}

public void ProcessCommand(string sCmd, byte[] bData)

{

string data = EncodeToString(bData);

switch(sCmd)

{

case "GPGGA":

ProcessGPGGA(data);

break;

case "GPGSA":

ProcessGPGSA(data);

break;

case "GPGSV":

ProcessGPGSV(data);

break;

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

Tags:Windows mobile gps

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