pub struct SafeClient { /* private fields */ }safe-client-sync and (crate features tokio-rtu-sync or tokio-tcp-sync) only.Expand description
A thread-safe synchronous client for the SDM72 energy meter.
Implementations§
Source§impl SafeClient
impl SafeClient
Sourcepub fn new(ctx: Context) -> Self
pub fn new(ctx: Context) -> Self
Creates a new SafeClient instance.
§Arguments
ctx: A synchronous Modbus client context, already connected.
Creates a new SafeClient from an existing Arc<Mutex<Context>>.
This allows multiple SafeClient instances to share the exact same
underlying connection context.
Clones and returns the underlying Arc<Mutex<Context>>.
This allows the shared context to be used by other parts of an application that may need direct access to the Modbus context.
Sourcepub fn system_type(&mut self) -> Result<SystemType, Error>
pub fn system_type(&mut self) -> Result<SystemType, Error>
Reads the proto::SystemType value from the Modbus holding register.
Sourcepub fn set_system_type(&mut self, value: SystemType) -> Result<(), Error>
pub fn set_system_type(&mut self, value: SystemType) -> Result<(), Error>
Writes the proto::SystemType value to the Modbus holding register.
Sourcepub fn pulse_width(&mut self) -> Result<PulseWidth, Error>
pub fn pulse_width(&mut self) -> Result<PulseWidth, Error>
Reads the proto::PulseWidth value from the Modbus holding register.
Sourcepub fn set_pulse_width(&mut self, value: PulseWidth) -> Result<(), Error>
pub fn set_pulse_width(&mut self, value: PulseWidth) -> Result<(), Error>
Writes the proto::PulseWidth value to the Modbus holding register.
Sourcepub fn kppa(&mut self) -> Result<KPPA, Error>
pub fn kppa(&mut self) -> Result<KPPA, Error>
Reads the proto::KPPA value from the Modbus holding register.
Sourcepub fn set_kppa(&mut self, password: Password) -> Result<(), Error>
pub fn set_kppa(&mut self, password: Password) -> Result<(), Error>
Sets the Key Parameter Programming Authorization (KPPA).
This is required to change settings on the meter.
Sourcepub fn parity_and_stop_bit(&mut self) -> Result<ParityAndStopBit, Error>
pub fn parity_and_stop_bit(&mut self) -> Result<ParityAndStopBit, Error>
Reads the proto::ParityAndStopBit value from the Modbus holding register.
Sourcepub fn set_parity_and_stop_bit(
&mut self,
value: ParityAndStopBit,
) -> Result<(), Error>
pub fn set_parity_and_stop_bit( &mut self, value: ParityAndStopBit, ) -> Result<(), Error>
Writes the proto::ParityAndStopBit value to the Modbus holding register.
Sourcepub fn address(&mut self) -> Result<Address, Error>
pub fn address(&mut self) -> Result<Address, Error>
Reads the proto::Address value from the Modbus holding register.
pub fn set_address(&mut self, value: Address) -> Result<(), Error>
Sourcepub fn pulse_constant(&mut self) -> Result<PulseConstant, Error>
pub fn pulse_constant(&mut self) -> Result<PulseConstant, Error>
Reads the proto::PulseConstant value from the Modbus holding register.
Sourcepub fn set_pulse_constant(&mut self, value: PulseConstant) -> Result<(), Error>
pub fn set_pulse_constant(&mut self, value: PulseConstant) -> Result<(), Error>
Writes the proto::PulseConstant value to the Modbus holding register.
Sourcepub fn password(&mut self) -> Result<Password, Error>
pub fn password(&mut self) -> Result<Password, Error>
Reads the proto::Password value from the Modbus holding register.
Sourcepub fn set_password(&mut self, value: Password) -> Result<(), Error>
pub fn set_password(&mut self, value: Password) -> Result<(), Error>
Writes the proto::Password value to the Modbus holding register.
Sourcepub fn baud_rate(&mut self) -> Result<BaudRate, Error>
pub fn baud_rate(&mut self) -> Result<BaudRate, Error>
Reads the proto::BaudRate value from the Modbus holding register.
Sourcepub fn set_baud_rate(&mut self, value: BaudRate) -> Result<(), Error>
pub fn set_baud_rate(&mut self, value: BaudRate) -> Result<(), Error>
Writes the proto::BaudRate value to the Modbus holding register.
Sourcepub fn auto_scroll_time(&mut self) -> Result<AutoScrollTime, Error>
pub fn auto_scroll_time(&mut self) -> Result<AutoScrollTime, Error>
Reads the proto::AutoScrollTime value from the Modbus holding register.
Sourcepub fn set_auto_scroll_time(
&mut self,
value: AutoScrollTime,
) -> Result<(), Error>
pub fn set_auto_scroll_time( &mut self, value: AutoScrollTime, ) -> Result<(), Error>
Writes the proto::AutoScrollTime value to the Modbus holding register.
Sourcepub fn backlight_time(&mut self) -> Result<BacklightTime, Error>
pub fn backlight_time(&mut self) -> Result<BacklightTime, Error>
Reads the proto::BacklightTime value from the Modbus holding register.
Sourcepub fn set_backlight_time(&mut self, value: BacklightTime) -> Result<(), Error>
pub fn set_backlight_time(&mut self, value: BacklightTime) -> Result<(), Error>
Writes the proto::BacklightTime value to the Modbus holding register.
Sourcepub fn pulse_energy_type(&mut self) -> Result<PulseEnergyType, Error>
pub fn pulse_energy_type(&mut self) -> Result<PulseEnergyType, Error>
Reads the proto::PulseEnergyType value from the Modbus holding register.
Sourcepub fn set_pulse_energy_type(
&mut self,
value: PulseEnergyType,
) -> Result<(), Error>
pub fn set_pulse_energy_type( &mut self, value: PulseEnergyType, ) -> Result<(), Error>
Writes the proto::PulseEnergyType value to the Modbus holding register.
Sourcepub fn reset_historical_data(&mut self) -> Result<(), Error>
pub fn reset_historical_data(&mut self) -> Result<(), Error>
Resets the historical data on the meter.
This requires KPPA authorization.
Sourcepub fn serial_number(&mut self) -> Result<SerialNumber, Error>
pub fn serial_number(&mut self) -> Result<SerialNumber, Error>
Reads the proto::SerialNumber value from the Modbus holding register.
Sourcepub fn meter_code(&mut self) -> Result<MeterCode, Error>
pub fn meter_code(&mut self) -> Result<MeterCode, Error>
Reads the proto::MeterCode value from the Modbus holding register.
Sourcepub fn software_version(&mut self) -> Result<SoftwareVersion, Error>
pub fn software_version(&mut self) -> Result<SoftwareVersion, Error>
Reads the proto::SoftwareVersion value from the Modbus holding register.
Sourcepub fn read_all_settings(
&mut self,
delay: &Duration,
) -> Result<AllSettings, Error>
pub fn read_all_settings( &mut self, delay: &Duration, ) -> Result<AllSettings, Error>
Reads all settings from the meter in a single batch operation.
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