Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Fix config host connection parsing on uhk 60
Browse files Browse the repository at this point in the history
  • Loading branch information
kareltucek committed Oct 25, 2024
1 parent 44eb906 commit 5099eb2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 5 additions & 5 deletions right/src/config_parser/parse_host_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
19 changes: 15 additions & 4 deletions right/src/host_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@

// Includes:

#ifdef __ZEPHYR__

#include <stdint.h>
#include <stdbool.h>
#include "str_utils.h"

#ifdef __ZEPHYR__

#include <zephyr/kernel.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/addr.h>

#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
Expand Down Expand Up @@ -46,5 +59,3 @@
bool HostConnections_IsKnownBleAddress(const bt_addr_le_t *address);

#endif

#endif

0 comments on commit 5099eb2

Please sign in to comment.