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

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

 2010-06-22 03:15:00 来源:WEB开发网   
核心提示:GPRMC.Month = Convert.ToInt32(fields[8].Substring(2, 2));GPRMC.Year = Convert.ToInt32(fields[8].Substring(4, 2));GPRMC.DataValid = Convert.ToChar(fields[1]);//L

GPRMC.Month = Convert.ToInt32(fields[8].Substring(2, 2));

GPRMC.Year = Convert.ToInt32(fields[8].Substring(4, 2));

GPRMC.DataValid = Convert.ToChar(fields[1]);

//Latitude

GPRMC.Latitude = Convert.ToDouble(fields[2]) / 100;

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

GPRMC.LatitudeHemisphere = Cardinal.South;

else

GPRMC.LatitudeHemisphere = Cardinal.North;

//Longitude

GPRMC.Longitude = Convert.ToDouble(fields[4]) / 100;

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

GPRMC.LatitudeHemisphere = Cardinal.East;

else

GPRMC.LatitudeHemisphere = Cardinal.West;

GPRMC.GroundSpeed = Convert.ToDouble(fields[6]);

//TODO: MagVar and Course

GPRMC.Count++;

}

public void ProcessGPGSV(string data)

{

//parses the GPGSV stream to extract satellite information

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

uint totalNumberOfMessages = Convert.ToUInt32(fields[0]);

//make sure the data is OK. valid range is 1..8 channels

if ((totalNumberOfMessages > 8) || (totalNumberOfMessages <= 0))

return;

GPGSV.TotalNumberOfMessages = totalNumberOfMessages;

//message number

int nMessageNumber = Convert.ToInt32(fields[1]);

//make sure it is 0..9...is there an inconsistency? 8/9?

if ((nMessageNumber > 9) || (nMessageNumber < 0))

return;

//sats in view

GPGSV.SatellitesInView = Convert.ToInt32(fields[2]);

//for(int iSat = 0; iSat < GPGSV.SatellitesInView; iSat++)

for (int iSat = 0; iSat < 4; iSat++)

{

Satellite sat = new Satellite();

sat.Id = Convert.ToInt32(fields[3+iSat*4]);

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

sat.Azimuth = Convert.ToInt32(fields[5+iSat*4]);

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

Tags:Windows mobile gps

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接