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
impl Controller
Sourcepub fn start(config: Config) -> Result<Self, Error>
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.
Sourcepub fn info(&self) -> &ControllerInfo
pub fn info(&self) -> &ControllerInfo
The controller’s identity on its fabric.
Sourcepub fn events(&self) -> UnboundedReceiver<Event>
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.
Sourcepub async fn commission(&self, req: CommissionRequest) -> Result<Node, Error>
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.
Sourcepub async fn read(
&self,
node: u64,
path: AttributePath,
) -> Result<Vec<AttributeValue>, Error>
pub async fn read( &self, node: u64, path: AttributePath, ) -> Result<Vec<AttributeValue>, Error>
Read attributes; wildcards read several.
Sourcepub async fn write(
&self,
node: u64,
endpoint: u16,
cluster: u32,
attribute: u32,
value: Value,
timed_ms: Option<u16>,
) -> Result<(), Error>
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.
Sourcepub async fn invoke(
&self,
node: u64,
endpoint: u16,
cluster: u32,
command: u32,
fields: Value,
timed_ms: Option<u16>,
) -> Result<Value, Error>
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.
Sourcepub async fn open_commissioning_window(
&self,
node: u64,
timeout: u16,
) -> Result<CommissioningWindow, Error>
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.
Sourcepub async fn remove(&self, node: u64, force: bool) -> Result<(), Error>
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.
Sourcepub async fn interview(&self, node: u64) -> Result<Node, Error>
pub async fn interview(&self, node: u64) -> Result<Node, Error>
Read what a node is again (Basic Information, Descriptor).
Sourcepub async fn discover(&self, seconds: u16) -> Result<Vec<Commissionable>, Error>
pub async fn discover(&self, seconds: u16) -> Result<Vec<Commissionable>, Error>
Look for commissionable nodes for seconds.
Sourcepub async fn add_to_group(
&self,
node: u64,
endpoint: u16,
group: u16,
name: String,
) -> Result<(), Error>
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.
Sourcepub async fn remove_from_group(
&self,
node: u64,
endpoint: u16,
group: u16,
) -> Result<(), Error>
pub async fn remove_from_group( &self, node: u64, endpoint: u16, group: u16, ) -> Result<(), Error>
Take an endpoint of node out of group.
Sourcepub async fn group_invoke(
&self,
group: u16,
cluster: u32,
command: u32,
fields: Value,
) -> Result<(), Error>
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).
Sourcepub fn ota_images(&self) -> Result<Vec<OtaImage>, Error>
pub fn ota_images(&self) -> Result<Vec<OtaImage>, Error>
The OTA image files the controller offers (see Config::ota_dir).
Sourcepub async fn announce_ota(&self, node: u64) -> Result<Option<OtaImage>, Error>
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.
Sourcepub async fn abort_commissioning(&self) -> Result<bool, Error>
pub async fn abort_commissioning(&self) -> Result<bool, Error>
Stop the commissioning in progress, rolling the device back; whether one was running.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Controller
impl RefUnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl UnsafeUnpin for Controller
impl UnwindSafe for Controller
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Init<T> for T
impl<T> Init<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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