private ArduinoSession CreateSerialSession(IDataConnection connection, int timeout = -1) { var session = new ArduinoSession(connection); session.TimeOut = timeout; session.MessageReceived += (o, e) => { Assert.Fail("MessageReceived event triggered"); }; session.EvintFirmata().AnalogStateReceived += (o, e) => { Assert.Fail("AnalogStateReceived event triggered"); }; session.EvintFirmata().DigitalStateReceived += (o, e) => { Assert.Fail("DigitalStateReceived event triggered"); }; session.EvintI2C().I2CReplyReceived += (o, e) => { Assert.Fail("I2CReplyReceived event triggered"); }; session.EvintString().StringReceived += (o, e) => { Console.WriteLine("Received: '{0}'", e.Text); }; return(session); }
/// <summary> /// Creates an observable object tracking received ASCII <see cref="System.String"/> messages. /// </summary> /// <returns>An <see cref="IObservable{String}"/> interface</returns> public static IObservable <string> CreateReceivedStringMonitor(this ArduinoSession session) { return(new ReceivedStringTracker(session.EvintString())); }