Skip to main content

Commissioner

Struct Commissioner 

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

The commissioning state machine cursor.

One Commissioner per in-flight commissioning. Send but !Sync. See module docs in crate::state_machine for the driver-loop example.

Implementations§

Source§

impl Commissioner

Source

pub fn new(cfg: CommissionerConfig<'_>) -> Result<Self, CommissioningError>

Construct a new commissioner from a validated config.

§Errors

Returns CommissioningError::InvalidConfig if any field fails basic validation: zero commissioner_node_id, zero assigned_node_id, commissioner_node_id == assigned_node_id, or all-zero ipk_epoch_key.

Source

pub fn stage(&self) -> Stage

Current cursor position. Useful for logging + tests.

Source

pub fn poll(&mut self) -> Result<Action, CommissioningError>

Drive the state machine forward.

Returns the next Action the caller must perform. Idempotent: calling poll twice without an intervening on_response returns the same Action.

§Errors

Returns the typed error that caused a transition into Stage::Failed — when this happens, the cursor advances to Failed and the next poll() call emits an Action::Abort with a rendered summary of the failure.

Source

pub fn on_response( &mut self, expect: Expectation, payload: &[u8], ) -> Result<(), CommissioningError>

Feed a response payload back into the state machine.

expect MUST match the Expectation from the last poll()’s emitted Action.

§Errors

Any error other than OutOfOrderResponse and UnexpectedResponseKind transitions the cursor to Stage::Failed; the next poll() call emits Action::Abort with a rendered summary.

Source

pub fn on_case_established(&mut self) -> Result<(), CommissioningError>

Signal that CASE establishment (mDNS find-operational + the SIGMA-I handshake — both M6.6 mechanics, owned by the driver) has succeeded. The state machine advances from Stage::FindOperationalForComplete to Stage::SendComplete.

§Errors

Returns CommissioningError::OutOfOrderResponse if the state machine isn’t currently awaiting CASE establishment (i.e., the cursor is not at FindOperationalForComplete or the EstablishCase action hasn’t been emitted yet).

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.