orouter-serial (ōRouter serial protocol)
This crate provides typed messages used for serial communication between host and oRouter. It also contains codecs for different serial HW used in oRouter.
As a wire codec oRouter uses COBS encoding, specifically cobs rust crate but this is completely abstracted from user of this library.
For reading of messages one can use instance of [crate::host::MessageReader] -
after it's created it can be fed incoming slices of bytes (u8s) and messages are returned
in a [crate::heapless::Vec] when successfully decoded.
Example:
use ;
const TEST_DATA: = ;
, 17>default;
// feed the message_reader with test data representing a Status message
let messages = message_reader..unwrap;
println!;
assert_eq!;
}
for more complete read example refer to examples/read.rs
For encoding a message for being send over the serial line a method
[crate::host::Message::encode] is used. However, if you know a type of serial line you will
be using to send a message (USB or BLE) you can use [crate::host::Message::as_frames] method
with a specific codec from [crate::host::codec] module to get message bytes framed in a way
needed by the particular serial line type.
Example:
use FromStr;
use ;
for more complete write example refer to examples/write.rs
Cargo features
std- on by default, exposes things which need standard library (e.g.Debugderives)defmt-impl- add [defmt::Format] derive implementations
Dependant internal projects
- cli host tool
- node-overline-protocol
- RTNOrouterProtocols
- oRouter Desktop App
- orouter-cli-miner