Exemple #1
0
        public void CloseConnnection()
        {
            if (_utecConn != null)
            {
                _utecConn.DataReceived  -= _utecConn_DataReceived;
                _utecConn.ErrorReceived -= SerialConnection_ErrorReceived;
                _utecConn.Stop();
                _utecConn.Dispose();
                _utecConn = null;
            }

            if (_externalWB != null)
            {
                _externalWB.ErrorReceived -= SerialConnection_ErrorReceived;
                _externalWB.Stop();
                _externalWB.Dispose();
                _externalWB = null;
            }
        }
Exemple #2
0
        public void OpenConnection(string portName, bool fastLogging, int linesPerSecond, bool testMode)
        {
            CloseConnnection();

            _utecConn                = new UtecSerialConn(portName);
            _utecConn.FastLogging    = fastLogging;
            _utecConn.LinesPerSecond = linesPerSecond;
            _utecConn.DataReceived  += _utecConn_DataReceived;
            _utecConn.ErrorReceived += SerialConnection_ErrorReceived;
            _utecConn.TestMode       = testMode;
            _utecConn.Start();

            if (!TXSTunerPresent)
            {
                if (ExternalWBComPort == portName && ExternalWB != "No Wideband")
                {
                    throw new ArgumentException(String.Format("UTEC Com Port and External Wideband Com Port cannot be the same."));
                }

                _externalWB = new WidebandSupport.WidebandFactory(ExternalWB, ExternalWBComPort, _utecConn.TestMode).CreateInstance();
                _externalWB.ErrorReceived += SerialConnection_ErrorReceived;
                _externalWB.Start();
            }
        }