Skip to content

Commit

Permalink
Fix broker discovery query
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankZRS committed Mar 4, 2024
1 parent 940b358 commit 6862a22
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions api/oc_knx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,21 @@ int
oc_knx_client_do_broker_request(const char *resource_url, uint64_t iid,
uint32_t ia, char *destination, char *rp)
{
char query[20];
char query[50] = "";

snprintf(query, 20, "ep=knx://ia.%llu.%lu", iid, ia);
char prefix[20];
snprintf(prefix, 13, "ep=knx://ia.");
strcat(query, prefix);

char iid_hex[20];
oc_conv_uint64_to_hex_string(iid_hex, iid);
strcat(query, iid_hex);

char ia_str[11];
snprintf(ia_str, 11, ".%x", ia);
strcat(query, ia_str);

PRINT("oc_knx_client_do_broker_request: query=%s\n", query);

// not sure if we should use a malloc here, what would happen if there are no
// devices found? because that causes a memory leak
Expand Down

0 comments on commit 6862a22

Please sign in to comment.