/// <summary> /// Private method for parsing the GPGSA NMEA sentence /// </summary> /// <param name="strGSA">GPGSA sentence</param> private void ParseGSA(string strGSA) { GPGSA = new GPGSA(strGSA); //fire the event. GpsEventArgs e = new GpsEventArgs { TypeOfEvent = GpsEventType.GPGSA, Sentence = strGSA }; NewProcessedGpsFix(this, e); }
/// <summary> /// Initializes a GpsHandler for communication with GPS receiver. /// The GpsHandler is used for communication with the GPS device and process information from the GPS revice. /// </summary> public GpsHandler() { _disposed = false; NewProcessedGpsFix += GpsEventHandler; //Link event from GPS receiver to process data function GpsPort.NewGpsData += GpsDataEventHandler; GPRMC = new GPRMC(); GPGGA = new GPGGA(); GPGSA = new GPGSA(); GPRMC = new GPRMC(); PGRME = new GPRME(); GPGSV = new GPGSV(); }
/// <summary> /// Disposes the GpsHandler and if nessesary calls Stop() /// </summary> public void Dispose() { if (!_disposed) { Stop(); GpsPort.Dispose(); GPGGA = null; GPGLL = null; GPGSA = null; GPRMC = null; PGRME = null; GpsPort = null; _disposed = true; } GC.SuppressFinalize(this); }
public void ReadGPGSA(string[] strGPS, GPGSA gpgsa) { gpgsa.Mode = string.IsNullOrEmpty(strGPS[1]) ? ' ' : Convert.ToChar(strGPS[1]); gpgsa.Location = string.IsNullOrEmpty(strGPS[2]) ? 0 : Convert.ToInt32(strGPS[2]); gpgsa.PRN1 = string.IsNullOrEmpty(strGPS[3]) ? 0 : Convert.ToInt32(strGPS[3]); gpgsa.PRN2 = string.IsNullOrEmpty(strGPS[4]) ? 0 : Convert.ToInt32(strGPS[4]); gpgsa.PRN3 = string.IsNullOrEmpty(strGPS[5]) ? 0 : Convert.ToInt32(strGPS[5]); gpgsa.PRN4 = string.IsNullOrEmpty(strGPS[6]) ? 0 : Convert.ToInt32(strGPS[6]); gpgsa.PRN5 = string.IsNullOrEmpty(strGPS[7]) ? 0 : Convert.ToInt32(strGPS[7]); gpgsa.PRN6 = string.IsNullOrEmpty(strGPS[8]) ? 0 : Convert.ToInt32(strGPS[8]); gpgsa.PRN7 = string.IsNullOrEmpty(strGPS[9]) ? 0 : Convert.ToInt32(strGPS[9]); gpgsa.PRN8 = string.IsNullOrEmpty(strGPS[10]) ? 0 : Convert.ToInt32(strGPS[10]); gpgsa.PRN9 = string.IsNullOrEmpty(strGPS[11]) ? 0 : Convert.ToInt32(strGPS[11]); gpgsa.PRN10 = string.IsNullOrEmpty(strGPS[12]) ? 0 : Convert.ToInt32(strGPS[12]); gpgsa.PRN11 = string.IsNullOrEmpty(strGPS[13]) ? 0 : Convert.ToInt32(strGPS[13]); gpgsa.PRN12 = string.IsNullOrEmpty(strGPS[14]) ? 0 : Convert.ToInt32(strGPS[14]); gpgsa.PDOP = string.IsNullOrEmpty(strGPS[15]) ? 0 : Convert.ToDouble(strGPS[15]); gpgsa.HDOP = string.IsNullOrEmpty(strGPS[16]) ? 0 : Convert.ToDouble(strGPS[16]); gpgsa.VDOP = string.IsNullOrEmpty(strGPS[17]) ? 0 : Convert.ToDouble(strGPS[17]); //gpgsa.Checksum = string.IsNullOrEmpty(strGPS[18]) ? 0 : Convert.ToInt32(strGPS[18]); }