rsiot/components_config/master_device/
device_trait.rs1use std::fmt::Debug;
2
3use async_trait::async_trait;
4use tokio::sync::{broadcast, mpsc};
5
6use crate::message::{Message, MsgDataBound};
7
8use super::RequestResponseBound;
9
10#[async_trait]
12pub trait DeviceTrait<TMsg, TRequest, TResponse>
13where
14 Self: Debug + Send + Sync,
15 TMsg: MsgDataBound + 'static,
16 TRequest: 'static + RequestResponseBound,
17 TResponse: 'static + RequestResponseBound,
18{
19 async fn spawn(
21 self: Box<Self>,
22 ch_rx_msgbus_to_device: broadcast::Receiver<Message<TMsg>>,
23 ch_tx_device_to_addindex: mpsc::Sender<TRequest>,
24 ch_rx_fieldbus_to_split: mpsc::Receiver<TResponse>,
25 ch_tx_device_to_msgbus: mpsc::Sender<Message<TMsg>>,
26 ) -> super::Result<()>;
27}