pub struct ExecuteCommandRequest {
    pub command: u16,
    pub parameter: Vec<u8, 255>,
}
Expand description

uavcan.node.ExecuteCommand.1.1

Size ranges from 3 to 258 bytes

Instructs the server node to execute or commence execution of a simple predefined command. All standard commands are optional; i.e., not guaranteed to be supported by all nodes.

Fields§

§command: u16

Standard pre-defined commands are at the top of the range (defined below). Vendors can define arbitrary, vendor-specific commands in the bottom part of the range (starting from zero). Vendor-specific commands shall not use identifiers above 32767.

saturated uint16

Always aligned, size 16 bits

§parameter: Vec<u8, 255>

A string parameter supplied to the command. The format and interpretation is command-specific. The standard commands do not use this field (ignore it), excepting the following:

  • COMMAND_BEGIN_SOFTWARE_UPDATE

saturated uint8[<=255]

Always aligned, size ranges from 0 to 2040 bits

Implementations§

source§

impl ExecuteCommandRequest

source

pub const COMMAND_RESTART: u16 = 65_535u16

Reboot the node. Note that some standard commands may or may not require a restart in order to take effect; e.g., factory reset.

source

pub const COMMAND_POWER_OFF: u16 = 65_534u16

Shut down the node; further access will not be possible until the power is turned back on.

source

pub const COMMAND_BEGIN_SOFTWARE_UPDATE: u16 = 65_533u16

Begin the software update process using uavcan.file.Read. This command makes use of the “parameter” field below. The parameter contains the path to the new software image file to be downloaded by the server from the client using the standard service uavcan.file.Read. Observe that this operation swaps the roles of the client and the server.

Upon reception of this command, the server (updatee) will evaluate whether it is possible to begin the software update process. If that is deemed impossible, the command will be rejected with one of the error codes defined in the response section of this definition (e.g., BAD_STATE if the node is currently on-duty and a sudden interruption of its activities is considered unsafe, and so on). If an update process is already underway, the updatee should abort the process and restart with the new file, unless the updatee can determine that the specified file is the same file that is already being downloaded, in which case it is allowed to respond SUCCESS and continue the old update process. If there are no other conditions precluding the requested update, the updatee will return a SUCCESS and initiate the file transfer process by invoking the standard service uavcan.file.Read repeatedly until the file is transferred fully (please refer to the documentation for that data type for more information about its usage).

While the software is being updated, the updatee should set its mode (the field “mode” in uavcan.node.Heartbeat) to MODE_SOFTWARE_UPDATE. Please refer to the documentation for uavcan.node.Heartbeat for more information.

It is recognized that most systems will have to interrupt their normal services to perform the software update (unless some form of software hot swapping is implemented, as is the case in some high-availability systems).

Microcontrollers that are requested to update their firmware may need to stop execution of their current firmware and start the embedded bootloader (although other approaches are possible as well). In that case, while the embedded bootloader is running, the mode reported via the message uavcan.node.Heartbeat should be MODE_SOFTWARE_UPDATE as long as the bootloader is runing, even if no update-related activities are currently underway. For example, if the update process failed and the bootloader cannot load the software, the same mode MODE_SOFTWARE_UPDATE will be reported. It is also recognized that in a microcontroller setting, the application that served the update request will have to pass the update-related metadata (such as the node-ID of the server and the firmware image file path) to the embedded bootloader. The tactics of that transaction lie outside of the scope of this specification.

source

pub const COMMAND_FACTORY_RESET: u16 = 65_532u16

Return the node’s configuration back to the factory default settings (may require restart). Due to the uncertainty whether a restart is required, generic interfaces should always force a restart.

source

pub const COMMAND_EMERGENCY_STOP: u16 = 65_531u16

Cease activities immediately, enter a safe state until restarted. Further operation may no longer be possible until a restart command is executed.

source

pub const COMMAND_STORE_PERSISTENT_STATES: u16 = 65_530u16

This command instructs the node to store the current configuration parameter values and other persistent states to the non-volatile storage. Nodes are allowed to manage persistent states automatically, obviating the need for this command by committing all such data to the non-volatile memory automatically as necessary. However, some nodes may lack this functionality, in which case this parameter should be used. Generic interfaces should always invoke this command in order to ensure that the data is stored even if the node doesn’t implement automatic persistence management.

Trait Implementations§

source§

impl DataType for ExecuteCommandRequest

source§

const EXTENT_BYTES: Option<u32> = _

This type is delimited with an extent of 300 bytes.

source§

impl Deserialize for ExecuteCommandRequest

source§

fn deserialize(cursor: &mut ReadCursor<'_>) -> Result<Self, DeserializeError>where Self: Sized,

Deserializes a value and returns it
source§

fn deserialize_from_bytes(bytes: &[u8]) -> Result<Self, DeserializeError>where Self: Sized,

A convenience function that creates a cursor around the provided bytes and calls deserialize
source§

impl Serialize for ExecuteCommandRequest

source§

fn size_bits(&self) -> usize

Returns the size of the encoded form of this value, in bits Read more
source§

fn serialize(&self, cursor: &mut WriteCursor<'_>)

Serializes this value into a buffer Read more
source§

fn serialize_to_bytes(&self, bytes: &mut [u8])

A convenience function that creates a cursor around the provided bytes and calls serialize
source§

impl Request for ExecuteCommandRequest

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.