Skip to main content

Mesh

Struct Mesh 

Source
pub struct Mesh { /* private fields */ }
Expand description

A mesh instance (provisioner, node, or both).

Implementations§

Source§

impl Mesh

Source

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.

Source

pub fn events(&self) -> Receiver<MeshEvent>

Events, from now on.

Source

pub fn store(&self) -> Store

A copy of the store.

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn app_key(&self, index: u16) -> Option<(Key, u8)>

The application key with this index, and its AID.

Source

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.

Source

pub async fn send_access( &self, dst: u16, key: AccessKey<'_>, payload: &[u8], ) -> Result<(), Error>

Sends an access message (segmented and acknowledged as needed).

Source

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).

Source

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.

Source

pub fn network_id(&self) -> Option<[u8; 8]>

The primary network’s Network ID (what a proxy advertises).

Source

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.

Source

pub fn open_proxy_configuration(&self, data: &[u8]) -> Option<Config>

A Proxy Configuration message from the proxy (or its client), opened.

Source

pub fn receive(&self, ad_type: u8, data: &[u8])

Takes one Mesh AD structure heard on the air.

Trait Implementations§

Source§

impl Clone for Mesh

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Mesh

§

impl !UnwindSafe for Mesh

§

impl Freeze for Mesh

§

impl Send for Mesh

§

impl Sync for Mesh

§

impl Unpin for Mesh

§

impl UnsafeUnpin for Mesh

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more