Beispiel #1
0
        /// <summary>
        /// Method called when a GPS event occured.
        /// This is where we call the methods that parses each kind of NMEA sentence
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GpsDataEventHandler(object sender, SerialPort.GpsEventArgs e)
        {
            switch (e.TypeOfEvent)
            {
            case GpsEventType.GPRMC:
                ParseRMC(e.Sentence);
                break;

            case GpsEventType.GPGGA:
                ParseGGA(e.Sentence);
                break;

            case GpsEventType.GPGLL:
                ParseGLL(e.Sentence);
                break;

            case GpsEventType.GPGSA:
                ParseGSA(e.Sentence);
                break;

            case GpsEventType.GPGSV:
                ParseGSV(e.Sentence);
                break;

            case GpsEventType.PGRME:
                ParseRME(e.Sentence);
                break;

            case GpsEventType.TimeOut:
                FireTimeOut();
                break;

            case GpsEventType.Unknown:
                GpsEventArgs e2 = new GpsEventArgs
                {
                    TypeOfEvent = e.TypeOfEvent,
                    Sentence    = e.Sentence
                };
                NewProcessedGpsFix(this, e2);
                break;

            default: break;
            }
        }
Beispiel #2
0
 public void Emulator()
 {
     _file = new StreamReader(NMEAInputFile);
     while (true)
     {
         if (_file.EndOfStream)
         {
             //Start from beginning of file
             _file.Close();
             _file = new StreamReader(NMEAInputFile);
         }
         string line = _file.ReadLine();
         SerialPort.GpsEventArgs e = new SerialPort.GpsEventArgs
         {
             TypeOfEvent = String2Eventtype(line),
             Sentence    = line
         };
         NewGpsData(this, e);
         Thread.Sleep(50);
     }
 }
Beispiel #3
0
 public void Emulator()
 {
     _file = new StreamReader(NMEAInputFile);
     while (true)
     {
         if (_file.EndOfStream)
         {
             //Start from beginning of file
             _file.Close();
             _file = new StreamReader(NMEAInputFile);
         }
         string line = _file.ReadLine();
         SerialPort.GpsEventArgs e = new SerialPort.GpsEventArgs
                                         {
                                             TypeOfEvent = String2Eventtype(line),
                                             Sentence = line
                                         };
         NewGpsData(this, e);
         Thread.Sleep(50);
     }
 }