From f46778c17631de13b142397f7ae02a2ef8c14bb8 Mon Sep 17 00:00:00 2001 From: Nanosonde <2073569+nanosonde@users.noreply.github.com> Date: Thu, 16 Jul 2020 21:02:25 +0200 Subject: [PATCH] handle SBC on closed media --- src/knx/application_layer.cpp | 20 -------------------- src/knx/network_layer.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/knx/application_layer.cpp b/src/knx/application_layer.cpp index bfe59b1..18094d0 100644 --- a/src/knx/application_layer.cpp +++ b/src/knx/application_layer.cpp @@ -142,14 +142,8 @@ void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority pr break; } default: -#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0) - // Make sure we also check if it is a service normally available only on SystemBroadcast on open media - dataSystemBroadcastIndication(hopType, priority, source, apdu, secCtrl); -#else print("Broadcast-indication: unhandled APDU-Type: "); println(apdu.type()); - -#endif break; } } @@ -195,14 +189,8 @@ void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, P break; } default: -#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0) - // Make sure we also check if it is a service normally available only on SystemBroadcast on open media - dataSystemBroadcastConfirm(hopType, priority, apdu, secCtrl, status); -#else print("Broadcast-confirm: unhandled APDU-Type: "); println(apdu.type()); - -#endif break; } } @@ -246,11 +234,7 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior break; } default: -#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0) - print("Broadcast-indication: unhandled APDU-Type: "); -#else print("SystemBroadcast-indication: unhandled APDU-Type: "); -#endif println(apdu.type()); break; } @@ -294,11 +278,7 @@ void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority break; } default: -#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0) - print("Broadcast-confirm: unhandled APDU-Type: "); -#else print("SystemBroadcast-confirm: unhandled APDU-Type: "); -#endif println(apdu.type()); break; } diff --git a/src/knx/network_layer.cpp b/src/knx/network_layer.cpp index 8fa53d2..8bd856a 100644 --- a/src/knx/network_layer.cpp +++ b/src/knx/network_layer.cpp @@ -107,6 +107,15 @@ void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t de void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source) { HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter; + + // for closed media like TP1 and IP + if (isApciSystemBroadcast(npdu.tpdu().apdu())) + { + npdu.frame().systemBroadcast(SysBroadcast); + _transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu()); + return; + } + _transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu()); }