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
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.
StopGraph
Stop AdcQueue graph mode
Accept
Accept response
Reject
Reject response
NotReadable
NotReadable response - memory address not accessible
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
MemoryReadResponse
Decrypted data returned by the unframed MemoryRead data transfer
StreamingAuth
StreamingAuth command (0x4C) - authenticate for AdcQueue streaming
Fields
hardware_id: HardwareIdHardwareID 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
impl Packet
Sourcepub fn get_adc(&self) -> Option<&AdcDataSimple>
pub fn get_adc(&self) -> Option<&AdcDataSimple>
Get ADC data from the packet, if present
Sourcepub fn get_adc_queue(&self) -> Option<&AdcQueueData>
pub fn get_adc_queue(&self) -> Option<&AdcQueueData>
Get AdcQueue data from the packet, if present
Sourcepub fn get_pd_status(&self) -> Option<&PdStatus>
pub fn get_pd_status(&self) -> Option<&PdStatus>
Get PD status from the packet, if present
Sourcepub fn get_pd_events(&self) -> Option<&PdEventStream>
pub fn get_pd_events(&self) -> Option<&PdEventStream>
Get PD events from the packet, if present
Sourcepub fn has_payload(&self, attr: Attribute) -> bool
pub fn has_payload(&self, attr: Attribute) -> bool
Check if packet has a specific payload type
Source§impl Packet
impl Packet
Sourcepub fn from_raw_with_graph_rate(
raw_packet: RawPacket,
rate: GraphSampleRate,
) -> Result<Self, KMError>
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.