private bool AreMultipleMastersActive(BusMaster currentMaster) { return(_masters .Where(m => !m.Value.IsFloating) .Except(new[] { currentMaster }) .Any()); }
private void ThrowIfMultipleMastersAreActive(BusMaster currentMaster) { if (AreMultipleMastersActive(currentMaster)) { throw new BusConflictException("Multiple masters are active on bus: " + Name); } }
private bool AreMultipleMastersActive(BusMaster currentMaster) { var floating = new BusData(BusWidth); return(_masters .Where(m => !m.Value.Equals(floating)) .Except(new[] { currentMaster }) .Any()); }
internal void OnMasterValueChanged(BusMaster busMaster) { ThrowIfMultipleMastersAreActive(busMaster); var value = busMaster.Value; if (!Value.Equals(value)) { Value = value; ApplyValue(value); NotifyChange(busMaster); } }
internal void Attach(BusMaster busMaster) { if (busMaster == null) { throw new ArgumentNullException(nameof(busMaster)); } if (_masters.Contains(busMaster)) { throw new ArgumentException("Specified BusMaster is already connected.", nameof(busMaster)); } _masters.Add(busMaster); }
public BusChangedEventArgs(BusMaster busMaster, BusData value) { BusMaster = busMaster; Value = value; }
protected void NotifyChange(BusMaster source) { OnChanged?.Invoke(this, new BusChangedEventArgs <BusData>(source, Value)); }
public BusSlaveOfMaster(BusMaster owner, Bus bus, string name) : base(bus, name) { _owner = owner; }
public BusSlaveOfMaster(BusMaster owner, Bus bus) : base(bus) { _owner = owner; }
public BusSlaveOfMaster(BusMaster owner) { _owner = owner; }