Files
gateway/components/gateway_knx/src/knx_device_broker.cpp
T
Tony 8211514fe3 feat: Enhance OAM router functionality and improve KNX device handling
- Added support for OAM router configuration in app_main, allowing the IP interface individual address to be set based on the OAM router's individual address.
- Updated GatewayBridgeService to validate IP interface addresses only when OAM router is disabled, ensuring proper address management.
- Introduced KnxResponseDeduplicator to prevent duplicate responses in KNX communication.
- Enhanced ETS device runtime to handle bus frames and set up frame receivers for OAM router.
- Improved GatewayKnxTpIpRouter to manage OAM router interactions, including handling tunnel frames and bus frames.
- Updated CMakeLists to include new knx_device_broker source file.
- Refined logging messages to provide clearer context regarding the IP interface being used.
- Added methods to retrieve IP interface names and friendly names based on the OAM router configuration.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-05-28 15:44:17 +08:00

33 lines
888 B
C++

#include "knx_device_broker.h"
#include <algorithm>
namespace gateway {
KnxResponseDeduplicator::KnxResponseDeduplicator(const uint8_t* original, size_t len) {
if (original != nullptr && len > 0) {
original_.assign(original, original + len);
}
}
bool KnxResponseDeduplicator::remember(const uint8_t* data, size_t len) {
if (data == nullptr || len == 0) {
++suppressed_count_;
return false;
}
return remember(std::vector<uint8_t>(data, data + len));
}
bool KnxResponseDeduplicator::remember(const std::vector<uint8_t>& data) {
if (data.empty() || (!original_.empty() && data == original_) ||
std::find(sent_.begin(), sent_.end(), data) != sent_.end()) {
++suppressed_count_;
return false;
}
sent_.push_back(data);
return true;
}
size_t KnxResponseDeduplicator::suppressedCount() const { return suppressed_count_; }
} // namespace gateway