FotaInfo

Struct FotaInfo 

#[repr(C)]
pub struct FotaInfo {
Show 18 fields magic: ByteStr<8>, activerootfs: ByteStr<32>, activebootimg: ByteStr<32>, activemodem: ByteStr<32>, backrootfs: ByteStr<32>, backbootimg: ByteStr<32>, backmodem: ByteStr<32>, padding1: Padding<32>, type_: EnumRepr<u32, FotaType>, eventstat: EnumRepr<u32, FotaState>, eventstat_: [u32; 3], upcount: u32, pub(crate) ecount: u32, fcount: u32, padding2: Padding<52>, package: ByteStr<128>, padding3: Padding<64>, pub(crate) info_crc: u32,
}
Expand description

Represents FOTA (Firmware Over-The-Air) update information.

Fields§

§magic: ByteStr<8>

FOTA info magic number.

§activerootfs: ByteStr<32>

Currently activated rootfs (A/B FOTA).

§activebootimg: ByteStr<32>

Currently activated bootimg (A/B FOTA).

§activemodem: ByteStr<32>

Currently activated modem (A/B FOTA).

§backrootfs: ByteStr<32>

Backup rootfs.

§backbootimg: ByteStr<32>

Backup bootimg.

§backmodem: ByteStr<32>

Backup modem.

§padding1: Padding<32>

Reserved for expansion, filled with zeros.

§type_: EnumRepr<u32, FotaType>

FOTA update type (e.g., A/B FOTA, full FOTA, diff FOTA).

§eventstat: EnumRepr<u32, FotaState>

Status of update (e.g., update, backup, expand status).

§eventstat_: [u32; 3]

No idea what this is. In the original struct eventstat is [u32; 4].

§upcount: u32

Count of successful FOTA updates.

§ecount: u32

Count of FOTA info updates.

§fcount: u32

Count of FOTA failures (cleared on successful update).

§padding2: Padding<52>

Reserved for expansion, filled with zeros.

§package: ByteStr<128>

Package information.

§padding3: Padding<64>

Reserved for expansion, filled with zeros.

§info_crc: u32

CRC code for FOTA info.

Implementations§

§

impl FotaInfo

pub const fn new(active: FotaActive) -> Self

Creates a new FOTA info with the given active partition.

const fn new_invalid() -> Self

Creates a new FOTA info with the correct magic value and zeroed fields (including the CRC).

pub const fn get_active(&self) -> Option<FotaActive>

Returns the currently active partition (A or B) for FOTA updates.

If the system is running a mix of A and B partitions, this function will return None.

pub const fn set_active(&mut self, active: FotaActive)

Sets the active partition (A or B) for FOTA updates.

const fn set_active_inner(&mut self, active: FotaActive)

pub fn get_state(&self) -> Option<FotaState>

Returns the FOTA update state.

pub fn set_state(&mut self, state: FotaState)

Sets the FOTA update state.

This function behaves like the fotainfo CLI.

§

impl FotaInfo

§Loading / Storing

pub(crate) fn from_slice(buf: &[u8]) -> Result<Self>

fn from_slice_unchecked(buf: &[u8]) -> Self

pub(crate) const fn as_slice(&self) -> &[u8]

pub(crate) const fn calculate_crc(&self) -> u32

Trait Implementations§

§

impl Clone for FotaInfo

§

fn clone(&self) -> FotaInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for FotaInfo

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.