mirror of
https://github.com/thelsing/knx.git
synced 2025-03-13 00:15:58 +01:00
Handle SystemBroadcast and Broadcast for TP and IP
This commit is contained in:
parent
960c7744f9
commit
73a0989a3b
@ -118,8 +118,12 @@ void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority pr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
#if (defined(USE_TP)||defined(USE_IP))
|
||||||
|
dataSystemBroadcastIndication(hopType, priority, source, apdu);
|
||||||
|
#else
|
||||||
print("Broadcast-indication: unhandled APDU-Type: ");
|
print("Broadcast-indication: unhandled APDU-Type: ");
|
||||||
println(apdu.type());
|
println(apdu.type());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +163,12 @@ void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, P
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
#if (defined(USE_TP)||defined(USE_IP))
|
||||||
|
dataSystemBroadcastConfirm(hopType, priority, apdu, status);
|
||||||
|
#else
|
||||||
print("Broadcast-confirm: unhandled APDU-Type: ");
|
print("Broadcast-confirm: unhandled APDU-Type: ");
|
||||||
println(apdu.type());
|
println(apdu.type());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,13 +206,63 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
#if !(defined(USE_TP)||defined(USE_IP))
|
||||||
|
// For open media (e.g. PL, RF)
|
||||||
|
print("SystemBroadcast-indication: unhandled APDU-Type: ");
|
||||||
|
println(apdu.type());
|
||||||
|
#else
|
||||||
|
// For closed media
|
||||||
|
print("Broadcast-indication: unhandled APDU-Type: ");
|
||||||
|
println(apdu.type());
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
|
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
|
||||||
{
|
{
|
||||||
|
const uint8_t* data = apdu.data();
|
||||||
|
switch (apdu.type())
|
||||||
|
{
|
||||||
|
case SystemNetworkParameterRead:
|
||||||
|
{
|
||||||
|
uint16_t objectType;
|
||||||
|
uint16_t propertyId;
|
||||||
|
uint8_t testInfo[2];
|
||||||
|
popWord(objectType, data + 1);
|
||||||
|
popWord(propertyId, data + 3);
|
||||||
|
popByte(testInfo[0], data + 4);
|
||||||
|
popByte(testInfo[1], data + 5);
|
||||||
|
propertyId = (propertyId >> 4) & 0x0FFF;;
|
||||||
|
testInfo[0] &= 0x0F;
|
||||||
|
//TODO: _bau.systemNetworkParameterReadLocalConfirm(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo), status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DomainAddressSerialNumberWrite:
|
||||||
|
{
|
||||||
|
const uint8_t* knxSerialNumber = &data[1];
|
||||||
|
const uint8_t* domainAddress = &data[7];
|
||||||
|
//TODO: _bau.domainAddressSerialNumberWriteLocalConfirm(priority, hopType, domainAddress, knxSerialNumber, status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DomainAddressSerialNumberRead:
|
||||||
|
{
|
||||||
|
const uint8_t* knxSerialNumber = &data[1];
|
||||||
|
//TODO: _bau.domainAddressSerialNumberReadLocalConfirm(priority, hopType, knxSerialNumber, status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
#if !(defined(USE_TP)||defined(USE_IP))
|
||||||
|
// For open media (e.g. PL, RF)
|
||||||
|
print("SystemBroadcast-confirm: unhandled APDU-Type: ");
|
||||||
|
println(apdu.type());
|
||||||
|
#else
|
||||||
|
// For closed media
|
||||||
|
print("Broadcast-confirm: unhandled APDU-Type: ");
|
||||||
|
println(apdu.type());
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLayer::dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
|
void ApplicationLayer::dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
|
||||||
@ -423,8 +481,7 @@ void ApplicationLayer::systemNetworkParameterReadResponse(Priority priority, Hop
|
|||||||
|
|
||||||
//apdu.printPDU();
|
//apdu.printPDU();
|
||||||
|
|
||||||
//dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
|
dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
|
||||||
dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: ApplicationLayer::domainAddressSerialNumberWriteRequest()
|
//TODO: ApplicationLayer::domainAddressSerialNumberWriteRequest()
|
||||||
|
@ -45,7 +45,11 @@ void DataLinkLayer::systemBroadcastRequest(AckType ack, FrameFormat format, Prio
|
|||||||
{
|
{
|
||||||
// System Broadcast requests will always be transmitted as broadcast with KNX serial number for open media (e.g. RF medium)
|
// System Broadcast requests will always be transmitted as broadcast with KNX serial number for open media (e.g. RF medium)
|
||||||
// See 3.2.5 p.22
|
// See 3.2.5 p.22
|
||||||
|
#if !(defined(USE_TP)||defined(USE_IP))
|
||||||
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, SysBroadcast);
|
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, SysBroadcast);
|
||||||
|
#else
|
||||||
|
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, Broadcast);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
|
void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
|
||||||
@ -73,10 +77,17 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (addrType == GroupAddress && destination == 0)
|
if (addrType == GroupAddress && destination == 0)
|
||||||
|
{
|
||||||
|
#if !(defined(USE_TP)||defined(USE_IP))
|
||||||
if (systemBroadcast == SysBroadcast)
|
if (systemBroadcast == SysBroadcast)
|
||||||
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
|
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
|
||||||
else
|
else
|
||||||
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
|
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
|
||||||
|
#else
|
||||||
|
(void) systemBroadcast; // not used
|
||||||
|
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
|
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
|
||||||
|
|
||||||
@ -108,13 +119,13 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
|
|||||||
|
|
||||||
if (addrType == GroupAddress && destination == 0)
|
if (addrType == GroupAddress && destination == 0)
|
||||||
{
|
{
|
||||||
#if !defined(USE_TP)
|
#if !(defined(USE_TP)||defined(USE_IP))
|
||||||
if (systemBroadcast == SysBroadcast)
|
if (systemBroadcast == SysBroadcast)
|
||||||
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
|
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
|
||||||
else
|
else
|
||||||
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
|
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
|
||||||
#else
|
#else
|
||||||
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
|
(void) systemBroadcast; // not used
|
||||||
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
|
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user