/// <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); } }
/// <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); } }