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