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
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
public byte HardwareRevision { get; }
ModbusAddress
Gets the Modbus address of the simulated sensor device
View Source
public byte ModbusAddress { get; }
ProductModel
Gets the product model identifier of the simulated sensor
View Source
public byte ProductModel { get; }
SerialNumber
Gets the serial number of the simulated sensor device
View Source
public int SerialNumber { get; }
SoftwareVersion
Gets the software/firmware version of the simulated sensor
View Source
public int SoftwareVersion { get; }
Current
Gets the current measurement from the simulated sensor
View Source
public Current? Current { get; }
Voltage
Gets the voltage measurement from the simulated sensor
View Source
public Voltage? Voltage { get; }
Methods
SetCurrent(Current)
Sets the current value that will be returned by subsequent sensor readings
View Source
public void SetCurrent(Current current)
Parameters
| Type | Name | Description |
|---|---|---|
Meadow.Units.Current | current | The current value to simulate |
SetVoltage(Voltage)
Sets the voltage value that will be returned by subsequent sensor readings
View Source
public void SetVoltage(Voltage voltage)
Parameters
| Type | Name | Description |
|---|---|---|
Meadow.Units.Voltage | voltage | The voltage value to simulate |
ReadCurrent()
Asynchronously reads the current measurement from the simulated sensor
View Source
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
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.ICurrentSensorMeadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>Meadow.Peripherals.Sensors.IVoltageSensorMeadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>Meadow.Peripherals.Sensors.ISensor