public KnxBinding(KnxConnection knxConnection, MessageBus messageBus, IMessageBusAddress sendingAddress) { _knxConnection = knxConnection; _messageBus = messageBus; Address = sendingAddress; _busInlet = _messageBus.CreateInletFor(this); _knxConnection.KnxEventReceived += _knxConnection_KnxEventReceived; }
public Entity(MessageBus messageBus, IMessageBusAddress address, IEnumerable <IComponent> components) { Inlet = messageBus.CreateInletFor(this); Address = address; _components = components.ToArray(); for (int i = 0; i < _components.Length; i++) { _components[i].AddedToEntity(this); } messageBus.AddMessageSink(address, this, this); }
public void AddMessageSink(IMessageBusAddress listeningFor, IMessageSink sink, IMessageSource correlatingSource) { ImmutableList <SinkData> list; int correlatingSourceId; if (!_sourceToCorrelationId.TryGetValue(correlatingSource, out correlatingSourceId)) { correlatingSourceId = -1; } _sinkMapping = _sinkMapping.SetItem(listeningFor, _sinkMapping.TryGetValue(listeningFor, out list) ? list.Add(new SinkData(sink, correlatingSourceId)) : ImmutableList <SinkData> .Empty.Add(new SinkData(sink, correlatingSourceId))); }
public MessageHeader(IMessageBusAddress sourceAddress, IMessageBusAddress destinationAddress) { SourceAddress = sourceAddress; DestinationAddress = destinationAddress; }
public Button(IMessageBusAddress targetEntityAddress) { _targetEntityAddress = targetEntityAddress; }
public void Send(IMessageBusAddress destinationAddress, IMessagePayload message) { var sourceAddress = _messageSource.Address; _messageBus.Send(new Message(new MessageHeader(sourceAddress, destinationAddress), message), _correlatingSourceId); }
public void AddSwitch(GroupAddress groupAddress, IMessageBusAddress address, KnxAddressBindingTypes knxAddressBindingType) { _mapping.Add(address, groupAddress); _bindingTypes = _bindingTypes.Add(groupAddress, knxAddressBindingType); _messageBus.AddMessageSink(address, this, this); }