Skip to main content

IotClient

Trait IotClient 

Source
pub trait IotClient {
    // Required methods
    fn connect(&mut self) -> impl Future<Output = IotResult<()>> + Send;
    fn disconnect(&mut self) -> impl Future<Output = IotResult<()>> + Send;
    fn read_property(
        &mut self,
        path: &PropertyPath,
    ) -> impl Future<Output = IotResult<PropertySample>> + Send;
    fn write_property(
        &mut self,
        path: &PropertyPath,
        value: Value,
    ) -> impl Future<Output = IotResult<()>> + Send;
}
Expand description

The unified interface every protocol client implements.

Methods are intentionally narrow: read one path, write one path, observe one path. Protocols that natively support batch reads (Modbus, OPC UA ReadRequest) expose batching via their native API; the gateway only ever needs one-by-one access.

Required Methods§

Source

fn connect(&mut self) -> impl Future<Output = IotResult<()>> + Send

Connect — must be called before any read / write / observe call.

Source

fn disconnect(&mut self) -> impl Future<Output = IotResult<()>> + Send

Cleanly disconnect.

Source

fn read_property( &mut self, path: &PropertyPath, ) -> impl Future<Output = IotResult<PropertySample>> + Send

Read the current value of a bound property.

Source

fn write_property( &mut self, path: &PropertyPath, value: Value, ) -> impl Future<Output = IotResult<()>> + Send

Write a value to a bound property.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§