Skip to main content

docan_rs/client/service/
tester_present.rs

1//! response of Service 3E
2
3use crate::{client::DoCanClient, DoCanResult};
4use iso14229_1::TesterPresentType;
5use iso15765_2::can::AddressType;
6use rs_can::{CanDevice, CanFrame};
7use std::{fmt::Display, hash::Hash};
8
9impl<D, C, F> DoCanClient<D, C, F>
10where
11    D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
12    C: Clone + Eq + Display + Hash + Send + Sync + 'static,
13    F: CanFrame<Channel = C> + Clone + Display + 'static,
14{
15    pub async fn tester_present(
16        &mut self,
17        r#type: TesterPresentType,
18        suppress_positive: bool,
19        addr_type: AddressType,
20    ) -> DoCanResult<()> {
21        let cfg = self.context.get_cfg().await;
22        let (service, request) =
23            Self::tester_present_request(r#type, suppress_positive, &cfg).await?;
24
25        let _ = self
26            .suppress_positive_sr(
27                addr_type,
28                request,
29                suppress_positive,
30                Some((r#type.into(), service)),
31                &cfg,
32            )
33            .await?;
34
35        Ok(())
36    }
37}