1 /* 2 * Copyright (C) 2015 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 MATTHIAS 24 * RINGWALD 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 /* 39 * btstack-defines.h 40 * 41 * BTstack definitions, events, and error codes */ 42 43 #ifndef __BTSTACK_DEFINES_H 44 #define __BTSTACK_DEFINES_H 45 46 #include <stdint.h> 47 #include "btstack_linked_list.h" 48 49 // TYPES 50 51 // packet handler 52 typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); 53 54 // packet callback supporting multiple registrations 55 typedef struct { 56 btstack_linked_item_t item; 57 btstack_packet_handler_t callback; 58 } btstack_packet_callback_registration_t; 59 60 /** 61 * @brief 128 bit key used with AES128 in Security Manager 62 */ 63 typedef uint8_t sm_key_t[16]; 64 65 // DEFINES 66 67 #define DAEMON_EVENT_PACKET 0x05 68 69 // L2CAP data 70 #define L2CAP_DATA_PACKET 0x06 71 72 // RFCOMM data 73 #define RFCOMM_DATA_PACKET 0x07 74 75 // Attribute protocol data 76 #define ATT_DATA_PACKET 0x08 77 78 // Security Manager protocol data 79 #define SM_DATA_PACKET 0x09 80 81 // SDP query result 82 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k) 83 #define SDP_CLIENT_PACKET 0x0a 84 85 // BNEP data 86 #define BNEP_DATA_PACKET 0x0b 87 88 // Unicast Connectionless Data 89 #define UCD_DATA_PACKET 0x0c 90 91 // debug log messages 92 #define LOG_MESSAGE_PACKET 0xfc 93 94 95 // ERRORS 96 97 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors 98 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED 0x50 99 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH 0x51 100 #define BTSTACK_ACTIVATION_POWERON_FAILED 0x52 101 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN 0x53 102 #define BTSTACK_NOT_ACTIVATED 0x54 103 #define BTSTACK_BUSY 0x55 104 #define BTSTACK_MEMORY_ALLOC_FAILED 0x56 105 #define BTSTACK_ACL_BUFFERS_FULL 0x57 106 107 // l2cap errors - enumeration by the command that created them 108 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60 109 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61 110 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62 111 112 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL 0x63 113 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING 0x64 114 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65 115 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66 116 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67 117 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT 0x68 118 119 #define L2CAP_SERVICE_ALREADY_REGISTERED 0x69 120 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU 0x6A 121 122 #define RFCOMM_MULTIPLEXER_STOPPED 0x70 123 #define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71 124 #define RFCOMM_NO_OUTGOING_CREDITS 0x72 125 #define RFCOMM_AGGREGATE_FLOW_OFF 0x73 126 #define RFCOMM_DATA_LEN_EXCEEDS_MTU 0x74 127 128 #define SDP_HANDLE_ALREADY_REGISTERED 0x80 129 #define SDP_QUERY_INCOMPLETE 0x81 130 #define SDP_SERVICE_NOT_FOUND 0x82 131 #define SDP_HANDLE_INVALID 0x83 132 #define SDP_QUERY_BUSY 0x84 133 134 #define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS 0x90 135 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT 0x91 136 137 #define GATT_CLIENT_NOT_CONNECTED 0x93 138 #define GATT_CLIENT_BUSY 0x94 139 #define GATT_CLIENT_IN_WRONG_STATE 0x95 140 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96 141 #define GATT_CLIENT_VALUE_TOO_LONG 0x97 142 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98 143 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED 0x99 144 145 #define BNEP_SERVICE_ALREADY_REGISTERED 0xA0 146 #define BNEP_CHANNEL_NOT_CONNECTED 0xA1 147 #define BNEP_DATA_LEN_EXCEEDS_MTU 0xA2 148 149 150 151 // DAEMON COMMANDS 152 153 #define OGF_BTSTACK 0x3d 154 155 // cmds for BTstack 156 // get state: @returns HCI_STATE 157 #define BTSTACK_GET_STATE 0x01 158 159 // set power mode: param HCI_POWER_MODE 160 #define BTSTACK_SET_POWER_MODE 0x02 161 162 // set capture mode: param on 163 #define BTSTACK_SET_ACL_CAPTURE_MODE 0x03 164 165 // get BTstack version 166 #define BTSTACK_GET_VERSION 0x04 167 168 // get system Bluetooth state 169 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED 0x05 170 171 // set system Bluetooth state 172 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED 0x06 173 174 // enable inquiry scan for this client 175 #define BTSTACK_SET_DISCOVERABLE 0x07 176 177 // set global Bluetooth state 178 #define BTSTACK_SET_BLUETOOTH_ENABLED 0x08 179 180 // create l2cap channel: param bd_addr(48), psm (16) 181 #define L2CAP_CREATE_CHANNEL 0x20 182 183 // disconnect l2cap disconnect, param channel(16), reason(8) 184 #define L2CAP_DISCONNECT 0x21 185 186 // register l2cap service: param psm(16), mtu (16) 187 #define L2CAP_REGISTER_SERVICE 0x22 188 189 // unregister l2cap disconnect, param psm(16) 190 #define L2CAP_UNREGISTER_SERVICE 0x23 191 192 // accept connection param bd_addr(48), dest cid (16) 193 #define L2CAP_ACCEPT_CONNECTION 0x24 194 195 // decline l2cap disconnect,param bd_addr(48), dest cid (16), reason(8) 196 #define L2CAP_DECLINE_CONNECTION 0x25 197 198 // create l2cap channel: param bd_addr(48), psm (16), mtu (16) 199 #define L2CAP_CREATE_CHANNEL_MTU 0x26 200 201 // register SDP Service Record: service record (size) 202 #define SDP_REGISTER_SERVICE_RECORD 0x30 203 204 // unregister SDP Service Record 205 #define SDP_UNREGISTER_SERVICE_RECORD 0x31 206 207 // Get remote RFCOMM services 208 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES 0x32 209 210 // Get remote SDP services 211 #define SDP_CLIENT_QUERY_SERVICES 0x33 212 213 // RFCOMM "HCI" Commands 214 #define RFCOMM_CREATE_CHANNEL 0x40 215 #define RFCOMM_DISCONNECT 0x41 216 #define RFCOMM_REGISTER_SERVICE 0x42 217 #define RFCOMM_UNREGISTER_SERVICE 0x43 218 #define RFCOMM_ACCEPT_CONNECTION 0x44 219 #define RFCOMM_DECLINE_CONNECTION 0x45 220 #define RFCOMM_PERSISTENT_CHANNEL 0x46 221 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS 0x47 222 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48 223 #define RFCOMM_GRANT_CREDITS 0x49 224 225 // GAP Classic 0x50 226 #define GAP_DISCONNECT 0x50 227 228 // GAP LE 0x60 229 #define GAP_LE_SCAN_START 0x60 230 #define GAP_LE_SCAN_STOP 0x61 231 #define GAP_LE_CONNECT 0x62 232 #define GAP_LE_CONNECT_CANCEL 0x63 233 #define GAP_LE_SET_SCAN_PARAMETERS 0x64 234 235 // GATT (Client) 0x70 236 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES 0x70 237 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16 0x71 238 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128 0x72 239 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE 0x73 240 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE 0x74 241 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128 0x75 242 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS 0x76 243 #define GATT_READ_VALUE_OF_CHARACTERISTIC 0x77 244 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC 0x78 245 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE 0x79 246 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC 0x7A 247 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7B 248 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7C 249 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR 0X7D 250 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR 0X7E 251 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR 0X7F 252 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR 0X80 253 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION 0X81 254 #define GATT_GET_MTU 0x82 255 256 257 258 // EVENTS 259 260 /** 261 * @format 1 262 * @param state 263 */ 264 #define BTSTACK_EVENT_STATE 0x60 265 266 // data: event(8), len(8), nr hci connections 267 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61 268 269 /** 270 * @format 271 */ 272 #define BTSTACK_EVENT_POWERON_FAILED 0x62 273 274 /** 275 * @format 1 276 * @param discoverable 277 */ 278 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66 279 280 // Daemon Events 281 282 /** 283 * @format 112 284 * @param major 285 * @param minor 286 @ @param revision 287 */ 288 #define DAEMON_EVENT_VERSION 0x63 289 290 // data: system bluetooth on/off (bool) 291 /** 292 * @format 1 293 * param system_bluetooth_enabled 294 */ 295 #define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64 296 297 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes) 298 299 /* 300 * @format 1BT 301 * @param status == 0 to match read_remote_name_request 302 * @param address 303 * @param name 304 */ 305 #define DAEMON_EVENT_REMOTE_NAME_CACHED 0x65 306 307 // internal - data: event(8) 308 #define DAEMON_EVENT_CONNECTION_OPENED 0x67 309 310 // internal - data: event(8) 311 #define DAEMON_EVENT_CONNECTION_CLOSED 0x68 312 313 // data: event(8), len(8), local_cid(16), credits(8) 314 #define DAEMON_EVENT_L2CAP_CREDITS 0x74 315 316 /** 317 * @format 12 318 * @param status 319 * @param psm 320 */ 321 #define DAEMON_EVENT_L2CAP_SERVICE_REGISTERED 0x75 322 323 /** 324 * @format 21 325 * @param rfcomm_cid 326 * @param credits 327 */ 328 #define DAEMON_EVENT_RFCOMM_CREDITS 0x84 329 330 /** 331 * @format 11 332 * @param status 333 * @param channel_id 334 */ 335 #define DAEMON_EVENT_RFCOMM_SERVICE_REGISTERED 0x85 336 337 /** 338 * @format 11 339 * @param status 340 * @param server_channel_id 341 */ 342 #define DAEMON_EVENT_RFCOMM_PERSISTENT_CHANNEL 0x86 343 344 /** 345 * @format 14 346 * @param status 347 * @param service_record_handle 348 */ 349 #define DAEMON_EVENT_SDP_SERVICE_REGISTERED 0x90 350 351 352 353 // additional HCI events 354 355 /** 356 * @brief Outgoing packet 357 */ 358 #define HCI_EVENT_TRANSPORT_PACKET_SENT 0x6E 359 360 /** 361 * @format B 362 * @param handle 363 */ 364 #define HCI_EVENT_SCO_CAN_SEND_NOW 0x6F 365 366 367 // L2CAP EVENTS 368 369 /** 370 * @format 1BH222222 371 * @param status 372 * @param address 373 * @param handle 374 * @param psm 375 * @param local_cid 376 * @param remote_cid 377 * @param local_mtu 378 * @param remote_mtu 379 * @param flush_timeout 380 */ 381 #define L2CAP_EVENT_CHANNEL_OPENED 0x70 382 383 /* 384 * @format 2 385 * @param local_cid 386 */ 387 #define L2CAP_EVENT_CHANNEL_CLOSED 0x71 388 389 /** 390 * @format 1BH222 391 * @param status 392 * @param address 393 * @param handle 394 * @param psm 395 * @param local_cid 396 * @param remote_cid 397 */ 398 #define L2CAP_EVENT_INCOMING_CONNECTION 0x72 399 400 // ?? 401 // data: event(8), len(8), handle(16) 402 #define L2CAP_EVENT_TIMEOUT_CHECK 0x73 403 404 /** 405 * @format H2222 406 * @param handle 407 * @param interval_min 408 * @param interval_max 409 * @param latencey 410 * @param timeout_multiplier 411 */ 412 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 0x76 413 414 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail) 415 /** 416 * @format H2 417 * @param handle 418 * @result 419 */ 420 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE 0x77 421 422 /** 423 * @format 2 424 * @param local_cid 425 */ 426 #define L2CAP_EVENT_CAN_SEND_NOW 0x78 427 428 // RFCOMM EVENTS 429 430 /** 431 * @format 1B2122 432 * @param status 433 * @param bd_addr 434 * @param con_handle 435 * @param server_channel 436 * @param rfcomm_cid 437 * @param max_frame_size 438 */ 439 #define RFCOMM_EVENT_CHANNEL_OPENED 0x80 440 441 /** 442 * @format 2 443 * @param rfcomm_cid 444 */ 445 #define RFCOMM_EVENT_CHANNEL_CLOSED 0x81 446 447 /** 448 * @format B12 449 * @param bd_addr 450 * @param server_channel 451 * @param rfcomm_cid 452 */ 453 #define RFCOMM_EVENT_INCOMING_CONNECTION 0x82 454 455 /** 456 * @format 21 457 * @param rfcomm_cid 458 * @param line_status 459 */ 460 #define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83 461 462 /** 463 * @format 21 464 * @param rfcomm_cid 465 * @param modem_status 466 */ 467 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS 0x87 468 469 /** 470 * TODO: format for variable data 2? 471 * param rfcomm_cid 472 * param rpn_data 473 */ 474 #define RFCOMM_EVENT_PORT_CONFIGURATION 0x88 475 476 /** 477 * @format 2 478 * @param rfcomm_cid 479 */ 480 #define RFCOMM_EVENT_CAN_SEND_NOW 0x89 481 482 483 /** 484 * @format 1 485 * @param status 486 */ 487 #define SDP_EVENT_QUERY_COMPLETE 0x91 488 489 /** 490 * @format 1T 491 * @param rfcomm_channel 492 * @param name 493 */ 494 #define SDP_EVENT_QUERY_RFCOMM_SERVICE 0x92 495 496 /** 497 * @format 22221 498 * @param record_id 499 * @param attribute_id 500 * @param attribute_length 501 * @param data_offset 502 * @param data 503 */ 504 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE 0x93 505 506 /** 507 * @format 22LV 508 * @param record_id 509 * @param attribute_id 510 * @param attribute_length 511 * @param attribute_value 512 */ 513 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE 0x94 514 515 /** 516 * @format 224 517 * @param total_count 518 * @param record_index 519 * @param record_handle 520 * @note Not provided by daemon, only used for internal testing 521 */ 522 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 0x95 523 524 /** 525 * @format H1 526 * @param handle 527 * @param status 528 */ 529 #define GATT_EVENT_QUERY_COMPLETE 0xA0 530 531 /** 532 * @format HX 533 * @param handle 534 * @param service 535 */ 536 #define GATT_EVENT_SERVICE_QUERY_RESULT 0xA1 537 538 /** 539 * @format HY 540 * @param handle 541 * @param characteristic 542 */ 543 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT 0xA2 544 545 /** 546 * @format H2X 547 * @param handle 548 * @param include_handle 549 * @param service 550 */ 551 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 0xA3 552 553 /** 554 * @format HZ 555 * @param handle 556 * @param characteristic_descriptor 557 */ 558 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 0xA4 559 560 /** 561 * @format H2LV 562 * @param handle 563 * @param value_handle 564 * @param value_length 565 * @param value 566 */ 567 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA5 568 569 /** 570 * @format H22LV 571 * @param handle 572 * @param value_handle 573 * @param value_offset 574 * @param value_length 575 * @param value 576 */ 577 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA6 578 579 /** 580 * @format H2LV 581 * @param handle 582 * @param value_handle 583 * @param value_length 584 * @param value 585 */ 586 #define GATT_EVENT_NOTIFICATION 0xA7 587 588 /** 589 * @format H2LV 590 * @param handle 591 * @param value_handle 592 * @param value_length 593 * @param value 594 */ 595 #define GATT_EVENT_INDICATION 0xA8 596 597 /** 598 * @format H2LV 599 * @param descriptor_handle 600 * @param descriptor_length 601 * @param descriptor 602 */ 603 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xA9 604 605 /** 606 * @format H2LV 607 * @param handle 608 * @param descriptor_offset 609 * @param descriptor_length 610 * @param descriptor 611 */ 612 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xAA 613 614 /** 615 * @format H2 616 * @param handle 617 * @param MTU 618 */ 619 #define GATT_EVENT_MTU 0xAB 620 621 /** 622 * @format H2 623 * @param handle 624 * @param MTU 625 */ 626 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE 0xB5 627 628 /** 629 * @format 1H2 630 * @param status 631 * @param conn_handle 632 * @param attribute_handle 633 */ 634 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE 0xB6 635 636 /** 637 * @format 638 */ 639 #define ATT_EVENT_CAN_SEND_NOW 0xB7 640 641 // TODO: daemon only event 642 643 /** 644 * @format 12 645 * @param status 646 * @param service_uuid 647 */ 648 #define BNEP_EVENT_SERVICE_REGISTERED 0xC0 649 650 /** 651 * @format 12222B 652 * @param status 653 * @param bnep_cid 654 * @param source_uuid 655 * @param destination_uuid 656 * @param mtu 657 * @param remote_address 658 */ 659 #define BNEP_EVENT_CHANNEL_OPENED 0xC1 660 661 /** 662 * @format 222B 663 * @param bnep_cid 664 * @param source_uuid 665 * @param destination_uuid 666 * @param remote_address 667 */ 668 #define BNEP_EVENT_CHANNEL_CLOSED 0xC2 669 670 /** 671 * @format 222B1 672 * @param bnep_cid 673 * @param source_uuid 674 * @param destination_uuid 675 * @param remote_address 676 * @param channel_state 677 */ 678 #define BNEP_EVENT_CHANNEL_TIMEOUT 0xC3 679 680 /** 681 * @format 222B 682 * @param bnep_cid 683 * @param source_uuid 684 * @param destination_uuid 685 * @param remote_address 686 */ 687 #define BNEP_EVENT_CAN_SEND_NOW 0xC4 688 689 /** 690 * @format H1B 691 * @param handle 692 * @param addr_type 693 * @param address 694 */ 695 #define SM_EVENT_JUST_WORKS_REQUEST 0xD0 696 697 /** 698 * @format H1B 699 * @param handle 700 * @param addr_type 701 * @param address 702 */ 703 #define SM_EVENT_JUST_WORKS_CANCEL 0xD1 704 705 /** 706 * @format H1B4 707 * @param handle 708 * @param addr_type 709 * @param address 710 * @param passkey 711 */ 712 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER 0xD2 713 714 /** 715 * @format H1B 716 * @param handle 717 * @param addr_type 718 * @param address 719 */ 720 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL 0xD3 721 722 /** 723 * @format H1B421 724 * @param handle 725 * @param addr_type 726 * @param address 727 */ 728 #define SM_EVENT_PASSKEY_INPUT_NUMBER 0xD4 729 730 /** 731 * @format H1B 732 * @param handle 733 * @param addr_type 734 * @param address 735 */ 736 #define SM_EVENT_PASSKEY_INPUT_CANCEL 0xD5 737 738 /** 739 * @format H1B 740 * @param handle 741 * @param addr_type 742 * @param address 743 */ 744 #define SM_EVENT_IDENTITY_RESOLVING_STARTED 0xD6 745 746 /** 747 * @format H1B 748 * @param handle 749 * @param addr_type 750 * @param address 751 */ 752 #define SM_EVENT_IDENTITY_RESOLVING_FAILED 0xD7 753 754 /** 755 * @format H1B2 756 * @param handle 757 * @param addr_type 758 * @param address 759 * @param le_device_db_index 760 */ 761 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xD8 762 763 /** 764 * @format H1B 765 * @param handle 766 * @param addr_type 767 * @param address 768 */ 769 #define SM_EVENT_AUTHORIZATION_REQUEST 0xD9 770 771 /** 772 * @format H1B1 773 * @param handle 774 * @param addr_type 775 * @param address 776 * @param authorization_result 777 */ 778 #define SM_EVENT_AUTHORIZATION_RESULT 0xDA 779 780 // GAP 781 782 // data: event(8), len(8), hci_handle (16), security_level (8) 783 #define GAP_EVENT_SECURITY_LEVEL 0xE0 784 785 // data: event(8), len(8), status (8), bd_addr(48) 786 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED 0xE1 787 788 /** 789 * @format 11B1JV 790 * @param advertising_event_type 791 * @param address_type 792 * @param address 793 * @param rssi 794 * @param data_length 795 * @param data 796 */ 797 #define GAP_EVENT_ADVERTISING_REPORT 0xE2 798 799 800 // Meta Events, see below for sub events 801 #define HCI_EVENT_HSP_META 0xE8 802 #define HCI_EVENT_HFP_META 0xE9 803 #define HCI_EVENT_ANCS_META 0xEA 804 805 // Potential other meta groups 806 // #define HCI_EVENT_BNEP_META 0xxx 807 // #define HCI_EVENT_GAP_META 0xxx 808 // #define HCI_EVENT_GATT_META 0xxx 809 // #define HCI_EVENT_PAN_META 0xxx 810 // #define HCI_EVENT_SDP_META 0xxx 811 // #define HCI_EVENT_SM_META 0xxx 812 813 814 /** HSP Subevent */ 815 816 /** 817 * @format 11 818 * @param subevent_code 819 * @param status 0 == OK 820 */ 821 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE 0x01 822 823 /** 824 * @format 11 825 * @param subevent_code 826 * @param status 0 == OK 827 */ 828 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE 0x02 829 830 831 /** 832 * @format 11H 833 * @param subevent_code 834 * @param status 0 == OK 835 * @param handle 836 */ 837 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE 0x03 838 839 /** 840 * @format 11 841 * @param subevent_code 842 * @param status 0 == OK 843 */ 844 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE 0x04 845 846 /** 847 * @format 1 848 * @param subevent_code 849 */ 850 #define HSP_SUBEVENT_RING 0x05 851 852 /** 853 * @format 11 854 * @param subevent_code 855 * @param gain Valid range: [0,15] 856 */ 857 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED 0x06 858 859 /** 860 * @format 11 861 * @param subevent_code 862 * @param gain Valid range: [0,15] 863 */ 864 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED 0x07 865 866 /** 867 * @format 1JV 868 * @param subevent_code 869 * @param value_length 870 * @param value 871 */ 872 #define HSP_SUBEVENT_HS_COMMAND 0x08 873 874 /** 875 * @format 1JV 876 * @param subevent_code 877 * @param value_length 878 * @param value 879 */ 880 #define HSP_SUBEVENT_AG_INDICATION 0x09 881 882 883 /** HFP Subevent */ 884 885 /** 886 * @format 11 887 * @param subevent_code 888 * @param status 0 == OK 889 */ 890 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED 0x01 891 892 /** 893 * @format 1 894 * @param subevent_code 895 */ 896 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED 0x02 897 898 /** 899 * @format 11 900 * @param subevent_code 901 * @param status 0 == OK 902 */ 903 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED 0x03 904 905 /** 906 * @format 1 907 * @param subevent_code 908 */ 909 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED 0x04 910 911 /** 912 * @format 11 913 * @param subevent_code 914 * @param status 0 == OK 915 */ 916 #define HFP_SUBEVENT_COMPLETE 0x05 917 918 /** 919 * @format 111T 920 * @param subevent_code 921 * @param indicator_index 922 * @param indicator_status 923 * @param indicator_name 924 */ 925 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED 0x06 926 927 /** 928 * @format 1111T 929 * @param subevent_code 930 * @param network_operator_mode 931 * @param network_operator_format 932 * @param network_operator_name 933 */ 934 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED 0x07 935 936 /** 937 * @format 11 938 * @param subevent_code 939 * @param error 940 */ 941 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR 0x08 942 943 /** 944 * @format 11 945 * @param subevent_code 946 * @param status 947 */ 948 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE 0x09 949 950 /** 951 * @format 1 952 * @param subevent_code 953 */ 954 #define HFP_SUBEVENT_START_RINGINIG 0x0A 955 956 /** 957 * @format 1 958 * @param subevent_code 959 */ 960 #define HFP_SUBEVENT_STOP_RINGINIG 0x0B 961 962 /** 963 * @format 1 964 * @param subevent_code 965 */ 966 #define HFP_SUBEVENT_CALL_TERMINATED 0x0C 967 968 /** 969 * @format 1T 970 * @param subevent_code 971 * @param number 972 */ 973 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER 0x0D 974 975 /** 976 * @format 1 977 * @param subevent_code 978 */ 979 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG 0x0E 980 981 /** 982 * @format 1T 983 * @param subevent_code 984 * @param number 985 */ 986 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG 0x0F 987 988 /** 989 * @format 1T 990 * @param subevent_code 991 * @param dtmf code 992 */ 993 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES 0x10 994 995 /** 996 * @format 1 997 * @param subevent_code 998 */ 999 #define HFP_SUBEVENT_CALL_ANSWERED 0x11 1000 1001 /** 1002 * @format 1 1003 * @param subevent_code 1004 */ 1005 #define HFP_SUBEVENT_CONFERENCE_CALL 0x12 1006 1007 /** 1008 * @format 1 1009 * @param subevent_code 1010 */ 1011 #define HFP_SUBEVENT_RING 0x13 1012 1013 /** 1014 * @format 111 1015 * @param subevent_code 1016 * @param status 1017 * @param gain 1018 */ 1019 #define HFP_SUBEVENT_SPEAKER_VOLUME 0x14 1020 1021 /** 1022 * @format 111 1023 * @param subevent_code 1024 * @param status 1025 * @param gain 1026 */ 1027 #define HFP_SUBEVENT_MICROPHONE_VOLUME 0x15 1028 1029 /** 1030 * @format 11T 1031 * @param subevent_code 1032 * @param type 1033 * @param number 1034 */ 1035 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION 0x16 1036 1037 /** 1038 * @format 11T 1039 * @param subevent_code 1040 * @param type 1041 * @param number 1042 */ 1043 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17 1044 1045 /** 1046 * @format 111111T 1047 * @param subevent_code 1048 * @param clcc_idx 1049 * @param clcc_dir 1050 * @param clcc_status 1051 * @param clcc_mpty 1052 * @param bnip_type 1053 * @param bnip_number 1054 */ 1055 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS 0x18 1056 1057 /** 1058 * @format 111T 1059 * @param subevent_code 1060 * @param status 1061 * @param bnip_type 1062 * @param bnip_number 1063 */ 1064 #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION 0x19 1065 1066 /** 1067 * @format 1T 1068 * @param subevent_code 1069 * @param value 1070 */ 1071 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS 0x1A 1072 1073 // ANCS Client 1074 1075 /** 1076 * @format 1H 1077 * @param subevent_code 1078 * @param handle 1079 */ 1080 #define ANCS_SUBEVENT_CLIENT_CONNECTED 0xF0 1081 1082 /** 1083 * @format 1H2T 1084 * @param subevent_code 1085 * @param handle 1086 * @param attribute_id 1087 * @param text 1088 */ 1089 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION 0xF1 1090 1091 /** 1092 * @format 1H 1093 * @param subevent_code 1094 * @param handle 1095 */ 1096 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED 0xF2 1097 1098 #endif 1099