private void OnPortClosed()
        {
            SerialConnectButton.Content = "Connect";
            UdpConnectButton.Content    = "Connect";
            channel.MessageReceived    -= OnMessageReceived;
            channel.Stop();
            channel = null;

            if (Disconnected != null)
            {
                Disconnected(this, EventArgs.Empty);
            }
            logList.Clear();
        }
        void OnPortConnected(IPort port)
        {
            this.port = port;

            port.Write("\n\n\n\nexit\r\nlogs\r\n");

            channel = new Microsoft.Networking.Mavlink.MavlinkChannel();
            channel.Start(port);
            channel.MessageReceived += OnMessageReceived;

            if (Connected != null)
            {
                Connected(this, EventArgs.Empty);
            }
        }
        private void OnPortClosed()
        {
            SerialConnectButton.Content = "Connect";
            UdpConnectButton.Content = "Connect";
            channel.MessageReceived -= OnMessageReceived;
            channel.Stop();
            channel = null;

            if (Disconnected != null)
            {
                Disconnected(this, EventArgs.Empty);
            }
            logList.Clear();
        }
Пример #4
0
        void Run()
        {
            if (udpAddress != null)
            {
                UdpPort udp = new UdpPort();
                udp.Connect(udpAddress);

                IPEndPoint remote = udp.WaitForOneMessage(TimeSpan.FromSeconds(10));
                if (remote == null)
                {
                    Console.WriteLine("### Error: not getting any messages from " + udpAddress);
                    return;
                }
                port = udp;
            }
            else if (comPortName != null)
            {
                SerialPort serial = new SerialPort();
                serial.Connect(comPortName, DefaultComBaudRate);
                port = serial;
            }
            if (proxyAddress != null)
            {
                proxyPort = new UdpPort();
                proxyPort.Connect(new IPEndPoint(udpAddress.Address, 0), proxyAddress);
                proxyChannel = new MavlinkChannel();
                proxyChannel.MessageReceived += OnProxyMessageReceived;
                proxyChannel.Start(proxyPort);
            }

            MavlinkChannel channel = new MavlinkChannel();
            channel.MessageReceived += OnMessageReceived;
            channel.Start(port);
        }
        void OnPortConnected(IPort port)
        {
            this.port = port;

            port.Write("\n\n\n\nexit\r\nlogs\r\n");

            channel = new Microsoft.Networking.Mavlink.MavlinkChannel();
            channel.Start(port);
            channel.MessageReceived += OnMessageReceived;

            if (Connected != null)
            {
                Connected(this, EventArgs.Empty);
            }
        }