pub struct UdsClient<'a, T: CanSocketTx> { /* private fields */ }Implementations§
Source§impl<'a, T: CanSocketTx> UdsClient<'a, T>
impl<'a, T: CanSocketTx> UdsClient<'a, T>
Sourcepub fn new(channel: T, id: u32, resp: &'a LazyLock<Arc<ResponseSlot>>) -> Self
pub fn new(channel: T, id: u32, resp: &'a LazyLock<Arc<ResponseSlot>>) -> Self
Create a new UdsClient instance.
Takes a CAN socket channel channel, a 32-bit identifier id, and a reference
to a ResponseSlot wrapped in Arc. The Id::Extended is used to create a unique
identifier for the CAN frame.
Sourcepub async fn send_command<P: Into<u8>, M: Into<u8>>(
&mut self,
pci: P,
cmd: M,
args: &[u8],
) -> Result<(), DiagError>
pub async fn send_command<P: Into<u8>, M: Into<u8>>( &mut self, pci: P, cmd: M, args: &[u8], ) -> Result<(), DiagError>
Send a command without expecting a response.
This function sends a command using ISO 15765-2 format, which includes PCI, CMD,
and ARGS. The args are added to the frame and sent using the send_raw method.
Sourcepub async fn send_frame(&mut self, frame: UdsFrame) -> Result<(), DiagError>
pub async fn send_frame(&mut self, frame: UdsFrame) -> Result<(), DiagError>
Send an UDS frame without expecting a response.
This function sends the given UdsFrame to the CAN bus using the send_raw method
after converting the frame into a byte vector.
Sourcepub async fn send_frame_with_response(
&mut self,
frame: UdsFrame,
) -> Result<UdsFrame, DiagError>
pub async fn send_frame_with_response( &mut self, frame: UdsFrame, ) -> Result<UdsFrame, DiagError>
Send an UDS frame and wait for a response.
This function sends an UdsFrame to the CAN bus and waits for a response. If the
response is valid (Response::Ok), it returns the response frame, otherwise returns
the error contained in Response::Error.
Sourcepub async fn send_command_with_response<P: Into<u8>, M: Into<u8>>(
&mut self,
pci: P,
cmd: M,
args: &[u8],
) -> Result<UdsFrame, DiagError>
pub async fn send_command_with_response<P: Into<u8>, M: Into<u8>>( &mut self, pci: P, cmd: M, args: &[u8], ) -> Result<UdsFrame, DiagError>
Send a command with the response.
This function is similar to send_command but expects a response after sending
the command. It returns the response frame (UdsFrame) if successful, or the
error if something went wrong.
Source§impl<T: CanSocketTx> UdsClient<'_, T>
impl<T: CanSocketTx> UdsClient<'_, T>
Sourcepub async fn uds_reset_ecu(&mut self) -> Result<(), DiagError>
pub async fn uds_reset_ecu(&mut self) -> Result<(), DiagError>
Service ID: 0x11 - ECU Reset Description: The function will request an ECU reset event.
Source§impl<T: CanSocketTx> UdsClient<'_, T>
impl<T: CanSocketTx> UdsClient<'_, T>
Sourcepub async fn uds_real_time_data_slow(&mut self) -> Result<(), DiagError>
pub async fn uds_real_time_data_slow(&mut self) -> Result<(), DiagError>
Service ID: 0x2A - Data Transmission Sub-ID: 0x01 Description: The function will request an Realtime data sent from ECU with slow rate.
Sourcepub async fn uds_real_time_data_medium(&mut self) -> Result<(), DiagError>
pub async fn uds_real_time_data_medium(&mut self) -> Result<(), DiagError>
Service ID: 0x2A - Data Transmission Sub-ID: 0x02 Description: The function will request an Realtime data sent from ECU with medium rate.
Sourcepub async fn uds_real_time_data_fast(&mut self) -> Result<(), DiagError>
pub async fn uds_real_time_data_fast(&mut self) -> Result<(), DiagError>
Service ID: 0x2A - Data Transmission Sub-ID: 0x03 Description: The function will request an Realtime data sent from ECU with fast rate.
Sourcepub async fn uds_real_time_data_stop(&mut self) -> Result<(), DiagError>
pub async fn uds_real_time_data_stop(&mut self) -> Result<(), DiagError>
Service ID: 0x2A - Data Transmission Sub-ID: 0x04 Description: The function will send a stop event for realtime data from ECU.
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for UdsClient<'a, T>
impl<'a, T> !UnwindSafe for UdsClient<'a, T>
impl<'a, T> Freeze for UdsClient<'a, T>where
T: Freeze,
impl<'a, T> Send for UdsClient<'a, T>where
T: Send,
impl<'a, T> Sync for UdsClient<'a, T>where
T: Sync,
impl<'a, T> Unpin for UdsClient<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for UdsClient<'a, T>where
T: UnsafeUnpin,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more