pub struct SDM72;tokio-rtu-sync or tokio-tcp-sync only.Expand description
A synchronous client for the SDM72 energy meter.
This struct provides a high-level interface for interacting with the SDM72
energy meter. It uses a synchronous tokio-modbus context for communication.
An instance of this client can be created using the new method.
Implementations§
Source§impl SDM72
impl SDM72
Sourcepub fn system_type(ctx: &mut Context) -> Result<SystemType, Error>
pub fn system_type(ctx: &mut Context) -> Result<SystemType, Error>
Reads the proto::SystemType value from the Modbus holding register.
Sourcepub fn set_system_type(
ctx: &mut Context,
value: SystemType,
) -> Result<(), Error>
pub fn set_system_type( ctx: &mut Context, value: SystemType, ) -> Result<(), Error>
Writes the proto::SystemType value to the Modbus holding register.
Sourcepub fn pulse_width(ctx: &mut Context) -> Result<PulseWidth, Error>
pub fn pulse_width(ctx: &mut Context) -> Result<PulseWidth, Error>
Reads the proto::PulseWidth value from the Modbus holding register.
Sourcepub fn set_pulse_width(
ctx: &mut Context,
value: PulseWidth,
) -> Result<(), Error>
pub fn set_pulse_width( ctx: &mut Context, value: PulseWidth, ) -> Result<(), Error>
Writes the proto::PulseWidth value to the Modbus holding register.
Sourcepub fn kppa(ctx: &mut Context) -> Result<KPPA, Error>
pub fn kppa(ctx: &mut Context) -> Result<KPPA, Error>
Reads the proto::KPPA value from the Modbus holding register.
Sourcepub fn set_kppa(ctx: &mut Context, password: Password) -> Result<(), Error>
pub fn set_kppa(ctx: &mut Context, 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(ctx: &mut Context) -> Result<ParityAndStopBit, Error>
pub fn parity_and_stop_bit(ctx: &mut Context) -> Result<ParityAndStopBit, Error>
Reads the proto::ParityAndStopBit value from the Modbus holding register.
Sourcepub fn set_parity_and_stop_bit(
ctx: &mut Context,
value: ParityAndStopBit,
) -> Result<(), Error>
pub fn set_parity_and_stop_bit( ctx: &mut Context, value: ParityAndStopBit, ) -> Result<(), Error>
Writes the proto::ParityAndStopBit value to the Modbus holding register.
Sourcepub fn address(ctx: &mut Context) -> Result<Address, Error>
pub fn address(ctx: &mut Context) -> Result<Address, Error>
Reads the proto::Address value from the Modbus holding register.
Sourcepub fn set_address(ctx: &mut Context, value: Address) -> Result<(), Error>
pub fn set_address(ctx: &mut Context, value: Address) -> Result<(), Error>
Writes the proto::Address value to the Modbus holding register.
Sourcepub fn pulse_constant(ctx: &mut Context) -> Result<PulseConstant, Error>
pub fn pulse_constant(ctx: &mut Context) -> Result<PulseConstant, Error>
Reads the proto::PulseConstant value from the Modbus holding register.
Sourcepub fn set_pulse_constant(
ctx: &mut Context,
value: PulseConstant,
) -> Result<(), Error>
pub fn set_pulse_constant( ctx: &mut Context, value: PulseConstant, ) -> Result<(), Error>
Writes the proto::PulseConstant value to the Modbus holding register.
Sourcepub fn password(ctx: &mut Context) -> Result<Password, Error>
pub fn password(ctx: &mut Context) -> Result<Password, Error>
Reads the proto::Password value from the Modbus holding register.
Sourcepub fn set_password(ctx: &mut Context, value: Password) -> Result<(), Error>
pub fn set_password(ctx: &mut Context, value: Password) -> Result<(), Error>
Writes the proto::Password value to the Modbus holding register.
Sourcepub fn baud_rate(ctx: &mut Context) -> Result<BaudRate, Error>
pub fn baud_rate(ctx: &mut Context) -> Result<BaudRate, Error>
Reads the proto::BaudRate value from the Modbus holding register.
Sourcepub fn set_baud_rate(ctx: &mut Context, value: BaudRate) -> Result<(), Error>
pub fn set_baud_rate(ctx: &mut Context, value: BaudRate) -> Result<(), Error>
Writes the proto::BaudRate value to the Modbus holding register.
Sourcepub fn auto_scroll_time(ctx: &mut Context) -> Result<AutoScrollTime, Error>
pub fn auto_scroll_time(ctx: &mut Context) -> Result<AutoScrollTime, Error>
Reads the proto::AutoScrollTime value from the Modbus holding register.
Sourcepub fn set_auto_scroll_time(
ctx: &mut Context,
value: AutoScrollTime,
) -> Result<(), Error>
pub fn set_auto_scroll_time( ctx: &mut Context, value: AutoScrollTime, ) -> Result<(), Error>
Writes the proto::AutoScrollTime value to the Modbus holding register.
Sourcepub fn backlight_time(ctx: &mut Context) -> Result<BacklightTime, Error>
pub fn backlight_time(ctx: &mut Context) -> Result<BacklightTime, Error>
Reads the proto::BacklightTime value from the Modbus holding register.
Sourcepub fn set_backlight_time(
ctx: &mut Context,
value: BacklightTime,
) -> Result<(), Error>
pub fn set_backlight_time( ctx: &mut Context, value: BacklightTime, ) -> Result<(), Error>
Writes the proto::BacklightTime value to the Modbus holding register.
Sourcepub fn pulse_energy_type(ctx: &mut Context) -> Result<PulseEnergyType, Error>
pub fn pulse_energy_type(ctx: &mut Context) -> Result<PulseEnergyType, Error>
Reads the proto::PulseEnergyType value from the Modbus holding register.
Sourcepub fn set_pulse_energy_type(
ctx: &mut Context,
value: PulseEnergyType,
) -> Result<(), Error>
pub fn set_pulse_energy_type( ctx: &mut Context, value: PulseEnergyType, ) -> Result<(), Error>
Writes the proto::PulseEnergyType value to the Modbus holding register.
Sourcepub fn reset_historical_data(ctx: &mut Context) -> Result<(), Error>
pub fn reset_historical_data(ctx: &mut Context) -> Result<(), Error>
Resets the historical data on the meter.
This requires KPPA authorization.
Sourcepub fn serial_number(ctx: &mut Context) -> Result<SerialNumber, Error>
pub fn serial_number(ctx: &mut Context) -> Result<SerialNumber, Error>
Reads the proto::SerialNumber value from the Modbus holding register.
Sourcepub fn meter_code(ctx: &mut Context) -> Result<MeterCode, Error>
pub fn meter_code(ctx: &mut Context) -> Result<MeterCode, Error>
Reads the proto::MeterCode value from the Modbus holding register.
Sourcepub fn software_version(ctx: &mut Context) -> Result<SoftwareVersion, Error>
pub fn software_version(ctx: &mut Context) -> Result<SoftwareVersion, Error>
Reads the proto::SoftwareVersion value from the Modbus holding register.
Sourcepub fn read_all_settings(
ctx: &mut Context,
delay: &Duration,
) -> Result<AllSettings, Error>
pub fn read_all_settings( ctx: &mut Context, delay: &Duration, ) -> Result<AllSettings, Error>
Reads all settings from the meter in a single batch operation.
This method is more efficient than reading each setting individually because it minimizes the number of Modbus requests by batching them. The SDM72 meter has a limit of 30 parameters per request, so this function splits the reads into multiple batches.
§Arguments
delay- The delay to be inserted between Modbus requests. This is necessary for some Modbus devices, which may need a short pause to process a request before they are ready to accept the next one. A typical value is 100 milliseconds, but this may vary depending on the device and network conditions.
Sourcepub fn read_all(ctx: &mut Context, delay: &Duration) -> Result<AllValues, Error>
pub fn read_all(ctx: &mut Context, delay: &Duration) -> Result<AllValues, Error>
Reads all measurement values from the meter in a single batch operation.
This method is more efficient than reading each value individually because it minimizes the number of Modbus requests by batching them. The SDM72 meter has a limit of 30 parameters per request, so this function splits the reads into multiple batches.
§Arguments
delay- The delay to be inserted between Modbus requests. This is necessary for some Modbus devices, which may need a short pause to process a request before they are ready to accept the next one. A typical value is 100 milliseconds, but this may vary depending on the device and network conditions.