mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Merge pull request #265 from OpenKNX/fix_serialnumber
fixes the serial number handling
This commit is contained in:
commit
a870dd812d
@ -551,7 +551,7 @@ void ApplicationLayer::systemNetworkParameterReadResponse(Priority priority, Hop
|
|||||||
void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA,
|
void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA,
|
||||||
const uint8_t* knxSerialNumber)
|
const uint8_t* knxSerialNumber)
|
||||||
{
|
{
|
||||||
CemiFrame frame(11);
|
CemiFrame frame(13);
|
||||||
APDU& apdu = frame.apdu();
|
APDU& apdu = frame.apdu();
|
||||||
apdu.type(DomainAddressSerialNumberResponse);
|
apdu.type(DomainAddressSerialNumberResponse);
|
||||||
|
|
||||||
@ -567,19 +567,19 @@ void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority,
|
|||||||
|
|
||||||
//TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest()
|
//TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest()
|
||||||
//TODO: ApplicationLayer::IndividualAddressSerialNumberReadRequest()
|
//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)
|
const uint8_t* knxSerialNumber)
|
||||||
{
|
{
|
||||||
CemiFrame frame(13);
|
CemiFrame frame(11);
|
||||||
APDU& apdu = frame.apdu();
|
APDU& apdu = frame.apdu();
|
||||||
apdu.type(IndividualAddressSerialNumberResponse);
|
apdu.type(IndividualAddressSerialNumberResponse);
|
||||||
|
|
||||||
uint8_t* data = apdu.data() + 1;
|
uint8_t* data = apdu.data() + 1;
|
||||||
|
|
||||||
memcpy(data, knxSerialNumber, 6);
|
memcpy(data, knxSerialNumber, 6);
|
||||||
memcpy(data + 6, rfDoA, 6);
|
memcpy(data + 6, domainAddress, 2);
|
||||||
|
|
||||||
//apdu.printPDU();
|
//apdu.printPDU();
|
||||||
|
|
||||||
dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, secCtrl);
|
dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, secCtrl);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class ApplicationLayer
|
|||||||
uint8_t* testResult, uint16_t testResultLength);
|
uint8_t* testResult, uint16_t testResultLength);
|
||||||
void domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl& secCtrl, const uint8_t* rfDoA,
|
void domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const SecurityControl& secCtrl, const uint8_t* rfDoA,
|
||||||
const uint8_t* knxSerialNumber);
|
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);
|
const uint8_t* knxSerialNumber);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
@ -169,10 +169,7 @@ void Bau27B0::domainAddressSerialNumberReadIndication(Priority priority, HopCoun
|
|||||||
|
|
||||||
void Bau27B0::individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber)
|
void Bau27B0::individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber)
|
||||||
{
|
{
|
||||||
// If the received serial number matches our serial number
|
#pragma warning "individualAddressSerialNumberReadIndication is not available for rf"
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bau27B0::domainAddressSerialNumberWriteLocalConfirm(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA,
|
void Bau27B0::domainAddressSerialNumberWriteLocalConfirm(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA,
|
||||||
|
@ -494,7 +494,7 @@ void BauSystemB::individualAddressSerialNumberReadIndication(Priority priority,
|
|||||||
// An open medium BAU has to override this method and provide a proper domain address.
|
// An open medium BAU has to override this method and provide a proper domain address.
|
||||||
if (!memcmp(knxSerialNumber, _deviceObj.propertyData(PID_SERIAL_NUMBER), 6))
|
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);
|
applicationLayer().IndividualAddressSerialNumberReadResponse(priority, hopType, secCtrl, emptyDomainAddress, knxSerialNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user