save work

This commit is contained in:
Nanosonde 2020-07-16 18:58:24 +02:00
parent 3595e53aab
commit 68b38feaea
2 changed files with 22 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include "tpdu.h"
#include "cemi_frame.h"
#include "bits.h"
#include "apdu.h"
NetworkLayer::NetworkLayer(DeviceObject &deviceObj, TransportLayer& layer) :
_deviceObj(deviceObj),
@ -28,6 +29,25 @@ uint8_t NetworkLayer::hopCount() const
return _hopCount;
}
bool NetworkLayer::isApciSystemBroadcast(APDU& apdu)
{
switch (apdu.type())
{
// Application Layer Services on System Broadcast communication mode
case SystemNetworkParameterRead:
case SystemNetworkParameterResponse:
case SystemNetworkParameterWrite:
// Open media specific Application Layer Services on System Broadcast communication mode
case DomainAddressSerialNumberRead:
case DomainAddressSerialNumberResponse:
case DomainAddressSerialNumberWrite:
return true;
default:
return false;
}
return false;
}
void NetworkLayer::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;

View File

@ -7,6 +7,7 @@
#include "network_layer_entity.h"
class DeviceObject;
class APDU;
class NetworkLayer
{
@ -18,6 +19,7 @@ class NetworkLayer
virtual NetworkLayerEntity& getEntity(uint8_t interfaceIndex) = 0;
uint8_t hopCount() const;
bool isApciSystemBroadcast(APDU& apdu);
// from transport layer
virtual void dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu) = 0;