#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 #include #include #include #include #include #if defined(ENABLE_BAU091A_PERSONA) #include "knx/bau091A.h" #endif namespace gateway::openknx { class OamRouterRuntime { public: using CemiFrameSender = std::function; 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); bool handleTunnelFrame(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; std::string nvs_namespace_; CemiFrameSender sender_; #if defined(ENABLE_BAU091A_PERSONA) EspIdfPlatform platform_; Bau091A device_; #endif }; } // namespace gateway::openknx