Module meshtastic::packet
source · Expand description
This module contains the structs, enums, and traits that are necessary to define the behavior
of packets within the library. This module exposes the PacketDestination
enum, the PacketRouter
trait, and the PacketReceiver
type.
The PacketDestination
enum is used to define the destination of a packet. The enum defines three possible
destinations for packets sent to the radio by the library:
PacketDestination::Local
- This destination is used for packets that are intended to be processed locally by the radio and not to be forwarded to other nodes. An example of this would be local configuration packets.PacketDestination::Broadcast
- This destination is used for packets that are intended to be broadcast to all nodes in the mesh. This is the default enum variant. Text messages are commonly broadcasted to the entire mesh.PacketDestination::Node(u32)
- This destination is used for packets that are intended to be sent to a specific node in the mesh. Theu32
value is the node id of the node that the packet should be sent to. This is commonly used for direct text messages.
The PacketRouter
trait defines the behavior of a struct that is able to route mesh packets. This trait is used
to allow for the echoing of mesh packets within the send_mesh_packet
method of the ConnectedStreamApi
struct.
The PacketReceiver
type defines the type of the tokio channel that is used to receive decoded packets from the radio.
This is intended to simplify the complexity of the underlying channel type.
Enums§
- An enum that defines the possible destinations for a mesh packet. This enum is used to specify the destination of a packet when sending a packet to the radio.
Constants§
- Interval for sending heartbeat packets to the radio (in seconds). Needs to be less than this: https://github.com/meshtastic/firmware/blob/eb372c190ec82366998c867acc609a418130d842/src/SerialConsole.cpp#L8
Traits§
- This trait defines the behavior of a struct that is able to route mesh packets. More generally, this trait defines the behavior of a struct that is able to send and receive mesh packets.
Type Aliases§
- A type alias for the tokio channel that is used to receive decoded
protobufs::FromRadio
packets from the radio.