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 H1B1B 837 * @param handle 838 * @param addr_type 839 * @param address 840 * @param identity_addr_type 841 * @param identity_address 842 * 843 * @note le_device_db_index was removed, please use provided identity information directly 844 * 845 */ 846 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xDA 847 848 /** 849 * @format H1B 850 * @param handle 851 * @param addr_type 852 * @param address 853 */ 854 #define SM_EVENT_AUTHORIZATION_REQUEST 0xDB 855 856 /** 857 * @format H1B1 858 * @param handle 859 * @param addr_type 860 * @param address 861 * @param authorization_result 862 */ 863 #define SM_EVENT_AUTHORIZATION_RESULT 0xDC 864 865 /** 866 * @format H1 867 * @param handle 868 * @param action see SM_KEYPRESS_* 869 */ 870 #define SM_EVENT_KEYPRESS_NOTIFICATION 0xDD 871 872 /** 873 * @brief Emitted during pairing to inform app about address used as identity 874 * 875 * @format H1B1B 876 * @param handle 877 * @param addr_type 878 * @param address 879 * @param identity_addr_type 880 * @param identity_address 881 */ 882 #define SM_EVENT_IDENTITY_CREATED 0xDE 883 884 // GAP 885 886 /** 887 * @format H1 888 * @param handle 889 * @param security_level 890 */ 891 #define GAP_EVENT_SECURITY_LEVEL 0xE0 892 893 /** 894 * @format 1B 895 * @param status 896 * @param address 897 */ 898 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED 0xE1 899 900 /** 901 * @format 11B1JV 902 * @param advertising_event_type 903 * @param address_type 904 * @param address 905 * @param rssi 906 * @param data_length 907 * @param data 908 */ 909 #define GAP_EVENT_ADVERTISING_REPORT 0xE2 910 911 912 // Meta Events, see below for sub events 913 #define HCI_EVENT_HSP_META 0xE8 914 #define HCI_EVENT_HFP_META 0xE9 915 #define HCI_EVENT_ANCS_META 0xEA 916 #define HCI_EVENT_AVDTP_META 0xEA 917 918 // Potential other meta groups 919 // #define HCI_EVENT_BNEP_META 0xxx 920 // #define HCI_EVENT_GAP_META 0xxx 921 // #define HCI_EVENT_GATT_META 0xxx 922 // #define HCI_EVENT_PAN_META 0xxx 923 // #define HCI_EVENT_SDP_META 0xxx 924 // #define HCI_EVENT_SM_META 0xxx 925 926 927 /** HSP Subevent */ 928 929 /** 930 * @format 11 931 * @param subevent_code 932 * @param status 0 == OK 933 */ 934 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE 0x01 935 936 /** 937 * @format 11 938 * @param subevent_code 939 * @param status 0 == OK 940 */ 941 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE 0x02 942 943 944 /** 945 * @format 11H 946 * @param subevent_code 947 * @param status 0 == OK 948 * @param handle 949 */ 950 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE 0x03 951 952 /** 953 * @format 11 954 * @param subevent_code 955 * @param status 0 == OK 956 */ 957 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE 0x04 958 959 /** 960 * @format 1 961 * @param subevent_code 962 */ 963 #define HSP_SUBEVENT_RING 0x05 964 965 /** 966 * @format 11 967 * @param subevent_code 968 * @param gain Valid range: [0,15] 969 */ 970 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED 0x06 971 972 /** 973 * @format 11 974 * @param subevent_code 975 * @param gain Valid range: [0,15] 976 */ 977 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED 0x07 978 979 /** 980 * @format 1JV 981 * @param subevent_code 982 * @param value_length 983 * @param value 984 */ 985 #define HSP_SUBEVENT_HS_COMMAND 0x08 986 987 /** 988 * @format 1JV 989 * @param subevent_code 990 * @param value_length 991 * @param value 992 */ 993 #define HSP_SUBEVENT_AG_INDICATION 0x09 994 995 996 /** HFP Subevent */ 997 998 /** 999 * @format 11HB 1000 * @param subevent_code 1001 * @param status 0 == OK 1002 * @param con_handle 1003 * @param bd_addr 1004 */ 1005 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED 0x01 1006 1007 /** 1008 * @format 1 1009 * @param subevent_code 1010 */ 1011 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED 0x02 1012 1013 /** 1014 * @format 11HB1 1015 * @param subevent_code 1016 * @param status 0 == OK 1017 * @param handle 1018 * @param bd_addr 1019 * @param negotiated_codec 1020 */ 1021 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED 0x03 1022 1023 /** 1024 * @format 1 1025 * @param subevent_code 1026 */ 1027 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED 0x04 1028 1029 /** 1030 * @format 11 1031 * @param subevent_code 1032 * @param status 0 == OK 1033 */ 1034 #define HFP_SUBEVENT_COMPLETE 0x05 1035 1036 /** 1037 * @format 111T 1038 * @param subevent_code 1039 * @param indicator_index 1040 * @param indicator_status 1041 * @param indicator_name 1042 */ 1043 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED 0x06 1044 1045 /** 1046 * @format 1111T 1047 * @param subevent_code 1048 * @param network_operator_mode 1049 * @param network_operator_format 1050 * @param network_operator_name 1051 */ 1052 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED 0x07 1053 1054 /** 1055 * @format 11 1056 * @param subevent_code 1057 * @param error 1058 */ 1059 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR 0x08 1060 1061 /** 1062 * @format 1 1063 * @param subevent_code 1064 */ 1065 #define HFP_SUBEVENT_START_RINGINIG 0x0A 1066 1067 /** 1068 * @format 1 1069 * @param subevent_code 1070 */ 1071 #define HFP_SUBEVENT_STOP_RINGINIG 0x0B 1072 1073 /** 1074 * @format 1 1075 * @param subevent_code 1076 */ 1077 #define HFP_SUBEVENT_CALL_TERMINATED 0x0C 1078 1079 /** 1080 * @format 1T 1081 * @param subevent_code 1082 * @param number 1083 */ 1084 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER 0x0D 1085 1086 /** 1087 * @format 1 1088 * @param subevent_code 1089 */ 1090 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG 0x0E 1091 1092 /** 1093 * @format 1T 1094 * @param subevent_code 1095 * @param number 1096 */ 1097 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG 0x0F 1098 1099 /** 1100 * @format 1T 1101 * @param subevent_code 1102 * @param dtmf code 1103 */ 1104 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES 0x10 1105 1106 /** 1107 * @format 1 1108 * @param subevent_code 1109 */ 1110 #define HFP_SUBEVENT_CALL_ANSWERED 0x11 1111 1112 /** 1113 * @format 1 1114 * @param subevent_code 1115 */ 1116 #define HFP_SUBEVENT_CONFERENCE_CALL 0x12 1117 1118 /** 1119 * @format 1 1120 * @param subevent_code 1121 */ 1122 #define HFP_SUBEVENT_RING 0x13 1123 1124 /** 1125 * @format 111 1126 * @param subevent_code 1127 * @param status 1128 * @param gain 1129 */ 1130 #define HFP_SUBEVENT_SPEAKER_VOLUME 0x14 1131 1132 /** 1133 * @format 111 1134 * @param subevent_code 1135 * @param status 1136 * @param gain 1137 */ 1138 #define HFP_SUBEVENT_MICROPHONE_VOLUME 0x15 1139 1140 /** 1141 * @format 11T 1142 * @param subevent_code 1143 * @param type 1144 * @param number 1145 */ 1146 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION 0x16 1147 1148 /** 1149 * @format 11T 1150 * @param subevent_code 1151 * @param type 1152 * @param number 1153 */ 1154 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17 1155 1156 /** 1157 * @format 111111T 1158 * @param subevent_code 1159 * @param clcc_idx 1160 * @param clcc_dir 1161 * @param clcc_status 1162 * @param clcc_mpty 1163 * @param bnip_type 1164 * @param bnip_number 1165 */ 1166 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS 0x18 1167 1168 /** 1169 * @format 111T 1170 * @param subevent_code 1171 * @param status 1172 * @param bnip_type 1173 * @param bnip_number 1174 */ 1175 #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION 0x19 1176 1177 /** 1178 * @format 1T 1179 * @param subevent_code 1180 * @param value 1181 */ 1182 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS 0x1A 1183 1184 // ANCS Client 1185 1186 /** 1187 * @format 1H 1188 * @param subevent_code 1189 * @param handle 1190 */ 1191 #define ANCS_SUBEVENT_CLIENT_CONNECTED 0xF0 1192 1193 /** 1194 * @format 1H2T 1195 * @param subevent_code 1196 * @param handle 1197 * @param attribute_id 1198 * @param text 1199 */ 1200 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION 0xF1 1201 1202 /** 1203 * @format 1H 1204 * @param subevent_code 1205 * @param handle 1206 */ 1207 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED 0xF2 1208 1209 1210 /** AVDTP Subevent */ 1211 1212 // /** 1213 // * @format 11HB 1214 // * @param subevent_code 1215 // * @param status 0 == OK 1216 // * @param con_handle 1217 // * @param bd_addr 1218 // */ 1219 // #define AVDTP_SUBEVENT_CONNECTION_ESTABLISHED 0x01 1220 1221 // /** 1222 // * @format 1 1223 // * @param subevent_code 1224 // */ 1225 // #define AVDTP_SUBEVENT_CONNECTION_RELEASED 0x02 1226 1227 #endif 1228