Skip to main content

docan_rs/client/service/
read_scaling_did.rs

1//! response of Service 24
2
3use crate::{client::DoCanClient, DoCanResult};
4use iso14229_1::{request, response, DataIdentifier, Service};
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 read_scaling_data_by_identifier(
16        &mut self,
17        did: DataIdentifier,
18    ) -> DoCanResult<response::ReadScalingDID> {
19        let data = request::ReadScalingDID(did);
20        let cfg = self.context.get_cfg().await;
21        let request = Self::make_request(Service::ReadScalingDID, None, data, &cfg)?;
22
23        self.send_and_parse(AddressType::Physical, request, None, &cfg)
24            .await
25    }
26}