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§
Sourcefn info(&self) -> &DeviceInfo
fn info(&self) -> &DeviceInfo
Get device information.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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).
Sourcefn point_definitions(&self) -> Vec<&DataPointDef>
fn point_definitions(&self) -> Vec<&DataPointDef>
Get all data point definitions.
Sourcefn point_definition(&self, point_id: &str) -> Option<&DataPointDef>
fn point_definition(&self, point_id: &str) -> Option<&DataPointDef>
Get a data point definition by ID.
Provided Methods§
Sourcefn state(&self) -> DeviceState
fn state(&self) -> DeviceState
Get device state.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn subscribe(&self) -> Option<Receiver<DataPoint>>
fn subscribe(&self) -> Option<Receiver<DataPoint>>
Subscribe to value changes (returns a receiver).
Sourcefn statistics(&self) -> DeviceStatistics
fn statistics(&self) -> DeviceStatistics
Get device statistics.