Skip to main content

docan_rs/client/service/
authentication.rs

1//! response of Service 29
2
3use crate::{client::DoCanClient, DoCanResult};
4use iso14229_1::{request, response, *};
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: Display + Clone + Hash + Eq + Send + Sync + 'static,
13    F: CanFrame<Channel = C> + Clone + Display + 'static,
14{
15    pub async fn authentication(
16        &mut self,
17        auth_task: AuthenticationTask,
18        data: request::Authentication,
19    ) -> DoCanResult<response::Authentication> {
20        let service = Service::Authentication;
21        let cfg = self.context.get_cfg().await;
22        let request = Self::make_request(service, Some(auth_task.into()), data, &cfg)?;
23
24        self.send_and_parse(
25            AddressType::Physical,
26            request,
27            Some((auth_task.into(), service)),
28            &cfg,
29        )
30        .await
31    }
32}