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