Esempio n. 1
0
        public void CloseCom(bool auto)
        {
            try
            {
                if (com.IsOpen)
                {
                    Logger.LogMessage("CloseCom", "Close {0} [{1}]", com.PortName.ToUpper(), auto ? "CORE" : "USER");

                    com.DiscardOutBuffer();
                    com.DiscardInBuffer();
                    com.Close();
                }

                mBuffer = 0;

                TX.Stop();
                RX.Stop();

                lock (this)
                { ClearQueue(false); }

                SetStatus(MacStatus.Disconnected);
            }
            catch (Exception ex)
            {
                Logger.LogException("CloseCom", ex);
            }
        }
Esempio n. 2
0
            protected override void OnClose(CloseEventArgs e)
            {
                lock (rxBuf)
                {
                    Console.WriteLine("Connection lost!");
                    RX.Stop();
                    rxBuf.Clear();

                    TX.Stop();
                    txBuf.Clear();
                }
            }
        public void CloseCom()
        {
            if (opened)
            {
                opened = false;

                RX.Stop();
                TX.Stop();

                lock (rxBuf)
                {
                    rxBuf.Clear();
                    txBuf.Clear();
                }

                EmuLog("Connection lost!");
                Tools.Serializer.ObjToFile(conf, filename);
            }
        }
Esempio n. 4
0
        public void CloseCom()
        {
            if (com.IsOpen)
            {
                com.DiscardOutBuffer();
                com.DiscardInBuffer();
                com.Close();
            }

            mBuffer = 0;

            TX.Stop();
            RX.Stop();

            lock (this)
            { ClearQueue(false); }

            mMachineStatus = MacStatus.Disconnected;
        }
Esempio n. 5
0
        public void CloseCom(bool auto)
        {
            try
            {
                if (com.IsOpen)
                {
                    com.Close(auto);
                }

                mBuffer = 0;

                TX.Stop();
                RX.Stop();

                lock (this)
                { ClearQueue(false); }

                SetStatus(MacStatus.Disconnected);
            }
            catch (Exception ex)
            {
                Logger.LogException("CloseCom", ex);
            }
        }