From 7fc0aea0eca4be9aef2697f6def9ba6542c599ca Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 26 Aug 2024 10:34:31 +0200 Subject: [PATCH] hci_event_builder: add functions for 8 and 16 byte arrays --- src/hci_event_builder.c | 12 ++++++++++++ src/hci_event_builder.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/hci_event_builder.c b/src/hci_event_builder.c index f5a504a4f..0a1ee1310 100644 --- a/src/hci_event_builder.c +++ b/src/hci_event_builder.c @@ -97,6 +97,18 @@ void hci_event_builder_add_32(hci_event_builder_context_t * context, uint32_t va little_endian_store_32(context->buffer, pos, value); } +void hci_event_builder_add_64(hci_event_builder_context_t * context, const uint8_t * value){ + uint16_t pos = context->pos; + hci_event_builder_increment_pos(context, 8); + reverse_64(value, &context->buffer[pos]); +} + +void hci_event_builder_add_128(hci_event_builder_context_t * context, const uint8_t * value){ + uint16_t pos = context->pos; + hci_event_builder_increment_pos(context, 16); + reverse_128(value, &context->buffer[pos]); +} + void hci_event_builder_add_bd_addr(hci_event_builder_context_t * context, bd_addr_t addr){ uint16_t pos = context->pos; hci_event_builder_increment_pos(context, 6); diff --git a/src/hci_event_builder.h b/src/hci_event_builder.h index effc19812..f0872d81f 100644 --- a/src/hci_event_builder.h +++ b/src/hci_event_builder.h @@ -112,6 +112,20 @@ void hci_event_builder_add_24(hci_event_builder_context_t * context, uint32_t va */ void hci_event_builder_add_32(hci_event_builder_context_t * context, uint32_t value); +/** + * @bbrief Add uint8_t[8] in big_endian to event + * @param context + * @param value + */ +void hci_event_builder_add_64(hci_event_builder_context_t * context, const uint8_t * value); + +/** + * @bbrief Add uint8_t[16] in big_endian to event + * @param context + * @param value + */ +void hci_event_builder_add_128(hci_event_builder_context_t * context, const uint8_t * value); + /** * @bbrief Add Bluetooth address to event * @param context