8211514fe3
- 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>
70 lines
2.0 KiB
C++
70 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "esp_idf_platform.h"
|
|
#include "ets_memory_loader.h"
|
|
|
|
#include "esp_netif.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "knx/cemi_frame.h"
|
|
#include "knx/device_object.h"
|
|
#include "knx/platform.h"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#if defined(ENABLE_BAU091A_PERSONA)
|
|
#include "knx/bau091A.h"
|
|
#endif
|
|
|
|
namespace gateway::openknx {
|
|
|
|
class OamRouterRuntime {
|
|
public:
|
|
using CemiFrameSender = std::function<void(const uint8_t* data, size_t len)>;
|
|
|
|
OamRouterRuntime(std::string nvs_namespace,
|
|
uint16_t fallback_individual_address,
|
|
uint16_t tunnel_client_address = 0);
|
|
~OamRouterRuntime();
|
|
|
|
bool available() const;
|
|
uint16_t individualAddress() const;
|
|
uint16_t tunnelClientAddress() const;
|
|
bool configured() const;
|
|
bool programmingMode() const;
|
|
void setProgrammingMode(bool enabled);
|
|
void toggleProgrammingMode();
|
|
EtsMemorySnapshot snapshot() const;
|
|
|
|
DeviceObject* deviceObject();
|
|
Platform* platform();
|
|
void setNetworkInterface(esp_netif_t* netif);
|
|
void setBusFrameSender(CemiFrameSender sender);
|
|
bool handleTunnelFrame(const uint8_t* data, size_t len, CemiFrameSender sender);
|
|
bool handleLocalBroadcastManagementFrame(const uint8_t* data, size_t len,
|
|
CemiFrameSender sender);
|
|
bool handleBusFrame(const uint8_t* data, size_t len, CemiFrameSender sender);
|
|
void loop();
|
|
|
|
private:
|
|
static bool HandleOutboundCemiFrame(CemiFrame& frame, void* context);
|
|
static void EmitTunnelFrame(CemiFrame& frame, void* context);
|
|
static uint16_t DefaultTunnelClientAddress(uint16_t individual_address);
|
|
bool shouldConsumeTunnelFrame(CemiFrame& frame) const;
|
|
bool shouldConsumeBusFrame(CemiFrame& frame) const;
|
|
|
|
std::string nvs_namespace_;
|
|
CemiFrameSender sender_;
|
|
CemiFrameSender bus_frame_sender_;
|
|
#if defined(ENABLE_BAU091A_PERSONA)
|
|
EspIdfPlatform platform_;
|
|
Bau091A device_;
|
|
#endif
|
|
};
|
|
|
|
} // namespace gateway::openknx
|