Class SimulatedRelay
Represents a simulated relay that implements both IRelay and ISimulatedSensor interfaces.
Assembly: Meadow.Foundation.dll
View Source
public class SimulatedRelay : IRelay, ISimulatedSensor
Implements:
Meadow.Peripherals.Relays.IRelay
, Meadow.Peripherals.Sensors.ISimulatedSensor
Properties
Type
Returns relay type.
View Source
public RelayType Type { get; }
Name
Gets the name of the Relay
View Source
public string Name { get; }
State
Gets or sets the state of the relay.
View Source
public RelayState State { get; set; }
SupportedBehaviors
Gets an array of supported simulation behaviors for the sensor.
View Source
public SimulationBehavior[] SupportedBehaviors { get; }
ValueType
Gets the type of the sensor's value.
View Source
public Type ValueType { get; }
Methods
Toggle()
Toggles the relay on or off.
View Source
public void Toggle()
SetSensorValue(object)
Sets the simulated value for the sensor.
View Source
public void SetSensorValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to set for the sensor. |
StartSimulation(SimulationBehavior)
Starts the simulation with the specified behavior.
View Source
public void StartSimulation(SimulationBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Peripherals.Sensors.SimulationBehavior | behavior | The simulation behavior to start. |
Events
OnChanged
Event raised after relay state change
View Source
public event EventHandler<RelayState> OnChanged
Event Type
System.EventHandler<Meadow.Peripherals.Relays.RelayState>
Implements
Meadow.Peripherals.Relays.IRelay
Meadow.Peripherals.Sensors.ISimulatedSensor