Ejemplo n.º 1
0
        private void CloseIfOpen()
        {
            if (this.IsReady)
            {
                this._serialDevice.Close();
            }
            this._serialDevice.Dispose();
            SerialPortStreamWrapper portStreamWrapper = new SerialPortStreamWrapper(this._port, this._baudRate, Parity.Odd, StopBits.One, 7, new Func <byte[], bool>(this.OnDataReceived));

            portStreamWrapper.RtsEnable = true;
            this._serialDevice          = portStreamWrapper;
        }
Ejemplo n.º 2
0
        public Magellan9300S(
            IConfiguration configuration,
            ILogger <Magellan9300S> logger)
        {
            if (logger != null)
            {
                logger.LogDebug("Magellan9300S CTOR");
            }
            this._configuration = configuration;
            this._logger        = logger;
            SerialPortStreamWrapper portStreamWrapper = new SerialPortStreamWrapper(this._port, this._baudRate, Parity.Odd, StopBits.One, 7, new Func <byte[], bool>(this.OnDataReceived));

            portStreamWrapper.RtsEnable = true;
            this._serialDevice          = portStreamWrapper;
            this._timer           = new System.Timers.Timer(250.0);
            this._timer.Elapsed  += new ElapsedEventHandler(this.OnTimedEvent);
            this._timer.AutoReset = true;
        }