Skip to main content

docan_rs/client/service/
response_on_event.rs

1//! response of Service 86
2
3use crate::{client::DoCanClient, DoCanResult};
4
5use iso14229_1::{request, response, Service};
6use iso15765_2::can::AddressType;
7use rs_can::{CanDevice, CanFrame};
8use std::{fmt::Display, hash::Hash};
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 response_on_event(
17        &mut self,
18        data: request::ResponseOnEvent,
19    ) -> DoCanResult<response::ResponseOnEvent> {
20        let cfg = self.context.get_cfg().await;
21        let request = Self::make_request(Service::ResponseOnEvent, None, data, &cfg)?;
22
23        self.send_and_parse(AddressType::Physical, request, None, &cfg)
24            .await
25    }
26}