Skip to main content

BaseDeviceBehavior

Struct BaseDeviceBehavior 

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

Base Device Behavior (BDB) commissioning manager.

Orchestrates the standard commissioning procedures defined in the BDB specification: initialization, network steering, network formation, finding & binding, and touchlink. The application owns the [ZigbeeDevice] and the Nlme; commissioning methods borrow the device for the duration of the procedure.

Like the layers below, procedures take &self and keep their few attributes (BDB 5.3) behind interior mutability, so one instance can be shared. They are not meant to overlap, though: run one commissioning procedure at a time.

Implementations§

Source§

impl BaseDeviceBehavior

Source

pub fn new(config: Config) -> Self

Source

pub fn nib(&self) -> &'static Nib

Returns a reference to the global NIB singleton.

Source

pub fn commissioning_status(&self) -> BdbCommissioningStatus

bdbCommissioningStatus (BDB 5.3.1): how the last commissioning procedure ended, or InProgress while one runs.

Source

pub fn commissioning_mode(&self) -> CommissioningMode

bdbCommissioningMode (BDB 5.3.5): the procedure commissioning runs.

Source

pub fn node_is_on_a_network(&self) -> bool

bdbNodeIsOnANetwork (BDB 5.3.9): whether the node is on a network.

Whether network steering exchanges the initial Trust Center link key for a unique one (BDB 8.2 step 12); a failed exchange takes the node off the network again.

Disable to stay on the default global TC link key with a trust center that answers neither Node_Desc_req nor REQUEST-KEY, at the cost of leaving the join unauthenticated.

Source

pub async fn start_initialization_procedure<M: Mlme>( &self, device: &ZigbeeDevice<M>, delay: &mut impl DelayNs, ) -> Result<Option<NlmeJoinConfirm>, NetworkError>

Initialization procedure (BDB 7.1).

Persistent state (NIB/AIB) must already be restored by the caller before constructing the Nlme/[ZigbeeDevice] — that is step 1. If the node is not on a network, or is not an end device, this returns Ok(None) and the caller should invoke Self::network_steering.

Step 4 delegates to [ZigbeeDevice::rejoin], so a Trust Center rejoin backs up the secure one. If both fail the caller is responsible for falling back to Self::network_steering after [ZigbeeDevice::forget_network]; keeping the parent link alive afterwards is [ZigbeeDevice::link_maintenance].

Source

pub async fn network_steering<M: Mlme>( &self, device: &ZigbeeDevice<M>, delay: &mut impl DelayNs, extended_pan_id: IeeeAddress, channels: Range<u8>, scan_duration: u8, capability_information: CapabilityInformation, ) -> Result<NlmeJoinConfirm, NetworkError>

Network steering procedure for a node not on a network (BDB 8.2).

Discovers and joins the network at extended_pan_id, then exchanges keys with the Trust Center.

The receive loop task must be spawned before calling this: it idles until the join completes (ZigbeeDevice::rx_loop), then delivers the Trust Center’s replies for the link key exchange.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.