pub struct Bus<P> { /* private fields */ }std only.Expand description
A wired M-Bus behind a port.
Implementations§
Source§impl<P: Read + Write> Bus<P>
impl<P: Read + Write> Bus<P>
Sourcepub fn new(port: P, baud: Baud) -> Self
pub fn new(port: P, baud: Baud) -> Self
A bus at baud (the baud rate the port is opened with), with 50 ms of slack on
every response timeout for USB and network latency.
Sourcepub fn slack(self, slack: Duration) -> Self
pub fn slack(self, slack: Duration) -> Self
Extra time added to every response timeout, and to the quiet time that ends a reply: more for a gateway on the network (whose replies arrive late and in pieces), zero for a UART on the same board. At most 10 s.
Sourcepub fn port_mut(&mut self) -> &mut P
pub fn port_mut(&mut self) -> &mut P
The port, e.g. to change its baud rate after master::set_baud.
Sourcepub fn into_inner(self) -> P
pub fn into_inner(self) -> P
The port back.
Sourcepub fn readout(&mut self, target: Target) -> Result<Vec<Telegram>, Error>
pub fn readout(&mut self, target: Target) -> Result<Vec<Telegram>, Error>
Read every telegram of one meter. Anything but a complete readout is an error
(Error::Incomplete).
Sourcepub fn search(&mut self) -> Result<Found, Error>
pub fn search(&mut self) -> Result<Found, Error>
Find every meter on the bus by secondary address (wildcard search). Each selection waits for the whole response window, so colliding replies are seen.
Sourcepub fn run_search(&mut self, search: Search) -> Result<Found, Error>
pub fn run_search(&mut self, search: Search) -> Result<Found, Error>
Search with a configured Search (selection limit).
Sourcepub fn command(&mut self, request: &Request) -> Result<bool, Error>
pub fn command(&mut self, request: &Request) -> Result<bool, Error>
Send a command and wait for its acknowledgement: Ok(true) when the reply is a
single E5, Ok(false) when nothing, something else, or an E5 with more bytes
behind it (two slaves answered) came back. A broadcast is Ok(true) unread.