pub struct Provider {
pub fab_idx: NonZero<u8>,
pub node_id: u64,
pub endpoint: u16,
}Expand description
One OTA Provider, scoped to the fabric that registered (or announced) it.
Fields§
§fab_idx: NonZero<u8>The fabric this provider belongs to.
node_id: u64The provider node’s id.
endpoint: u16The endpoint on the provider node hosting the OTA Provider cluster.
Implementations§
Source§impl Provider
impl Provider
Sourcepub async fn query<C, F, R>(
&self,
matter: &Matter<'_>,
crypto: C,
protocols: &[DownloadProtocolEnum],
current_version: Option<u32>,
requestor_can_consent: bool,
f: F,
) -> Result<R, Error>
pub async fn query<C, F, R>( &self, matter: &Matter<'_>, crypto: C, protocols: &[DownloadProtocolEnum], current_version: Option<u32>, requestor_can_consent: bool, f: F, ) -> Result<R, Error>
Ask this provider whether a software image newer than current_version
(defaulting to this device’s sw_ver from BasicInfoConfig when None)
is available, advertising the given download protocols.
The request’s VendorID, ProductID, SoftwareVersion and
HardwareVersion are taken from the node’s BasicInfoConfig, and
Location from the configured Basic Information settings - the spec
requires each to equal the corresponding Basic Information cluster
attribute. requestor_can_consent declares whether this requestor can
obtain user consent on its own (via built-in UI); pass true only if so,
as it lets the provider delegate consent (see OtaImagesRegistry).
Opens a CASE exchange to the provider, sends QueryImage, and invokes f
with the QueryImageResponse before the exchange is released - so f
reads image_uri/software_version/update_token straight off the RX
buffer without copying them onto the stack. f’s return value is returned.
query does not interpret the response (it checks neither status nor the
returned version); that is left to f. On a bdx:// image_uri, use
parse_bdx_url + Exchange::download to fetch.
Sourcepub async fn apply_update<C>(
&self,
matter: &Matter<'_>,
crypto: C,
update_token: &[u8],
new_version: u32,
) -> Result<OtaApplyOutcome, Error>where
C: Crypto,
pub async fn apply_update<C>(
&self,
matter: &Matter<'_>,
crypto: C,
update_token: &[u8],
new_version: u32,
) -> Result<OtaApplyOutcome, Error>where
C: Crypto,
Ask this provider how to apply the already-downloaded image identified by
update_token (the UpdateToken from the provider’s
QueryImageResponse), which upgrades to new_version.
Opens a CASE exchange and sends ApplyUpdateRequest. The returned
OtaApplyOutcome is the provider’s decision: Proceed (apply, after
its delay), Await (wait the delay and call this again), or
Discontinue (discard the image).
Sourcepub async fn notify_applied<C>(
&self,
matter: &Matter<'_>,
crypto: C,
update_token: &[u8],
software_version: u32,
) -> Result<(), Error>where
C: Crypto,
pub async fn notify_applied<C>(
&self,
matter: &Matter<'_>,
crypto: C,
update_token: &[u8],
software_version: u32,
) -> Result<(), Error>where
C: Crypto,
Tell this provider that the image identified by update_token has been
applied, now running software_version. Opens a CASE exchange and sends
NotifyUpdateApplied; there is no response payload.
Trait Implementations§
impl Copy for Provider
impl Eq for Provider
Source§impl<'__from_tlv> FromTLV<'__from_tlv> for Provider
impl<'__from_tlv> FromTLV<'__from_tlv> for Provider
Source§fn from_tlv(element: &TLVElement<'__from_tlv>) -> Result<Provider, Error>
fn from_tlv(element: &TLVElement<'__from_tlv>) -> Result<Provider, Error>
Source§fn init_from_tlv(element: TLVElement<'__from_tlv>) -> impl Init<Provider, Error>
fn init_from_tlv(element: TLVElement<'__from_tlv>) -> impl Init<Provider, Error>
Source§fn nullable_from_tlv(element: &TLVElement<'a>) -> Result<Self, Error>
fn nullable_from_tlv(element: &TLVElement<'a>) -> Result<Self, Error>
Source§fn init_nullable_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
fn init_nullable_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
impl StructuralPartialEq for Provider
Source§impl ToTLV for Provider
impl ToTLV for Provider
Source§fn to_tlv<W>(&self, tag: &TLVTag, tw: W) -> Result<(), Error>where
W: TLVWrite,
fn to_tlv<W>(&self, tag: &TLVTag, tw: W) -> Result<(), Error>where
W: TLVWrite,
Source§fn tlv_iter(&self, tag: TLVTag) -> impl Iterator<Item = Result<TLV<'_>, Error>>
fn tlv_iter(&self, tag: TLVTag) -> impl Iterator<Item = Result<TLV<'_>, Error>>
TLV instances by potentially borrowing
data from the type.Source§impl<'__from_tlv> TryFrom<&TLVElement<'__from_tlv>> for Provider
impl<'__from_tlv> TryFrom<&TLVElement<'__from_tlv>> for Provider
Auto Trait Implementations§
impl Freeze for Provider
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
impl UnwindSafe for Provider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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