Skip to main content

docan_rs/client/service/
read_dtc_info.rs

1//! response of Service 19
2
3use iso14229_1::{request, response, DTCReportType, 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 read_dtc_info(
17        &mut self,
18        r#type: DTCReportType,
19        data: request::DTCInfo,
20    ) -> DoCanResult<response::DTCInfo> {
21        let service = Service::ReadDTCInfo;
22        let cfg = self.context.get_cfg().await;
23        let request = Self::make_request(service, Some(r#type.into()), data, &cfg)?;
24
25        self.send_and_parse(
26            AddressType::Physical,
27            request,
28            Some((r#type.into(), service)),
29            &cfg,
30        )
31        .await
32    }
33}