private void ReceivedS7AlarmIndicationDatagram(Memory <byte> buffer) { var data = S7AlarmIndicationDatagram.TranslateFromMemory(buffer); if (data.UserData.Data == null) { _logger.LogWarning("No data from alarm update ack received for reference {0}", data.UserData.Header.ProtocolDataUnitReference); } foreach (var handler in _alarmIndicationHandler.Values) { handler.Event.Set(data); } }
private void ReceivedS7AlarmIndicationDatagram(Memory <byte> buffer) { var data = S7AlarmIndicationDatagram.TranslateFromMemory(buffer); if (data.UserData.Data == null) { _logger?.LogWarning("No data from alarm update ack received for reference {0}", data.UserData.Header.ProtocolDataUnitReference); } foreach (var subscription in _subscriptions.Values) { subscription.AddDatagram(data); } foreach (var handler in _alarmIndicationHandler.Where(x => !_subscriptions.ContainsKey(x.Key)).Select(x => x.Value)) { handler.Event.Set(data); } }
internal void AddDatagram(S7AlarmIndicationDatagram datagram) { _alarms.Enqueue(datagram); CallbackHandler.Event.Set(datagram); // set but ignore the datagram in code }
internal bool TryGetDatagram(out S7AlarmIndicationDatagram datagram) => _alarms.TryDequeue(out datagram);