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