TZ6PMQTGVJCSZDUIYFTT5RHPF7JHUBBRF25Z2RFLXFIBITITEFHQC
port
.expect_clear()
.times(1)
.in_sequence(&mut seq)
.returning(|_| serialport::Result::Ok(()));
port
.expect_write()
.times(1)
.in_sequence(&mut seq)
.returning(|b| {
assert_eq!(b, [0x15]);
std::io::Result::Ok(b.len())
});
port
.expect_write()
.times(1)
.in_sequence(&mut seq)
.returning(|b| {
assert_eq!(b, [1, 3, 0, 8, 0xFF ^ 3 ^ 0 ^ 8]);
std::io::Result::Ok(b.len())
});
port
.expect_read()
.times(1)
.in_sequence(&mut seq)
.return_once(|b| {
b[0] = FrameType::Ack.into();
std::io::Result::Ok(1)
});
port
.expect_clear()
.times(1)
.in_sequence(&mut seq)
.returning(|_| serialport::Result::Ok(()));
port
.expect_write()
.times(1)
.in_sequence(&mut seq)
.returning(|b| std::io::Result::Ok(b.len()));
port
.expect_write()
.times(1)
.in_sequence(&mut seq)
.returning(|b| std::io::Result::Ok(b.len()));
port
.expect_read()
.times(1)
.in_sequence(&mut seq)
.return_once(move |_| std::io::Result::Err(std::io::ErrorKind::TimedOut.into()));
port
.expect_read()
.times(1)
.in_sequence(&mut seq)
.return_once(|b| {
b[0] = FrameType::Ack.into();
std::io::Result::Ok(b.len())
});
Ok(port)
};
let mut driver = create_driver(&mut factory);