From 3c29d164508ea37e8dab78f174e56bf54b83f5da Mon Sep 17 00:00:00 2001 From: Marco Scholl Date: Wed, 20 Dec 2023 09:35:29 +0100 Subject: [PATCH] fix IndividualAddressSerialNumberReadResponse --- src/knx/application_layer.cpp | 8 ++++---- src/knx/application_layer.h | 2 +- src/knx/bau27B0.cpp | 5 +---- src/knx/bau_systemB.cpp | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/knx/application_layer.cpp b/src/knx/application_layer.cpp index 05df9a5..1e8ccec 100644 --- a/src/knx/application_layer.cpp +++ b/src/knx/application_layer.cpp @@ -567,19 +567,19 @@ void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority, //TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest() //TODO: ApplicationLayer::IndividualAddressSerialNumberReadRequest() -void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA, +void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* domainAddress, const uint8_t* knxSerialNumber) { - CemiFrame frame(13); + CemiFrame frame(11); APDU& apdu = frame.apdu(); apdu.type(IndividualAddressSerialNumberResponse); uint8_t* data = apdu.data() + 1; memcpy(data, knxSerialNumber, 6); - memcpy(data + 6, rfDoA, 6); + memcpy(data + 6, domainAddress, 2); - //apdu.printPDU(); + //apdu.printPDU(); dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, secCtrl); } diff --git a/src/knx/application_layer.h b/src/knx/application_layer.h index bd14ef2..c7593c8 100644 --- a/src/knx/application_layer.h +++ b/src/knx/application_layer.h @@ -154,7 +154,7 @@ class ApplicationLayer uint8_t* testResult, uint16_t testResultLength); void domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl& secCtrl, const uint8_t* rfDoA, const uint8_t* knxSerialNumber); - void IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl& secCtrl, const uint8_t* rfDoA, + void IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl& secCtrl, const uint8_t* domainAddress, const uint8_t* knxSerialNumber); #pragma endregion diff --git a/src/knx/bau27B0.cpp b/src/knx/bau27B0.cpp index 9b119f9..6180539 100644 --- a/src/knx/bau27B0.cpp +++ b/src/knx/bau27B0.cpp @@ -169,10 +169,7 @@ void Bau27B0::domainAddressSerialNumberReadIndication(Priority priority, HopCoun void Bau27B0::individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber) { - // If the received serial number matches our serial number - // then send a response with the current RF domain address stored in the RF medium object and the serial number - if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6)) - _appLayer.IndividualAddressSerialNumberReadResponse(priority, hopType, secCtrl, _rfMediumObj.rfDomainAddress(), knxSerialNumber); + #pragma warning "individualAddressSerialNumberReadIndication is not available for rf" } void Bau27B0::domainAddressSerialNumberWriteLocalConfirm(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA, diff --git a/src/knx/bau_systemB.cpp b/src/knx/bau_systemB.cpp index 9b8897f..fc1fdf8 100644 --- a/src/knx/bau_systemB.cpp +++ b/src/knx/bau_systemB.cpp @@ -494,7 +494,7 @@ void BauSystemB::individualAddressSerialNumberReadIndication(Priority priority, // An open medium BAU has to override this method and provide a proper domain address. if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6)) { - uint8_t emptyDomainAddress[6] = {0x00}; + uint8_t emptyDomainAddress[2] = {0x00}; applicationLayer().IndividualAddressSerialNumberReadResponse(priority, hopType, secCtrl, emptyDomainAddress, knxSerialNumber); } }