Ejemplo 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);
                }
            }
        }
Ejemplo 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;
        }
Ejemplo n.º 3
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)
            {
                SetNewLevel(Level);
            }
        }
Ejemplo n.º 4
0
 public DigitalSignalConsumer(DigitalSignal digitalSignal, string name)
 {
     Name = name;
     ConnectTo(digitalSignal);
 }
Ejemplo n.º 5
0
 public DigitalSignalProvider(DigitalSignal digitalSignal, string name)
 {
     Name = name;
     ConnectTo(digitalSignal);
 }
Ejemplo n.º 6
0
 public DigitalInputStream(DigitalSignal signal)
 {
     _signal = signal;
 }