Refactor Broadcast/SystemBroadcast

This commit is contained in:
Nanosonde 2020-06-08 08:56:25 +02:00
parent 506e0db468
commit e7478eac32
8 changed files with 212 additions and 179 deletions

View File

@ -77,99 +77,157 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
}
}
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType)
{
uint8_t* data = apdu.data();
switch (apdu.type())
if (broadcastType == Broadcast)
{
case IndividualAddressWrite:
// APCI on Broadcast
switch (apdu.type())
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteIndication(hopType, newAddress);
break;
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteIndication(hopType, newAddress);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadIndication(hopType);
break;
case IndividualAddressResponse:
_bau.individualAddressReadAppLayerConfirm(hopType, apdu.frame().sourceAddress());
break;
case IndividualAddressSerialNumberRead:
{
uint8_t* knxSerialNumber = &data[1];
_bau.individualAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadAppLayerConfirm(hopType, data + 1, apdu.frame().sourceAddress(),
domainAddress);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint8_t* knxSerialNumber = &data[1];
uint16_t newIndividualAddress;
popWord(newIndividualAddress, &data[7]);
_bau.individualAddressSerialNumberWriteIndication(priority, hopType, newIndividualAddress, knxSerialNumber);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
break;
}
case IndividualAddressRead:
_bau.individualAddressReadIndication(hopType);
break;
case IndividualAddressResponse:
_bau.individualAddressReadAppLayerConfirm(hopType, apdu.frame().sourceAddress());
break;
case IndividualAddressSerialNumberRead:
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
{
uint8_t* knxSerialNumber = &data[1];
_bau.individualAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
#endif
// TODO: testInfo could be of any length
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;
_bau.systemNetworkParameterReadIndication(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo));
break;
}
case DomainAddressSerialNumberWrite:
{
const uint8_t* knxSerialNumber = &data[1];
const uint8_t* domainAddress = &data[7];
_bau.domainAddressSerialNumberWriteIndication(priority, hopType, domainAddress, knxSerialNumber);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
_bau.domainAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
if (broadcastType == SysBroadcast)
{
print("System");
}
#endif
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
break;
}
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadAppLayerConfirm(hopType, data + 1, apdu.frame().sourceAddress(),
domainAddress);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint8_t* knxSerialNumber = &data[1];
uint16_t newIndividualAddress;
popWord(newIndividualAddress, &data[7]);
_bau.individualAddressSerialNumberWriteIndication(priority, hopType, newIndividualAddress, knxSerialNumber);
break;
}
default:
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
}
}
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status)
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType)
{
uint8_t* data = apdu.data();
switch (apdu.type())
{
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteLocalConfirm(ack, hopType, newAddress, status);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadLocalConfirm(ack, hopType, status);
break;
case IndividualAddressResponse:
_bau.individualAddressReadResponseConfirm(ack, hopType, status);
break;
case IndividualAddressSerialNumberRead:
_bau.individualAddressSerialNumberReadLocalConfirm(ack, hopType, data + 1, status);
break;
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadResponseConfirm(ack, hopType, data + 1, domainAddress, status);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 7);
_bau.individualAddressSerialNumberWriteLocalConfirm(ack, hopType, data + 1, newAddress, status);
break;
}
default:
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
}
}
void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
{
const uint8_t* data = apdu.data();
switch (apdu.type())
if (broadcastType == Broadcast)
{
// TODO: testInfo could be of any length
// APCI on Broadcast
switch (apdu.type())
{
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteLocalConfirm(ack, hopType, newAddress, status);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadLocalConfirm(ack, hopType, status);
break;
case IndividualAddressResponse:
_bau.individualAddressReadResponseConfirm(ack, hopType, status);
break;
case IndividualAddressSerialNumberRead:
_bau.individualAddressSerialNumberReadLocalConfirm(ack, hopType, data + 1, status);
break;
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadResponseConfirm(ack, hopType, data + 1, domainAddress, status);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 7);
_bau.individualAddressSerialNumberWriteLocalConfirm(ack, hopType, data + 1, newAddress, status);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
{
#endif
case SystemNetworkParameterRead:
{
uint16_t objectType;
@ -181,32 +239,36 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior
popByte(testInfo[1], data + 5);
propertyId = (propertyId >> 4) & 0x0FFF;;
testInfo[0] &= 0x0F;
_bau.systemNetworkParameterReadIndication(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo));
//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];
_bau.domainAddressSerialNumberWriteIndication(priority, hopType, domainAddress, knxSerialNumber);
//TODO: _bau.domainAddressSerialNumberWriteLocalConfirm(priority, hopType, domainAddress, knxSerialNumber, status);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
_bau.domainAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
//TODO: _bau.domainAddressSerialNumberReadLocalConfirm(priority, hopType, knxSerialNumber, status);
break;
}
default:
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
if (broadcastType == SysBroadcast)
{
print("System");
}
#endif
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
}
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
{
}
void ApplicationLayer::dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
{
individualIndication(hopType, priority, tsap, apdu);
@ -290,7 +352,7 @@ void ApplicationLayer::individualAddressWriteRequest(AckType ack, HopCountType h
apdu.type(IndividualAddressWrite);
uint8_t* apduData = apdu.data();
pushWord(newaddress, apduData + 1);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::individualAddressReadRequest(AckType ack, HopCountType hopType)
@ -298,7 +360,7 @@ void ApplicationLayer::individualAddressReadRequest(AckType ack, HopCountType ho
CemiFrame frame(1);
APDU& apdu = frame.apdu();
apdu.type(IndividualAddressRead);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::individualAddressReadResponse(AckType ack, HopCountType hopType)
@ -306,7 +368,7 @@ void ApplicationLayer::individualAddressReadResponse(AckType ack, HopCountType h
CemiFrame frame(1);
APDU& apdu = frame.apdu();
apdu.type(IndividualAddressResponse);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::individualAddressSerialNumberReadRequest(AckType ack, HopCountType hopType, uint8_t * serialNumber)
@ -316,7 +378,7 @@ void ApplicationLayer::individualAddressSerialNumberReadRequest(AckType ack, Hop
apdu.type(IndividualAddressSerialNumberRead);
uint8_t* data = apdu.data() + 1;
memcpy(data, serialNumber, 6);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::individualAddressSerialNumberReadResponse(AckType ack, HopCountType hopType,
@ -329,7 +391,7 @@ void ApplicationLayer::individualAddressSerialNumberReadResponse(AckType ack, Ho
memcpy(data, serialNumber, 6);
data += 6;
pushWord(domainAddress, data);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::individualAddressSerialNumberWriteRequest(AckType ack, HopCountType hopType, uint8_t * serialNumber,
@ -342,7 +404,7 @@ void ApplicationLayer::individualAddressSerialNumberWriteRequest(AckType ack, Ho
memcpy(data, serialNumber, 6);
data += 6;
pushWord(newaddress, data);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::deviceDescriptorReadRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
@ -423,7 +485,7 @@ void ApplicationLayer::systemNetworkParameterReadResponse(Priority priority, Hop
//apdu.printPDU();
_transportLayer->dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, SysBroadcast);
}
//TODO: ApplicationLayer::domainAddressSerialNumberWriteRequest()
@ -442,7 +504,7 @@ void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority,
//apdu.printPDU();
_transportLayer->dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, SysBroadcast);
}
//TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest()
@ -461,7 +523,7 @@ void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priori
//apdu.printPDU();
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::propertyValueReadRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
@ -919,4 +981,4 @@ void ApplicationLayer::individualSend(AckType ack, HopCountType hopType, Priorit
bool ApplicationLayer::isConnected()
{
return (_connectedTsap >= 0);
}
}

View File

@ -65,10 +65,8 @@ class ApplicationLayer
*/
void dataGroupConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap,
APDU& apdu, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status);
void dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
void dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType);
void dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
void dataIndividualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, bool status);
void connectIndication(uint16_t tsap);

View File

@ -41,11 +41,16 @@ void DataLinkLayer::dataRequest(AckType ack, AddressType addrType, uint16_t dest
sendTelegram(npdu, ack, destinationAddr, addrType, format, priority, Broadcast);
}
void DataLinkLayer::systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu)
void DataLinkLayer::broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType)
{
// 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
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, SysBroadcast);
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
(void)broadcastType; // not used on TP/IP, always normal broadcast
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, Broadcast);
#else
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, broadcastType);
#endif
}
void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
@ -60,7 +65,7 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
FrameFormat type = frame.frameType();
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
SystemBroadcast broadcastType = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// if the confirmation was caused by a tunnel request then
@ -73,10 +78,13 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
#endif
if (addrType == GroupAddress && destination == 0)
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
else
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
{
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
else
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
@ -93,7 +101,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
uint16_t ownAddr = _deviceObject.induvidualAddress();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
SystemBroadcast broadcastType = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// Do not send our own message back to the tunnel
@ -108,10 +116,11 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
if (addrType == GroupAddress && destination == 0)
{
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
else
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
}
else
{
@ -131,7 +140,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
}
}
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast)
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast broadcastType)
{
CemiFrame& frame = npdu.frame();
frame.messageCode(L_data_ind);
@ -140,7 +149,7 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
frame.addressType(addrType);
frame.priority(priority);
frame.repetition(RepititionAllowed);
frame.systemBroadcast(systemBroadcast);
frame.systemBroadcast(broadcastType);
if (npdu.octetCount() <= 15)
frame.frameType(StandardFrame);

View File

@ -24,7 +24,7 @@ class DataLinkLayer
// from network layer
void dataRequest(AckType ack, AddressType addrType, uint16_t destinationAddr, FrameFormat format,
Priority priority, NPDU& npdu);
void systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu);
void broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType);
virtual void loop() = 0;
virtual void enabled(bool value) = 0;
virtual bool enabled() const = 0;
@ -32,7 +32,7 @@ class DataLinkLayer
protected:
void frameRecieved(CemiFrame& frame);
void dataConReceived(CemiFrame& frame, bool success);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast broadcastType);
virtual bool sendFrame(CemiFrame& frame) = 0;
uint8_t* frameData(CemiFrame& frame);
DeviceObject& _deviceObject;

View File

@ -43,9 +43,10 @@ void NetworkLayer::dataIndication(AckType ack, AddressType addrType, uint16_t de
_transportLayer.dataGroupIndication(destination, hopType, priority, source, npdu.tpdu());
return;
}
// destination == 0
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu());
// assert: programming error
// should never be reached!
// destination == 0 && (addrType == InduvidualAddress || ddrType == GroupAddress)
}
void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
@ -62,32 +63,22 @@ void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t de
_transportLayer.dataGroupConfirm(ack, source, destination, hopType, priority, npdu.tpdu(), status);
return;
}
// destination == 0
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
// assert: programming error
// should never be reached!
// destination == 0 && (addrType == InduvidualAddress || ddrType == GroupAddress)
}
void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, SystemBroadcast broadcastType)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu());
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu(), broadcastType);
}
void NetworkLayer::broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
void NetworkLayer::broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, SystemBroadcast broadcastType)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
}
void NetworkLayer::systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
}
void NetworkLayer::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status, broadcastType);
}
void NetworkLayer::dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
@ -119,12 +110,7 @@ void NetworkLayer::dataGroupRequest(AckType ack, uint16_t destination, HopCountT
sendDataRequest(tpdu, hopType, ack, destination, priority, GroupAddress);
}
void NetworkLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
{
sendDataRequest(tpdu, hopType, ack, 0, priority, GroupAddress);
}
void NetworkLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
void NetworkLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, SystemBroadcast broadcastType)
{
NPDU& npdu = tpdu.frame().npdu();
@ -135,5 +121,5 @@ void NetworkLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType,
FrameFormat frameFormat = npdu.octetCount() > 15 ? ExtendedFrame : StandardFrame;
_dataLinkLayer->systemBroadcastRequest(ack, frameFormat, priority, npdu);
_dataLinkLayer->broadcastRequest(ack, frameFormat, priority, npdu, broadcastType);
}

View File

@ -21,17 +21,14 @@ class NetworkLayer
void dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority,
uint16_t source, NPDU& npdu, bool status);
void broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu,
Priority priority, uint16_t source);
void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status);
void systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu,
Priority priority, uint16_t source);
void systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status);
Priority priority, uint16_t source, SystemBroadcast broadcastType);
void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status,
SystemBroadcast broadcastType);
// from transport layer
void dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, SystemBroadcast broadcastType);
private:
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);

View File

@ -373,24 +373,14 @@ void TransportLayer::dataGroupConfirm(AckType ack, uint16_t source, uint16_t des
_applicationLayer.dataGroupConfirm(ack, hopType, priority, destination, tpdu.apdu(), status);
}
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu, SystemBroadcast broadcastType)
{
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu());
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu(), broadcastType);
}
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType)
{
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status);
}
void TransportLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
{
_applicationLayer.dataSystemBroadcastIndication(hopType, priority, source, tpdu.apdu());
}
void TransportLayer::dataSystemBroadcastConfirm(AckType ack, HopCountType hopType, TPDU& tpdu, Priority priority, bool status)
{
_applicationLayer.dataSystemBroadcastConfirm(hopType, priority, tpdu.apdu(), status);
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status, broadcastType);
}
void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
@ -400,16 +390,10 @@ void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priorit
_networkLayer->dataGroupRequest(ack, groupAdress, hopType, priority, tpdu);
}
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, SystemBroadcast broadcastType)
{
TPDU& tpdu = apdu.frame().tpdu();
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu);
}
void TransportLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
TPDU& tpdu = apdu.frame().tpdu();
return _networkLayer->dataSystemBroadcastRequest(ack, hopType, priority, tpdu);
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu, broadcastType);
}
void TransportLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)

View File

@ -24,10 +24,8 @@ public:
void dataIndividualConfirm(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataGroupIndication(uint16_t destination, HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataGroupConfirm(AckType ack, uint16_t source, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataSystemBroadcastConfirm(AckType ack, HopCountType hopType, TPDU& tpdu, Priority priority, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu, SystemBroadcast broadcastType);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType);
#pragma endregion
#pragma region from application layer
@ -48,8 +46,7 @@ public:
* @param ack Did we want a DataLinkLayer acknowledgement? See ::AckType.
*/
void dataGroupRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, SystemBroadcast broadcastType);
void dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu);
void connectRequest(uint16_t destination, Priority priority);