Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 26aed75
Author: Ing-Dom <[email protected]>
Date:   Tue Feb 13 09:07:56 2024 +0100

    only call isSentToTunnel when KNX_TUNNELING is defined

commit fad4d8a
Author: Mike <[email protected]>
Date:   Mon Feb 12 15:04:43 2024 +0100

    renamed isAckRequired isSentToTunnel

commit bb94e63
Author: Mike <[email protected]>
Date:   Mon Feb 12 12:32:47 2024 +0100

    added ack for tunneling
  • Loading branch information
thewhobox authored and Ing-Dom committed Feb 13, 2024
1 parent 6e61636 commit a37e294
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/knx/bau091A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ TPAckType Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
else
// all are ACKED
ack = TPAckType::AckReqAck;
#ifdef KNX_TUNNELING
if(_dlLayerPrimary.isSentToTunnel(address, isGrpAddr))
ack = TPAckType::AckReqAck;
#endif
}
else
{
Expand All @@ -197,18 +201,8 @@ TPAckType Bau091A::isAckRequired(uint16_t address, bool isGrpAddr)
ack = TPAckType::AckReqNone;

#ifdef KNX_TUNNELING
const uint8_t *addresses = _ipParameters.propertyData(PID_ADDITIONAL_INDIVIDUAL_ADDRESSES);
for(int i = 0; i < KNX_TUNNELING; i++)
{
uint16_t pa = 0;
popWord(pa, addresses + (i*2));

if(address == pa)
{
ack = TPAckType::AckReqAck;
break;
}
}
if(_dlLayerPrimary.isSentToTunnel(address, isGrpAddr))
ack = TPAckType::AckReqAck;
#endif

}
Expand Down
16 changes: 16 additions & 0 deletions src/knx/ip_data_link_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ bool IpDataLinkLayer::isTunnelAddress(uint16_t addr)

return false;
}

bool IpDataLinkLayer::isSentToTunnel(uint16_t address, bool isGrpAddr)
{
if(isGrpAddr)
{
for(int i = 0; i < KNX_TUNNELING; i++)
if(tunnels[i].ChannelId != 0)
return true;
return false;
} else {
for(int i = 0; i < KNX_TUNNELING; i++)
if(tunnels[i].ChannelId != 0 && tunnels[i].IndividualAddress == address)
return true;
return false;
}
}
#endif

void IpDataLinkLayer::loop()
Expand Down
1 change: 1 addition & 0 deletions src/knx/ip_data_link_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class IpDataLinkLayer : public DataLinkLayer
void dataConfirmationToTunnel(CemiFrame& frame) override;
void dataIndicationToTunnel(CemiFrame& frame) override;
bool isTunnelAddress(uint16_t addr) override;
bool isSentToTunnel(uint16_t address, bool isGrpAddr);
#endif

private:
Expand Down

0 comments on commit a37e294

Please sign in to comment.