pub trait UdsFrameExt<'a> {
Show 13 methods
// Required methods
fn service_identifier(&self) -> Option<ServiceIdentifier>;
fn payload(&self) -> &[u8];
fn data_iter(&self) -> Iter<'_, u8>;
fn sub_function(&self) -> Option<u8>;
fn is_suppressed(&self) -> bool;
fn is_negative_response(&self) -> bool;
fn negative_response_code(&self) -> Option<NegativeResponseCode>;
fn requested_service_identifier(&self) -> Option<ServiceIdentifier>;
fn validate(&self) -> Result<(), UdsError>;
fn to_message(&'a self) -> Result<UdsMessage<'a>, UdsError>;
// Provided methods
fn sub_function_value(&self) -> Option<u8> { ... }
fn is_positive_response(&self) -> bool { ... }
fn is_valid(&self) -> bool { ... }
}Expand description
Semantic extension trait for UdsFrame.
Provides protocol-level interpretation of the raw bytes in a UdsFrame -
service identification, sub-function parsing, response classification,
payload access, and message conversion.
Implemented for UdsFrame in ace-uds. The raw frame type in
ace-proto carries no protocol knowledge - all UDS semantics are
provided here.
Required Methods§
Sourcefn service_identifier(&self) -> Option<ServiceIdentifier>
fn service_identifier(&self) -> Option<ServiceIdentifier>
Returns the ServiceIdentifier for this frame if the first byte
corresponds to a known UDS service.
Returns None if the frame is empty or the first byte does not
match a known service identifier. Per ISO 14229, an absent SID
implies a periodic data response.
Sourcefn payload(&self) -> &[u8]
fn payload(&self) -> &[u8]
Returns the payload bytes of the frame, excluding the SID byte.
If no service identifier is present the entire buffer is returned, consistent with the periodic data response convention.
Sourcefn data_iter(&self) -> Iter<'_, u8>
fn data_iter(&self) -> Iter<'_, u8>
Returns an iterator over the payload bytes, excluding the SID byte.
Sourcefn sub_function(&self) -> Option<u8>
fn sub_function(&self) -> Option<u8>
Returns the raw sub-function byte for services that carry one, including the suppress positive response bit.
Returns None for services that do not define a sub-function byte,
or if the frame is too short to contain one.
Sourcefn is_suppressed(&self) -> bool
fn is_suppressed(&self) -> bool
Returns true if the suppress positive response bit is set in the
sub-function byte (bit 7 = 1).
Always returns false if the service does not define a sub-function.
Sourcefn is_negative_response(&self) -> bool
fn is_negative_response(&self) -> bool
Returns true if this frame is a negative response (SID 0x7F).
Sourcefn negative_response_code(&self) -> Option<NegativeResponseCode>
fn negative_response_code(&self) -> Option<NegativeResponseCode>
Returns the NegativeResponseCode if this is a negative response.
Negative response format: [0x7F, RequestedSID, NRC]
Returns None if this is not a negative response or the frame
is too short to contain an NRC byte.
Sourcefn requested_service_identifier(&self) -> Option<ServiceIdentifier>
fn requested_service_identifier(&self) -> Option<ServiceIdentifier>
Returns the requested ServiceIdentifier from a negative response.
Negative response format: [0x7F, RequestedSID, NRC]
Returns None if this is not a negative response or the SID byte
at position 1 is not a known service identifier.
Sourcefn validate(&self) -> Result<(), UdsError>
fn validate(&self) -> Result<(), UdsError>
Validates the frame against UDS protocol rules.
Checks that the SID is known, the payload length is appropriate for the service, and the sub-function (if present) is valid.
Individual service implementations may provide deeper validation
via their own validate() methods.
Sourcefn to_message(&'a self) -> Result<UdsMessage<'a>, UdsError>
fn to_message(&'a self) -> Result<UdsMessage<'a>, UdsError>
Parses this frame into a structured UdsMessage.
Provided Methods§
Sourcefn sub_function_value(&self) -> Option<u8>
fn sub_function_value(&self) -> Option<u8>
Returns the sub-function value with the suppress positive response bit masked off.
Sourcefn is_positive_response(&self) -> bool
fn is_positive_response(&self) -> bool
Returns true if this frame is a positive response.
A frame is a positive response if it is not a negative response -
i.e. the SID is not 0x7F.
Implementations on Foreign Types§
Source§impl<'a> UdsFrameExt<'a> for UdsFrame<'a>
impl<'a> UdsFrameExt<'a> for UdsFrame<'a>
fn service_identifier(&self) -> Option<ServiceIdentifier>
fn payload(&self) -> &[u8]
fn data_iter(&self) -> Iter<'_, u8>
fn sub_function(&self) -> Option<u8>
fn is_suppressed(&self) -> bool
fn is_negative_response(&self) -> bool
fn negative_response_code(&self) -> Option<NegativeResponseCode>
fn requested_service_identifier(&self) -> Option<ServiceIdentifier>
fn validate(&self) -> Result<(), UdsError>
fn to_message(&'a self) -> Result<UdsMessage<'a>, UdsError>
Source§impl<'a> UdsFrameExt<'a> for UdsFrameMut<'a>
UdsFrameMut delegates all read accessors to its immutable counterpart,
keeping the semantic logic in one place.
impl<'a> UdsFrameExt<'a> for UdsFrameMut<'a>
UdsFrameMut delegates all read accessors to its immutable counterpart,
keeping the semantic logic in one place.