hci_event.c (7d902a1f429eef0e075dcfd9b78a645cd530b4cf) | hci_event.c (c70b3b486dde2b96829c110a442a90c62ebfbd82) |
---|---|
1/* 2 * Copyright (C) 2020 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 50 unchanged lines hidden (view full) --- 59 * B: Bluetooth Baseband Address (BD_ADDR) 60 * D: 8 byte data block 61 * P: 16 byte data block. 62 * Q: 32 byte data block, e.g. for X and Y coordinates of P-256 public key 63 * J: 1-byte lenght of following variable-length data blob 'V' 64 * K: 1-byte length of following variable-length data blob 'V', length is not included in packet 65 * V: variable-length data blob of len provided in 'J' field 66 */ | 1/* 2 * Copyright (C) 2020 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 50 unchanged lines hidden (view full) --- 59 * B: Bluetooth Baseband Address (BD_ADDR) 60 * D: 8 byte data block 61 * P: 16 byte data block. 62 * Q: 32 byte data block, e.g. for X and Y coordinates of P-256 public key 63 * J: 1-byte lenght of following variable-length data blob 'V' 64 * K: 1-byte length of following variable-length data blob 'V', length is not included in packet 65 * V: variable-length data blob of len provided in 'J' field 66 */ |
67uint16_t hci_event_create_from_template_and_arglist(uint8_t *hci_event_buffer, const hci_event_t *event, va_list argptr){ 68 | 67uint16_t hci_event_create_from_template_and_arglist(uint8_t *hci_event_buffer, uint16_t buffer_size, const hci_event_t *event, va_list argptr){ 68 69 UNUSED(buffer_size); 70 |
69 hci_event_buffer[0] = event->event_code; 70 uint16_t pos = 2; 71 72 // store subevent code if set 73 if (event->subevent_code != 0){ 74 hci_event_buffer[pos++] = event->subevent_code; 75 } 76 --- 68 unchanged lines hidden (view full) --- 145 break; 146 } 147 format++; 148 }; 149 hci_event_buffer[1] = pos - 2; 150 return pos; 151} 152 | 71 hci_event_buffer[0] = event->event_code; 72 uint16_t pos = 2; 73 74 // store subevent code if set 75 if (event->subevent_code != 0){ 76 hci_event_buffer[pos++] = event->subevent_code; 77 } 78 --- 68 unchanged lines hidden (view full) --- 147 break; 148 } 149 format++; 150 }; 151 hci_event_buffer[1] = pos - 2; 152 return pos; 153} 154 |
153uint16_t hci_event_create_from_template_and_arguments(uint8_t *hci_buffer, const hci_event_t *event, ...){ | 155uint16_t hci_event_create_from_template_and_arguments(uint8_t *hci_buffer, uint16_t buffer_size, const hci_event_t *event, ...){ |
154 va_list argptr; 155 va_start(argptr, event); | 156 va_list argptr; 157 va_start(argptr, event); |
156 uint16_t length = hci_event_create_from_template_and_arglist(hci_buffer, event, argptr); | 158 uint16_t length = hci_event_create_from_template_and_arglist(hci_buffer, buffer_size, event, argptr); |
157 va_end(argptr); 158 return length; 159} 160 161/* HCI Events */ 162 163const hci_event_t hci_event_hardware_error = { 164 HCI_EVENT_HARDWARE_ERROR, 0, "1" --- 23 unchanged lines hidden --- | 159 va_end(argptr); 160 return length; 161} 162 163/* HCI Events */ 164 165const hci_event_t hci_event_hardware_error = { 166 HCI_EVENT_HARDWARE_ERROR, 0, "1" --- 23 unchanged lines hidden --- |