handle SBC on closed media

This commit is contained in:
Nanosonde 2020-07-16 21:02:25 +02:00
parent 79354f2394
commit f46778c176
2 changed files with 9 additions and 20 deletions

View File

@ -142,14 +142,8 @@ void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority pr
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
// Make sure we also check if it is a service normally available only on SystemBroadcast on open media
dataSystemBroadcastIndication(hopType, priority, source, apdu, secCtrl);
#else
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
#endif
break;
}
}
@ -195,14 +189,8 @@ void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, P
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
// Make sure we also check if it is a service normally available only on SystemBroadcast on open media
dataSystemBroadcastConfirm(hopType, priority, apdu, secCtrl, status);
#else
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
#endif
break;
}
}
@ -246,11 +234,7 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
print("Broadcast-indication: unhandled APDU-Type: ");
#else
print("SystemBroadcast-indication: unhandled APDU-Type: ");
#endif
println(apdu.type());
break;
}
@ -294,11 +278,7 @@ void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
print("Broadcast-confirm: unhandled APDU-Type: ");
#else
print("SystemBroadcast-confirm: unhandled APDU-Type: ");
#endif
println(apdu.type());
break;
}

View File

@ -107,6 +107,15 @@ void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t de
void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
// for closed media like TP1 and IP
if (isApciSystemBroadcast(npdu.tpdu().apdu()))
{
npdu.frame().systemBroadcast(SysBroadcast);
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
return;
}
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu());
}