Expand description
Lightweight mesh communication protocol for embedded devices.
embedded-nano-mesh allows you to build a self-healing mesh network
using very cheap microcontrollers and simple serial radio modules.
The library is no_std, non-blocking and works with any serial interface
that implements embedded_io::Read, embedded_io::Write and
embedded_io::ReadReady.
§Quick start
use embedded_nano_mesh::{ms, ExactAddressType, LifeTimeType, Node, NodeConfig, NodeString};
let mut mesh_node = Node::new(NodeConfig {
device_address: ExactAddressType::new(1).unwrap(),
listen_period: 150 as ms,
});
let _ = mesh_node.send_to_exact(
NodeString::from_iter("Hello".chars()).into_bytes(),
ExactAddressType::new(2).unwrap(),
10 as LifeTimeType,
true,
);
// In the main loop:
// mesh_node.update(&mut serial, current_time);
// if let Some(packet) = mesh_node.receive() { ... }Delivery guarantees (transactions, ping-pong, acknowledgements, retries)
are intentionally not part of the protocol core. They belong to the
application layer and can be built on top of send_to_exact / broadcast /
receive.
Structs§
- Node
- The main and only structure of the library that brings API for
communication trough the mesh network.
It works in the manner of listening of ether for
specified period of time, which is called
listen_period, and then sending out packets out of queues between those periods. - Node
Config - User-friendly
Nodeconfiguration structure. - Node
Update Error - Error that can be returned by
Nodeupdatemethod. - Packet
- A packet that is transmitted over the mesh network.
Enums§
- General
Address Type - Type to strict interaction with addressing during use of the library. It provides options to send packet to exact device or to all devices it can reach.
- Send
Error - Error that can be returned by
Nodesendmethod orbroadcastmethod.
Type Aliases§
- Exact
Address Type - Type alias for device address identification number. It can contain only non-zero positive number. The zero value is reserved for broadcast address.
- IdType
- Type alias for packet identification number.
- Life
Time Type - Type alias for packet lifetime. This value contains the information,
about for how many times the packet can be re-sent.
It has sense to contain same capacity of possible values same
as
AddressType- in order to make the packet possible to pass all the nodes of the network. - Node
String - Type alias for a String with fixed length, that is made to simplify messaging between nodes.
- Packet
Data Bytes - Type alias for bytes of data contained in the packet.
- ms
- Type alias for milliseconds. All time related values use this type.