pub struct DeviceInformation {
pub dst_addr: u8,
pub src_addr: u8,
pub serial_number: u32,
pub hardware_id: u32,
pub firmware_id: u32,
pub parameters_total: u8,
pub parameter_version_number: u8,
/* private fields */
}Expand description
Represents a Device Information packet (0x29).
Fields§
§dst_addr: u8§src_addr: u8§serial_number: u32§hardware_id: u32§firmware_id: u32§parameters_total: u8§parameter_version_number: u8Implementations§
Source§impl DeviceInformation
impl DeviceInformation
Sourcepub fn new(
dst_addr: u8,
src_addr: u8,
device_name: &str,
serial_number: u32,
hardware_id: u32,
firmware_id: u32,
parameters_total: u8,
parameter_version_number: u8,
) -> Result<Self, CrsfParsingError>
pub fn new( dst_addr: u8, src_addr: u8, device_name: &str, serial_number: u32, hardware_id: u32, firmware_id: u32, parameters_total: u8, parameter_version_number: u8, ) -> Result<Self, CrsfParsingError>
Creates a new DeviceInformation packet.
Sourcepub fn device_name(&self) -> &str
pub fn device_name(&self) -> &str
Returns the device name as a string slice.
Trait Implementations§
Source§impl Clone for DeviceInformation
impl Clone for DeviceInformation
Source§fn clone(&self) -> DeviceInformation
fn clone(&self) -> DeviceInformation
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 moreSource§impl CrsfPacket for DeviceInformation
impl CrsfPacket for DeviceInformation
Source§const PACKET_TYPE: PacketType = PacketType::DeviceInfo
const PACKET_TYPE: PacketType = PacketType::DeviceInfo
The CRSF frame type identifier for this packet.
Source§const MIN_PAYLOAD_SIZE: usize = 17usize
const MIN_PAYLOAD_SIZE: usize = 17usize
The minimum expected length of the packet’s payload in bytes.
For fixed-size packets, this is the same as the payload size.
fn to_bytes(&self, buffer: &mut [u8]) -> Result<usize, CrsfParsingError>
Source§fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
Creates a packet instance from a payload byte slice.
The slice is guaranteed to have a length of at least
MIN_PAYLOAD_SIZE.fn validate_buffer_size(&self, buffer: &[u8]) -> Result<(), CrsfParsingError>
Source§impl Debug for DeviceInformation
impl Debug for DeviceInformation
Source§impl PartialEq for DeviceInformation
impl PartialEq for DeviceInformation
impl Eq for DeviceInformation
impl StructuralPartialEq for DeviceInformation
Auto Trait Implementations§
impl Freeze for DeviceInformation
impl RefUnwindSafe for DeviceInformation
impl Send for DeviceInformation
impl Sync for DeviceInformation
impl Unpin for DeviceInformation
impl UnwindSafe for DeviceInformation
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