From 5099eb2872ba1e890ce451682bccc82bf77599ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Tu=C4=8Dek?= Date: Fri, 25 Oct 2024 23:36:59 +0200 Subject: [PATCH] Fix config host connection parsing on uhk 60 --- .../src/config_parser/parse_host_connection.c | 10 +++++----- right/src/host_connection.h | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/right/src/config_parser/parse_host_connection.c b/right/src/config_parser/parse_host_connection.c index 59700190..c033080e 100644 --- a/right/src/config_parser/parse_host_connection.c +++ b/right/src/config_parser/parse_host_connection.c @@ -8,7 +8,6 @@ #include "host_connection.h" #include "parse_config.h" -#ifdef __ZEPHYR__ static parser_error_t parseHostConnection(config_buffer_t* buffer, host_connection_t* hostConnection) { hostConnection->type = ReadUInt8(buffer); @@ -38,22 +37,23 @@ static parser_error_t parseHostConnection(config_buffer_t* buffer, host_connecti return ParserError_Success; } -#endif parser_error_t ParseHostConnections(config_buffer_t *buffer) { -#ifdef __ZEPHYR__ int errorCode; for (uint8_t hostConnectionId = 0; hostConnectionId < HOST_CONNECTION_COUNT_MAX; hostConnectionId++) { host_connection_t dummy; - host_connection_t* hostConnection = ParserRunDry ? &dummy : &HostConnections[hostConnectionId]; + host_connection_t* hostConnection = &dummy; + +#ifdef __ZEPHYR__ + hostConnection = ParserRunDry ? &dummy : &HostConnections[hostConnectionId]; +#endif RETURN_ON_ERROR( parseHostConnection(buffer, hostConnection); ); } -#endif return ParserError_Success; } diff --git a/right/src/host_connection.h b/right/src/host_connection.h index 5e9f62f6..04bae7ff 100644 --- a/right/src/host_connection.h +++ b/right/src/host_connection.h @@ -3,16 +3,29 @@ // Includes: -#ifdef __ZEPHYR__ - #include #include #include "str_utils.h" +#ifdef __ZEPHYR__ + #include #include #include +#else + typedef struct { + uint8_t val[6]; + } bt_addr_t; + + struct bt_addr_le { + uint8_t type; + bt_addr_t a; + }; + + typedef struct bt_addr_le bt_addr_le_t; +#endif + // Macros: #define HOST_CONNECTION_COUNT_MAX 22 @@ -46,5 +59,3 @@ bool HostConnections_IsKnownBleAddress(const bt_addr_le_t *address); #endif - -#endif