Skip to content

stdlib/otaView source ↗

ota

27 items · generated by scribe fromstdlib/ota.fd· synced 2026-11-15

stdlib/ota27 items

Contents

OTA_STATE_IDLE:

pub const OTA_STATE_IDLE: i64 = 0; pub const OTA_STATE_DOWNLOADING: i64 = 1; pub const OTA_STATE_VERIFYING: i64 = 2; pub const OTA_STATE_APPLYING: i64 = 3; pub const OTA_STATE_COMMITTED: i64 = 4; pub const OTA_STATE_ROLLBACK: i64 = 5; pub const OTA_STATE_FAILED: i64 = 6;

Defined at line 51


ota_state_name

Get OTA state name.

pub fn ota_state_name(state: i64) -> str {

Parameters:

  • state: i64

Returns: str

Defined at line 53


OTAManifest

An OTA update manifest.

pub struct OTAManifest {

Fields:

NameType
versionstr
filenamestr
sizei64
checksumstr
signaturestr
min_versionstr
max_versionstr
timestampi64
descriptionstr

Defined at line 85


ota_manifest_new

Create a new OTA manifest.

pub fn ota_manifest_new(filename: str, size: i64, checksum: str) -> OTAManifest {

Parameters:

  • filename: str
  • size: i64
  • checksum: str

Returns: OTAManifest

Defined at line 104


ota_manifest_set_version

Set version information.

pub fn ota_manifest_set_version(manifest: & mut OTAManifest, version: str, min_ver: str, max_ver: str) -> void {

Parameters:

  • manifest: & mut OTAManifest
  • version: str
  • min_ver: str
  • max_ver: str

Returns: void

Defined at line 111


ota_manifest_set_signature

Set signature.

pub fn ota_manifest_set_signature(manifest: & mut OTAManifest, signature: str) -> void {

Parameters:

  • manifest: & mut OTAManifest
  • signature: str

Returns: void

Defined at line 118


ota_manifest_set_description

Set description.

pub fn ota_manifest_set_description(manifest: & mut OTAManifest, desc: str) -> void {

Parameters:

  • manifest: & mut OTAManifest
  • desc: str

Returns: void

Defined at line 123


ota_verify_payload

Does the update match its manifest: the size, and the SHA-256 of its bytes? This is integrity only: a manifest proves who made it only if it is signed.

pub fn ota_verify_payload(manifest: OTAManifest, payload: str) -> bool {

Parameters:

  • manifest: OTAManifest
  • payload: str

Returns: bool

Defined at line 129


ota_verify_manifest

Are the manifest’s fields well formed? This only looks at the manifest: it says nothing about the update itself, which is ota_verify_payload’s work.

pub fn ota_verify_manifest(manifest: OTAManifest) -> bool {

Parameters:

  • manifest: OTAManifest

Returns: bool

Defined at line 138


ota_check_compatibility

Check if the current version is compatible with the manifest.

pub fn ota_check_compatibility(manifest: OTAManifest, current_version: str) -> bool {

Parameters:

  • manifest: OTAManifest
  • current_version: str

Returns: bool

Defined at line 160


OTASession

An OTA update session tracking the update process.

pub struct OTASession {

Fields:

NameType
manifestOTAManifest
statei64
bytes_downloadedi64
bytes_verifiedi64
error_msgstr
retry_counti64
max_retriesi64

Defined at line 179


ota_session_new

Create a new OTA session from a manifest.

pub fn ota_session_new(manifest: OTAManifest) -> OTASession {

Parameters:

  • manifest: OTAManifest

Returns: OTASession

Defined at line 190


ota_session_start_download

Start downloading the update.

pub fn ota_session_start_download(session: & mut OTASession) -> void {

Parameters:

  • session: & mut OTASession

Returns: void

Defined at line 197


ota_session_download_progress

Update download progress.

pub fn ota_session_download_progress(session: & mut OTASession, bytes: i64) -> void {

Parameters:

  • session: & mut OTASession
  • bytes: i64

Returns: void

Defined at line 203


ota_session_download_percent

Get download progress as percentage (0-100).

pub fn ota_session_download_percent(session: OTASession) -> i64 {

Parameters:

  • session: OTASession

Returns: i64

Defined at line 211


ota_session_verify

Verify the downloaded binary against the manifest checksum. binary_data: the downloaded bytes. Returns true if verification succeeds.

pub fn ota_session_verify(session: & mut OTASession, binary_data: Vec<i64>) -> bool {

Parameters:

  • session: & mut OTASession
  • binary_data: Vec<i64>

Returns: bool

Defined at line 221


ota_session_apply

Apply the update (transition to applying state).

pub fn ota_session_apply(session: & mut OTASession) -> void {

Parameters:

  • session: & mut OTASession

Returns: void

Defined at line 242


ota_session_commit

Commit the update (mark as committed, can’t rollback).

pub fn ota_session_commit(session: & mut OTASession) -> void {

Parameters:

  • session: & mut OTASession

Returns: void

Defined at line 247


ota_session_rollback

Rollback the update (revert to previous version).

pub fn ota_session_rollback(session: & mut OTASession) -> void {

Parameters:

  • session: & mut OTASession

Returns: void

Defined at line 252


ota_session_fail

Mark the session as failed.

pub fn ota_session_fail(session: & mut OTASession, error_msg: str) -> void {

Parameters:

  • session: & mut OTASession
  • error_msg: str

Returns: void

Defined at line 257


ota_session_can_retry

Check if the session can be retried.

pub fn ota_session_can_retry(session: OTASession) -> bool {

Parameters:

  • session: OTASession

Returns: bool

Defined at line 263


ota_session_retry

Retry the download.

pub fn ota_session_retry(session: & mut OTASession) -> void {

Parameters:

  • session: & mut OTASession

Returns: void

Defined at line 268


ota_session_state_name

Get the session state name.

pub fn ota_session_state_name(session: OTASession) -> str {

Parameters:

  • session: OTASession

Returns: str

Defined at line 277


DiffEntry

A binary diff entry.

pub struct DiffEntry {

Fields:

NameType
offseti64
lengthi64
dataVec<i64>

Defined at line 288


ota_binary_diff

Create a binary diff between old and new data. Returns a Vec of DiffEntry (flattened as alternating offset/length/data).

pub fn ota_binary_diff(old_data: Vec<i64>, new_data: Vec<i64>) -> Vec<i64> {

Parameters:

  • old_data: Vec<i64>
  • new_data: Vec<i64>

Returns: Vec<i64>

Defined at line 296


ota_diff_size

Compute the size of a binary diff (number of changed bytes).

pub fn ota_diff_size(diff: Vec<i64>) -> i64 {

Parameters:

  • diff: Vec<i64>

Returns: i64

Defined at line 335


ota_diff_region_count

Get the number of changed regions in a diff.

pub fn ota_diff_region_count(diff: Vec<i64>) -> i64 {

Parameters:

  • diff: Vec<i64>

Returns: i64

Defined at line 346


Generated by scribe, the Fides documentation generator