pub struct UpdateApi<P: CheckedPermissions> { /* private fields */ }Implementations§
Source§impl<P: CheckedPermissions> UpdateApi<P>
impl<P: CheckedPermissions> UpdateApi<P>
pub fn subscribe_update<S>(&self, context: &mut ServerContext<S>)where
S: Server + ArchiveEventHandler<ProgressUpdate>,
P: MessageAllowed<SubscribeUpdateProgress>,
Sourcepub fn start_update(&self, release_paths: Vec<String>)where
P: MessageAllowed<StartUpdate>,
pub fn start_update(&self, release_paths: Vec<String>)where
P: MessageAllowed<StartUpdate>,
Apply a series of successive updates to the device, sending progress/error updates to the caller.
If any of the releases require a reboot, the update server with store the information about the remaining releases to be applied and initiate a reboot.
To check whether an update has been stopped midway by a reboot, check UpdateStatus::needs_continue. To resume an update that was stopped midway by a reboot, call Self::continue_update.
NOTE: Paths to the release files must be absolute.
Sourcepub fn continue_update(&self)where
P: MessageAllowed<ContinueUpdate>,
pub fn continue_update(&self)where
P: MessageAllowed<ContinueUpdate>,
Continue an update that was interrupted by a reboot. Make sure that this is called only if UpdateStatus::needs_continue is true.
Sourcepub fn firmware_version(&self) -> Result<String, Error>where
P: MessageAllowed<FirmwareVersion>,
pub fn firmware_version(&self) -> Result<String, Error>where
P: MessageAllowed<FirmwareVersion>,
Get the current firmware version.
Sourcepub fn apply_downloaded_update(&self)where
P: MessageAllowed<ApplyDownloadedUpdate>,
pub fn apply_downloaded_update(&self)where
P: MessageAllowed<ApplyDownloadedUpdate>,
Apply the previously downloaded firmware update. This should be called after receiving a
messages::ProgressUpdate::DownloadComplete event.
Sourcepub fn check_update_applied(&self) -> boolwhere
P: MessageAllowed<GetUpdateApplied>,
pub fn check_update_applied(&self) -> boolwhere
P: MessageAllowed<GetUpdateApplied>,
Check whether an update was applied and is awaiting acknowledgment after reboot.
Sourcepub fn clear_update_applied(&self)where
P: MessageAllowed<ClearUpdateApplied>,
pub fn clear_update_applied(&self)where
P: MessageAllowed<ClearUpdateApplied>,
Clear the update applied flag after acknowledging the update on reboot. Note: The flag is automatically set to true by the update server when applying an update.
Sourcepub fn update_status(&self) -> UpdateStatuswhere
P: MessageAllowed<GetUpdateStatus>,
pub fn update_status(&self) -> UpdateStatuswhere
P: MessageAllowed<GetUpdateStatus>,
Get the current update status, including whether an update is available and if battery is sufficient.