public Relay(GpioController _gpioController, int gpioId, RelayConfig config, GpioPinValue state) { GpioPin = _gpioController.OpenPin(gpioId); GpioPin.SetDriveMode(GpioPinDriveMode.Output); GpioPin.Write(state); Config = config; State = state; }
public override RelayConfig AfterDeserializedConfig(RelayConfig config) { UnetConfig unetConfig = null; if (config.TransportConfig is UnetConfig) { unetConfig = (UnetConfig)config.TransportConfig; } else if (config.TransportConfig is JObject) { unetConfig = ((JObject)config.TransportConfig).ToObject <UnetConfig>(); } unetConfig.ConnectionConfig.Channels.Clear(); for (int i = 0; i < unetConfig.Channels.Count; i++) { unetConfig.ConnectionConfig.AddChannel(unetConfig.Channels[i]); } return(config); }
public virtual RelayConfig AfterDeserializedConfig(RelayConfig config) { return(config); }
public virtual RelayConfig BeforeSerializeConfig(RelayConfig config) { return(config); }