pub enum ClientEvent<const MAX_DATA: usize> {
PositiveResponse {
sid: u8,
data: Vec<u8, MAX_DATA>,
},
NegativeResponse {
sid: u8,
nrc: u8,
},
ResponsePending {
sid: u8,
},
Timeout {
sid: u8,
},
PeriodicData {
did: u8,
data: Vec<u8, MAX_DATA>,
},
Unsolicited {
data: Vec<u8, MAX_DATA>,
},
}Expand description
An observable event emitted by the UDS client.
Events accumulate in the client’s event queue across ticks and are drained by the caller via
drain_events(). Each event corresponds to a completed or failed request exchange.
The caller decides what to do with each event - the client never retries, escalates, or takes corrective action autonomously.
Variants§
PositiveResponse
A positive response was received for the given service.
sid is the request SID (not the response SID).
data contains the response payload bytes after the response SID.
NegativeResponse
A negative response was received.
sid is the request SID.
nrc is the Negative Response Code byte.
ResponsePending
A 0x78 Response Pending NRC was received.
The client has switched to the P2* extended timeout and is still waiting for the final
response. This event is emitted once per 0x78 received - the caller can observe how many
were received before the final response.
Timeout
No response was received within the P2 or P2* timeout.
The pending request has been discarded. The caller must decide whether to retry.
PeriodicData
A periodic data response arrived from the server.
[periodic_data_identifier (1 byte), data_record (n bytes)]
No SID prefix is present - did is the first byte of the frame, which is the low byte of
the periodic DID identifier. data contains the data record bytes that followed.
Only emitted for DID low bytes registered via subscribe_periodic
Unsolicited
A response arrived with no matching pending request.
This can occur under fault injection (reordered or delayed responses arriving after a timeout) or if the server sends an unsolicited response.
Trait Implementations§
Source§impl<const MAX_DATA: usize> Clone for ClientEvent<MAX_DATA>
impl<const MAX_DATA: usize> Clone for ClientEvent<MAX_DATA>
Source§fn clone(&self) -> ClientEvent<MAX_DATA>
fn clone(&self) -> ClientEvent<MAX_DATA>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more