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