Add network layer primitives for broadcastIndication() and broadcastConfirm()

This commit is contained in:
nanosonde 2019-10-28 12:39:15 +01:00
parent 6e654d4bf5
commit 9f2981abcb
3 changed files with 22 additions and 3 deletions

View File

@ -36,9 +36,13 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
FrameFormat type = frame.frameType(); FrameFormat type = frame.frameType();
Priority priority = frame.priority(); Priority priority = frame.priority();
NPDU& npdu = frame.npdu(); NPDU& npdu = frame.npdu();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
if (addrType == GroupAddress && destination == 0) if (addrType == GroupAddress && destination == 0)
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success); if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
else
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
else else
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success); _networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
@ -64,7 +68,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
if (systemBroadcast == SysBroadcast) if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source); _networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
else else
_networkLayer.dataIndication(ack, addrType, destination, type, npdu, priority, source); _networkLayer.broadcastIndication(ack, type, npdu, priority, source);
} }
else else
{ {

View File

@ -66,6 +66,18 @@ void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t de
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status); _transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
} }
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());
}
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);
}
void NetworkLayer::systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source) void NetworkLayer::systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
{ {
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter; HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
@ -75,7 +87,7 @@ void NetworkLayer::systemBroadcastIndication(AckType ack, FrameFormat format, NP
void NetworkLayer::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status) void NetworkLayer::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
{ {
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter; HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status); _transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
} }
void NetworkLayer::dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu) void NetworkLayer::dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)

View File

@ -20,6 +20,9 @@ class NetworkLayer
Priority priority, uint16_t source); Priority priority, uint16_t source);
void dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority, void dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority,
uint16_t source, NPDU& npdu, bool status); 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, void systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu,
Priority priority, uint16_t source); Priority priority, uint16_t source);
void systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status); void systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status);