Exemple #1
0
        /// <summary>
        /// Unloads the current device, and opens the next device
        /// </summary>
        /// <param name="device"></param>
        private void StartDevice(NmeaParser.NmeaDevice device)
        {
            //Clean up old device
            if (currentDevice != null)
            {
                currentDevice.MessageReceived -= device_MessageReceived;
                currentDevice.Dispose();
            }
            output.Text = "";
            messages.Clear();
            gprmcView.Message   = null;
            gpggaView.Message   = null;
            gpgsaView.Message   = null;
            gpgllView.Message   = null;
            pgrmeView.Message   = null;
            satView.GsvMessages = null;
            //Start new device
            currentDevice = device;
            currentDevice.MessageReceived += device_MessageReceived;
            var _ = currentDevice.OpenAsync();

            if (device is NmeaParser.NmeaFileDevice)
            {
                currentDeviceInfo.Text = string.Format("NmeaFileDevice( file={0} )", ((NmeaParser.NmeaFileDevice)device).FileName);
            }
            else if (device is NmeaParser.SerialPortDevice)
            {
                currentDeviceInfo.Text = string.Format("SerialPortDevice( port={0}, baud={1} )",
                                                       ((NmeaParser.SerialPortDevice)device).Port.PortName,
                                                       ((NmeaParser.SerialPortDevice)device).Port.BaudRate);
            }
        }
Exemple #2
0
 private void stopButton_Click(object sender, RoutedEventArgs e)
 {
     if (listener != null)
     {
         gnssMonitorView.DataContext = null;
         _ = listener.CloseAsync();
         listener.Dispose();
         listener = null;
         startButton.IsEnabled = true;
         stopButton.IsEnabled  = false;
     }
 }
Exemple #3
0
        private async void startButton_Click(object sender, RoutedEventArgs e)
        {
            var info = nmeaDevicePicker.SelectedItem as DeviceInfo;

            if (info != null)
            {
                var device = await info.CreateMethod();

                output.Text = string.Empty;
                messages.Clear();
                device.MessageReceived += device_MessageReceived;
                var _ = device.OpenAsync();
                listener = device;
                startButton.IsEnabled = false;
                stopButton.IsEnabled  = true;
                monitor = new NmeaParser.Gnss.GnssMonitor(device);
                gnssMonitorView.DataContext = monitor;
            }
        }