Esempio n. 1
0
        public void ConnectTo(DigitalSignal digitalSignal)
        {
            if (digitalSignal == null)
            {
                throw new ArgumentNullException(nameof(digitalSignal));
            }
            if (_digitalSignal != null)
            {
                throw new InvalidOperationException("This DigitalSignalProvider is already connected.");
            }

            _digitalSignal = digitalSignal;
            _digitalSignal.Attach(this);

            // catch up with set level value
            if (Level != DigitalLevel.Floating)
            {
                var newLevel = Level;
                foreach (var level in new DigitalLevelCycler(
                             DigitalLevelCycler.NextLevel(_digitalSignal.Level), newLevel))
                {
                    Level = level;
                    _digitalSignal.OnNewProviderValue(this);
                }
            }
        }
Esempio n. 2
0
        public void ConnectTo(DigitalSignal digitalSignal)
        {
            if (digitalSignal == null)
            {
                throw new ArgumentNullException(nameof(digitalSignal));
            }
            if (_digitalSignal != null)
            {
                throw new InvalidOperationException("DigitalConsumer is already connected.");
            }

            _digitalSignal = digitalSignal;
            _digitalSignal.Attach(this);

            _digitalSignal.OnChanged += DigitalSignal_OnChanged;
        }
        public void ConnectTo(DigitalSignal digitalSignal)
        {
            if (digitalSignal == null)
            {
                throw new ArgumentNullException(nameof(digitalSignal));
            }
            if (_digitalSignal != null)
            {
                throw new InvalidOperationException("This DigitalSignalProvider is already connected.");
            }

            _digitalSignal = digitalSignal;
            _digitalSignal.Attach(this);

            // catch up with set level value
            if (Level != DigitalLevel.Floating)
            {
                SetNewLevel(Level);
            }
        }
Esempio n. 4
0
 public DigitalSignalConsumer(DigitalSignal digitalSignal, string name)
 {
     Name = name;
     ConnectTo(digitalSignal);
 }
Esempio n. 5
0
 public DigitalSignalProvider(DigitalSignal digitalSignal, string name)
 {
     Name = name;
     ConnectTo(digitalSignal);
 }
Esempio n. 6
0
 public DigitalInputStream(DigitalSignal signal)
 {
     _signal = signal;
 }