Пример #1
0
 public static void Main()
 {
     try
     {
         var gps = new NMEA("COM1", 9600, Parity.None, 8, StopBits.One);
         //
         var ggaDecoder = new GGADecoder();
         ggaDecoder.OnPositionReceived += ggaDecoder_OnPositionReceived;
         gps.AddDecoder(ggaDecoder);
         //
         var gllDecoder = new GLLDecoder();
         gllDecoder.OnGeographicLatitudeLongitudeReceived += gllDecoder_OnGeographicLatitudeLongitudeReceived;
         gps.AddDecoder(gllDecoder);
         //
         var gsaDecoder = new GSADecoder();
         gsaDecoder.OnActiveSatellitesReceived += gsaDecoder_OnActiveSatelitesReceived;
         gps.AddDecoder(gsaDecoder);
         //
         var rmcDecoder = new RMCDecoder();
         rmcDecoder.OnPositionCourseAndTimeReceived += rmcDecoder_OnPositionCourseAndTimeReceived;
         gps.AddDecoder(rmcDecoder);
         //
         var vtgDecoder = new VTGDecoder();
         vtgDecoder.OnCourseAndVelocityReceived += vtgDecoder_OnCourseAndVelocityReceived;
         gps.AddDecoder(vtgDecoder);
         //
         gps.Open();
         Thread.Sleep(Timeout.Infinite);
     }
     catch (Exception ex)
     {
     }
 }
Пример #2
0
        void TestNMEA()
        {
            var gps = new NMEA(Device, Device.SerialPortNames.Com1, 9600, Parity.None, 8, StopBits.One);

            var ggaDecoder = new GGADecoder();

            ggaDecoder.OnPositionReceived += GgaDecoder_OnPositionReceived;
            gps.AddDecoder(ggaDecoder);
            //
            var gllDecoder = new GLLDecoder();

            gllDecoder.OnGeographicLatitudeLongitudeReceived += GllDecoder_OnGeographicLatitudeLongitudeReceived;
            gps.AddDecoder(gllDecoder);
            //
            var gsaDecoder = new GSADecoder();

            gsaDecoder.OnActiveSatellitesReceived += GsaDecoder_OnActiveSatelitesReceived;
            gps.AddDecoder(gsaDecoder);
            //
            var rmcDecoder = new RMCDecoder();

            rmcDecoder.OnPositionCourseAndTimeReceived += RmcDecoder_OnPositionCourseAndTimeReceived;
            gps.AddDecoder(rmcDecoder);
            //
            var vtgDecoder = new VTGDecoder();

            vtgDecoder.OnCourseAndVelocityReceived += VtgDecoder_OnCourseAndVelocityReceived;
            gps.AddDecoder(vtgDecoder);
            //
            gps.Open();
            Thread.Sleep(Timeout.Infinite);
        }
Пример #3
0
        static void InitGPS()
        {
            var gps = new NMEA("COM1", 9600, Parity.None, 8, StopBits.One);
            //
            var ggaDecoder = new GGADecoder();

            ggaDecoder.OnPositionReceived += ggaDecoder_OnPositionReceived;
            gps.AddDecoder(ggaDecoder);
            //
            var gllDecoder = new GLLDecoder();

            gllDecoder.OnGeographicLatitudeLongitudeReceived += gllDecoder_OnGeographicLatitudeLongitudeReceived;
            gps.AddDecoder(gllDecoder);
            //
            var gsaDecoder = new GSADecoder();

            gsaDecoder.OnActiveSatellitesReceived += gsaDecoder_OnActiveSatelitesReceived;
            gps.AddDecoder(gsaDecoder);
            //
            var rmcDecoder = new RMCDecoder();

            rmcDecoder.OnPositionCourseAndTimeReceived += rmcDecoder_OnPositionCourseAndTimeReceived;
            gps.AddDecoder(rmcDecoder);
            //
            var vtgDecoder = new VTGDecoder();

            vtgDecoder.OnCourseAndVelocityReceived += vtgDecoder_OnCourseAndVelocityReceived;
            gps.AddDecoder(vtgDecoder);
            //
            gps.Open();
        }