Skip to main content

Controller

Struct Controller 

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

The handle to a running controller. Cheap to clone; the controller stops when the last handle is dropped.

Implementations§

Source§

impl Controller

Source

pub fn start(config: Config) -> Result<Self, Error>

Start a controller with config: open (or create) its fabric, CA, identity and node store, and start subscribing to every node.

Source

pub fn info(&self) -> &ControllerInfo

The controller’s identity on its fabric.

Source

pub fn events(&self) -> UnboundedReceiver<Event>

Receive the controller’s Events from now on.

Delivery is lossless: a subscription’s priming report can carry thousands of attributes at once, and each must reach its consumer.

Source

pub async fn commission(&self, req: CommissionRequest) -> Result<Node, Error>

Commission a device: find it, add it to the fabric, interview it and subscribe to it.

Source

pub async fn read( &self, node: u64, path: AttributePath, ) -> Result<Vec<AttributeValue>, Error>

Read attributes; wildcards read several.

Source

pub async fn write( &self, node: u64, endpoint: u16, cluster: u32, attribute: u32, value: Value, timed_ms: Option<u16>, ) -> Result<(), Error>

Write one attribute. A write the data model says must be timed is.

Source

pub async fn invoke( &self, node: u64, endpoint: u16, cluster: u32, command: u32, fields: Value, timed_ms: Option<u16>, ) -> Result<Value, Error>

Invoke a command with fields (an object, or null for none) and return the response command’s fields, or null for a plain success.

Source

pub async fn open_commissioning_window( &self, node: u64, timeout: u16, ) -> Result<CommissioningWindow, Error>

Open an enhanced commissioning window on node for timeout seconds (180 to 900), so another administrator can commission it too.

Source

pub async fn remove(&self, node: u64, force: bool) -> Result<(), Error>

Remove a node: take our fabric off it, then forget it. With force, forget it even if it cannot be reached.

Source

pub async fn rename(&self, node: u64, name: String) -> Result<Node, Error>

Rename a node.

Source

pub async fn interview(&self, node: u64) -> Result<Node, Error>

Read what a node is again (Basic Information, Descriptor).

Source

pub async fn discover(&self, seconds: u16) -> Result<Vec<Commissionable>, Error>

Look for commissionable nodes for seconds.

Source

pub async fn add_to_group( &self, node: u64, endpoint: u16, group: u16, name: String, ) -> Result<(), Error>

Put an endpoint of node in group (named name on the node): the node gets the fabric’s group key and the group, so a group command reaches it.

Source

pub async fn remove_from_group( &self, node: u64, endpoint: u16, group: u16, ) -> Result<(), Error>

Take an endpoint of node out of group.

Source

pub async fn group_invoke( &self, group: u16, cluster: u32, command: u32, fields: Value, ) -> Result<(), Error>

Send a command to every member of group at once, as one multicast message (no response comes back from a group).

Source

pub fn ota_images(&self) -> Result<Vec<OtaImage>, Error>

The OTA image files the controller offers (see Config::ota_dir).

Source

pub async fn announce_ota(&self, node: u64) -> Result<Option<OtaImage>, Error>

Tell node to ask this controller for a software update, if an image in the OTA directory is newer for it; the image it will be offered, or None (and no announcement) when there is none. The update’s steps arrive as Event::Ota and the node’s own OTA Requestor events.

Source

pub async fn abort_commissioning(&self) -> Result<bool, Error>

Stop the commissioning in progress, rolling the device back; whether one was running.

Source

pub async fn nodes(&self) -> Result<Vec<Node>, Error>

Every node in the store.

Trait Implementations§

Source§

impl Clone for Controller

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§

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

§

unsafe fn __init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

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> 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
§

impl<T, I> IntoFallibleInit<T> for I
where I: Init<T>,

§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
§

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

§

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

§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

§

type Error = <Target as OctetsFrom<Source>>::Error

§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
§

fn octets_into(self) -> Target
where Self::Error: Into<!>,

Performs an infallible conversion.
§

impl<T> PinInit<T> for T

§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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