Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 internal void AddDatagram(S7AlarmIndicationDatagram datagram)
 {
     _alarms.Enqueue(datagram);
     CallbackHandler.Event.Set(datagram); // set but ignore the datagram in code
 }
Пример #4
0
 internal bool TryGetDatagram(out S7AlarmIndicationDatagram datagram) => _alarms.TryDequeue(out datagram);