pub struct CommandHeader {
pub flag: CommandFlag,
pub reserved: u8,
}Expand description
Command packet header structure
Contains the command flag indicating whether the command has a data phase, and a reserved byte for future use. This structure is part of every McuBoot command packet sent to the target device.
Fields§
§flag: CommandFlagFlag indicating command characteristics (e.g., has data phase)
reserved: u8Reserved byte for future protocol extensions
Implementations§
Source§impl CommandHeader
impl CommandHeader
Sourcepub fn construct_frame(&self, params: &[u32], command_code: u8) -> Vec<u8> ⓘ
pub fn construct_frame(&self, params: &[u32], command_code: u8) -> Vec<u8> ⓘ
Constructs a complete command frame ready for transmission
This method builds a McuBoot command packet by combining the command code, flags, parameter count, and parameters into a properly formatted frame. The frame includes the protocol header and follows the McuBoot packet format.
§Arguments
params- Slice ofu32parameters for the commandcommand_code- The command identifier (fromCommandTagenum)
§Returns
A Vec<u8> containing the complete command frame ready for transmission
§Frame Format
The constructed frame follows this structure:
- Protocol header (added by
construct_header) - Command code (1 byte)
- Command flag (1 byte)
- Reserved byte (1 byte)
- Parameter count (1 byte)
- Parameters (4 bytes each, little-endian)
Trait Implementations§
Source§impl Clone for CommandHeader
impl Clone for CommandHeader
Source§fn clone(&self) -> CommandHeader
fn clone(&self) -> CommandHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CommandHeader
impl RefUnwindSafe for CommandHeader
impl Send for CommandHeader
impl Sync for CommandHeader
impl Unpin for CommandHeader
impl UnwindSafe for CommandHeader
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
Mutably borrows from an owned value. Read more