Skip to main content

Device

Trait Device 

Source
pub trait Device: Send + Sync {
Show 18 methods // Required methods fn info(&self) -> &DeviceInfo; fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn point_definitions(&self) -> Vec<&DataPointDef>; fn point_definition(&self, point_id: &str) -> Option<&DataPointDef>; fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; // Provided methods fn id(&self) -> &str { ... } fn name(&self) -> &str { ... } fn protocol(&self) -> Protocol { ... } fn state(&self) -> DeviceState { ... } fn read_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, point_ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<DataPoint>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait { ... } fn read_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DataPoint>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn write_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, values: &'life1 [(&'life2 str, Value)], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait { ... } fn subscribe(&self) -> Option<Receiver<DataPoint>> { ... } fn statistics(&self) -> DeviceStatistics { ... }
}
Expand description

Core device trait that all protocol devices must implement.

Required Methods§

Source

fn info(&self) -> &DeviceInfo

Get device information.

Source

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Initialize the device.

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Start the device.

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Stop the device.

Source

fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Process one tick (for simulation updates).

Source

fn point_definitions(&self) -> Vec<&DataPointDef>

Get all data point definitions.

Source

fn point_definition(&self, point_id: &str) -> Option<&DataPointDef>

Get a data point definition by ID.

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Read a data point value.

Source

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Write a data point value.

Provided Methods§

Source

fn id(&self) -> &str

Get device ID.

Source

fn name(&self) -> &str

Get device name.

Source

fn protocol(&self) -> Protocol

Get protocol.

Source

fn state(&self) -> DeviceState

Get device state.

Source

fn read_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, point_ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<DataPoint>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Read multiple data point values.

Source

fn read_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DataPoint>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Read all data points.

Source

fn write_multiple<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, values: &'life1 [(&'life2 str, Value)], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Write multiple data point values.

Source

fn subscribe(&self) -> Option<Receiver<DataPoint>>

Subscribe to value changes (returns a receiver).

Source

fn statistics(&self) -> DeviceStatistics

Get device statistics.

Implementations on Foreign Types§

Source§

impl Device for BacnetDevice

Source§

fn info(&self) -> &DeviceInfo

Source§

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn point_definitions(&self) -> Vec<&DataPointDef>

Source§

fn point_definition(&self, _point_id: &str) -> Option<&DataPointDef>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, BacnetDevice: 'async_trait,

Source§

fn subscribe(&self) -> Option<Receiver<DataPoint>>

Source§

fn statistics(&self) -> DeviceStatistics

Source§

impl Device for KnxDevice

Source§

fn info(&self) -> &DeviceInfo

Source§

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, KnxDevice: 'async_trait,

Source§

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, KnxDevice: 'async_trait,

Source§

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, KnxDevice: 'async_trait,

Source§

fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, KnxDevice: 'async_trait,

Source§

fn point_definitions(&self) -> Vec<&DataPointDef>

Source§

fn point_definition(&self, _point_id: &str) -> Option<&DataPointDef>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, KnxDevice: 'async_trait,

Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, KnxDevice: 'async_trait,

Source§

fn subscribe(&self) -> Option<Receiver<DataPoint>>

Source§

fn statistics(&self) -> DeviceStatistics

Source§

impl Device for ModbusDevice

Source§

fn info(&self) -> &DeviceInfo

Source§

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn point_definitions(&self) -> Vec<&DataPointDef>

Source§

fn point_definition(&self, point_id: &str) -> Option<&DataPointDef>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, ModbusDevice: 'async_trait,

Source§

fn subscribe(&self) -> Option<Receiver<DataPoint>>

Source§

fn statistics(&self) -> DeviceStatistics

Source§

impl Device for OpcUaDevice

Source§

fn info(&self) -> &DeviceInfo

Source§

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn tick<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn point_definitions(&self) -> Vec<&DataPointDef>

Source§

fn point_definition(&self, point_id: &str) -> Option<&DataPointDef>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, point_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DataPoint, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, point_id: &'life1 str, value: Value, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, OpcUaDevice: 'async_trait,

Source§

fn subscribe(&self) -> Option<Receiver<DataPoint>>

Source§

fn statistics(&self) -> DeviceStatistics

Implementors§