public override IObservable <TSource> Process <TSource>(IObservable <TSource> source) { var newLine = ObservableSerialPort.Unescape(NewLine); return(Observable.Using( () => SerialPortManager.ReserveConnection(PortName), connection => source.Do(value => { lock (connection.SerialPort) { connection.SerialPort.Write(value.ToString()); connection.SerialPort.Write(newLine); } }))); }
public override IObservable <string> Generate() { var newLine = ObservableSerialPort.Unescape(NewLine); return(ObservableSerialPort.ReadLine(PortName, newLine)); }