pub struct SimulatorEngine { /* private fields */ }Expand description
Simulator engine that manages all virtual devices.
Implementations§
Source§impl SimulatorEngine
impl SimulatorEngine
Sourcepub fn new(config: EngineConfig) -> SimulatorEngine
pub fn new(config: EngineConfig) -> SimulatorEngine
Create a new simulator engine.
Sourcepub fn config(&self) -> &EngineConfig
pub fn config(&self) -> &EngineConfig
Get the engine configuration.
Sourcepub fn state(&self) -> EngineState
pub fn state(&self) -> EngineState
Get the current engine state.
Sourcepub fn metrics(&self) -> &MetricsCollector
pub fn metrics(&self) -> &MetricsCollector
Get metrics collector.
Sourcepub fn subscribe(&self) -> Receiver<EngineEvent>
pub fn subscribe(&self) -> Receiver<EngineEvent>
Subscribe to engine events.
Sourcepub fn device_count(&self) -> usize
pub fn device_count(&self) -> usize
Get device count.
Sourcepub fn point_count(&self) -> usize
pub fn point_count(&self) -> usize
Get total data points across all devices.
Sourcepub async fn add_device(&self, device: Box<dyn Device>) -> Result<(), Error>
pub async fn add_device(&self, device: Box<dyn Device>) -> Result<(), Error>
Add a device to the engine.
Sourcepub async fn remove_device(&self, device_id: &str) -> Result<(), Error>
pub async fn remove_device(&self, device_id: &str) -> Result<(), Error>
Remove a device from the engine.
Sourcepub fn device(&self, device_id: &str) -> Option<DeviceHandle>
pub fn device(&self, device_id: &str) -> Option<DeviceHandle>
Get device by ID.
Sourcepub fn list_devices(&self) -> Vec<DeviceInfo>
pub fn list_devices(&self) -> Vec<DeviceInfo>
List all devices.
Sourcepub fn list_devices_by_protocol(&self, protocol: Protocol) -> Vec<DeviceInfo>
pub fn list_devices_by_protocol(&self, protocol: Protocol) -> Vec<DeviceInfo>
List devices by protocol.
Sourcepub async fn read_point(
&self,
device_id: &str,
point_id: &str,
) -> Result<DataPoint, Error>
pub async fn read_point( &self, device_id: &str, point_id: &str, ) -> Result<DataPoint, Error>
Read a data point.
Sourcepub async fn write_point(
&self,
device_id: &str,
point_id: &str,
value: Value,
) -> Result<(), Error>
pub async fn write_point( &self, device_id: &str, point_id: &str, value: Value, ) -> Result<(), Error>
Write a data point.
Sourcepub fn tick_count(&self) -> u64
pub fn tick_count(&self) -> u64
Get tick count.
Sourcepub fn is_shutdown_requested(&self) -> bool
pub fn is_shutdown_requested(&self) -> bool
Check if shutdown is requested.
Sourcepub fn request_shutdown(&self)
pub fn request_shutdown(&self)
Request shutdown.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SimulatorEngine
impl !RefUnwindSafe for SimulatorEngine
impl Send for SimulatorEngine
impl Sync for SimulatorEngine
impl Unpin for SimulatorEngine
impl UnsafeUnpin for SimulatorEngine
impl !UnwindSafe for SimulatorEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more