Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public virtual RelayConfig AfterDeserializedConfig(RelayConfig config)
 {
     return(config);
 }
Esempio n. 4
0
 public virtual RelayConfig BeforeSerializeConfig(RelayConfig config)
 {
     return(config);
 }