Exemplo n.º 1
0
        public void Open()
        {
            if (is_open)
            {
                throw new InvalidOperationException("Port is already open");
            }

            stream = new FrostedSerialPortStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                                                 rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);

            is_open = true;
        }
Exemplo n.º 2
0
        protected override void Dispose(bool disposing)
        {
            if (!is_open)
            {
                return;
            }

            is_open = false;
            // Do not close the base stream when the finalizer is run; the managed code can still hold a reference to it.
            if (disposing)
            {
                stream.Close();
            }
            stream = null;
        }
Exemplo n.º 3
0
        public void Open()
        {
            if (is_open)
            {
                throw new InvalidOperationException("Port is already open");
            }

#if !TARGET_JVM
            if (IsWindows) // Use windows kernel32 backend
            {
                stream = new WinSerialStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                                             rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);
            }
            else // Use standard unix backend
#endif
            stream = new FrostedSerialPortStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                                                 rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);

            is_open = true;
        }
Exemplo n.º 4
0
        public void Open()
        {
            if (is_open)
                throw new InvalidOperationException("Port is already open");

            stream = new FrostedSerialPortStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);

            is_open = true;
        }
Exemplo n.º 5
0
        protected override void Dispose(bool disposing)
        {
            if (!is_open)
                return;

            is_open = false;
            // Do not close the base stream when the finalizer is run; the managed code can still hold a reference to it.
            if (disposing)
                stream.Close();
            stream = null;
        }
Exemplo n.º 6
0
        public void Open()
        {
            if (is_open)
                throw new InvalidOperationException("Port is already open");

#if !TARGET_JVM
            if (IsWindows) // Use windows kernel32 backend
                stream = new WinSerialStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                    rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);
            else // Use standard unix backend
#endif
                stream = new FrostedSerialPortStream(port_name, baud_rate, data_bits, parity, stop_bits, dtr_enable,
                    rts_enable, handshake, read_timeout, write_timeout, readBufferSize, writeBufferSize);

            is_open = true;
        }