pub struct RemoteControl<V: Validator = DjiValidator> { /* private fields */ }remote only.Expand description
Decoded view of the remote-control state.
The struct is designed for lock-free sharing across tasks/threads in
embedded runtimes. update writes a new snapshot atomically per field, and
all getters are wait-free atomic loads.
§Generic Parameter
V is the validator type used for CRC16 checksum verification. It must
implement the Validator trait, which defines how to calculate the CRC16
checksum for the frame. By default, V is set to DjiValidator,
which uses the standard DJI CRC16 algorithm.
Implementations§
Source§impl<V: Validator> RemoteControl<V>
impl<V: Validator> RemoteControl<V>
Sourcepub const fn new() -> RemoteControl<V>
pub const fn new() -> RemoteControl<V>
Creates a zero-initialized remote-control state.
Sourcepub fn update(&self, data: &[u8]) -> Result<usize, UnPackError>
pub fn update(&self, data: &[u8]) -> Result<usize, UnPackError>
Parses one 21-byte VT03/VT13 uplink frame and updates internal state.
Returns the number of consumed bytes (21) on success.
§Errors
UnPackError::UnexpectedEnd: input shorter than 21 bytes.UnPackError::MissingHeader: SOF mismatch at frame start.UnPackError::InvalidChecksum: CRC16 mismatch (tail bytes 19..21).
Source§impl<V: Validator> RemoteControl<V>
impl<V: Validator> RemoteControl<V>
Sourcepub fn right_horizontal(&self) -> i16
pub fn right_horizontal(&self) -> i16
Right stick horizontal channel (ch0), (±660, centered at 0).
Sourcepub fn right_vertical(&self) -> i16
pub fn right_vertical(&self) -> i16
Right stick vertical channel (ch1), (±660, centered at 0).
Sourcepub fn left_vertical(&self) -> i16
pub fn left_vertical(&self) -> i16
Left stick vertical channel (ch2), (±660, centered at 0).
Sourcepub fn left_horizontal(&self) -> i16
pub fn left_horizontal(&self) -> i16
Left stick horizontal channel (ch3), (±660, centered at 0).
Source§impl<V: Validator> RemoteControl<V>
impl<V: Validator> RemoteControl<V>
Left mouse button state, true if pressed.
Right mouse button state, true if pressed.
Middle mouse button state, true if pressed.
Source§impl<V: Validator> RemoteControl<V>
impl<V: Validator> RemoteControl<V>
Sourcepub fn keyboard_w(&self) -> bool
pub fn keyboard_w(&self) -> bool
Keyboard W key state, true if pressed.
Sourcepub fn keyboard_s(&self) -> bool
pub fn keyboard_s(&self) -> bool
Keyboard S key state, true if pressed.
Sourcepub fn keyboard_a(&self) -> bool
pub fn keyboard_a(&self) -> bool
Keyboard A key state, true if pressed.
Sourcepub fn keyboard_d(&self) -> bool
pub fn keyboard_d(&self) -> bool
Keyboard D key state, true if pressed.
Sourcepub fn keyboard_shift(&self) -> bool
pub fn keyboard_shift(&self) -> bool
Keyboard Shift key state, true if pressed.
Sourcepub fn keyboard_ctrl(&self) -> bool
pub fn keyboard_ctrl(&self) -> bool
Keyboard Ctrl key state, true if pressed.
Sourcepub fn keyboard_q(&self) -> bool
pub fn keyboard_q(&self) -> bool
Keyboard Q key state, true if pressed.
Sourcepub fn keyboard_e(&self) -> bool
pub fn keyboard_e(&self) -> bool
Keyboard E key state, true if pressed.
Sourcepub fn keyboard_r(&self) -> bool
pub fn keyboard_r(&self) -> bool
Keyboard R key state, true if pressed.
Sourcepub fn keyboard_f(&self) -> bool
pub fn keyboard_f(&self) -> bool
Keyboard F key state, true if pressed.
Sourcepub fn keyboard_g(&self) -> bool
pub fn keyboard_g(&self) -> bool
Keyboard G key state, true if pressed.
Sourcepub fn keyboard_z(&self) -> bool
pub fn keyboard_z(&self) -> bool
Keyboard Z key state, true if pressed.
Sourcepub fn keyboard_x(&self) -> bool
pub fn keyboard_x(&self) -> bool
Keyboard X key state, true if pressed.
Sourcepub fn keyboard_c(&self) -> bool
pub fn keyboard_c(&self) -> bool
Keyboard C key state, true if pressed.
Sourcepub fn keyboard_v(&self) -> bool
pub fn keyboard_v(&self) -> bool
Keyboard V key state, true if pressed.
Sourcepub fn keyboard_b(&self) -> bool
pub fn keyboard_b(&self) -> bool
Keyboard B key state, true if pressed.