Skip to main content

Packet

Enum Packet 

Source
pub enum Packet {
Show 16 variants DataResponse { payloads: Vec<PayloadData>, }, GetData { attribute_mask: u16, }, StartGraph { rate_index: u16, }, StopGraph, Accept { id: u8, }, Reject { id: u8, }, NotReadable { id: u8, }, Connect, Disconnect, EnablePdMonitor, DisablePdMonitor, MemoryRead { address: u32, size: u32, }, MemoryReadResponse { data: Vec<u8>, }, StreamingAuth { hardware_id: HardwareId, }, StreamingAuthResponse(StreamingAuthResult), Generic(RawPacket),
}

Variants§

§

DataResponse

Data response with parsed payload data

Fields

§payloads: Vec<PayloadData>
§

GetData

Request data with attribute set

Fields

§attribute_mask: u16
§

StartGraph

Start AdcQueue graph mode with sample rate Logical rate index: 0=2SPS, 1=10SPS, 2=50SPS, 3=1000SPS. CtrlHeader places this attribute in the wire header, producing byte 2 values 0, 2, 4, and 6 respectively.

Fields

§rate_index: u16
§

StopGraph

Stop AdcQueue graph mode

§

Accept

Accept response

Fields

§id: u8
§

Reject

Reject response

Fields

§id: u8
§

NotReadable

NotReadable response - memory address not accessible

Fields

§id: u8
§

Connect

Connect command

§

Disconnect

Disconnect command

§

EnablePdMonitor

Enable PD monitor/sniffer

§

DisablePdMonitor

Disable PD monitor/sniffer

§

MemoryRead

MemoryRead command (0x44) - read device memory with encrypted payload

Fields

§address: u32

Memory address to read from

§size: u32

Number of bytes to read

§

MemoryReadResponse

Decrypted data returned by the unframed MemoryRead data transfer

Fields

§data: Vec<u8>

Raw data read from memory (e.g., 12-byte HardwareID)

§

StreamingAuth

StreamingAuth command (0x4C) - authenticate for AdcQueue streaming

Fields

§hardware_id: HardwareId

HardwareID to authenticate with

§

StreamingAuthResponse(StreamingAuthResult)

StreamingAuth response (0x4C) - authentication result

§

Generic(RawPacket)

Generic packet for types we haven’t specifically implemented yet

Implementations§

Source§

impl Packet

Source

pub fn get_adc(&self) -> Option<&AdcDataSimple>

Get ADC data from the packet, if present

Source

pub fn get_adc_queue(&self) -> Option<&AdcQueueData>

Get AdcQueue data from the packet, if present

Source

pub fn get_pd_status(&self) -> Option<&PdStatus>

Get PD status from the packet, if present

Source

pub fn get_pd_events(&self) -> Option<&PdEventStream>

Get PD events from the packet, if present

Source

pub fn has_payload(&self, attr: Attribute) -> bool

Check if packet has a specific payload type

Source§

impl Packet

Source

pub fn from_raw_with_graph_rate( raw_packet: RawPacket, rate: GraphSampleRate, ) -> Result<Self, KMError>

Parse a raw packet using the configured AdcQueue graph rate.

Live device users should supply the rate used with StartGraph because auxiliary AdcQueue voltage fields use rate-dependent units.

Source§

impl Packet

Source

pub fn to_raw_packet(self, id: u8) -> Result<RawPacket, KMError>

Convert a high-level packet to a raw packet with the given transaction ID

Trait Implementations§

Source§

impl Clone for Packet

Source§

fn clone(&self) -> Packet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Packet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Packet

Source§

fn eq(&self, other: &Packet) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Packet

Source§

impl TryFrom<RawPacket> for Packet

Source§

type Error = KMError

The type returned in the event of a conversion error.
Source§

fn try_from(raw_packet: RawPacket) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more