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);
        }
Example #2
0
 /// <summary>
 /// Creates an observable object tracking <see cref="I2CReply"/> messages.
 /// </summary>
 /// <returns>An <see cref="IObservable{I2cReply}"/> interface</returns>
 public static IObservable <I2CReply> CreateI2CReplyMonitor(this ArduinoSession session)
 {
     return(new I2CReplyTracker(session.EvintI2C()));
 }