public FakeSerialPortL7S(SerialPortConfig portConfig) { if (portConfig == null) throw new ArgumentNullException("portConfig"); //this.Log = LogManager.GetLogger(this.GetType()); // http://zachsaw.blogspot.com/2010/07/net-serialport-woes.html //ObjectClasses.SerialPortFixer.Execute(portConfig.Name); var port = new RJCP.IO.Ports.SerialPortStream(portConfig.Name, portConfig.BaudRate, portConfig.DataBits, RJCP.IO.Ports.Parity.None, RJCP.IO.Ports.StopBits.One); //var port = new RJCP.IO.Ports.SerialPortStream( // portConfig.Name, // portConfig.BaudRate, // portConfig.DataBits, // RJCP.IO.Ports.Parity.None, // RJCP.IO.Ports.StopBits.One) //{ // RtsEnable = portConfig.RtsEnable, // DtrEnable = portConfig.DtrEnable, // ReadTimeout = -1, // WriteTimeout = -1, // ReceivedBytesThreshold = 40 //}; //this._internalSerialStream = port.BaseStream; this._port = port; //this._port..Disposed += new EventHandler(_port_Disposed); byte[] mockByteBuffer = new byte[73]; }
protected override IStreamResource TryOpen() { var sps = new RJCP.IO.Ports.SerialPortStream(Port, Baud, Data, Parity, StopBits); sps.Open(); return(new SerialPortStreamAdapter(sps)); }
public override bool Connect(Uri destination, NetworkCredentials credentials) { var port = destination.Host; var names = RJCP.IO.Ports.SerialPortStream.GetPortNames(); Stream = new RJCP.IO.Ports.SerialPortStream(port, 9600); Stream.Open(); Stream.BeginRead(ReceiveBuffer, 0, ReceiveBuffer.Length, OnDataReceived, null); return(true); }
public SerialPort(string name) { _serialPortStream = new RJCP.IO.Ports.SerialPortStream(name, 115200, 8, RJCP.IO.Ports.Parity.None, RJCP.IO.Ports.StopBits.One); }
public SerialPortStreamAdapter(RJCP.IO.Ports.SerialPortStream serialPortStream) { _serialPortStream = serialPortStream; }
public AsyncState(RJCP.IO.Ports.SerialPortStream serialPort) { this.SerialPort = serialPort; this.Buffer = new byte[BufferSize]; }