Skip to content

Commit c6f96f0

Browse files
committed
refactored KNX Tunneling, created new class IpTunnelServer
1 parent 83afcad commit c6f96f0

6 files changed

Lines changed: 912 additions & 811 deletions

File tree

src/knx/bau091A.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ Bau091A::Bau091A(Platform& platform)
1717
: BauSystemBCoupler(platform),
1818
_routerObj(memory(), 0x200, 0x2000), // the Filtertable of 0x091A IP Routers is fixed at 0x200 and 0x2000 long
1919
_ipParameters(_deviceObj, platform),
20-
_dlLayerPrimary(_deviceObj, _ipParameters, _netLayer.getPrimaryInterface(), _platform, *this, (DataLinkLayerCallbacks*) this),
20+
_dlLayerPrimary(_deviceObj, _ipParameters, _netLayer.getPrimaryInterface(), _platform, *this,
21+
#ifdef KNX_TUNNELING
22+
_ipTunnelServer,
23+
#endif
24+
(DataLinkLayerCallbacks*) this),
2125
_dlLayerSecondary(_deviceObj, _netLayer.getSecondaryInterface(), platform, *this, (ITpUartCallBacks&) *this, (DataLinkLayerCallbacks*) this),
2226
DataLinkLayerCallbacks()
2327
#ifdef USE_CEMI_SERVER
2428
,
2529
_cemiServer(*this)
2630
#endif
31+
#ifdef KNX_TUNNELING
32+
,
33+
_ipTunnelServer(_deviceObj, _ipParameters, platform, _cemiServer)
34+
#endif
2735
{
2836
// Before accessing anything of the router object they have to be initialized according to the used medium
2937
// Coupler model 1.x
@@ -159,6 +167,7 @@ void Bau091A::loop()
159167
_dlLayerPrimary.loop();
160168
_dlLayerSecondary.loop();
161169
BauSystemBCoupler::loop();
170+
_ipTunnelServer.loop();
162171
}
163172

164173
TPAckType Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
@@ -195,7 +204,7 @@ TPAckType Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
195204
}
196205
}
197206
#ifdef KNX_TUNNELING
198-
if(_dlLayerPrimary.isSentToTunnel(address, isGrpAddr))
207+
if(_ipTunnelServer.isSentToTunnel(address, isGrpAddr))
199208
ack = TPAckType::AckReqAck;
200209
#endif
201210
}
@@ -212,7 +221,7 @@ TPAckType Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
212221
ack = TPAckType::AckReqNone;
213222

214223
#ifdef KNX_TUNNELING
215-
if(_dlLayerPrimary.isSentToTunnel(address, isGrpAddr))
224+
if(_ipTunnelServer.isSentToTunnel(address, isGrpAddr))
216225
ack = TPAckType::AckReqAck;
217226
#endif
218227

src/knx/bau091A.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "ip_data_link_layer.h"
1010
#include "tpuart_data_link_layer.h"
1111
#include "cemi_server_object.h"
12+
#include "ip_tunnel_server.h"
1213

1314
class Bau091A : public BauSystemBCoupler, public ITpUartCallBacks, public DataLinkLayerCallbacks
1415
{
@@ -38,5 +39,8 @@ class Bau091A : public BauSystemBCoupler, public ITpUartCallBacks, public DataLi
3839
CemiServer _cemiServer;
3940
CemiServerObject _cemiServerObject;
4041
#endif
42+
#ifdef KNX_TUNNELING
43+
IpTunnelServer _ipTunnelServer;
44+
#endif
4145
};
4246
#endif

0 commit comments

Comments
 (0)