Пример #1
0
        /// <summary>
        /// Shutdown the ADCP serial port.
        /// This will stop all the read threads
        /// for the ADCP serial port.
        /// </summary>
        public void DisconnectAdcpSerial()
        {
            try
            {
                if (_adcpSerialPort != null)
                {
                    DispalyStatus(string.Format("ADCP Disconnect: {0}", _adcpSerialPort.ToString()));

                    // Disconnect the serial port
                    _adcpSerialPort.Disconnect();

                    // Unscribe to ADCP SerialPort events
                    _adcpSerialPort.ReceiveAdcpSerialDataEvent -= ReceiveAdcpSerialData;


                    // Publish that the ADCP serial conneciton is disconnected
                    //PublishAdcpSerialDisconnection();

                    // Shutdown the serial port
                    _adcpSerialPort.Dispose();
                }
                //Status.Status = eAdcpStatus.NotConnected;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error disconnecting the serial port.", e);
            }
        }
Пример #2
0
        /// <summary>
        /// Shutdown the ADCP serial port.
        /// This will stop all the read threads
        /// for the ADCP serial port.
        /// </summary>
        public void DisconnectSerial()
        {
            try
            {
                if (_serialPort != null)
                {
                    DisplayStatus(string.Format("Disconnect Serial: {0}", _serialPort.ToString()));

                    // Disconnect the serial port
                    _serialPort.Disconnect();


                    // Publish that the ADCP serial conneciton is disconnected
                    //PublishAdcpSerialDisconnection();

                    // Shutdown the serial port
                    _serialPort.Dispose();
                }
                //Status.Status = eAdcpStatus.NotConnected;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error disconnecting the serial port.", e);
            }
        }
Пример #3
0
        /// <summary>
        /// Disconnect the serial port.
        /// </summary>
        private void Disconnect()
        {
            if (_serialPort != null)
            {
                _serialPort.ReceiveRawSerialDataEvent -= _serialPort_ReceiveRawSerialDataEvent;
                _serialPort.Disconnect();
                _serialPort = null;
            }

            // Set status message
            DisplaySerialPortStatusMsg(string.Format("Disconnect from ADCP on {0} - {1}", _serialOption.Port, _serialOption.BaudRate));
        }