fix: enhance KNX OAM router functionality and security features
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -23,6 +23,7 @@ class EtsDeviceRuntime {
|
||||
public:
|
||||
using CemiFrameSender = std::function<void(const uint8_t* data, size_t len)>;
|
||||
using CemiFrameReceiver = std::function<bool(const uint8_t* data, size_t len)>;
|
||||
using TpAckHandler = std::function<TPAckType(uint16_t destination, bool is_group_address)>;
|
||||
using GroupWriteHandler = std::function<void(uint16_t group_address, const uint8_t* data,
|
||||
size_t len)>;
|
||||
using GroupObjectWriteHandler = std::function<void(uint16_t group_object_number,
|
||||
@@ -64,6 +65,7 @@ class EtsDeviceRuntime {
|
||||
void setGroupObjectWriteHandler(GroupObjectWriteHandler handler);
|
||||
void setBusFrameSender(CemiFrameSender sender);
|
||||
void setTpFrameReceiver(CemiFrameReceiver receiver);
|
||||
void setTpAckHandler(TpAckHandler handler);
|
||||
void setNetworkInterface(esp_netif_t* netif);
|
||||
bool hasTpUart() const;
|
||||
bool enableTpUart(bool enabled = true);
|
||||
@@ -124,6 +126,7 @@ class EtsDeviceRuntime {
|
||||
CemiFrameSender sender_;
|
||||
CemiFrameSender bus_frame_sender_;
|
||||
CemiFrameReceiver tp_frame_receiver_;
|
||||
TpAckHandler tp_ack_handler_;
|
||||
GroupWriteHandler group_write_handler_;
|
||||
GroupObjectWriteHandler group_object_write_handler_;
|
||||
FunctionPropertyHandler command_handler_;
|
||||
|
||||
@@ -33,6 +33,7 @@ class TpuartUartInterface;
|
||||
|
||||
constexpr uint16_t kGatewayKnxDefaultUdpPort = 3671;
|
||||
constexpr const char* kGatewayKnxDefaultMulticastAddress = "224.0.23.12";
|
||||
constexpr const char* kGatewayKnxOamOpenKnxNamespace = "openknx_oam";
|
||||
constexpr uint32_t kGatewayKnxDefaultTpBaudrate = 19200;
|
||||
constexpr uint32_t kGatewayKnxDefaultTpStartupTimeoutMs = 2000;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ inline constexpr uint32_t kOamRouterSerialMacIncrement = kDaliMaxKnxInstanceCoun
|
||||
inline constexpr uint16_t kOamRouterDeviceDescriptor = 0x091A;
|
||||
inline constexpr uint16_t kOamRouterManufacturerId =
|
||||
static_cast<uint16_t>(CONFIG_GATEWAY_KNX_OAM_ROUTER_OEM_MANUFACTURER_ID);
|
||||
inline constexpr uint16_t kOamRouterHardwareId =
|
||||
inline constexpr uint16_t kOamRouterLegacyHardwareId =
|
||||
static_cast<uint16_t>(CONFIG_GATEWAY_KNX_OAM_ROUTER_HARDWARE_ID);
|
||||
inline constexpr uint16_t kOamRouterApplicationNumber =
|
||||
static_cast<uint16_t>(CONFIG_GATEWAY_KNX_OAM_ROUTER_APPLICATION_NUMBER);
|
||||
@@ -87,8 +87,15 @@ inline constexpr uint8_t kOamRouterApplicationVersion =
|
||||
inline constexpr uint8_t kOamRouterHardwareType[6] = {
|
||||
0x00,
|
||||
0x00,
|
||||
static_cast<uint8_t>((kOamRouterHardwareId >> 8) & 0xff),
|
||||
static_cast<uint8_t>(kOamRouterHardwareId & 0xff),
|
||||
static_cast<uint8_t>((kOamRouterApplicationNumber >> 8) & 0xff),
|
||||
static_cast<uint8_t>(kOamRouterApplicationNumber & 0xff),
|
||||
kOamRouterApplicationVersion,
|
||||
0x00};
|
||||
inline constexpr uint8_t kOamRouterLegacyHardwareType[6] = {
|
||||
0x00,
|
||||
0x00,
|
||||
static_cast<uint8_t>((kOamRouterLegacyHardwareId >> 8) & 0xff),
|
||||
static_cast<uint8_t>(kOamRouterLegacyHardwareId & 0xff),
|
||||
kOamRouterApplicationVersion,
|
||||
0x00};
|
||||
inline constexpr uint8_t kOamRouterOrderNumber[10] = {
|
||||
|
||||
@@ -38,6 +38,8 @@ class OamRouterRuntime {
|
||||
bool programmingMode() const;
|
||||
void setProgrammingMode(bool enabled);
|
||||
void toggleProgrammingMode();
|
||||
bool matchesSecureSyncSerial(CemiFrame& frame) const;
|
||||
bool matchesRecentSecureToolAccess(CemiFrame& frame) const;
|
||||
EtsMemorySnapshot snapshot() const;
|
||||
|
||||
DeviceObject* deviceObject();
|
||||
@@ -60,6 +62,8 @@ class OamRouterRuntime {
|
||||
std::string nvs_namespace_;
|
||||
CemiFrameSender sender_;
|
||||
CemiFrameSender bus_frame_sender_;
|
||||
mutable uint16_t recent_secure_tool_source_{0xffff};
|
||||
mutable int64_t recent_secure_tool_sync_us_{0};
|
||||
#if defined(ENABLE_BAU091A_PERSONA)
|
||||
EspIdfPlatform platform_;
|
||||
Bau091A device_;
|
||||
|
||||
Reference in New Issue
Block a user