docan_rs/client/service/
clear_diagnostic_info.rs1use iso14229_1::{request, utils::U24, Service};
4use iso15765_2::can::AddressType;
5use rs_can::{CanDevice, CanFrame};
6use std::{fmt::Display, hash::Hash};
7
8use crate::{DoCanClient, DoCanResult};
9
10impl<D, C, F> DoCanClient<D, C, F>
11where
12 D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
13 C: Clone + Eq + Display + Hash + Send + Sync + 'static,
14 F: CanFrame<Channel = C> + Clone + Display + 'static,
15{
16 pub async fn clear_dtc_info(
17 &mut self,
18 group: U24,
19 mem_sel: Option<u8>,
20 addr_type: AddressType,
21 ) -> DoCanResult<()> {
22 #[cfg(any(feature = "std2020"))]
23 let data = request::ClearDiagnosticInfo::new(group, mem_sel);
24 #[cfg(any(feature = "std2006", feature = "std2013"))]
25 let data = request::ClearDiagnosticInfo::new(group);
26 let cfg = self.context.get_cfg().await;
27 let request = Self::make_request(Service::ClearDiagnosticInfo, None, data, &cfg)?;
28
29 let _ = self
30 .send_and_response(addr_type, request, None, &cfg)
31 .await?;
32
33 Ok(())
34 }
35}