mirror of
https://github.com/thelsing/knx.git
synced 2025-08-26 13:51:28 +02:00
save work
This commit is contained in:
parent
f46778c176
commit
fb87828881
@ -29,6 +29,7 @@ class DataLinkLayer
|
|||||||
virtual void loop() = 0;
|
virtual void loop() = 0;
|
||||||
virtual void enabled(bool value) = 0;
|
virtual void enabled(bool value) = 0;
|
||||||
virtual bool enabled() const = 0;
|
virtual bool enabled() const = 0;
|
||||||
|
virtual bool isOpenMedium() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void frameRecieved(CemiFrame& frame);
|
void frameRecieved(CemiFrame& frame);
|
||||||
|
@ -99,6 +99,10 @@ bool IpDataLinkLayer::enabled() const
|
|||||||
return _enabled;
|
return _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IpDataLinkLayer::isOpenMedium() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool IpDataLinkLayer::sendBytes(uint8_t* bytes, uint16_t length)
|
bool IpDataLinkLayer::sendBytes(uint8_t* bytes, uint16_t length)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ class IpDataLinkLayer : public DataLinkLayer
|
|||||||
void loop();
|
void loop();
|
||||||
void enabled(bool value);
|
void enabled(bool value);
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
|
virtual bool isOpenMedium() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "network_layer.h"
|
#include "network_layer.h"
|
||||||
#include "device_object.h"
|
#include "device_object.h"
|
||||||
|
#include "data_link_layer.h"
|
||||||
#include "tpdu.h"
|
#include "tpdu.h"
|
||||||
#include "cemi_frame.h"
|
#include "cemi_frame.h"
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
@ -108,8 +109,10 @@ void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& np
|
|||||||
{
|
{
|
||||||
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
|
||||||
|
|
||||||
|
DataLinkLayer& dlLayer = getEntity(npdu.frame().sourceInterface()).dataLinkLayer();
|
||||||
|
|
||||||
// for closed media like TP1 and IP
|
// for closed media like TP1 and IP
|
||||||
if (isApciSystemBroadcast(npdu.tpdu().apdu()))
|
if (!dlLayer.isOpenMedium() && isApciSystemBroadcast(npdu.tpdu().apdu()))
|
||||||
{
|
{
|
||||||
npdu.frame().systemBroadcast(SysBroadcast);
|
npdu.frame().systemBroadcast(SysBroadcast);
|
||||||
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
|
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
|
||||||
|
@ -14,6 +14,11 @@ void NetworkLayerEntity::dataLinkLayer(DataLinkLayer& layer)
|
|||||||
_dataLinkLayer = &layer;
|
_dataLinkLayer = &layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataLinkLayer& NetworkLayerEntity::dataLinkLayer()
|
||||||
|
{
|
||||||
|
return *_dataLinkLayer;
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkLayerEntity::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
|
void NetworkLayerEntity::dataIndication(AckType ack, AddressType addrType, uint16_t destination, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
|
||||||
{
|
{
|
||||||
npdu.frame().sourceInterface(_entityIndex);
|
npdu.frame().sourceInterface(_entityIndex);
|
||||||
|
@ -16,6 +16,7 @@ class NetworkLayerEntity
|
|||||||
NetworkLayerEntity(NetworkLayer &netLayer, uint8_t entityIndex);
|
NetworkLayerEntity(NetworkLayer &netLayer, uint8_t entityIndex);
|
||||||
|
|
||||||
void dataLinkLayer(DataLinkLayer& layer);
|
void dataLinkLayer(DataLinkLayer& layer);
|
||||||
|
DataLinkLayer& dataLinkLayer();
|
||||||
|
|
||||||
// from data link layer
|
// from data link layer
|
||||||
void dataIndication(AckType ack, AddressType addType, uint16_t destination, FrameFormat format, NPDU& npdu,
|
void dataIndication(AckType ack, AddressType addType, uint16_t destination, FrameFormat format, NPDU& npdu,
|
||||||
|
@ -269,6 +269,11 @@ bool RfDataLinkLayer::enabled() const
|
|||||||
return _enabled;
|
return _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RfDataLinkLayer::isOpenMedium() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void RfDataLinkLayer::fillRfFrame(CemiFrame& frame, uint8_t* data)
|
void RfDataLinkLayer::fillRfFrame(CemiFrame& frame, uint8_t* data)
|
||||||
{
|
{
|
||||||
uint16_t crc;
|
uint16_t crc;
|
||||||
|
@ -25,6 +25,7 @@ class RfDataLinkLayer : public DataLinkLayer
|
|||||||
void loop();
|
void loop();
|
||||||
void enabled(bool value);
|
void enabled(bool value);
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
|
virtual bool isOpenMedium() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
|
@ -505,6 +505,11 @@ bool TpUartDataLinkLayer::enabled() const
|
|||||||
return _enabled;
|
return _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TpUartDataLinkLayer::isOpenMedium() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool TpUartDataLinkLayer::sendSingleFrameByte()
|
bool TpUartDataLinkLayer::sendSingleFrameByte()
|
||||||
{
|
{
|
||||||
uint8_t cmd[2];
|
uint8_t cmd[2];
|
||||||
|
@ -24,6 +24,7 @@ class TpUartDataLinkLayer : public DataLinkLayer
|
|||||||
void loop();
|
void loop();
|
||||||
void enabled(bool value);
|
void enabled(bool value);
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
|
virtual bool isOpenMedium() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user