コード例 #1
0
        private void KnxEventDelegate(object sender, KnxDatgramEventArgs knxDatgramEventArgs)
        {
            KnxHelper.Logger.LogDebug($"Datagram on GA {knxDatgramEventArgs.Datagram.DestinationAddress}");

            TelegramMonitor.NotifyTelegram(TelegramDirection.Input, knxDatgramEventArgs.Datagram.SourceAddress, knxDatgramEventArgs.Datagram.DestinationAddress, knxDatgramEventArgs.Datagram.ToString(), Automatica.Core.Driver.Utility.Utils.ByteArrayToString(knxDatgramEventArgs.Datagram.Data));

            if (_callbackMap.ContainsKey(knxDatgramEventArgs.Datagram.DestinationAddress))
            {
                foreach (var ac in _callbackMap[knxDatgramEventArgs.Datagram.DestinationAddress])
                {
                    try
                    {
                        KnxHelper.Logger.LogDebug($"Datagram on GA {knxDatgramEventArgs.Datagram.DestinationAddress} - dispatch to {ac}");
                        ac.Invoke(knxDatgramEventArgs.Datagram);
                    }
                    catch (Exception e)
                    {
                        KnxHelper.Logger.LogError($"{e}");
                    }
                }
            }
            else
            {
                KnxHelper.Logger.LogWarning($"Datagram on GA - not callback registered");
            }
        }
コード例 #2
0
 private void DriverOnTelegramReceived(object sender, PacketReceivedEventArgs packetReceivedEventArgs)
 {
     if (packetReceivedEventArgs.Telegram is RadioErp1Packet radio)
     {
         TelegramMonitor.NotifyTelegram(Automatica.Core.Base.TelegramMonitor.TelegramDirection.Input, radio.SenderIdString, radio.Packet.DestinationIdString, radio.Packet.ToString(), Utils.ByteArrayToString(radio.Data));
         TelegramReceived(radio);
     }
 }
コード例 #3
0
        private void _driver_PacketSent(object sender, PacketSentEventArgs e)
        {
            var idBase = _driver.IdBase;

            if (e.Telegram is RadioErp1Packet radio)
            {
                TelegramMonitor.NotifyTelegram(Automatica.Core.Base.TelegramMonitor.TelegramDirection.Output, Utils.ByteArrayToString(idBase), "FF FF FF FF", e.Packet.ToString(), Utils.ByteArrayToString(radio.Data));
            }
            else
            {
                TelegramMonitor.NotifyTelegram(Automatica.Core.Base.TelegramMonitor.TelegramDirection.Output, Utils.ByteArrayToString(idBase), "FF FF FF FF", e.Packet.ToString(), "");
            }
        }
コード例 #4
0
 private void _driver_AnswerReceived(object sender, AnswerReceviedEventArgs e)
 {
     TelegramMonitor.NotifyTelegram(Automatica.Core.Base.TelegramMonitor.TelegramDirection.Input, "EnOcean Dongle", "Automatica.Core.Server", e.Packet.ToString(), Utils.ByteArrayToString(e.Packet.Data));
 }