hci_event_builder: use JV format for add string

This commit is contained in:
Matthias Ringwald 2024-09-30 10:33:51 +02:00
parent 43bdd57606
commit 7d006440e7
2 changed files with 5 additions and 2 deletions

View File

@ -122,8 +122,11 @@ void hci_event_builder_add_con_handle(hci_event_builder_context_t * context, hci
void hci_event_builder_add_string(hci_event_builder_context_t * context, const char * text){
uint16_t length = (uint16_t) strlen(text);
uint16_t pos = context->pos;
hci_event_builder_increment_pos(context, length);
hci_event_builder_increment_pos(context, length + 2);
context->buffer[pos++] = length;
memcpy(&context->buffer[pos], text, length);
pos += length;
context->buffer[pos] = 0;
}
void hci_event_builder_add_bytes(hci_event_builder_context_t * context, const uint8_t * data, uint16_t length){

View File

@ -141,7 +141,7 @@ void hci_event_builder_add_bd_addr(hci_event_builder_context_t * context, bd_add
void hci_event_builder_add_con_handle(hci_event_builder_context_t * context, hci_con_handle_t con_handle);
/**
* @bbrief Add string to event
* @bbrief Add string to event using JV format: len, string, trailing zero
* @param context
* @param value
*/