pub struct SafeClient { /* private fields */ }safe-client-async and (crate features tokio-rtu or tokio-tcp) only.Expand description
Asynchronous client for interacting with the R4DCB08 temperature module over Modbus.
This struct provides methods to read sensor data and configure the module’s
operational parameters by wrapping tokio-modbus asynchronous operations.
All methods that interact with the Modbus device are async and return Futures.
Implementations§
Source§impl SafeClient
impl SafeClient
Sourcepub fn new(ctx: Context) -> Self
pub fn new(ctx: Context) -> Self
Creates a new SafeClient with a given tokio-modbus asynchronous context.
Creates a new SafeClient from a shared tokio-modbus asynchronous context.
Clones the shared tokio-modbus asynchronous context.
Sourcepub async fn read_temperatures(&self) -> Result<Temperatures, Error>
pub async fn read_temperatures(&self) -> Result<Temperatures, Error>
Reads the current temperatures from all 8 available channels in degrees Celsius (°C).
Sourcepub async fn read_temperature_correction(
&self,
) -> Result<TemperatureCorrection, Error>
pub async fn read_temperature_correction( &self, ) -> Result<TemperatureCorrection, Error>
Reads the configured temperature correction values (°C) for all 8 channels.
Sourcepub async fn set_temperature_correction(
&self,
channel: Channel,
correction: Temperature,
) -> Result<(), Error>
pub async fn set_temperature_correction( &self, channel: Channel, correction: Temperature, ) -> Result<(), Error>
Sets a temperature correction value for a specific channel.
Sourcepub async fn read_automatic_report(&self) -> Result<AutomaticReport, Error>
pub async fn read_automatic_report(&self) -> Result<AutomaticReport, Error>
Reads the automatic temperature reporting interval.
Sourcepub async fn set_automatic_report(
&self,
report: AutomaticReport,
) -> Result<(), Error>
pub async fn set_automatic_report( &self, report: AutomaticReport, ) -> Result<(), Error>
Sets the automatic temperature reporting interval.
Sourcepub async fn read_baud_rate(&self) -> Result<BaudRate, Error>
pub async fn read_baud_rate(&self) -> Result<BaudRate, Error>
Reads the current Modbus communication baud rate setting from the device.
Sourcepub async fn set_baud_rate(&self, baud_rate: BaudRate) -> Result<(), Error>
pub async fn set_baud_rate(&self, baud_rate: BaudRate) -> Result<(), Error>
Sets the Modbus communication baud rate for the device.
Sourcepub async fn factory_reset(&self) -> Result<(), Error>
pub async fn factory_reset(&self) -> Result<(), Error>
Resets the R4DCB08 module to its factory default settings.
Sourcepub async fn read_address(&self) -> Result<Address, Error>
pub async fn read_address(&self) -> Result<Address, Error>
Reads the current Modbus device address (Slave ID) from the module.
Trait Implementations§
Source§impl Clone for SafeClient
impl Clone for SafeClient
Source§fn clone(&self) -> SafeClient
fn clone(&self) -> SafeClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more