uds_client/uds_client/services/
ecu_reset.rs

1//!  Provides methods to reset the ECU that includes soft-reset, hard-reset, ...
2//!
3
4use crate::{
5    socket_can::CanSocketTx,
6    uds_client::{DiagError, PciByte, UdsClient},
7};
8use automotive_diag::uds::UdsCommand;
9
10#[allow(dead_code)]
11impl<T: CanSocketTx> UdsClient<'_, T> {
12    /// Service ID: 0x11 - ECU Reset
13    /// Description:
14    ///     The function will request an ECU reset event.
15    pub async fn uds_reset_ecu(&mut self) -> Result<(), DiagError> {
16        dbg!("UDS: send reset ECU");
17        let pci_byte = PciByte::new(crate::uds_client::PciType::SingleFrame, 2);
18        self.send_command_with_response(pci_byte, UdsCommand::ECUReset, &[])
19            .await?;
20        Ok(())
21    }
22}