1 /* 2 * Copyright (C) 2014 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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24 * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 #define BTSTACK_FILE__ "hci_cmd.c" 39 40 /* 41 * hci_cmd.c 42 * 43 * Created by Matthias Ringwald on 7/23/09. 44 */ 45 46 #include "btstack_config.h" 47 48 #include "hci.h" 49 #include "hci_cmd.h" 50 #include "btstack_debug.h" 51 52 #include <string.h> 53 54 55 #ifdef ENABLE_SDP 56 #include "classic/sdp_util.h" 57 #endif 58 59 // calculate combined ogf/ocf value 60 #define OPCODE(ogf, ocf) ((ocf) | ((ogf) << 10)) 61 62 #define INVALID_VAR_LEN 0xffffu 63 // hci_le_set_cig_parameters_test has 10 arrayed parameters 64 #define MAX_NR_ARRAY_FIELDS 10 65 #define INVALID_ARRAY_LEN 0xff 66 67 /** 68 * construct HCI Command based on template 69 * 70 * Format: 71 * 1,2,3,4: one to four byte value 72 * H: HCI connection handle 73 * B: Bluetooth Baseband Address (BD_ADDR) 74 * D: 8 byte data block 75 * E: Extended Inquiry Result 76 * N: Name up to 248 chars, \0 terminated 77 * P: 16 byte data block. Pairing code, Simple Pairing Hash and Randomizer 78 * A: 31 bytes advertising data 79 * S: Service Record (Data Element Sequence) 80 * Q: 32 byte data block, e.g. for X and Y coordinates of P-256 public key 81 * J: 8-bit length of variable size element 82 * V: variable size element, len was given with param 'J' 83 * a: number of elements in following arrayed parameters(s), specified as '[...]' 84 * b: bit field indicating number of arrayed parameters(s), specified as '[...]' 85 * [: start of arrayed param sequence 86 * ]: end of arrayed param sequence 87 */ 88 uint16_t hci_cmd_create_from_template(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr){ 89 90 hci_cmd_buffer[0] = cmd->opcode & 0xffu; 91 hci_cmd_buffer[1] = cmd->opcode >> 8; 92 uint16_t pos = 3; 93 94 const char *format = cmd->format; 95 uint16_t word; 96 uint32_t longword; 97 uint8_t * ptr; 98 99 #ifdef ENABLE_BLE 100 // variable size data 101 uint16_t var_len = INVALID_VAR_LEN; 102 // array processing 103 const char * array_format = NULL; 104 void * array_data[MAX_NR_ARRAY_FIELDS]; 105 uint8_t array_num_elements = INVALID_ARRAY_LEN; 106 uint8_t array_num_fields; 107 uint8_t array_element_index; 108 bool array_done; 109 #endif 110 111 bool done_format = false; 112 while (!done_format) { 113 switch(*format) { 114 case 0: 115 done_format = true; 116 break; 117 case '1': // 8 bit value 118 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 119 hci_cmd_buffer[pos++] = word & 0xffu; 120 break; 121 case '2': // 16 bit value 122 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 123 hci_cmd_buffer[pos++] = word & 0xffu; 124 hci_cmd_buffer[pos++] = word >> 8; 125 break; 126 case 'H': // hci_handle 127 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 128 hci_cmd_buffer[pos++] = word & 0xffu; 129 hci_cmd_buffer[pos++] = word >> 8; 130 break; 131 case '3': 132 longword = va_arg(argptr, uint32_t); // LCOV_EXCL_BR_LINE 133 hci_cmd_buffer[pos++] = longword; 134 hci_cmd_buffer[pos++] = longword >> 8; 135 hci_cmd_buffer[pos++] = longword >> 16; 136 break; 137 case '4': 138 longword = va_arg(argptr, uint32_t); // LCOV_EXCL_BR_LINE 139 hci_cmd_buffer[pos++] = longword; 140 hci_cmd_buffer[pos++] = longword >> 8; 141 hci_cmd_buffer[pos++] = longword >> 16; 142 hci_cmd_buffer[pos++] = longword >> 24; 143 break; 144 case 'B': // bt-addr 145 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 146 hci_cmd_buffer[pos++] = ptr[5]; 147 hci_cmd_buffer[pos++] = ptr[4]; 148 hci_cmd_buffer[pos++] = ptr[3]; 149 hci_cmd_buffer[pos++] = ptr[2]; 150 hci_cmd_buffer[pos++] = ptr[1]; 151 hci_cmd_buffer[pos++] = ptr[0]; 152 break; 153 case 'D': // 8 byte data block 154 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 155 (void)memcpy(&hci_cmd_buffer[pos], ptr, 8); 156 pos += 8; 157 break; 158 case 'E': // Extended Inquiry Information 240 octets 159 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 160 (void)memcpy(&hci_cmd_buffer[pos], ptr, 240); 161 pos += 240; 162 break; 163 case 'N': { // UTF-8 string, null terminated 164 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 165 uint16_t len = (uint16_t) strlen((const char*) ptr); 166 if (len > 248u) { 167 len = 248; 168 } 169 (void)memcpy(&hci_cmd_buffer[pos], ptr, len); 170 if (len < 248u) { 171 // fill remaining space with zeroes 172 memset(&hci_cmd_buffer[pos+len], 0u, 248u-len); 173 } 174 pos += 248; 175 break; 176 } 177 case 'P': // 16 byte PIN code or link key in little endian 178 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 179 (void)memcpy(&hci_cmd_buffer[pos], ptr, 16); 180 pos += 16; 181 break; 182 case 'K': // 16 byte OOB Data or Link Key in big endian 183 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 184 reverse_bytes(ptr, &hci_cmd_buffer[pos], 16); 185 pos += 16; 186 break; 187 #ifdef ENABLE_BLE 188 case 'A': // 31 bytes advertising data 189 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 190 (void)memcpy(&hci_cmd_buffer[pos], ptr, 31); 191 pos += 31; 192 break; 193 case 'J': // 8 bit variable length indicator for 'V' 194 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 195 var_len = word & 0xffu; 196 hci_cmd_buffer[pos++] = (uint8_t) var_len; 197 break; 198 case 'V': 199 btstack_assert(var_len != INVALID_VAR_LEN); 200 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 201 (void)memcpy(&hci_cmd_buffer[pos], ptr, var_len); 202 pos += var_len; 203 var_len = INVALID_VAR_LEN; 204 break; 205 case 'a': 206 btstack_assert(array_num_elements == INVALID_ARRAY_LEN); 207 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 208 hci_cmd_buffer[pos++] = word & 0xff; 209 array_num_elements = word & 0xffu; 210 break; 211 case 'b': 212 btstack_assert(array_num_elements == INVALID_ARRAY_LEN); 213 word = va_arg(argptr, int); // LCOV_EXCL_BR_LINE 214 hci_cmd_buffer[pos++] = word & 0xff; 215 array_num_elements = count_set_bits_uint32(word & 0xffu); 216 break; 217 case '[': 218 btstack_assert(array_num_elements != INVALID_ARRAY_LEN); 219 // process array 220 format++; 221 array_format = format; 222 array_num_fields = 0; 223 array_done = false; 224 while (!array_done){ 225 switch (*format){ 226 case 0: 227 array_done = true; 228 done_format = true; 229 break; 230 case ']': 231 array_done = true; 232 break; 233 case '1': 234 case '2': 235 // all arrayed parameters are passed in as arrays 236 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 237 array_data[array_num_fields++] = ptr; 238 format++; 239 break; 240 default: 241 btstack_unreachable(); 242 break; 243 } 244 } 245 for (array_element_index = 0; array_element_index < array_num_elements ; array_element_index++){ 246 uint8_t array_field_index; 247 for (array_field_index = 0; array_field_index < array_num_fields ; array_field_index++){ 248 switch (array_format[array_field_index]){ 249 case '1': 250 hci_cmd_buffer[pos++] = ((const uint8_t *) array_data[array_field_index])[array_element_index]; 251 break; 252 case '2': 253 little_endian_store_16(hci_cmd_buffer, pos, ((const uint16_t *) array_data[array_field_index])[array_element_index]); 254 pos += 2; 255 break; 256 default: 257 btstack_unreachable(); 258 break; 259 } 260 } 261 } 262 break; 263 #endif 264 #ifdef ENABLE_LE_SECURE_CONNECTIONS 265 case 'Q': 266 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 267 reverse_bytes(ptr, &hci_cmd_buffer[pos], 32); 268 pos += 32; 269 break; 270 #endif 271 #ifdef ENABLE_SDP 272 // used by daemon 273 case 'S': { // Service Record (Data Element Sequence) 274 ptr = va_arg(argptr, uint8_t *); // LCOV_EXCL_BR_LINE 275 uint16_t len = de_get_len(ptr); 276 (void)memcpy(&hci_cmd_buffer[pos], ptr, len); 277 pos += len; 278 break; 279 } 280 #endif 281 default: 282 btstack_unreachable(); 283 break; 284 } 285 format++; 286 }; 287 hci_cmd_buffer[2] = pos - 3; 288 return pos; 289 } 290 291 292 uint16_t hci_cmd_create_from_template_with_vargs(uint8_t * hci_cmd_buffer, const hci_cmd_t * cmd, ...){ 293 va_list argptr; 294 va_start(argptr, cmd); 295 uint16_t size = hci_cmd_create_from_template(hci_cmd_buffer, cmd, argptr); 296 va_end(argptr); 297 return size; 298 } 299 300 /** 301 * Link Control Commands 302 */ 303 304 /** 305 * @param lap 306 * @param inquiry_length 307 * @param num_responses 308 */ 309 const hci_cmd_t hci_inquiry = { 310 HCI_OPCODE_HCI_INQUIRY, "311" 311 }; 312 313 /** 314 */ 315 const hci_cmd_t hci_inquiry_cancel = { 316 HCI_OPCODE_HCI_INQUIRY_CANCEL, "" 317 }; 318 319 /** 320 * @param max_period_length 321 * @param min_period_length 322 * @param lap 323 * @param inquiry_length 324 * @param num_responses 325 */ 326 const hci_cmd_t hci_periodic_inquiry_mode = { 327 HCI_OPCODE_HCI_PERIODIC_INQUIRY_MODE, "22311" 328 }; 329 330 /** 331 */ 332 const hci_cmd_t hci_exit_periodic_inquiry_mode = { 333 HCI_OPCODE_HCI_EXIT_PERIODIC_INQUIRY_MODE, "" 334 }; 335 336 /** 337 * @param bd_addr 338 * @param packet_type 339 * @param page_scan_repetition_mode 340 * @param reserved 341 * @param clock_offset 342 * @param allow_role_switch 343 */ 344 const hci_cmd_t hci_create_connection = { 345 HCI_OPCODE_HCI_CREATE_CONNECTION, "B21121" 346 }; 347 348 /** 349 * @param handle 350 * @param reason (0x05, 0x13-0x15, 0x1a, 0x29, see Errors Codes in BT Spec Part D) 351 */ 352 const hci_cmd_t hci_disconnect = { 353 HCI_OPCODE_HCI_DISCONNECT, "H1" 354 }; 355 356 /** 357 * @param bd_addr 358 */ 359 const hci_cmd_t hci_create_connection_cancel = { 360 HCI_OPCODE_HCI_CREATE_CONNECTION_CANCEL, "B" 361 }; 362 363 /** 364 * @param bd_addr 365 * @param role (become master, stay slave) 366 */ 367 const hci_cmd_t hci_accept_connection_request = { 368 HCI_OPCODE_HCI_ACCEPT_CONNECTION_REQUEST, "B1" 369 }; 370 371 /** 372 * @param bd_addr 373 * @param reason (e.g. CONNECTION REJECTED DUE TO LIMITED RESOURCES (0x0d)) 374 */ 375 const hci_cmd_t hci_reject_connection_request = { 376 HCI_OPCODE_HCI_REJECT_CONNECTION_REQUEST, "B1" 377 }; 378 379 /** 380 * @param bd_addr 381 * @param link_key 382 */ 383 const hci_cmd_t hci_link_key_request_reply = { 384 HCI_OPCODE_HCI_LINK_KEY_REQUEST_REPLY, "BP" 385 }; 386 387 /** 388 * @param bd_addr 389 */ 390 const hci_cmd_t hci_link_key_request_negative_reply = { 391 HCI_OPCODE_HCI_LINK_KEY_REQUEST_NEGATIVE_REPLY, "B" 392 }; 393 394 /** 395 * @param bd_addr 396 * @param pin_length 397 * @param pin (c-string) 398 */ 399 const hci_cmd_t hci_pin_code_request_reply = { 400 HCI_OPCODE_HCI_PIN_CODE_REQUEST_REPLY, "B1P" 401 }; 402 403 /** 404 * @param bd_addr 405 */ 406 const hci_cmd_t hci_pin_code_request_negative_reply = { 407 HCI_OPCODE_HCI_PIN_CODE_REQUEST_NEGATIVE_REPLY, "B" 408 }; 409 410 /** 411 * @param handle 412 * @param packet_type 413 */ 414 const hci_cmd_t hci_change_connection_packet_type = { 415 HCI_OPCODE_HCI_CHANGE_CONNECTION_PACKET_TYPE, "H2" 416 }; 417 418 /** 419 * @param handle 420 */ 421 const hci_cmd_t hci_authentication_requested = { 422 HCI_OPCODE_HCI_AUTHENTICATION_REQUESTED, "H" 423 }; 424 425 /** 426 * @param handle 427 * @param encryption_enable 428 */ 429 const hci_cmd_t hci_set_connection_encryption = { 430 HCI_OPCODE_HCI_SET_CONNECTION_ENCRYPTION, "H1" 431 }; 432 433 /** 434 * @param handle 435 */ 436 const hci_cmd_t hci_change_connection_link_key = { 437 HCI_OPCODE_HCI_CHANGE_CONNECTION_LINK_KEY, "H" 438 }; 439 440 /** 441 * @param bd_addr 442 * @param page_scan_repetition_mode 443 * @param reserved 444 * @param clock_offset 445 */ 446 const hci_cmd_t hci_remote_name_request = { 447 HCI_OPCODE_HCI_REMOTE_NAME_REQUEST, "B112" 448 }; 449 450 451 /** 452 * @param bd_addr 453 */ 454 const hci_cmd_t hci_remote_name_request_cancel = { 455 HCI_OPCODE_HCI_REMOTE_NAME_REQUEST_CANCEL, "B" 456 }; 457 458 /** 459 * @param handle 460 */ 461 const hci_cmd_t hci_read_remote_supported_features_command = { 462 HCI_OPCODE_HCI_READ_REMOTE_SUPPORTED_FEATURES_COMMAND, "H" 463 }; 464 465 /** 466 * @param handle 467 */ 468 const hci_cmd_t hci_read_remote_extended_features_command = { 469 HCI_OPCODE_HCI_READ_REMOTE_EXTENDED_FEATURES_COMMAND, "H1" 470 }; 471 472 /** 473 * @param handle 474 */ 475 const hci_cmd_t hci_read_remote_version_information = { 476 HCI_OPCODE_HCI_READ_REMOTE_VERSION_INFORMATION, "H" 477 }; 478 479 /** 480 * @param handle 481 * @param transmit_bandwidth 8000(64kbps) 482 * @param receive_bandwidth 8000(64kbps) 483 * @param max_latency >= 7ms for eSCO, 0xFFFF do not care 484 * @param voice_settings e.g. CVSD, Input Coding: Linear, Input Data Format: 2’s complement, data 16bit: 00011000000 == 0x60 485 * @param retransmission_effort e.g. 0xFF do not care 486 * @param packet_type at least EV3 for eSCO 487 */ 488 const hci_cmd_t hci_setup_synchronous_connection = { 489 HCI_OPCODE_HCI_SETUP_SYNCHRONOUS_CONNECTION, "H442212" 490 }; 491 492 /** 493 * @param bd_addr 494 * @param transmit_bandwidth 495 * @param receive_bandwidth 496 * @param max_latency 497 * @param voice_settings 498 * @param retransmission_effort 499 * @param packet_type 500 */ 501 const hci_cmd_t hci_accept_synchronous_connection = { 502 HCI_OPCODE_HCI_ACCEPT_SYNCHRONOUS_CONNECTION, "B442212" 503 }; 504 505 /** 506 * @param bd_addr 507 * @param IO_capability 508 * @param OOB_data_present 509 * @param authentication_requirements 510 */ 511 const hci_cmd_t hci_io_capability_request_reply = { 512 HCI_OPCODE_HCI_IO_CAPABILITY_REQUEST_REPLY, "B111" 513 }; 514 515 /** 516 * @param bd_addr 517 */ 518 const hci_cmd_t hci_user_confirmation_request_reply = { 519 HCI_OPCODE_HCI_USER_CONFIRMATION_REQUEST_REPLY, "B" 520 }; 521 522 /** 523 * @param bd_addr 524 */ 525 const hci_cmd_t hci_user_confirmation_request_negative_reply = { 526 HCI_OPCODE_HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY, "B" 527 }; 528 529 /** 530 * @param bd_addr 531 * @param numeric_value 532 */ 533 const hci_cmd_t hci_user_passkey_request_reply = { 534 HCI_OPCODE_HCI_USER_PASSKEY_REQUEST_REPLY, "B4" 535 }; 536 537 /** 538 * @param bd_addr 539 */ 540 const hci_cmd_t hci_user_passkey_request_negative_reply = { 541 HCI_OPCODE_HCI_USER_PASSKEY_REQUEST_NEGATIVE_REPLY, "B" 542 }; 543 544 /** 545 * @param bd_addr 546 * @param c Simple Pairing Hash C 547 * @param r Simple Pairing Randomizer R 548 */ 549 const hci_cmd_t hci_remote_oob_data_request_reply = { 550 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_REPLY, "BKK" 551 }; 552 553 /** 554 * @param bd_addr 555 */ 556 const hci_cmd_t hci_remote_oob_data_request_negative_reply = { 557 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY, "B" 558 }; 559 560 /** 561 * @param bd_addr 562 * @param reason (Part D, Error codes) 563 */ 564 const hci_cmd_t hci_io_capability_request_negative_reply = { 565 HCI_OPCODE_HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY, "B1" 566 }; 567 568 /** 569 * @param handle 570 * @param transmit_bandwidth 571 * @param receive_bandwidth 572 * @param transmit_coding_format_type 573 * @param transmit_coding_format_company 574 * @param transmit_coding_format_codec 575 * @param receive_coding_format_type 576 * @param receive_coding_format_company 577 * @param receive_coding_format_codec 578 * @param transmit_coding_frame_size 579 * @param receive_coding_frame_size 580 * @param input_bandwidth 581 * @param output_bandwidth 582 * @param input_coding_format_type 583 * @param input_coding_format_company 584 * @param input_coding_format_codec 585 * @param output_coding_format_type 586 * @param output_coding_format_company 587 * @param output_coding_format_codec 588 * @param input_coded_data_size 589 * @param outupt_coded_data_size 590 * @param input_pcm_data_format 591 * @param output_pcm_data_format 592 * @param input_pcm_sample_payload_msb_position 593 * @param output_pcm_sample_payload_msb_position 594 * @param input_data_path 595 * @param output_data_path 596 * @param input_transport_unit_size 597 * @param output_transport_unit_size 598 * @param max_latency 599 * @param packet_type 600 * @param retransmission_effort 601 */ 602 const hci_cmd_t hci_enhanced_setup_synchronous_connection = { 603 HCI_OPCODE_HCI_ENHANCED_SETUP_SYNCHRONOUS_CONNECTION, "H4412212222441221222211111111221" 604 }; 605 606 /** 607 * @param bd_addr 608 * @param transmit_bandwidth 609 * @param receive_bandwidth 610 * @param transmit_coding_format_type 611 * @param transmit_coding_format_company 612 * @param transmit_coding_format_codec 613 * @param receive_coding_format_type 614 * @param receive_coding_format_company 615 * @param receive_coding_format_codec 616 * @param transmit_coding_frame_size 617 * @param receive_coding_frame_size 618 * @param input_bandwidth 619 * @param output_bandwidth 620 * @param input_coding_format_type 621 * @param input_coding_format_company 622 * @param input_coding_format_codec 623 * @param output_coding_format_type 624 * @param output_coding_format_company 625 * @param output_coding_format_codec 626 * @param input_coded_data_size 627 * @param outupt_coded_data_size 628 * @param input_pcm_data_format 629 * @param output_pcm_data_format 630 * @param input_pcm_sample_payload_msb_position 631 * @param output_pcm_sample_payload_msb_position 632 * @param input_data_path 633 * @param output_data_path 634 * @param input_transport_unit_size 635 * @param output_transport_unit_size 636 * @param max_latency 637 * @param packet_type 638 * @param retransmission_effort 639 */ 640 const hci_cmd_t hci_enhanced_accept_synchronous_connection = { 641 HCI_OPCODE_HCI_ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION, "B4412212222441221222211111111221" 642 }; 643 644 /** 645 * @param bd_addr 646 * @param c_192 Simple Pairing Hash C derived from P-192 public key 647 * @param r_192 Simple Pairing Randomizer derived from P-192 public key 648 * @param c_256 Simple Pairing Hash C derived from P-256 public key 649 * @param r_256 Simple Pairing Randomizer derived from P-256 public key 650 */ 651 const hci_cmd_t hci_remote_oob_extended_data_request_reply = { 652 HCI_OPCODE_HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY, "BKKKK" 653 }; 654 655 /** 656 * Link Policy Commands 657 */ 658 659 /** 660 * @param handle 661 * @param hold_mode_max_interval * 0.625 ms, range: 0x0002..0xFFFE; only even values are valid. 662 * @param hold_mode_min_interval * 0.625 ms, range: 0x0002..0xFFFE; only even values are valid. 663 */ 664 const hci_cmd_t hci_hold_mode = { 665 HCI_OPCODE_HCI_HOLD_MODE, "H22" 666 }; 667 668 /** 669 * @param handle 670 * @param sniff_max_interval 671 * @param sniff_min_interval 672 * @param sniff_attempt 673 * @param sniff_timeout 674 */ 675 const hci_cmd_t hci_sniff_mode = { 676 HCI_OPCODE_HCI_SNIFF_MODE, "H2222" 677 }; 678 679 /** 680 * @param handle 681 */ 682 const hci_cmd_t hci_exit_sniff_mode = { 683 HCI_OPCODE_HCI_EXIT_SNIFF_MODE, "H" 684 }; 685 686 /** 687 * @note Removed in Bluetooth Core v5.0 688 * @param handle 689 * @param beacon_max_interval * 0.625 ms, range: 0x000E..0xFFFE; only even values are valid. 690 * @param beacon_max_interval * 0.625 ms, range: 0x000E..0xFFFE; only even values are valid. 691 */ 692 const hci_cmd_t hci_park_state = { 693 HCI_OPCODE_HCI_PARK_STATE, "H22" 694 }; 695 696 /** 697 * @note Removed in Bluetooth Core v5.0 698 * @param handle 699 */ 700 const hci_cmd_t hci_exit_park_state = { 701 HCI_OPCODE_HCI_EXIT_PARK_STATE, "H" 702 }; 703 704 /** 705 * @param handle 706 * @param flags 707 * @param service_type 708 * @param token_rate (bytes/s) 709 * @param peak_bandwith (bytes/s) 710 * @param latency (us) 711 * @param delay_variation (us) 712 */ 713 const hci_cmd_t hci_qos_setup = { 714 HCI_OPCODE_HCI_QOS_SETUP, "H114444" 715 }; 716 717 /** 718 * @param handle 719 */ 720 const hci_cmd_t hci_role_discovery = { 721 HCI_OPCODE_HCI_ROLE_DISCOVERY, "H" 722 }; 723 724 /** 725 * @param bd_addr 726 * @param role (0=master,1=slave) 727 */ 728 const hci_cmd_t hci_switch_role_command= { 729 HCI_OPCODE_HCI_SWITCH_ROLE_COMMAND, "B1" 730 }; 731 732 /** 733 * @param handle 734 */ 735 const hci_cmd_t hci_read_link_policy_settings = { 736 HCI_OPCODE_HCI_READ_LINK_POLICY_SETTINGS, "H" 737 }; 738 739 /** 740 * @param handle 741 * @param settings 742 */ 743 const hci_cmd_t hci_write_link_policy_settings = { 744 HCI_OPCODE_HCI_WRITE_LINK_POLICY_SETTINGS, "H2" 745 }; 746 747 /** 748 * @param handle 749 * @param max_latency 750 * @param min_remote_timeout 751 * @param min_local_timeout 752 */ 753 const hci_cmd_t hci_sniff_subrating = { 754 HCI_OPCODE_HCI_SNIFF_SUBRATING, "H222" 755 }; 756 757 /** 758 * @param policy 759 */ 760 const hci_cmd_t hci_write_default_link_policy_setting = { 761 HCI_OPCODE_HCI_WRITE_DEFAULT_LINK_POLICY_SETTING, "2" 762 }; 763 764 /** 765 * @param handle 766 * @param unused 767 * @param flow_direction 768 * @param service_type 769 * @param token_rate 770 * @param token_bucket_size 771 * @param peak_bandwidth 772 * @param access_latency 773 */ 774 const hci_cmd_t hci_flow_specification = { 775 HCI_OPCODE_HCI_FLOW_SPECIFICATION, "H1114444" 776 }; 777 778 779 /** 780 * Controller & Baseband Commands 781 */ 782 783 784 /** 785 * @param event_mask_lower_octets 786 * @param event_mask_higher_octets 787 */ 788 const hci_cmd_t hci_set_event_mask = { 789 HCI_OPCODE_HCI_SET_EVENT_MASK, "44" 790 }; 791 792 /** 793 */ 794 const hci_cmd_t hci_reset = { 795 HCI_OPCODE_HCI_RESET, "" 796 }; 797 798 /** 799 * @param handle 800 */ 801 const hci_cmd_t hci_flush = { 802 HCI_OPCODE_HCI_FLUSH, "H" 803 }; 804 805 /** 806 * @param handle 807 */ 808 const hci_cmd_t hci_read_pin_type = { 809 HCI_OPCODE_HCI_READ_PIN_TYPE, "" 810 }; 811 812 /** 813 * @param handle 814 */ 815 const hci_cmd_t hci_write_pin_type = { 816 HCI_OPCODE_HCI_WRITE_PIN_TYPE, "1" 817 }; 818 819 /** 820 * @param bd_addr 821 * @param delete_all_flags 822 */ 823 const hci_cmd_t hci_delete_stored_link_key = { 824 HCI_OPCODE_HCI_DELETE_STORED_LINK_KEY, "B1" 825 }; 826 827 #ifdef ENABLE_CLASSIC 828 /** 829 * @param local_name (UTF-8, Null Terminated, max 248 octets) 830 */ 831 const hci_cmd_t hci_write_local_name = { 832 HCI_OPCODE_HCI_WRITE_LOCAL_NAME, "N" 833 }; 834 #endif 835 836 /** 837 */ 838 const hci_cmd_t hci_read_local_name = { 839 HCI_OPCODE_HCI_READ_LOCAL_NAME, "" 840 }; 841 842 /** 843 */ 844 const hci_cmd_t hci_read_page_timeout = { 845 HCI_OPCODE_HCI_READ_PAGE_TIMEOUT, "" 846 }; 847 848 /** 849 * @param page_timeout (* 0.625 ms) 850 */ 851 const hci_cmd_t hci_write_page_timeout = { 852 HCI_OPCODE_HCI_WRITE_PAGE_TIMEOUT, "2" 853 }; 854 855 /** 856 * @param scan_enable (no, inq, page, inq+page) 857 */ 858 const hci_cmd_t hci_write_scan_enable = { 859 HCI_OPCODE_HCI_WRITE_SCAN_ENABLE, "1" 860 }; 861 862 /** 863 */ 864 const hci_cmd_t hci_read_page_scan_activity = { 865 HCI_OPCODE_HCI_READ_PAGE_SCAN_ACTIVITY, "" 866 }; 867 868 /** 869 * @param page_scan_interval (* 0.625 ms) 870 * @param page_scan_window (* 0.625 ms, must be <= page_scan_interval) 871 */ 872 const hci_cmd_t hci_write_page_scan_activity = { 873 HCI_OPCODE_HCI_WRITE_PAGE_SCAN_ACTIVITY, "22" 874 }; 875 876 /** 877 */ 878 const hci_cmd_t hci_read_inquiry_scan_activity = { 879 HCI_OPCODE_HCI_READ_INQUIRY_SCAN_ACTIVITY, "" 880 }; 881 882 /** 883 * @param inquiry_scan_interval (* 0.625 ms) 884 * @param inquiry_scan_window (* 0.625 ms, must be <= inquiry_scan_interval) 885 */ 886 const hci_cmd_t hci_write_inquiry_scan_activity = { 887 HCI_OPCODE_HCI_WRITE_INQUIRY_SCAN_ACTIVITY, "22" 888 }; 889 890 /** 891 * @param authentication_enable 892 */ 893 const hci_cmd_t hci_write_authentication_enable = { 894 HCI_OPCODE_HCI_WRITE_AUTHENTICATION_ENABLE, "1" 895 }; 896 897 /** 898 * @param handle 899 * @param timeout, max 0x07FF 900 */ 901 const hci_cmd_t hci_write_automatic_flush_timeout = { 902 HCI_OPCODE_HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT, "H2" 903 }; 904 905 /** 906 * @param class_of_device 907 */ 908 const hci_cmd_t hci_write_class_of_device = { 909 HCI_OPCODE_HCI_WRITE_CLASS_OF_DEVICE, "3" 910 }; 911 912 /** 913 */ 914 const hci_cmd_t hci_read_num_broadcast_retransmissions = { 915 HCI_OPCODE_HCI_READ_NUM_BROADCAST_RETRANSMISSIONS, "" 916 }; 917 918 /** 919 * @param num_broadcast_retransmissions (e.g. 0 for a single broadcast) 920 */ 921 const hci_cmd_t hci_write_num_broadcast_retransmissions = { 922 HCI_OPCODE_HCI_WRITE_NUM_BROADCAST_RETRANSMISSIONS, "1" 923 }; 924 925 /** 926 * @param connection_handle 927 * @param type 0 = current transmit level, 1 = max transmit level 928 */ 929 const hci_cmd_t hci_read_transmit_power_level = { 930 HCI_OPCODE_HCI_READ_TRANSMIT_POWER_LEVEL, "H1" 931 }; 932 933 /** 934 * @param synchronous_flow_control_enable - if yes, num completed packet everts are sent for SCO packets 935 */ 936 const hci_cmd_t hci_write_synchronous_flow_control_enable = { 937 HCI_OPCODE_HCI_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE, "1" 938 }; 939 940 #ifdef ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL 941 942 /** 943 * @param flow_control_enable - 0: off, 1: ACL only, 2: SCO only, 3: ACL + SCO 944 */ 945 const hci_cmd_t hci_set_controller_to_host_flow_control = { 946 HCI_OPCODE_HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL, "1" 947 }; 948 949 /** 950 * @param host_acl_data_packet_length 951 * @param host_synchronous_data_packet_length 952 * @param host_total_num_acl_data_packets 953 * @param host_total_num_synchronous_data_packets 954 */ 955 const hci_cmd_t hci_host_buffer_size = { 956 HCI_OPCODE_HCI_HOST_BUFFER_SIZE, "2122" 957 }; 958 959 960 #if 0 961 // 962 // command sent manually sent by hci_host_num_completed_packets 963 // 964 /** 965 * @note only single handle supported by BTstack command generator 966 * @param number_of_handles must be 1 967 * @param connection_handle 968 * @param host_num_of_completed_packets for the given connection handle 969 */ 970 const hci_cmd_t hci_host_number_of_completed_packets = { 971 HCI_OPCODE_HCI_HOST_NUMBER_OF_COMPLETED_PACKETS, "1H2" 972 }; 973 #endif 974 975 #endif 976 977 /** 978 * @param handle 979 */ 980 const hci_cmd_t hci_read_link_supervision_timeout = { 981 HCI_OPCODE_HCI_READ_LINK_SUPERVISION_TIMEOUT, "H" 982 }; 983 984 /** 985 * @param handle 986 * @param timeout (0x0001 - 0xFFFF Time -> Range: 0.625ms - 40.9 sec) 987 */ 988 const hci_cmd_t hci_write_link_supervision_timeout = { 989 HCI_OPCODE_HCI_WRITE_LINK_SUPERVISION_TIMEOUT, "H2" 990 }; 991 992 /** 993 * @param num_current_iac must be 2 994 * @param iac_lap1 995 * @param iac_lap2 996 */ 997 const hci_cmd_t hci_write_current_iac_lap_two_iacs = { 998 HCI_OPCODE_HCI_WRITE_CURRENT_IAC_LAP_TWO_IACS, "133" 999 }; 1000 1001 /** 1002 * @param inquiry_scan_type (0x00 = standard, 0x01 = interlaced) 1003 */ 1004 const hci_cmd_t hci_write_inquiry_scan_type = { 1005 HCI_OPCODE_HCI_WRITE_INQUIRY_SCAN_TYPE, "1" 1006 }; 1007 1008 /** 1009 * @param inquiry_mode (0x00 = standard, 0x01 = with RSSI, 0x02 = extended) 1010 */ 1011 const hci_cmd_t hci_write_inquiry_mode = { 1012 HCI_OPCODE_HCI_WRITE_INQUIRY_MODE, "1" 1013 }; 1014 1015 /** 1016 * @param page_scan_type (0x00 = standard, 0x01 = interlaced) 1017 */ 1018 const hci_cmd_t hci_write_page_scan_type = { 1019 HCI_OPCODE_HCI_WRITE_PAGE_SCAN_TYPE, "1" 1020 }; 1021 1022 /** 1023 * @param fec_required 1024 * @param exstended_inquiry_response 1025 */ 1026 const hci_cmd_t hci_write_extended_inquiry_response = { 1027 HCI_OPCODE_HCI_WRITE_EXTENDED_INQUIRY_RESPONSE, "1E" 1028 }; 1029 1030 /** 1031 * @param mode (0 = off, 1 = on) 1032 */ 1033 const hci_cmd_t hci_write_simple_pairing_mode = { 1034 HCI_OPCODE_HCI_WRITE_SIMPLE_PAIRING_MODE, "1" 1035 }; 1036 1037 /** 1038 */ 1039 const hci_cmd_t hci_read_local_oob_data = { 1040 HCI_OPCODE_HCI_READ_LOCAL_OOB_DATA, "" 1041 // return status, C, R 1042 }; 1043 1044 /** 1045 */ 1046 const hci_cmd_t hci_read_inquiry_response_transmit_power_level = { 1047 HCI_OPCODE_HCI_READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL, "" 1048 // return status, pwr level 1049 }; 1050 1051 /** 1052 */ 1053 const hci_cmd_t hci_write_inquiry_transmit_power_level = { 1054 HCI_OPCODE_HCI_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL, "1" 1055 // return status 1056 }; 1057 1058 /** 1059 * @param mode (0 = off, 1 = on) 1060 */ 1061 const hci_cmd_t hci_write_default_erroneous_data_reporting = { 1062 HCI_OPCODE_HCI_WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING, "1" 1063 }; 1064 1065 /** 1066 * @param event_mask_page_2_lower_octets 1067 * @param event_mask_page_2_higher_octets 1068 */ 1069 const hci_cmd_t hci_set_event_mask_2 = { 1070 HCI_OPCODE_HCI_SET_EVENT_MASK_2, "44" 1071 }; 1072 1073 /** 1074 */ 1075 const hci_cmd_t hci_read_le_host_supported = { 1076 HCI_OPCODE_HCI_READ_LE_HOST_SUPPORTED, "" 1077 // return: status, le supported host, simultaneous le host 1078 }; 1079 1080 /** 1081 * @param le_supported_host 1082 * @param simultaneous_le_host 1083 */ 1084 const hci_cmd_t hci_write_le_host_supported = { 1085 HCI_OPCODE_HCI_WRITE_LE_HOST_SUPPORTED, "11" 1086 // return: status 1087 }; 1088 1089 /** 1090 * @param secure_connections_host_support 1091 */ 1092 const hci_cmd_t hci_write_secure_connections_host_support = { 1093 HCI_OPCODE_HCI_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT, "1" 1094 // return: status 1095 }; 1096 1097 /** 1098 */ 1099 const hci_cmd_t hci_read_local_extended_oob_data = { 1100 HCI_OPCODE_HCI_READ_LOCAL_EXTENDED_OOB_DATA, "" 1101 // return status, C_192, R_192, R_256, C_256 1102 }; 1103 1104 /** 1105 */ 1106 const hci_cmd_t hci_read_extended_page_timeout = { 1107 HCI_OPCODE_HCI_READ_EXTENDED_PAGE_TIMEOUT, "" 1108 // return: status, extender page timeout 1109 }; 1110 1111 /** 1112 * @param extended_page_timeout 1113 */ 1114 const hci_cmd_t hci_write_extended_page_timeout = { 1115 HCI_OPCODE_HCI_WRITE_EXTENDED_PAGE_TIMEOUT, "2" 1116 // return: status 1117 }; 1118 1119 /** 1120 */ 1121 const hci_cmd_t hci_read_extended_inquiry_length = { 1122 HCI_OPCODE_HCI_READ_EXTENDED_INQUIRY_LENGTH, "" 1123 // return: status, extended_inquiry_length 1124 }; 1125 1126 /** 1127 * @param extended_inquiry_length 1128 */ 1129 const hci_cmd_t hci_write_extended_inquiry_length = { 1130 HCI_OPCODE_HCI_WRITE_EXTENDED_INQUIRY_LENGTH, "2" 1131 // return: status 1132 }; 1133 1134 /** 1135 * @param interval 1136 */ 1137 const hci_cmd_t hci_set_ecosystem_base_interval = { 1138 HCI_OPCODE_HCI_SET_ECOSYSTEM_BASE_INTERVAL, "2" 1139 // return: status 1140 }; 1141 1142 /** 1143 * @param data_path_direction 1144 * @param data_path_id 1145 * @param vendor_specific_config_length 1146 * @param vendor_specific_config 1147 */ 1148 const hci_cmd_t hci_configure_data_path = { 1149 HCI_OPCODE_HCI_CONFIGURE_DATA_PATH, "11JV" 1150 // return: status 1151 }; 1152 1153 /** 1154 * @param min_encryption_key_size 1155 */ 1156 const hci_cmd_t hci_set_min_encryption_key_size = { 1157 HCI_OPCODE_HCI_SET_MIN_ENCRYPTION_KEY_SIZE, "1" 1158 // return: status 1159 }; 1160 1161 1162 /** 1163 * Testing Commands 1164 */ 1165 1166 1167 /** 1168 */ 1169 const hci_cmd_t hci_read_loopback_mode = { 1170 HCI_OPCODE_HCI_READ_LOOPBACK_MODE, "" 1171 // return: status, loopback mode (0 = off, 1 = local loopback, 2 = remote loopback) 1172 }; 1173 1174 /** 1175 * @param loopback_mode 1176 */ 1177 const hci_cmd_t hci_write_loopback_mode = { 1178 HCI_OPCODE_HCI_WRITE_LOOPBACK_MODE, "1" 1179 // return: status 1180 }; 1181 1182 /** 1183 */ 1184 const hci_cmd_t hci_enable_device_under_test_mode = { 1185 HCI_OPCODE_HCI_ENABLE_DEVICE_UNDER_TEST_MODE, "" 1186 // return: status 1187 }; 1188 1189 /** 1190 * @param simple_pairing_debug_mode 1191 */ 1192 const hci_cmd_t hci_write_simple_pairing_debug_mode = { 1193 HCI_OPCODE_HCI_WRITE_SIMPLE_PAIRING_DEBUG_MODE, "1" 1194 // return: status 1195 }; 1196 1197 /** 1198 * @param handle 1199 * @param dm1_acl_u_mode 1200 * @param esco_loopback_mode 1201 */ 1202 const hci_cmd_t hci_write_secure_connections_test_mode = { 1203 HCI_OPCODE_HCI_WRITE_SECURE_CONNECTIONS_TEST_MODE, "H11" 1204 // return: status 1205 }; 1206 1207 1208 /** 1209 * Informational Parameters 1210 */ 1211 1212 const hci_cmd_t hci_read_local_version_information = { 1213 HCI_OPCODE_HCI_READ_LOCAL_VERSION_INFORMATION, "" 1214 }; 1215 const hci_cmd_t hci_read_local_supported_commands = { 1216 HCI_OPCODE_HCI_READ_LOCAL_SUPPORTED_COMMANDS, "" 1217 }; 1218 const hci_cmd_t hci_read_local_supported_features = { 1219 HCI_OPCODE_HCI_READ_LOCAL_SUPPORTED_FEATURES, "" 1220 }; 1221 const hci_cmd_t hci_read_buffer_size = { 1222 HCI_OPCODE_HCI_READ_BUFFER_SIZE, "" 1223 }; 1224 const hci_cmd_t hci_read_bd_addr = { 1225 HCI_OPCODE_HCI_READ_BD_ADDR, "" 1226 }; 1227 1228 /** 1229 * Status Paramters 1230 */ 1231 1232 /** 1233 * @param handle 1234 */ 1235 const hci_cmd_t hci_read_rssi = { 1236 HCI_OPCODE_HCI_READ_RSSI, "H" 1237 }; 1238 1239 /** 1240 * @param handle 1241 */ 1242 const hci_cmd_t hci_read_encryption_key_size = { 1243 HCI_OPCODE_HCI_READ_ENCRYPTION_KEY_SIZE, "H" 1244 }; 1245 1246 1247 #ifdef ENABLE_BLE 1248 /** 1249 * Low Energy Commands 1250 */ 1251 1252 /** 1253 * @param event_mask_lower_octets 1254 * @param event_mask_higher_octets 1255 */ 1256 const hci_cmd_t hci_le_set_event_mask = { 1257 HCI_OPCODE_HCI_LE_SET_EVENT_MASK, "44" 1258 // return: status 1259 }; 1260 1261 const hci_cmd_t hci_le_read_buffer_size = { 1262 HCI_OPCODE_HCI_LE_READ_BUFFER_SIZE, "" 1263 // return: status, le acl data packet len (16), total num le acl data packets(8) 1264 }; 1265 const hci_cmd_t hci_le_read_local_supported_features = { 1266 HCI_OPCODE_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES, "" 1267 // return: LE_Features See [Vol 6] Part B, Section 4.6 1268 }; 1269 1270 /** 1271 * @param random_bd_addr 1272 */ 1273 const hci_cmd_t hci_le_set_random_address = { 1274 HCI_OPCODE_HCI_LE_SET_RANDOM_ADDRESS, "B" 1275 // return: status 1276 }; 1277 1278 /** 1279 * @param advertising_interval_min ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec) 1280 * @param advertising_interval_max ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec) 1281 * @param advertising_type (enum from 0: ADV_IND, ADC_DIRECT_IND, ADV_SCAN_IND, ADV_NONCONN_IND) 1282 * @param own_address_type (enum from 0: public device address, random device address) 1283 * @param direct_address_type () 1284 * @param direct_address (public or random address of device to be connecteed) 1285 * @param advertising_channel_map (flags: chan_37(1), chan_38(2), chan_39(4)) 1286 * @param advertising_filter_policy (enum from 0: scan any conn any, scan whitelist, con any, scan any conn whitelist, scan whitelist, con whitelist) 1287 */ 1288 const hci_cmd_t hci_le_set_advertising_parameters = { 1289 HCI_OPCODE_HCI_LE_SET_ADVERTISING_PARAMETERS, "22111B11" 1290 // return: status 1291 }; 1292 1293 const hci_cmd_t hci_le_read_advertising_channel_tx_power = { 1294 HCI_OPCODE_HCI_LE_READ_ADVERTISING_CHANNEL_TX_POWER, "" 1295 // return: status, level [-20,10] signed int (8), units dBm 1296 }; 1297 1298 /** 1299 * @param advertising_data_length 1300 * @param advertising_data (31 bytes) 1301 */ 1302 const hci_cmd_t hci_le_set_advertising_data= { 1303 HCI_OPCODE_HCI_LE_SET_ADVERTISING_DATA, "1A" 1304 // return: status 1305 }; 1306 1307 /** 1308 * @param scan_response_data_length 1309 * @param scan_response_data (31 bytes) 1310 */ 1311 const hci_cmd_t hci_le_set_scan_response_data= { 1312 HCI_OPCODE_HCI_LE_SET_SCAN_RESPONSE_DATA, "1A" 1313 // return: status 1314 }; 1315 1316 /** 1317 * @param advertise_enable (off: 0, on: 1) 1318 */ 1319 const hci_cmd_t hci_le_set_advertise_enable = { 1320 HCI_OPCODE_HCI_LE_SET_ADVERTISE_ENABLE, "1" 1321 // return: status 1322 }; 1323 1324 /** 1325 * @param le_scan_type (passive (0), active (1)) 1326 * @param le_scan_interval ([0x0004,0x4000], unit: 0.625 msec) 1327 * @param le_scan_window ([0x0004,0x4000], unit: 0.625 msec) 1328 * @param own_address_type (public (0), random (1)) 1329 * @param scanning_filter_policy (any (0), only whitelist (1)) 1330 */ 1331 const hci_cmd_t hci_le_set_scan_parameters = { 1332 HCI_OPCODE_HCI_LE_SET_SCAN_PARAMETERS, "12211" 1333 // return: status 1334 }; 1335 1336 /** 1337 * @param le_scan_enable (disabled (0), enabled (1)) 1338 * @param filter_duplices (disabled (0), enabled (1)) 1339 */ 1340 const hci_cmd_t hci_le_set_scan_enable = { 1341 HCI_OPCODE_HCI_LE_SET_SCAN_ENABLE, "11" 1342 // return: status 1343 }; 1344 1345 /** 1346 * @param le_scan_interval ([0x0004, 0x4000], unit: 0.625 msec) 1347 * @param le_scan_window ([0x0004, 0x4000], unit: 0.625 msec) 1348 * @param initiator_filter_policy (peer address type + peer address (0), whitelist (1)) 1349 * @param peer_address_type (public (0), random (1)) 1350 * @param peer_address 1351 * @param own_address_type (public (0), random (1)) 1352 * @param conn_interval_min ([0x0006, 0x0c80], unit: 1.25 msec) 1353 * @param conn_interval_max ([0x0006, 0x0c80], unit: 1.25 msec) 1354 * @param conn_latency (number of connection events [0x0000, 0x01f4]) 1355 * @param supervision_timeout ([0x000a, 0x0c80], unit: 10 msec) 1356 * @param minimum_CE_length ([0x0000, 0xffff], unit: 0.625 msec) 1357 * @param maximum_CE_length ([0x0000, 0xffff], unit: 0.625 msec) 1358 */ 1359 const hci_cmd_t hci_le_create_connection= { 1360 HCI_OPCODE_HCI_LE_CREATE_CONNECTION, "2211B1222222" 1361 // return: none -> le create connection complete event 1362 }; 1363 1364 const hci_cmd_t hci_le_create_connection_cancel = { 1365 HCI_OPCODE_HCI_LE_CREATE_CONNECTION_CANCEL, "" 1366 // return: status 1367 }; 1368 1369 const hci_cmd_t hci_le_read_white_list_size = { 1370 HCI_OPCODE_HCI_LE_READ_WHITE_LIST_SIZE, "" 1371 // return: status, number of entries in controller whitelist 1372 }; 1373 1374 const hci_cmd_t hci_le_clear_white_list = { 1375 HCI_OPCODE_HCI_LE_CLEAR_WHITE_LIST, "" 1376 // return: status 1377 }; 1378 1379 /** 1380 * @param address_type (public (0), random (1)) 1381 * @param bd_addr 1382 */ 1383 const hci_cmd_t hci_le_add_device_to_white_list = { 1384 HCI_OPCODE_HCI_LE_ADD_DEVICE_TO_WHITE_LIST, "1B" 1385 // return: status 1386 }; 1387 1388 /** 1389 * @param address_type (public (0), random (1)) 1390 * @param bd_addr 1391 */ 1392 const hci_cmd_t hci_le_remove_device_from_white_list = { 1393 HCI_OPCODE_HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST, "1B" 1394 // return: status 1395 }; 1396 1397 /** 1398 * @param conn_handle 1399 * @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec) 1400 * @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec) 1401 * @param conn_latency ([0x0000,0x03e8], number of connection events) 1402 * @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec) 1403 * @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec) 1404 * @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec) 1405 */ 1406 const hci_cmd_t hci_le_connection_update = { 1407 HCI_OPCODE_HCI_LE_CONNECTION_UPDATE, "H222222" 1408 // return: none -> le connection update complete event 1409 }; 1410 1411 /** 1412 * @param channel_map_lower_32bits 1413 * @param channel_map_higher_5bits 1414 */ 1415 const hci_cmd_t hci_le_set_host_channel_classification = { 1416 HCI_OPCODE_HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION, "41" 1417 // return: status 1418 }; 1419 1420 /** 1421 * @param conn_handle 1422 */ 1423 const hci_cmd_t hci_le_read_channel_map = { 1424 HCI_OPCODE_HCI_LE_READ_CHANNEL_MAP, "H" 1425 // return: status, connection handle, channel map (5 bytes, 37 used) 1426 }; 1427 1428 /** 1429 * @param conn_handle 1430 */ 1431 const hci_cmd_t hci_le_read_remote_used_features = { 1432 HCI_OPCODE_HCI_LE_READ_REMOTE_USED_FEATURES, "H" 1433 // return: none -> le read remote used features complete event 1434 }; 1435 1436 /** 1437 * @param key ((128) for AES-128) 1438 * @param plain_text (128) 1439 */ 1440 const hci_cmd_t hci_le_encrypt = { 1441 HCI_OPCODE_HCI_LE_ENCRYPT, "PP" 1442 // return: status, encrypted data (128) 1443 }; 1444 1445 const hci_cmd_t hci_le_rand = { 1446 HCI_OPCODE_HCI_LE_RAND, "" 1447 // return: status, random number (64) 1448 }; 1449 1450 /** 1451 * @param conn_handle 1452 * @param random_number_lower_32bits 1453 * @param random_number_higher_32bits 1454 * @param encryption_diversifier (16) 1455 * @param long_term_key (128) 1456 */ 1457 const hci_cmd_t hci_le_start_encryption = { 1458 HCI_OPCODE_HCI_LE_START_ENCRYPTION, "H442P" 1459 // return: none -> encryption changed or encryption key refresh complete event 1460 }; 1461 1462 /** 1463 * @param connection_handle 1464 * @param long_term_key (128) 1465 */ 1466 const hci_cmd_t hci_le_long_term_key_request_reply = { 1467 HCI_OPCODE_HCI_LE_LONG_TERM_KEY_REQUEST_REPLY, "HP" 1468 // return: status, connection handle 1469 }; 1470 1471 /** 1472 * @param conn_handle 1473 */ 1474 const hci_cmd_t hci_le_long_term_key_negative_reply = { 1475 HCI_OPCODE_HCI_LE_LONG_TERM_KEY_NEGATIVE_REPLY, "H" 1476 // return: status, connection handle 1477 }; 1478 1479 /** 1480 * @param conn_handle 1481 */ 1482 const hci_cmd_t hci_le_read_supported_states = { 1483 HCI_OPCODE_HCI_LE_READ_SUPPORTED_STATES, "H" 1484 // return: status, LE states (64) 1485 }; 1486 1487 /** 1488 * @param rx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2) 1489 */ 1490 const hci_cmd_t hci_le_receiver_test = { 1491 HCI_OPCODE_HCI_LE_RECEIVER_TEST, "1" 1492 // return: status 1493 }; 1494 1495 /** 1496 * @param tx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2) 1497 * @param test_payload_lengh ([0x00,0x25]) 1498 * @param packet_payload ([0,7] different patterns) 1499 */ 1500 const hci_cmd_t hci_le_transmitter_test = { 1501 HCI_OPCODE_HCI_LE_TRANSMITTER_TEST, "111" 1502 // return: status 1503 }; 1504 1505 /** 1506 * @param end_test_cmd 1507 */ 1508 const hci_cmd_t hci_le_test_end = { 1509 HCI_OPCODE_HCI_LE_TEST_END, "1" 1510 // return: status, number of packets (8) 1511 }; 1512 1513 /** 1514 * @param conn_handle 1515 * @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec) 1516 * @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec) 1517 * @param conn_latency ([0x0000,0x03e8], number of connection events) 1518 * @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec) 1519 * @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec) 1520 * @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec) 1521 */ 1522 const hci_cmd_t hci_le_remote_connection_parameter_request_reply = { 1523 HCI_OPCODE_HCI_LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY, "H222222" 1524 // return: status, connection handle 1525 }; 1526 1527 /** 1528 * @param con_handle 1529 * @param reason 1530 */ 1531 const hci_cmd_t hci_le_remote_connection_parameter_request_negative_reply = { 1532 HCI_OPCODE_HCI_LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY, "H1" 1533 // return: status, connection handle 1534 }; 1535 1536 /** 1537 * @param con_handle 1538 * @param tx_octets 1539 * @param tx_time 1540 */ 1541 const hci_cmd_t hci_le_set_data_length = { 1542 HCI_OPCODE_HCI_LE_SET_DATA_LENGTH, "H22" 1543 // return: status, connection handle 1544 }; 1545 1546 /** 1547 */ 1548 const hci_cmd_t hci_le_read_suggested_default_data_length = { 1549 HCI_OPCODE_HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH, "" 1550 // return: status, suggested max tx octets, suggested max tx time 1551 }; 1552 1553 /** 1554 * @param suggested_max_tx_octets 1555 * @param suggested_max_tx_time 1556 */ 1557 const hci_cmd_t hci_le_write_suggested_default_data_length = { 1558 HCI_OPCODE_HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH, "22" 1559 // return: status 1560 }; 1561 1562 /** 1563 */ 1564 const hci_cmd_t hci_le_read_local_p256_public_key = { 1565 HCI_OPCODE_HCI_LE_READ_LOCAL_P256_PUBLIC_KEY, "" 1566 // LE Read Local P-256 Public Key Complete is generated on completion 1567 }; 1568 1569 /** 1570 * @param public key 1571 * @param private key 1572 */ 1573 const hci_cmd_t hci_le_generate_dhkey = { 1574 HCI_OPCODE_HCI_LE_GENERATE_DHKEY, "QQ" 1575 // LE Generate DHKey Complete is generated on completion 1576 }; 1577 1578 /** 1579 * @param Peer_Identity_Address_Type 1580 * @param Peer_Identity_Address 1581 * @param Peer_IRK 1582 * @param Local_IRK 1583 */ 1584 const hci_cmd_t hci_le_add_device_to_resolving_list = { 1585 HCI_OPCODE_HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST, "1BPP" 1586 }; 1587 1588 /** 1589 * @param Peer_Identity_Address_Type 1590 * @param Peer_Identity_Address 1591 */ 1592 const hci_cmd_t hci_le_remove_device_from_resolving_list = { 1593 HCI_OPCODE_HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST, "1B" 1594 }; 1595 1596 /** 1597 */ 1598 const hci_cmd_t hci_le_clear_resolving_list = { 1599 HCI_OPCODE_HCI_LE_CLEAR_RESOLVING_LIST, "" 1600 }; 1601 1602 /** 1603 */ 1604 const hci_cmd_t hci_le_read_resolving_list_size = { 1605 HCI_OPCODE_HCI_LE_READ_RESOLVING_LIST_SIZE, "" 1606 }; 1607 1608 /** 1609 * @param Peer_Identity_Address_Type 1610 * @param Peer_Identity_Address 1611 */ 1612 const hci_cmd_t hci_le_read_peer_resolvable_address = { 1613 HCI_OPCODE_HCI_LE_READ_PEER_RESOLVABLE_ADDRESS, "" 1614 }; 1615 1616 /** 1617 * @param Peer_Identity_Address_Type 1618 * @param Peer_Identity_Address 1619 */ 1620 const hci_cmd_t hci_le_read_local_resolvable_address = { 1621 HCI_OPCODE_HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS, "" 1622 }; 1623 1624 /** 1625 * @param Address_Resolution_Enable 1626 */ 1627 const hci_cmd_t hci_le_set_address_resolution_enabled= { 1628 HCI_OPCODE_HCI_LE_SET_ADDRESS_RESOLUTION_ENABLED, "1" 1629 }; 1630 1631 /** 1632 * @param RPA_Timeout in seconds, range 0x0001 to 0x0E10, default: 900 s 1633 */ 1634 const hci_cmd_t hci_le_set_resolvable_private_address_timeout= { 1635 HCI_OPCODE_HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT, "2" 1636 }; 1637 1638 /** 1639 */ 1640 const hci_cmd_t hci_le_read_maximum_data_length = { 1641 HCI_OPCODE_HCI_LE_READ_MAXIMUM_DATA_LENGTH, "" 1642 // return: status, supported max tx octets, supported max tx time, supported max rx octets, supported max rx time 1643 }; 1644 1645 /** 1646 * @param con_handle 1647 */ 1648 const hci_cmd_t hci_le_read_phy = { 1649 HCI_OPCODE_HCI_LE_READ_PHY, "H" 1650 // return: status, connection handler, tx phy, rx phy 1651 }; 1652 1653 /** 1654 * @param all_phys 1655 * @param tx_phys 1656 * @param rx_phys 1657 */ 1658 const hci_cmd_t hci_le_set_default_phy = { 1659 HCI_OPCODE_HCI_LE_SET_DEFAULT_PHY, "111" 1660 // return: status 1661 }; 1662 1663 /** 1664 * @param con_handle 1665 * @param all_phys 1666 * @param tx_phys 1667 * @param rx_phys 1668 * @param phy_options 1669 */ 1670 const hci_cmd_t hci_le_set_phy = { 1671 HCI_OPCODE_HCI_LE_SET_PHY, "H1112" 1672 // LE PHY Update Complete is generated on completion 1673 }; 1674 1675 /** 1676 * @param rx_channel 1677 * @param phy 1678 * @param modulation_index 1679 */ 1680 const hci_cmd_t hci_le_receiver_test_v2 = { 1681 HCI_OPCODE_HCI_LE_RECEIVER_TEST_V2, "111" 1682 }; 1683 1684 /** 1685 * @param tx_channel 1686 * @param test_data_length 1687 * @param packet_payload 1688 * @param phy 1689 */ 1690 const hci_cmd_t hci_le_transmitter_test_v2 = { 1691 HCI_OPCODE_HCI_LE_TRANSMITTER_TEST_V2, "1111" 1692 }; 1693 1694 /** 1695 * @param advertising_handle 1696 * @param random_address 1697 */ 1698 const hci_cmd_t hci_le_set_advertising_set_random_address = { 1699 HCI_OPCODE_HCI_LE_SET_ADVERTISING_SET_RANDOM_ADDRESS, "1B" 1700 }; 1701 1702 /** 1703 * @param advertising_handle 1704 * @param advertising_event_properties 1705 * @param primary_advertising_interval_min in 0.625 ms, range: 0x000020..0xffffff 1706 * @param primary_advertising_interval_max in 0.625 ms, range: 0x000020..0xffffff 1707 * @param primary_advertising_channel_map 1708 * @param own_address_type 1709 * @param peer_address_type 1710 * @param peer_address 1711 * @param advertising_filter_policy 1712 * @param advertising_tx_power in dBm, range: -127..20 1713 * @param primary_advertising_phy 1714 * @param secondary_advertising_max_skip 1715 * @param secondary_advertising_phy 1716 * @param advertising_sid 1717 * @param scan_request_notification_enable 1718 */ 1719 const hci_cmd_t hci_le_set_extended_advertising_parameters = { 1720 HCI_OPCODE_HCI_LE_SET_EXTENDED_ADVERTISING_PARAMETERS, "1233111B1111111" 1721 }; 1722 1723 /** 1724 * @param advertising_handle 1725 * @param operation 1726 * @param fragment_preference 1727 * @param advertising_data_length 1728 * @param advertising_data 1729 */ 1730 1731 const hci_cmd_t hci_le_set_extended_advertising_data = { 1732 HCI_OPCODE_HCI_LE_SET_EXTENDED_ADVERTISING_DATA, "111JV" 1733 }; 1734 1735 /** 1736 * @param advertising_handle 1737 * @param operation 1738 * @param fragment_preference 1739 * @param scan_response_data_length 1740 * @param scan_response_data 1741 */ 1742 1743 const hci_cmd_t hci_le_set_extended_scan_response_data = { 1744 HCI_OPCODE_HCI_LE_SET_EXTENDED_SCAN_RESPONSE_DATA, "111JV" 1745 }; 1746 1747 /** 1748 * @param enable 1749 * @param num_sets 1750 * @param advertising_handle[i] 1751 * @param duration[i] 1752 * @param max_extended_advertising_events[i] 1753 */ 1754 1755 const hci_cmd_t hci_le_set_extended_advertising_enable = { 1756 HCI_OPCODE_HCI_LE_SET_EXTENDED_ADVERTISING_ENABLE, "1a[121]" 1757 }; 1758 1759 /** 1760 */ 1761 const hci_cmd_t hci_le_read_maximum_advertising_data_length = { 1762 HCI_OPCODE_HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH, "" 1763 }; 1764 1765 /** 1766 */ 1767 const hci_cmd_t hci_le_read_number_of_supported_advertising_sets = { 1768 HCI_OPCODE_HCI_LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS, "" 1769 }; 1770 1771 /** 1772 * @param advertising_handle 1773 */ 1774 const hci_cmd_t hci_le_remove_advertising_set = { 1775 HCI_OPCODE_HCI_LE_REMOVE_ADVERTISING_SET, "1" 1776 }; 1777 1778 /** 1779 */ 1780 const hci_cmd_t hci_le_clear_advertising_sets = { 1781 HCI_OPCODE_HCI_LE_CLEAR_ADVERTISING_SETS, "" 1782 }; 1783 1784 /** 1785 * @param advertising_handle 1786 * @param periodic_advertising_interval_min * 1.25 ms, range 0x0006..0xffff 1787 * @param periodic_advertising_interval_max * 1.25 ms, range 0x0006..0xffff 1788 * @param periodic_advertising_properties 1789 */ 1790 const hci_cmd_t hci_le_set_periodic_advertising_parameters = { 1791 HCI_OPCODE_HCI_LE_SET_PERIODIC_ADVERTISING_PARAMETERS, "1222" 1792 }; 1793 1794 /** 1795 * @param advertising_handle 1796 * @param operation 1797 * @param advertising_data_length 1798 * @param advertising_data 1799 */ 1800 1801 const hci_cmd_t hci_le_set_periodic_advertising_data = { 1802 HCI_OPCODE_HCI_LE_SET_PERIODIC_ADVERTISING_DATA, "11JV" 1803 }; 1804 1805 /** 1806 * @param enable 1807 * @param advertising_handle 1808 */ 1809 const hci_cmd_t hci_le_set_periodic_advertising_enable = { 1810 HCI_OPCODE_HCI_LE_SET_PERIODIC_ADVERTISING_ENABLE, "11" 1811 }; 1812 1813 /** 1814 * @param own_address_type 1815 * @param scanning_filter_policy 1816 * @param scanning_phys 0 = LE 1M PHY | 2 = LE Coded PHY 1817 * @param scan_type[i] 1818 * @param scan_interval[i] * 0.625, range = 0x0004..0xffff 1819 * @param scan_window[i] * 0.625, range = 0x0004..0xffff 1820 */ 1821 1822 const hci_cmd_t hci_le_set_extended_scan_parameters = { 1823 HCI_OPCODE_HCI_LE_SET_EXTENDED_SCAN_PARAMETERS, "11b[122]" 1824 }; 1825 1826 /** 1827 * @param enable 1828 * @param filter_duplicates 1829 * @param duration 0 = Scan continuously until explicitly disable, 10 ms 1830 * @param period 0 = Scan continuously, 1.28 s 1831 */ 1832 const hci_cmd_t hci_le_set_extended_scan_enable = { 1833 HCI_OPCODE_HCI_LE_SET_EXTENDED_SCAN_ENABLE, "1122" 1834 }; 1835 1836 /** 1837 * @param initiator_filter_policy 1838 * @param own_address_type 1839 * @param peer_address_type 1840 * @param peer_address 1841 * @param initiating_phys with bit 0 = LE 1M PHY, bit 1 = LE 2M PHY, bit 2 = Coded PHY 1842 * @param scan_interval[i] * 0.625 ms 1843 * @param scan_window[i] * 0.625 ms 1844 * @param connection_interval_min[i] * 1.25 ms 1845 * @param connection_interval_max[i] * 1.25 ms 1846 * @param connection_latency[i] 1847 * @param supervision_timeout[i] * 10 ms 1848 * @param min_ce_length[i] * 0.625 ms 1849 * @param max_ce_length[i] * 0.625 ms 1850 */ 1851 1852 const hci_cmd_t hci_le_extended_create_connection = { 1853 HCI_OPCODE_HCI_LE_EXTENDED_CREATE_CONNECTION, "111Bb[22222222]" 1854 }; 1855 1856 /** 1857 * @param options 1858 * @param advertising_sid 1859 * @param advertiser_address_type 1860 * @param advertiser_address 1861 * @param skip 1862 * @param sync_timeout * 10 ms 1863 * @param sync_cte_type 1864 */ 1865 const hci_cmd_t hci_le_periodic_advertising_create_sync = { 1866 HCI_OPCODE_HCI_LE_PERIODIC_ADVERTISING_CREATE_SYNC, "111B221" 1867 }; 1868 1869 /** 1870 */ 1871 const hci_cmd_t hci_le_periodic_advertising_create_sync_cancel = { 1872 HCI_OPCODE_HCI_LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL, "" 1873 }; 1874 1875 /** 1876 * @param sync_handle 1877 */ 1878 const hci_cmd_t hci_le_periodic_advertising_terminate_sync = { 1879 HCI_OPCODE_HCI_LE_PERIODIC_ADVERTISING_TERMINATE_SYNC, "2" 1880 }; 1881 1882 /** 1883 * @param advertiser_address_type 1884 * @param advertiser_address 1885 * @param advertising_sid 1886 */ 1887 const hci_cmd_t hci_le_add_device_to_periodic_advertiser_list = { 1888 HCI_OPCODE_HCI_LE_ADD_DEVICE_TO_PERIODIC_ADVERTISER_LIST, "1B1" 1889 }; 1890 1891 /** 1892 * @param advertiser_address_type 1893 * @param advertiser_address 1894 * @param advertising_sid 1895 */ 1896 const hci_cmd_t hci_le_remove_device_from_periodic_advertiser_list = { 1897 HCI_OPCODE_HCI_LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISER_LIST, "1B1" 1898 }; 1899 1900 /** 1901 */ 1902 const hci_cmd_t hci_le_clear_periodic_advertiser_list = { 1903 HCI_OPCODE_HCI_LE_CLEAR_PERIODIC_ADVERTISER_LIST, "" 1904 }; 1905 1906 /** 1907 */ 1908 const hci_cmd_t hci_le_read_periodic_advertiser_list_size = { 1909 HCI_OPCODE_HCI_LE_READ_PERIODIC_ADVERTISER_LIST_SIZE, "" 1910 }; 1911 1912 /** 1913 */ 1914 const hci_cmd_t hci_le_read_transmit_power = { 1915 HCI_OPCODE_HCI_LE_READ_TRANSMIT_POWER, "" 1916 }; 1917 1918 /** 1919 */ 1920 const hci_cmd_t hci_le_read_rf_path_compensation = { 1921 HCI_OPCODE_HCI_LE_READ_RF_PATH_COMPENSATION, "" 1922 }; 1923 1924 /** 1925 * @param rf_tx_path_compensation_value * 0.1 dB, signed 1926 * @param rf_rx_path_compensation_value * 0.1 dB, signed 1927 */ 1928 const hci_cmd_t hci_le_write_rf_path_compensation = { 1929 HCI_OPCODE_HCI_LE_WRITE_RF_PATH_COMPENSATION, "22" 1930 }; 1931 1932 /** 1933 * @param peer_identity_address_type 1934 * @param peer_identity_address 1935 * @param privacy_mode 1936 */ 1937 const hci_cmd_t hci_le_set_privacy_mode = { 1938 HCI_OPCODE_HCI_LE_SET_PRIVACY_MODE, "1B1" 1939 }; 1940 1941 /** 1942 * @param rx_channel 1943 * @param phy 1944 * @param modulation_index 1945 * @param expected_cte_length 1946 * @param expected_cte_type 1947 * @param slot_durations 1948 * @param switching_pattern_length 1949 * @param antenna_ids[i] 1950 */ 1951 1952 const hci_cmd_t hci_le_receiver_test_v3 = { 1953 HCI_OPCODE_HCI_LE_RECEIVER_TEST_V3, "111111a[1]" 1954 }; 1955 1956 /** 1957 * @param tx_channel 1958 * @param test_data_length 1959 * @param packet_payload 1960 * @param phy 1961 * @param cte_length 1962 * @param cte_type 1963 * @param switching_pattern_length 1964 * @param antenna_ids[i] 1965 */ 1966 1967 const hci_cmd_t hci_le_transmitter_test_v3 = { 1968 HCI_OPCODE_HCI_LE_TRANSMITTER_TEST_V3, "111111a[1]" 1969 }; 1970 1971 /** 1972 * @param advertising_handle 1973 * @param cte_length 1974 * @param cte_type 1975 * @param cte_count 1976 * @param switching_pattern_length 1977 * @param antenna_ids[i] 1978 */ 1979 1980 const hci_cmd_t hci_le_set_connectionless_cte_transmit_parameters = { 1981 HCI_OPCODE_HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_PARAMETERS, "1111a[1]" 1982 }; 1983 1984 /** 1985 * @param advertising_handle 1986 * @param cte_enable 1987 */ 1988 const hci_cmd_t hci_le_set_connectionless_cte_transmit_enable = { 1989 HCI_OPCODE_HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_ENABLE, "11" 1990 }; 1991 1992 /** 1993 * @param sync_handle 1994 * @param sampling_enable 1995 * @param slot_durations 1996 * @param max_sampled_ctes 1997 * @param switching_pattern_length 1998 * @param antenna_ids[i] 1999 */ 2000 2001 const hci_cmd_t hci_le_set_connectionless_iq_sampling_enable = { 2002 HCI_OPCODE_HCI_LE_SET_CONNECTIONLESS_IQ_SAMPLING_ENABLE, "2111a[i]" 2003 }; 2004 2005 /** 2006 * @param connection_handle 2007 * @param sampling_enable 2008 * @param slot_durations 2009 * @param switching_pattern_length 2010 * @param antenna_ids[i] 2011 */ 2012 2013 const hci_cmd_t hci_le_set_connection_cte_receive_parameters = { 2014 HCI_OPCODE_HCI_LE_SET_CONNECTION_CTE_RECEIVE_PARAMETERS, "211a[1]" 2015 }; 2016 2017 /** 2018 * @param connection_handle 2019 * @param cte_types 2020 * @param switching_pattern_length 2021 * @param antenna_ids[i] 2022 */ 2023 2024 const hci_cmd_t hci_le_set_connection_cte_transmit_parameters = { 2025 HCI_OPCODE_HCI_LE_SET_CONNECTION_CTE_TRANSMIT_PARAMETERS, "21a[1]" 2026 }; 2027 2028 /** 2029 * @param connection_handle 2030 * @param enable 2031 * @param cte_request_interval 2032 * @param requested_cte_length 2033 * @param requested_cte_type 2034 */ 2035 const hci_cmd_t hci_le_connection_cte_request_enable = { 2036 HCI_OPCODE_HCI_LE_CONNECTION_CTE_REQUEST_ENABLE, "H1211" 2037 }; 2038 2039 /** 2040 * @param connection_handle 2041 * @param enable 2042 */ 2043 const hci_cmd_t hci_le_connection_cte_response_enable = { 2044 HCI_OPCODE_HCI_LE_CONNECTION_CTE_RESPONSE_ENABLE, "H1" 2045 }; 2046 2047 /** 2048 */ 2049 const hci_cmd_t hci_le_read_antenna_information = { 2050 HCI_OPCODE_HCI_LE_READ_ANTENNA_INFORMATION, "" 2051 }; 2052 2053 /** 2054 * @param sync_handle 2055 * @param enable 2056 */ 2057 const hci_cmd_t hci_le_set_periodic_advertising_receive_enable = { 2058 HCI_OPCODE_HCI_LE_SET_PERIODIC_ADVERTISING_RECEIVE_ENABLE, "H1" 2059 }; 2060 2061 /** 2062 * @param connection_handle 2063 * @param service_data 2064 * @param sync_handle 2065 */ 2066 const hci_cmd_t hci_le_periodic_advertising_sync_transfer = { 2067 HCI_OPCODE_HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER, "H22" 2068 }; 2069 2070 /** 2071 * @param connection_handle 2072 * @param service_data 2073 * @param advertising_handle 2074 */ 2075 const hci_cmd_t hci_le_periodic_advertising_set_info_transfer = { 2076 HCI_OPCODE_HCI_LE_PERIODIC_ADVERTISING_SET_INFO_TRANSFER, "H21" 2077 }; 2078 2079 /** 2080 * @param connection_handle 2081 * @param mode 2082 * @param skip 2083 * @param sync_timeout 2084 * @param cte_type 2085 */ 2086 const hci_cmd_t hci_le_set_periodic_advertising_sync_transfer_parameters = { 2087 HCI_OPCODE_HCI_LE_SET_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAMETERS, "H1221" 2088 }; 2089 2090 /** 2091 * @param mode 2092 * @param skip 2093 * @param sync_timeout 2094 * @param cte_type 2095 */ 2096 const hci_cmd_t hci_le_set_default_periodic_advertising_sync_transfer_parameters = { 2097 HCI_OPCODE_HCI_LE_SET_DEFAULT_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAMETERS, "1221" 2098 }; 2099 2100 /** 2101 * @param 256Remote_P-256_public_key_x 2102 * @param 256Remote_P-256_public_key_y 2103 * @param key_type 2104 */ 2105 const hci_cmd_t hci_le_generate_dhkey_v2 = { 2106 HCI_OPCODE_HCI_LE_GENERATE_DHKEY_V2, "QQ1" 2107 }; 2108 2109 /** 2110 * @param action 2111 */ 2112 const hci_cmd_t hci_le_modify_sleep_clock_accuracy = { 2113 HCI_OPCODE_HCI_LE_MODIFY_SLEEP_CLOCK_ACCURACY, "1" 2114 }; 2115 2116 /** 2117 */ 2118 const hci_cmd_t hci_le_read_buffer_size_v2 = { 2119 HCI_OPCODE_HCI_LE_READ_BUFFER_SIZE_V2, "" 2120 }; 2121 2122 /** 2123 * @param connection_handle 2124 */ 2125 const hci_cmd_t hci_le_read_iso_tx_sync = { 2126 HCI_OPCODE_HCI_LE_READ_ISO_TX_SYNC, "H" 2127 }; 2128 2129 /** 2130 * @param cig_id 2131 * @param sdu_interval_m_to_s 2132 * @param sdu_interval_s_to_m 2133 * @param slaves_clock_accuracy 2134 * @param packing 2135 * @param framing 2136 * @param max_transport_latency_m_to_s 2137 * @param max_transport_latency_s_to_m 2138 * @param cis_count 2139 * @param cis_id[i] 2140 * @param max_sdu_m_to_s[i] 2141 * @param max_sdu_s_to_m[i] 2142 * @param phy_m_to_s[i] 2143 * @param phy_s_to_m[i] 2144 * @param rtn_m_to_s[i] 2145 * @param rtn_s_to_m[i] 2146 */ 2147 2148 const hci_cmd_t hci_le_set_cig_parameters = { 2149 HCI_OPCODE_HCI_LE_SET_CIG_PARAMETERS, "13311122a[1221111]" 2150 }; 2151 2152 /** 2153 * @param cig_id 2154 * @param sdu_interval_m_to_s 2155 * @param sdu_interval_s_to_m 2156 * @param ft_m_to_s 2157 * @param ft_s_to_m 2158 * @param iso_interval 2159 * @param slaves_clock_accuracy 2160 * @param packing 2161 * @param framing 2162 * @param max_transport_latency_m_to_s 2163 * @param max_transport_latency_s_to_m 2164 * @param cis_count 2165 * @param cis_id[i] 2166 * @param nse[i] 2167 * @param max_sdu_m_to_s[i] 2168 * @param max_sdu_s_to_m[i] 2169 * @param max_pdu_m_to_s[i] 2170 * @param max_pdu_s_to_m[i] 2171 * @param phy_m_to_s[i] 2172 * @param phy_s_to_m[i] 2173 * @param bn_m_to_s[i] 2174 * @param bn_s_to_m[i] 2175 */ 2176 2177 const hci_cmd_t hci_le_set_cig_parameters_test = { 2178 HCI_OPCODE_HCI_LE_SET_CIG_PARAMETERS_TEST, "133112111a[1122221111]" 2179 }; 2180 2181 /** 2182 * @param cis_count 2183 * @param cis_connection_handle[i] 2184 * @param acl_connection_handle[i] 2185 */ 2186 2187 const hci_cmd_t hci_le_create_cis = { 2188 HCI_OPCODE_HCI_LE_CREATE_CIS, "a[22]" 2189 }; 2190 2191 /** 2192 * @param cig_id 2193 */ 2194 const hci_cmd_t hci_le_remove_cig = { 2195 HCI_OPCODE_HCI_LE_REMOVE_CIG, "1" 2196 }; 2197 2198 /** 2199 * @param connection_handle 2200 */ 2201 const hci_cmd_t hci_le_accept_cis_request = { 2202 HCI_OPCODE_HCI_LE_ACCEPT_CIS_REQUEST, "H" 2203 }; 2204 2205 /** 2206 * @param connection_handle 2207 */ 2208 const hci_cmd_t hci_le_reject_cis_request = { 2209 HCI_OPCODE_HCI_LE_REJECT_CIS_REQUEST, "H1" 2210 }; 2211 2212 /** 2213 * @param big_handle 2214 * @param advertising_handle 2215 * @param num_bis 2216 * @param sdu_interval 2217 * @param max_sdu 2218 * @param max_transport_latency 2219 * @param rtn 2220 * @param phy 2221 * @param packing 2222 * @param framing 2223 * @param encryption 2224 * @param broadcast_code 2225 */ 2226 const hci_cmd_t hci_le_create_big = { 2227 HCI_OPCODE_HCI_LE_CREATE_BIG, "11132211111K" 2228 }; 2229 2230 /** 2231 * @param big_handle 2232 * @param advertising_handle 2233 * @param num_bis 2234 * @param sdu_interval 2235 * @param iso_interval 2236 * @param nse 2237 * @param max_sdu 2238 * @param max_PDU 2239 * @param phy 2240 * @param packing 2241 * @param framing 2242 * @param bn 2243 * @param irc 2244 * @param pto 2245 * @param encryption 2246 * @param broadcast_code 2247 */ 2248 const hci_cmd_t hci_le_create_big_test = { 2249 HCI_OPCODE_HCI_LE_CREATE_BIG_TEST, "111321221111111K" 2250 }; 2251 2252 /** 2253 * @param big_handle 2254 * @param reason 2255 */ 2256 const hci_cmd_t hci_le_terminate_big = { 2257 HCI_OPCODE_HCI_LE_TERMINATE_BIG, "11" 2258 }; 2259 2260 /** 2261 * @param big_handle 2262 * @param sync_handle 2263 * @param encryption 2264 * @param broadcast_code 2265 * @param mse 2266 * @param big_sync_timeout 2267 * @param num_bis 2268 * @param bis[i] 2269 */ 2270 2271 const hci_cmd_t hci_le_big_create_sync = { 2272 HCI_OPCODE_HCI_LE_BIG_CREATE_SYNC, "1H1K12a[1]" 2273 }; 2274 2275 /** 2276 * @param big_handle 2277 */ 2278 const hci_cmd_t hci_le_big_terminate_sync = { 2279 HCI_OPCODE_HCI_LE_BIG_TERMINATE_SYNC, "1" 2280 }; 2281 2282 /** 2283 * @param connection_handle 2284 */ 2285 const hci_cmd_t hci_le_request_peer_sca = { 2286 HCI_OPCODE_HCI_LE_REQUEST_PEER_SCA, "H" 2287 }; 2288 2289 /** 2290 * @param connection_handle 2291 * @param data_path_direction 2292 * @param data_path_id 2293 * @param codec_id_coding_format 2294 * @param codec_id_company_identifier (Shall be ignored if codec_id_coding_format is not 0xFF) 2295 * @param codec_id_vendor_codec_id (Shall be ignored if codec_id_coding_format is not 0xFF) 2296 * @param controller_delay 2297 * @param codec_configuration_length 2298 * @param codec_configuration 2299 */ 2300 2301 const hci_cmd_t hci_le_setup_iso_data_path = { 2302 HCI_OPCODE_HCI_LE_SETUP_ISO_DATA_PATH, "H111223JV" 2303 }; 2304 2305 /** 2306 * @param connection_handle 2307 */ 2308 const hci_cmd_t hci_le_remove_iso_data_path = { 2309 HCI_OPCODE_HCI_LE_REMOVE_ISO_DATA_PATH, "H1" 2310 }; 2311 2312 /** 2313 * @param connection_handle 2314 * @param paylaod_type 2315 */ 2316 const hci_cmd_t hci_le_iso_transmit_test = { 2317 HCI_OPCODE_HCI_LE_ISO_TRANSMIT_TEST, "H1" 2318 }; 2319 2320 /** 2321 * @param connection_handle 2322 * @param paylaod_type 2323 */ 2324 const hci_cmd_t hci_le_iso_receive_test = { 2325 HCI_OPCODE_HCI_LE_ISO_RECEIVE_TEST, "H1" 2326 }; 2327 2328 /** 2329 * @param connection_handle 2330 */ 2331 const hci_cmd_t hci_le_iso_read_test_counters = { 2332 HCI_OPCODE_HCI_LE_ISO_READ_TEST_COUNTERS, "H" 2333 }; 2334 2335 /** 2336 * @param connection_handle 2337 */ 2338 const hci_cmd_t hci_le_iso_test_end = { 2339 HCI_OPCODE_HCI_LE_ISO_TEST_END, "H" 2340 }; 2341 2342 /** 2343 * @param bit_number 2344 * @param bit_value 2345 */ 2346 const hci_cmd_t hci_le_set_host_feature = { 2347 HCI_OPCODE_HCI_LE_SET_HOST_FEATURE, "11" 2348 }; 2349 2350 /** 2351 * @param connection_handle 2352 */ 2353 const hci_cmd_t hci_le_read_iso_link_quality = { 2354 HCI_OPCODE_HCI_LE_READ_ISO_LINK_QUALITY, "H" 2355 }; 2356 2357 /** 2358 * @param connection_handle 2359 * @param phy 2360 */ 2361 const hci_cmd_t hci_le_enhanced_read_transmit_power_level = { 2362 HCI_OPCODE_HCI_LE_ENHANCED_READ_TRANSMIT_POWER_LEVEL, "H1" 2363 }; 2364 2365 /** 2366 * @param connection_handle 2367 * @param phy 2368 */ 2369 const hci_cmd_t hci_le_read_remote_transmit_power_level = { 2370 HCI_OPCODE_HCI_LE_READ_REMOTE_TRANSMIT_POWER_LEVEL, "H1" 2371 }; 2372 2373 /** 2374 * @param connection_handle 2375 * @param high_threshold 2376 * @param high_hysteresis 2377 * @param low_threshold 2378 * @param low_hysteresis 2379 * @param min_time_spent 2380 */ 2381 const hci_cmd_t hci_le_set_path_loss_reporting_parameters = { 2382 HCI_OPCODE_HCI_LE_SET_PATH_LOSS_REPORTING_PARAMETERS, "211112" 2383 }; 2384 2385 /** 2386 * @param connection_handle 2387 * @param enable 2388 */ 2389 const hci_cmd_t hci_le_set_path_loss_reporting_enable = { 2390 HCI_OPCODE_HCI_LE_SET_PATH_LOSS_REPORTING_ENABLE, "H1" 2391 }; 2392 2393 /** 2394 * @param connection_handle 2395 * @param local_enable 2396 * @param remote_enable 2397 */ 2398 const hci_cmd_t hci_le_set_transmit_power_reporting_enable = { 2399 HCI_OPCODE_HCI_LE_SET_TRANSMIT_POWER_REPORTING_ENABLE, "H11" 2400 }; 2401 2402 /** 2403 * @param tx_channel 2404 * @param test_data_length 2405 * @param packet_payload 2406 * @param phy 2407 * @param cte_length 2408 * @param cte_type 2409 * @param switching_pattern_length 2410 * @param antenna_ids[i] 2411 * @param transmit_power_level 2412 */ 2413 2414 const hci_cmd_t hci_le_transmitter_test_v4 = { 2415 HCI_OPCODE_HCI_LE_TRANSMITTER_TEST_V4, "111111a[1]1" 2416 }; 2417 2418 #endif 2419 2420 // Broadcom / Cypress specific HCI commands 2421 2422 /** 2423 * @brief Enable Wide-Band Speech / mSBC decoding for PCM 2424 * @param enable_wbs is 0 for disable, 1 for enable 2425 * @param uuid_wbs is 2 for EV2/EV3 2426 */ 2427 const hci_cmd_t hci_bcm_enable_wbs = { 2428 HCI_OPCODE_HCI_BCM_ENABLE_WBS, "12" 2429 // return: status 2430 }; 2431 2432 /** 2433 * @brief Configure SCO Routing (BCM) 2434 * @param sco_routing is 0 for PCM, 1 for Transport, 2 for Codec and 3 for I2S 2435 * @param pcm_interface_rate is 0 for 128KBps, 1 for 256 KBps, 2 for 512KBps, 3 for 1024KBps, and 4 for 2048Kbps 2436 * @param frame_type is 0 for short and 1 for long 2437 * @param sync_mode is 0 for slave and 1 for master 2438 * @param clock_mode is 0 for slabe and 1 for master 2439 */ 2440 const hci_cmd_t hci_bcm_write_sco_pcm_int = { 2441 HCI_OPCODE_HCI_BCM_WRITE_SCO_PCM_INT, "11111" 2442 // return: status 2443 }; 2444 2445 /** 2446 * @brief Configure PCM Data Format (BCM) 2447 * @param lsb_position 0x00 – LSB last/MSB first, 0x01 – LSB first/MSB last 2448 * @param fill_bits_value three bit value defines the fill bits used by the PCM interface,only if fill_data_selection == programmable 2449 * @param fill_data_selection 0x00 zeros, 0x01 ones, 0x02 sign bit, 0x03 programmable 2450 * @param number_of_fill_bits 0..3 2451 * @param right_left_justification 0x00 left justified, 0x01 right justified 2452 */ 2453 const hci_cmd_t hci_bcm_write_pcm_data_format_param = { 2454 HCI_OPCODE_HCI_BCM_WRITE_PCM_DATA_FORMAT_PARAM, "11111" 2455 // return: status 2456 }; 2457 2458 /** 2459 * @brief Configure the I2S/PCM interface (BCM) 2460 * @param i2s_enable is 0 for off, 1 for on 2461 * @param is_master is 0 for slave, is 1 for master 2462 * @param sample_rate is 0 for 8 kHz, 1 for 16 kHz, 2 for 4 kHz 2463 * @param clock_rate is 0 for 128 kz, 1 for 256 kHz, 2 for 512 khz, 3 for 1024 kHz, 4 for 2048 khz 2464 */ 2465 const hci_cmd_t hci_bcm_write_i2spcm_interface_param = { 2466 HCI_OPCODE_HCI_BCM_WRITE_I2SPCM_INTERFACE_PARAM, "1111" 2467 // return: status 2468 }; 2469 2470 2471 /** 2472 * @brief Activates selected Sleep Mode 2473 * @param sleep_mode: 0=no sleep, 1=UART, 2=UART with Messaging, 3=USB, 4=H4IBSS, USB with Host Wake, 6=SDIO, 7=UART CS-N, 8=SPI, 9=H5, 10=H4DS, 12=UART with BREAK 2474 * @param idle_threshold_host (modes 1,2,5,7) time until considered idle, unit roughly 300 ms 2475 * @param idle_threshold_controller (modes 1-7,9) time until considered idle, unit roughly 300 ms 2476 * @param bt_wake_active_mode (modes 1,2,7) 0 = BT_WAKE line is active high, 1 = BT_WAKE is active low 2477 * @param host_wake_active_mode (modes 1,2,5,7) 0 = HOST_WAKE line is active high, 1 = HOST_WAKE is active low 2478 * @param allow_host_sleep_during_sco (modes 1,2,3,5,7) 2479 * @param combine_sleep_mode_and_lpm (modes 1,2,3,5,7) 2480 * @param enable_tristate_control_of_uart_tx_line (modes 1,2,7) 2481 * @param active_connection_handling_on_suspend (modes 3,5) 2482 * @param resume_timeout (modes 3,5) 2483 * @param enable_break_to_host (mode 12) 2484 * @param pulsed_host_wake (modes 1,12) 2485 */ 2486 const hci_cmd_t hci_bcm_set_sleep_mode = { 2487 HCI_OPCODE_HCI_BCM_SET_SLEEP_MODE, "111111111111" 2488 }; 2489 2490 /** 2491 * @brief Set TX Power Table 2492 * @param is_le 0=classic, 1=LE 2493 * @param chip_max_tx_pwr_db chip level max TX power in dBM 2494 */ 2495 const hci_cmd_t hci_bcm_write_tx_power_table = { 2496 HCI_OPCODE_HCI_BCM_WRITE_TX_POWER_TABLE, "11" 2497 }; 2498 2499 const hci_cmd_t hci_bcm_set_tx_pwr = { 2500 HCI_OPCODE_HCI_BCM_SET_TX_PWR, "11H" 2501 }; 2502 2503 /** 2504 * @brief This command starts receiving packets using packet transmission parameters such as 2505 * frequency channel, packet type, and packet length. It is used for Packet RX. 2506 * @see processors.wiki.ti.com/index.php/CC256x_Testing_Guide#Continuous_RX 2507 * @param frequency 2508 * @param ADPLL loop mode 2509 */ 2510 const hci_cmd_t hci_ti_drpb_tester_con_rx = { 2511 0xFD17, "11" 2512 }; 2513 2514 /** 2515 * 2516 * 2517 * @brief This command tests the RF transceiver in continuous transmission mode. 2518 * The transmitter is activated by configuring the transmission parameters such as pattern, 2519 * modulation, and frequency. 2520 * @see processors.wiki.ti.com/index.php/CC256x_VS_HCI_Commands#HCI_VS_DRPb_Tester_Con_TX.280xFD84.29 2521 * @param modulation 2522 * @param test_pattern 2523 * @param frequency 2524 * @param power_level 2525 * @param reserved1 2526 * @param reserved2 2527 */ 2528 const hci_cmd_t hci_ti_drpb_tester_con_tx = { 2529 0xFD84, "111144" 2530 }; 2531 2532 /** 2533 * @brief This command starts sending/receiving packets using packet transmission parameters such as 2534 * frequency channel, packet type, and packet length. It is used for Packet TX/RX. 2535 * @see processors.wiki.ti.com/index.php/CC256x_VS_HCI_Commands#HCI_VS_DRPb_Tester_Packet_TX_RX_.280xFD85.29 2536 * @param frequency_mode 2537 * @param tx_single_frequency 2538 * @param rx_single_frequency 2539 * @param acl_packet_type 2540 * @paarm acl_packet_data_pattern 2541 * @param reserved 2542 * @param power_level 2543 * @param disable_whitening 2544 * @param prbs9_initialization_value 2545 */ 2546 const hci_cmd_t hci_ti_drpb_tester_packet_tx_rx = { 2547 0xFD85, "1111112112" 2548 }; 2549 2550 2551 /** 2552 * @param best effort access percentage 2553 * @param guaranteed access percentage 2554 * @param poll period 2555 * @param slave burst after tx 2556 * @param slave master search count 2557 * @param master burst after tx enable 2558 * @param master burst after rx limit 2559 */ 2560 const hci_cmd_t hci_ti_configure_ddip = { 2561 HCI_OPCODE_HCI_TI_VS_CONFIGURE_DDIP, "1111111" 2562 }; 2563 2564 /** 2565 * @brief This command is used to associate the requested ACL handle with Wide Band Speech configuration. 2566 * @param enable 0=disable, 1=enable 2567 * @param a3dp_role (NL5500, WL128x only) 0=source,1=sink 2568 * @param code_upload (NL5500, WL128x only) 0=do not load a3dp code, 1=load a3dp code 2569 * @param reserved for future use 2570 */ 2571 const hci_cmd_t hci_ti_avrp_enable = { 2572 0xFD92, "1112" 2573 }; 2574 2575 /** 2576 * @brief This command is used to associate the requested ACL handle with Wide Band Speech configuration. 2577 * @param acl_con_handle 2578 */ 2579 const hci_cmd_t hci_ti_wbs_associate = { 2580 0xFD78, "H" 2581 }; 2582 2583 /** 2584 * @brief This command is used to disassociate Wide Band Speech configuration from any ACL handle. 2585 */ 2586 const hci_cmd_t hci_ti_wbs_disassociate = { 2587 0xFD79, "" 2588 }; 2589 2590 /** 2591 * @brief This command configures the codec interface parameters and the PCM clock rate, which is relevant when 2592 the Bluetooth core generates the clock. This command must be used by the host to use the PCM 2593 interface. 2594 * @param clock_rate in kHz 2595 * @param clock_direction 0=master/output, 1=slave/input 2596 * @param frame_sync_frequency in Hz 2597 * @param frame_sync_duty_cycle 0=50% (I2S Format), 0x0001-0xffff number of cycles of PCM clock 2598 * @param frame_sync_edge 0=driven/sampled at rising edge, 1=driven/sampled at falling edge of PCM clock 2599 * @param frame_sync_polariy 0=active high, 1=active low 2600 * @param reserved1 2601 * @param channel_1_data_out_size sample size in bits 2602 * @param channel_1_data_out_offset number of PCM clock cycles between rising of frame sync and data start 2603 * @param channel_1_data_out_edge 0=data driven at rising edge, 1=data driven at falling edge of PCM clock 2604 * @param channel_1_data_in_size sample size in bits 2605 * @param channel_1_data_in_offset number of PCM clock cycles between rising of frame sync and data start 2606 * @param channel_1_data_in_edge 0=data sampled at rising edge, 1=data sampled at falling edge of PCM clock 2607 * @param fsync_multiplier this field is only relevant to CC256XB from service pack 0.2 !!! -> use 0x00 2608 * @param channel_2_data_out_size sample size in bits 2609 * @param channel_2_data_out_offset number of PCM clock cycles between rising of frame sync and data start 2610 * @param channel_2_data_out_edge 0=data driven at rising edge, 1=data driven at falling edge of PCM clock 2611 * @param channel_2_data_in_size sample size in bits 2612 * @param channel_2_data_in_offset number of PCM clock cycles between rising of frame sync and data start 2613 * @param channel_2_data_in_edge 0=data sampled at rising edge, 1=data sampled at falling edge of PCM clock 2614 * @param reserved2 2615 * 2616 */ 2617 const hci_cmd_t hci_ti_write_codec_config = { 2618 0xFD06, "214211122122112212211" 2619 }; 2620 2621 /** 2622 * @brief This command is used only for internal testing. 2623 * @see processors.wiki.ti.com/index.php/CC256x_Testing_Guide#Continuous_TX 2624 * @param frequency 2625 * @param ADPLL loop mode 2626 */ 2627 const hci_cmd_t hci_ti_drpb_enable_rf_calibration = { 2628 0xFD80, "141" 2629 }; 2630 2631 /** 2632 * @brief This command command is only required for the continuous TX test of modulated 2633 * (GFSK, π/4-DQPSK or 8DPSK) signal. This command should be skipped when performing continuous TX test for CW. 2634 * @see processors.wiki.ti.com/index.php/CC256x_Testing_Guide#Continuous_RX 2635 * @param frequency 2636 * @param ADPLL loop mode 2637 */ 2638 const hci_cmd_t hci_ti_write_hardware_register = { 2639 0xFF01, "42" 2640 }; 2641 2642 /** 2643 * @brief Configure SCO routing on Realtek Controllers 2644 */ 2645 const hci_cmd_t hci_rtk_configure_sco_routing = { 2646 HCI_OPCODE_HCI_RTK_CONFIGURE_SCO_ROUTING, "111111111" 2647 }; 2648 2649 /** 2650 * @brief Read Card Information 2651 */ 2652 const hci_cmd_t hci_rtk_read_card_info = { 2653 HCI_OPCODE_HCI_RTK_READ_CARD_INFO, "11111" 2654 }; 2655 2656 2657 /** 2658 * @param voice_path 0x00 - transport, 0x01 - I2S/PCM 2659 */ 2660 const hci_cmd_t hci_nxp_set_sco_data_path = { 2661 HCI_OPCODE_HCI_NXP_SET_SCO_DATA_PATH, "1" 2662 }; 2663 2664 /** 2665 * @param settings bits 7-5: reserved, bit 4: pcm clock on, bit 3: reserved, bit 2: pcm sync source, bit 1: master/slave, bit 0: pcm direction 2666 */ 2667 const hci_cmd_t hci_nxp_write_pcm_i2s_settings = { 2668 HCI_OPCODE_HCI_NXP_WRITE_PCM_I2S_SETTINGS, "1" 2669 }; 2670 2671 /** 2672 * @param sync_settings_1 bits 7-2: reserved, bit 1: ISR, bit 0: ISR 2673 * @param sync_settings_2 bits 15-11: reserved, bit 10: 16k synchronization, bit 9: clock setting, bit 8: main clock, bits 7-5: reserved, bit 4: i2s sent in right channel, bit 3: clock alignment DIN, bit 2: clock alignment DOUT, bits 1-0: mode 2674 */ 2675 const hci_cmd_t hci_nxp_write_pcm_i2s_sync_settings = { 2676 HCI_OPCODE_HCI_NXP_WRITE_PCM_I2S_SYNC_SETTINGS, "12" 2677 }; 2678 2679 /** 2680 * @param settings bits 15-14: reserved, bit 13-10: each bit == one PCM time slot,, bits 9-2: slot relative to PCM synchronization, bits 1-0: PCM slots to be used 2681 */ 2682 const hci_cmd_t hci_nxp_write_pcm_link_settings = { 2683 HCI_OPCODE_HCI_NXP_WRITE_PCM_LINK_SETTINGS, "2" 2684 }; 2685 2686 /** 2687 * @param next_connection_wbs 0: CVSD, 1: mSBC 2688 */ 2689 const hci_cmd_t hci_nxp_set_wbs_connection = { 2690 HCI_OPCODE_HCI_NXP_SET_WBS_CONNECTION, "1" 2691 }; 2692 2693 /** 2694 * @param action 2695 * @param operation mode 2696 * @param sco_handle_1 2697 * @param sco_handle_2 2698 */ 2699 const hci_cmd_t hci_nxp_host_pcm_i2s_audio_config = { 2700 HCI_OPCODE_HCI_NXP_HOST_PCM_I2S_AUDIO_CONFIG, "11HH" 2701 }; 2702 2703 /** 2704 * @param action 2705 */ 2706 const hci_cmd_t hci_nxp_host_pcm_i2s_control_enable = { 2707 HCI_OPCODE_HCI_NXP_HOST_PCM_I2S_CONTROL_ENABLE, "1" 2708 }; 2709