pub struct OtaState { /* private fields */ }Expand description
The OTA Requestor’s reported update state: the UpdateState,
UpdateStateProgress and UpdatePossible attributes.
Held separately from Providers because it is transient runtime state, not
configuration. The application reports progress through an OtaUpdate
session obtained from initiate_update.
Because progress is reported from the application’s own update loop (outside
any cluster-handler ctx), the reporting calls take the data model’s
AttrChangeNotifier (typically the InteractionModel) so each change bumps the
cluster’s data version and wakes subscribers. It is passed in rather than
stored because the InteractionModel is constructed after this state (it borrows
it), so there is never a moment at which it could be stored here.
Implementations§
Source§impl OtaState
impl OtaState
Sourcepub const fn new(endpoint_id: u16) -> OtaState
pub const fn new(endpoint_id: u16) -> OtaState
Create idle, update-possible state for the endpoint hosting the OTA
Requestor cluster (the one whose OtaRequestorHandler reads this state),
so change notifications target the right cluster instance.
Sourcepub fn set_update_possible(
&self,
notifier: &dyn AttrChangeNotifier,
possible: bool,
)
pub fn set_update_possible( &self, notifier: &dyn AttrChangeNotifier, possible: bool, )
Set the UpdatePossible attribute (e.g. false when the battery is too
low to apply an update), notifying notifier of the change.
Sourcepub fn initiate_update<'a>(
&'a self,
notifier: &'a dyn AttrChangeNotifier,
) -> OtaUpdate<'a>
pub fn initiate_update<'a>( &'a self, notifier: &'a dyn AttrChangeNotifier, ) -> OtaUpdate<'a>
Auto Trait Implementations§
impl !Freeze for OtaState
impl !RefUnwindSafe for OtaState
impl !Sync for OtaState
impl Send for OtaState
impl Unpin for OtaState
impl UnsafeUnpin for OtaState
impl UnwindSafe for OtaState
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> 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