pub struct Mesh { /* private fields */ }Expand description
A mesh instance (provisioner, node, or both).
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn open(
bearer: Arc<dyn Bearer>,
dir: Option<PathBuf>,
uuid: [u8; 16],
) -> Result<Mesh>
pub fn open( bearer: Arc<dyn Bearer>, dir: Option<PathBuf>, uuid: [u8; 16], ) -> Result<Mesh>
Opens (or creates) a mesh instance with its store in dir, and a
Device UUID for when it is a node waiting to be provisioned.
Sourcepub fn create_network(&self)
pub fn create_network(&self)
Starts a new network with us as its provisioner at address 0x0001: a fresh network key (index 0) and application key (index 0).
Sourcepub async fn provision(
&self,
uuid: [u8; 16],
auth: Auth,
) -> Result<NodeRecord, Error>
pub async fn provision( &self, uuid: [u8; 16], auth: Auth, ) -> Result<NodeRecord, Error>
Provisions the device with this UUID over PB-ADV; returns its record.
Sourcepub async fn configure(&self, node: &NodeRecord) -> Result<Composition, Error>
pub async fn configure(&self, node: &NodeRecord) -> Result<Composition, Error>
Configures a provisioned node: reads its composition, gives it the application key, and binds it to every Generic OnOff and Level Server.
Sourcepub async fn request(
&self,
dst: u16,
key: AccessKey<'_>,
payload: &[u8],
reply: Opcode,
) -> Result<Vec<u8>, Error>
pub async fn request( &self, dst: u16, key: AccessKey<'_>, payload: &[u8], reply: Opcode, ) -> Result<Vec<u8>, Error>
Sends an acknowledged access message and waits for the reply’s parameters.
Sourcepub fn app_key(&self, index: u16) -> Option<(Key, u8)>
pub fn app_key(&self, index: u16) -> Option<(Key, u8)>
The application key with this index, and its AID.
Sourcepub async fn onoff_set(
&self,
dst: u16,
on: bool,
tid: u8,
) -> Result<bool, Error>
pub async fn onoff_set( &self, dst: u16, on: bool, tid: u8, ) -> Result<bool, Error>
Sets a Generic OnOff Server and returns its present state.
Sourcepub async fn send_access(
&self,
dst: u16,
key: AccessKey<'_>,
payload: &[u8],
) -> Result<(), Error>
pub async fn send_access( &self, dst: u16, key: AccessKey<'_>, payload: &[u8], ) -> Result<(), Error>
Sends an access message (segmented and acknowledged as needed).
Sourcepub async fn wait_for_provisioning(
&self,
caps: Capabilities,
static_oob: Option<Key>,
)
pub async fn wait_for_provisioning( &self, caps: Capabilities, static_oob: Option<Key>, )
Starts as a node waiting to be provisioned: sends unprovisioned device beacons until provisioned (then sends nothing).
Sourcepub fn proxy_configuration(&self, msg: &Config) -> Option<Vec<u8>>
pub fn proxy_configuration(&self, msg: &Config) -> Option<Vec<u8>>
A Proxy Configuration message from us, for the proxy we are connected to: a control message, TTL 0, to the unassigned address, with the proxy nonce and our primary network key. None until provisioned.
Sourcepub fn network_id(&self) -> Option<[u8; 8]>
pub fn network_id(&self) -> Option<[u8; 8]>
The primary network’s Network ID (what a proxy advertises).
Sourcepub fn open_network(&self, data: &[u8]) -> Option<NetworkPdu>
pub fn open_network(&self, data: &[u8]) -> Option<NetworkPdu>
A Network PDU opened with our keys, without taking it (no replay cache, no delivery): for a proxy deciding where it goes.
Sourcepub fn open_proxy_configuration(&self, data: &[u8]) -> Option<Config>
pub fn open_proxy_configuration(&self, data: &[u8]) -> Option<Config>
A Proxy Configuration message from the proxy (or its client), opened.