public FloatSwitch(FloatSwitchSettings settings) : base(settings)
        {
            activated     = false;
            switchType    = settings.switchType;
            switchFuntion = settings.switchFuntion;
            physicalLevel = settings.physicalLevel;
            delayTimer    = new OnDelayTimer(settings.timeOffset);
            delayTimer.TimerElapsedEvent += OnDelayTimerTimerElapsedEvent;
            var channelName = string.Format("{0}, Float Switch", name);

            Driver.DigitalInput.AddChannel(channel, channelName);
            Subscribe(Driver.DigitalInput.GetChannelEventPublisherKey(channelName));
        }
Esempio n. 2
0
        public override GenericGadgetSettings GetGadgetSettings(string name)
        {
            CheckGadgetKey(name);
            var floatSwitch = gadgets[name] as FloatSwitch;
            var settings    = new FloatSwitchSettings();

            settings.name          = name;
            settings.channel       = floatSwitch.channel;
            settings.physicalLevel = floatSwitch.physicalLevel;
            settings.switchType    = floatSwitch.switchType;
            settings.switchFuntion = floatSwitch.switchFuntion;
            settings.timeOffset    = floatSwitch.timeOffset;
            return(settings);
        }