Enum embedded_update::Command
source · [−]pub enum Command<'a> {
Wait {
correlation_id: Option<u32>,
poll: Option<u32>,
},
Sync {
version: Bytes<'a>,
correlation_id: Option<u32>,
poll: Option<u32>,
},
Write {
version: Bytes<'a>,
correlation_id: Option<u32>,
offset: u32,
data: Bytes<'a>,
},
Swap {
version: Bytes<'a>,
correlation_id: Option<u32>,
checksum: Bytes<'a>,
},
}
Expand description
Represents a command issued from the update service to a device.
Variants
Wait
Fields
Instruct the device to wait and send its status update at a later time.
Sync
Fields
version: Bytes<'a>
The version that was used for deciding the device was up to date. The device should check it matches its own version.
Tell the device that it is up to date and that it can send its status update at a later time.
Write
Fields
version: Bytes<'a>
The firmware version that this block corresponds to. The device should check that this matches version it has been writing so far.
offset: u32
The offset where this block should be written.
data: Bytes<'a>
The firmware data to write.
A block of firmware data that should be written to the device at a given offset.
Swap
Fields
version: Bytes<'a>
The version that was used for deciding the device is ready to swap. The device should check it matches the version being written.
checksum: Bytes<'a>
The full checksum of the firmware being written. The device should compare this with the checksum of the firmware it has written before swapping.
Tell the device that it has now written all of the firmware and that it can commence the swap/update operation.
Implementations
sourceimpl<'a> Command<'a>
impl<'a> Command<'a>
sourcepub fn new_wait(poll: Option<u32>, correlation_id: Option<u32>) -> Self
pub fn new_wait(poll: Option<u32>, correlation_id: Option<u32>) -> Self
Create a new Wait command
sourcepub fn new_sync(
version: &'a [u8],
poll: Option<u32>,
correlation_id: Option<u32>
) -> Self
pub fn new_sync(
version: &'a [u8],
poll: Option<u32>,
correlation_id: Option<u32>
) -> Self
Create a new Sync command.
Trait Implementations
sourceimpl<'de: 'a, 'a> Deserialize<'de> for Command<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Command<'a>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for Command<'a>
impl<'a> Send for Command<'a>
impl<'a> Sync for Command<'a>
impl<'a> Unpin for Command<'a>
impl<'a> UnwindSafe for Command<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more