Skip to main content

Class SimulatedSpm1x

Simulated implementation of the SPM1-X sensor for testing and development purposes. Allows manual setting of current and voltage values that will be returned by sensor readings.

Assembly: Spm1x.dll​
View Source​
Declaration
public class SimulatedSpm1x : ISpm1x, ICurrentSensor, ISensor<Current>, IVoltageSensor, ISensor<Voltage>, ISensor

Implements:
Meadow.Foundation.Sensors.Power.ISpm1x, Meadow.Peripherals.Sensors.ICurrentSensor, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.IVoltageSensor, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.ISensor

Properties​

HardwareRevision​

Gets the hardware revision of the simulated sensor

View Source​
Declaration
public byte HardwareRevision { get; }

ModbusAddress​

Gets the Modbus address of the simulated sensor device

View Source​
Declaration
public byte ModbusAddress { get; }

ProductModel​

Gets the product model identifier of the simulated sensor

View Source​
Declaration
public byte ProductModel { get; }

SerialNumber​

Gets the serial number of the simulated sensor device

View Source​
Declaration
public int SerialNumber { get; }

SoftwareVersion​

Gets the software/firmware version of the simulated sensor

View Source​
Declaration
public int SoftwareVersion { get; }

Current​

Gets the current measurement from the simulated sensor

View Source​
Declaration
public Current? Current { get; }

Voltage​

Gets the voltage measurement from the simulated sensor

View Source​
Declaration
public Voltage? Voltage { get; }

Methods​

SetCurrent(Current)​

Sets the current value that will be returned by subsequent sensor readings

View Source​
Declaration
public void SetCurrent(Current current)
Parameters​
TypeNameDescription
Meadow.Units.CurrentcurrentThe current value to simulate

SetVoltage(Voltage)​

Sets the voltage value that will be returned by subsequent sensor readings

View Source​
Declaration
public void SetVoltage(Voltage voltage)
Parameters​
TypeNameDescription
Meadow.Units.VoltagevoltageThe voltage value to simulate

ReadCurrent()​

Asynchronously reads the current measurement from the simulated sensor

View Source​
Declaration
public ValueTask<Current> ReadCurrent()
Returns​

System.Threading.Tasks.ValueTask<Meadow.Units.Current>: A task containing the current measurement set via SetCurrent()

ReadVoltage()​

Asynchronously reads the voltage measurement from the simulated sensor

View Source​
Declaration
public ValueTask<Voltage> ReadVoltage()
Returns​

System.Threading.Tasks.ValueTask<Meadow.Units.Voltage>: A task containing the voltage measurement set via SetVoltage()

Implements​

  • Meadow.Foundation.Sensors.Power.ISpm1x
  • Meadow.Peripherals.Sensors.ICurrentSensor
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.IVoltageSensor
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.ISensor