Restore old structure

This commit is contained in:
Nanosonde 2020-06-09 11:49:46 +02:00
parent ad4b719398
commit 8a2121aac9
8 changed files with 211 additions and 207 deletions

View File

@ -77,157 +77,139 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
}
}
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType)
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
{
uint8_t* data = apdu.data();
if (broadcastType == Broadcast)
switch (apdu.type())
{
// APCI on Broadcast
switch (apdu.type())
case IndividualAddressWrite:
{
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;
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteIndication(hopType, newAddress);
break;
}
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
case IndividualAddressRead:
_bau.individualAddressReadIndication(hopType);
break;
case IndividualAddressResponse:
_bau.individualAddressReadAppLayerConfirm(hopType, apdu.frame().sourceAddress());
break;
case IndividualAddressSerialNumberRead:
{
#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;
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;
}
default:
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
}
}
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType)
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status)
{
uint8_t* data = apdu.data();
if (broadcastType == Broadcast)
switch (apdu.type())
{
// APCI on Broadcast
switch (apdu.type())
case IndividualAddressWrite:
{
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;
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteLocalConfirm(ack, hopType, newAddress, status);
break;
}
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
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:
{
#endif
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())
{
// 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;
}
default:
print("SystemBroadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
{
const uint8_t* data = apdu.data();
switch (apdu.type())
{
// TODO: testInfo could be of any length
case SystemNetworkParameterRead:
{
uint16_t objectType;
@ -246,27 +228,20 @@ void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, P
{
const uint8_t* knxSerialNumber = &data[1];
const uint8_t* domainAddress = &data[7];
_bau.domainAddressSerialNumberWriteLocalConfirm(priority, hopType, domainAddress, knxSerialNumber, status);
_bau.domainAddressSerialNumberWriteIndication(priority, hopType, domainAddress, knxSerialNumber);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
_bau.domainAddressSerialNumberReadLocalConfirm(priority, hopType, knxSerialNumber, status);
_bau.domainAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
default:
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
if (broadcastType == SysBroadcast)
{
print("System");
}
#endif
print("Broadcast-confirm: unhandled APDU-Type: ");
print("SystemBroadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
}
void ApplicationLayer::dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
@ -352,7 +327,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, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::individualAddressReadRequest(AckType ack, HopCountType hopType)
@ -360,7 +335,7 @@ void ApplicationLayer::individualAddressReadRequest(AckType ack, HopCountType ho
CemiFrame frame(1);
APDU& apdu = frame.apdu();
apdu.type(IndividualAddressRead);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::individualAddressReadResponse(AckType ack, HopCountType hopType)
@ -368,7 +343,7 @@ void ApplicationLayer::individualAddressReadResponse(AckType ack, HopCountType h
CemiFrame frame(1);
APDU& apdu = frame.apdu();
apdu.type(IndividualAddressResponse);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::individualAddressSerialNumberReadRequest(AckType ack, HopCountType hopType, uint8_t * serialNumber)
@ -378,7 +353,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, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::individualAddressSerialNumberReadResponse(AckType ack, HopCountType hopType,
@ -391,7 +366,7 @@ void ApplicationLayer::individualAddressSerialNumberReadResponse(AckType ack, Ho
memcpy(data, serialNumber, 6);
data += 6;
pushWord(domainAddress, data);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::individualAddressSerialNumberWriteRequest(AckType ack, HopCountType hopType, uint8_t * serialNumber,
@ -404,7 +379,7 @@ void ApplicationLayer::individualAddressSerialNumberWriteRequest(AckType ack, Ho
memcpy(data, serialNumber, 6);
data += 6;
pushWord(newaddress, data);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void ApplicationLayer::deviceDescriptorReadRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
@ -485,7 +460,7 @@ void ApplicationLayer::systemNetworkParameterReadResponse(Priority priority, Hop
//apdu.printPDU();
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, SysBroadcast);
_transportLayer->dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
}
//TODO: ApplicationLayer::domainAddressSerialNumberWriteRequest()
@ -504,7 +479,7 @@ void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority,
//apdu.printPDU();
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, SysBroadcast);
_transportLayer->dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
}
//TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest()
@ -523,7 +498,7 @@ void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priori
//apdu.printPDU();
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu, Broadcast);
_transportLayer->dataBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
}
void ApplicationLayer::propertyValueReadRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,

View File

@ -65,8 +65,10 @@ 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, SystemBroadcast broadcastType);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType);
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 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,15 +41,11 @@ void DataLinkLayer::dataRequest(AckType ack, AddressType addrType, uint16_t dest
sendTelegram(npdu, ack, destinationAddr, addrType, format, priority, Broadcast);
}
void DataLinkLayer::broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType)
void DataLinkLayer::systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu)
{
// 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
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, Broadcast);
#else
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, broadcastType);
#endif
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, SysBroadcast);
}
void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
@ -64,7 +60,7 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
FrameFormat type = frame.frameType();
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
SystemBroadcast broadcastType = frame.systemBroadcast();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// if the confirmation was caused by a tunnel request then
@ -77,13 +73,10 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
#endif
if (addrType == GroupAddress && destination == 0)
{
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
else
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
else
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
@ -100,7 +93,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
uint16_t ownAddr = _deviceObject.induvidualAddress();
SystemBroadcast broadcastType = frame.systemBroadcast();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// Do not send our own message back to the tunnel
@ -115,11 +108,10 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
if (addrType == GroupAddress && destination == 0)
{
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
else
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
}
else
{
@ -139,7 +131,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
}
}
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast broadcastType)
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast)
{
CemiFrame& frame = npdu.frame();
frame.messageCode(L_data_ind);
@ -148,7 +140,7 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
frame.addressType(addrType);
frame.priority(priority);
frame.repetition(RepititionAllowed);
frame.systemBroadcast(broadcastType);
frame.systemBroadcast(systemBroadcast);
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 broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType);
void systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu);
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 broadcastType);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast);
virtual bool sendFrame(CemiFrame& frame) = 0;
uint8_t* frameData(CemiFrame& frame);
DeviceObject& _deviceObject;

View File

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

View File

@ -21,14 +21,17 @@ 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, SystemBroadcast broadcastType);
void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status,
SystemBroadcast broadcastType);
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);
// 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, SystemBroadcast broadcastType);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
private:
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);

View File

@ -373,14 +373,24 @@ 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, SystemBroadcast broadcastType)
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
{
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu(), broadcastType);
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu());
}
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType)
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
{
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status, 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);
}
void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
@ -390,10 +400,16 @@ 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, SystemBroadcast broadcastType)
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
TPDU& tpdu = apdu.frame().tpdu();
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu, broadcastType);
_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);
}
void TransportLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)

View File

@ -24,8 +24,10 @@ 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, SystemBroadcast broadcastType);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType);
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);
#pragma endregion
#pragma region from application layer
@ -46,7 +48,8 @@ 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, SystemBroadcast broadcastType);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu);
void connectRequest(uint16_t destination, Priority priority);