1 /* 2 * Copyright (C) 2016 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 /* 40 * btstack_event.h 41 * 42 * @brief BTstack event getter/setter 43 * @note Don't edit - generated by tool/btstack_event_generator.py 44 * 45 */ 46 47 #ifndef __BTSTACK_EVENT_H 48 #define __BTSTACK_EVENT_H 49 50 #if defined __cplusplus 51 extern "C" { 52 #endif 53 54 #include "btstack_util.h" 55 #include <stdint.h> 56 57 #ifdef ENABLE_BLE 58 #include "ble/gatt_client.h" 59 #endif 60 61 /* API_START */ 62 63 /** 64 * @brief Get event type 65 * @param event 66 * @return type of event 67 */ 68 static inline uint8_t hci_event_packet_get_type(const uint8_t * event){ 69 return event[0]; 70 } 71 72 /*** 73 * @brief Get subevent code for hsp event 74 * @param event packet 75 * @return subevent_code 76 */ 77 static inline uint8_t hci_event_hsp_meta_get_subevent_code(const uint8_t * event){ 78 return event[2]; 79 } 80 /*** 81 * @brief Get subevent code for hfp event 82 * @param event packet 83 * @return subevent_code 84 */ 85 static inline uint8_t hci_event_hfp_meta_get_subevent_code(const uint8_t * event){ 86 return event[2]; 87 } 88 /*** 89 * @brief Get subevent code for ancs event 90 * @param event packet 91 * @return subevent_code 92 */ 93 static inline uint8_t hci_event_ancs_meta_get_subevent_code(const uint8_t * event){ 94 return event[2]; 95 } 96 /*** 97 * @brief Get subevent code for le event 98 * @param event packet 99 * @return subevent_code 100 */ 101 static inline uint8_t hci_event_le_meta_get_subevent_code(const uint8_t * event){ 102 return event[2]; 103 } 104 /** 105 * @brief Get field status from event HCI_EVENT_INQUIRY_COMPLETE 106 * @param event packet 107 * @return status 108 * @note: btstack_type 1 109 */ 110 static inline uint8_t hci_event_inquiry_complete_get_status(const uint8_t * event){ 111 return event[2]; 112 } 113 114 /** 115 * @brief Get field num_responses from event HCI_EVENT_INQUIRY_RESULT 116 * @param event packet 117 * @return num_responses 118 * @note: btstack_type 1 119 */ 120 static inline uint8_t hci_event_inquiry_result_get_num_responses(const uint8_t * event){ 121 return event[2]; 122 } 123 /** 124 * @brief Get field bd_addr from event HCI_EVENT_INQUIRY_RESULT 125 * @param event packet 126 * @param Pointer to storage for bd_addr 127 * @note: btstack_type B 128 */ 129 static inline void hci_event_inquiry_result_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 130 reverse_bd_addr(&event[3], bd_addr); 131 } 132 /** 133 * @brief Get field page_scan_repetition_mode from event HCI_EVENT_INQUIRY_RESULT 134 * @param event packet 135 * @return page_scan_repetition_mode 136 * @note: btstack_type 1 137 */ 138 static inline uint8_t hci_event_inquiry_result_get_page_scan_repetition_mode(const uint8_t * event){ 139 return event[9]; 140 } 141 /** 142 * @brief Get field reserved1 from event HCI_EVENT_INQUIRY_RESULT 143 * @param event packet 144 * @return reserved1 145 * @note: btstack_type 1 146 */ 147 static inline uint8_t hci_event_inquiry_result_get_reserved1(const uint8_t * event){ 148 return event[10]; 149 } 150 /** 151 * @brief Get field reserved2 from event HCI_EVENT_INQUIRY_RESULT 152 * @param event packet 153 * @return reserved2 154 * @note: btstack_type 1 155 */ 156 static inline uint8_t hci_event_inquiry_result_get_reserved2(const uint8_t * event){ 157 return event[11]; 158 } 159 /** 160 * @brief Get field class_of_device from event HCI_EVENT_INQUIRY_RESULT 161 * @param event packet 162 * @return class_of_device 163 * @note: btstack_type 3 164 */ 165 static inline uint32_t hci_event_inquiry_result_get_class_of_device(const uint8_t * event){ 166 return little_endian_read_24(event, 12); 167 } 168 /** 169 * @brief Get field clock_offset from event HCI_EVENT_INQUIRY_RESULT 170 * @param event packet 171 * @return clock_offset 172 * @note: btstack_type 2 173 */ 174 static inline uint16_t hci_event_inquiry_result_get_clock_offset(const uint8_t * event){ 175 return little_endian_read_16(event, 15); 176 } 177 178 /** 179 * @brief Get field status from event HCI_EVENT_CONNECTION_COMPLETE 180 * @param event packet 181 * @return status 182 * @note: btstack_type 1 183 */ 184 static inline uint8_t hci_event_connection_complete_get_status(const uint8_t * event){ 185 return event[2]; 186 } 187 /** 188 * @brief Get field connection_handle from event HCI_EVENT_CONNECTION_COMPLETE 189 * @param event packet 190 * @return connection_handle 191 * @note: btstack_type 2 192 */ 193 static inline uint16_t hci_event_connection_complete_get_connection_handle(const uint8_t * event){ 194 return little_endian_read_16(event, 3); 195 } 196 /** 197 * @brief Get field bd_addr from event HCI_EVENT_CONNECTION_COMPLETE 198 * @param event packet 199 * @param Pointer to storage for bd_addr 200 * @note: btstack_type B 201 */ 202 static inline void hci_event_connection_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 203 reverse_bd_addr(&event[5], bd_addr); 204 } 205 /** 206 * @brief Get field link_type from event HCI_EVENT_CONNECTION_COMPLETE 207 * @param event packet 208 * @return link_type 209 * @note: btstack_type 1 210 */ 211 static inline uint8_t hci_event_connection_complete_get_link_type(const uint8_t * event){ 212 return event[11]; 213 } 214 /** 215 * @brief Get field encryption_enabled from event HCI_EVENT_CONNECTION_COMPLETE 216 * @param event packet 217 * @return encryption_enabled 218 * @note: btstack_type 1 219 */ 220 static inline uint8_t hci_event_connection_complete_get_encryption_enabled(const uint8_t * event){ 221 return event[12]; 222 } 223 224 /** 225 * @brief Get field bd_addr from event HCI_EVENT_CONNECTION_REQUEST 226 * @param event packet 227 * @param Pointer to storage for bd_addr 228 * @note: btstack_type B 229 */ 230 static inline void hci_event_connection_request_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 231 reverse_bd_addr(&event[2], bd_addr); 232 } 233 /** 234 * @brief Get field class_of_device from event HCI_EVENT_CONNECTION_REQUEST 235 * @param event packet 236 * @return class_of_device 237 * @note: btstack_type 3 238 */ 239 static inline uint32_t hci_event_connection_request_get_class_of_device(const uint8_t * event){ 240 return little_endian_read_24(event, 8); 241 } 242 /** 243 * @brief Get field link_type from event HCI_EVENT_CONNECTION_REQUEST 244 * @param event packet 245 * @return link_type 246 * @note: btstack_type 1 247 */ 248 static inline uint8_t hci_event_connection_request_get_link_type(const uint8_t * event){ 249 return event[11]; 250 } 251 252 /** 253 * @brief Get field status from event HCI_EVENT_DISCONNECTION_COMPLETE 254 * @param event packet 255 * @return status 256 * @note: btstack_type 1 257 */ 258 static inline uint8_t hci_event_disconnection_complete_get_status(const uint8_t * event){ 259 return event[2]; 260 } 261 /** 262 * @brief Get field connection_handle from event HCI_EVENT_DISCONNECTION_COMPLETE 263 * @param event packet 264 * @return connection_handle 265 * @note: btstack_type 2 266 */ 267 static inline uint16_t hci_event_disconnection_complete_get_connection_handle(const uint8_t * event){ 268 return little_endian_read_16(event, 3); 269 } 270 /** 271 * @brief Get field reason from event HCI_EVENT_DISCONNECTION_COMPLETE 272 * @param event packet 273 * @return reason 274 * @note: btstack_type 1 275 */ 276 static inline uint8_t hci_event_disconnection_complete_get_reason(const uint8_t * event){ 277 return event[5]; 278 } 279 280 /** 281 * @brief Get field status from event HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT 282 * @param event packet 283 * @return status 284 * @note: btstack_type 1 285 */ 286 static inline uint8_t hci_event_authentication_complete_event_get_status(const uint8_t * event){ 287 return event[2]; 288 } 289 /** 290 * @brief Get field connection_handle from event HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT 291 * @param event packet 292 * @return connection_handle 293 * @note: btstack_type 2 294 */ 295 static inline uint16_t hci_event_authentication_complete_event_get_connection_handle(const uint8_t * event){ 296 return little_endian_read_16(event, 3); 297 } 298 299 /** 300 * @brief Get field status from event HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 301 * @param event packet 302 * @return status 303 * @note: btstack_type 1 304 */ 305 // static inline uint8_t hci_event_remote_name_request_complete_get_status(const uint8_t * event){ 306 // not implemented yet 307 // } 308 /** 309 * @brief Get field bd_addr from event HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 310 * @param event packet 311 * @return bd_addr 312 * @note: btstack_type B 313 */ 314 // static inline bd_addr_t hci_event_remote_name_request_complete_get_bd_addr(const uint8_t * event){ 315 // not implemented yet 316 // } 317 /** 318 * @brief Get field remote_name from event HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 319 * @param event packet 320 * @return remote_name 321 * @note: btstack_type N 322 */ 323 // static inline String hci_event_remote_name_request_complete_get_remote_name(const uint8_t * event){ 324 // not implemented yet 325 // } 326 327 /** 328 * @brief Get field status from event HCI_EVENT_ENCRYPTION_CHANGE 329 * @param event packet 330 * @return status 331 * @note: btstack_type 1 332 */ 333 static inline uint8_t hci_event_encryption_change_get_status(const uint8_t * event){ 334 return event[2]; 335 } 336 /** 337 * @brief Get field connection_handle from event HCI_EVENT_ENCRYPTION_CHANGE 338 * @param event packet 339 * @return connection_handle 340 * @note: btstack_type 2 341 */ 342 static inline uint16_t hci_event_encryption_change_get_connection_handle(const uint8_t * event){ 343 return little_endian_read_16(event, 3); 344 } 345 /** 346 * @brief Get field encryption_enabled from event HCI_EVENT_ENCRYPTION_CHANGE 347 * @param event packet 348 * @return encryption_enabled 349 * @note: btstack_type 1 350 */ 351 static inline uint8_t hci_event_encryption_change_get_encryption_enabled(const uint8_t * event){ 352 return event[5]; 353 } 354 355 /** 356 * @brief Get field status from event HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 357 * @param event packet 358 * @return status 359 * @note: btstack_type 1 360 */ 361 static inline uint8_t hci_event_change_connection_link_key_complete_get_status(const uint8_t * event){ 362 return event[2]; 363 } 364 /** 365 * @brief Get field connection_handle from event HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 366 * @param event packet 367 * @return connection_handle 368 * @note: btstack_type 2 369 */ 370 static inline uint16_t hci_event_change_connection_link_key_complete_get_connection_handle(const uint8_t * event){ 371 return little_endian_read_16(event, 3); 372 } 373 374 /** 375 * @brief Get field status from event HCI_EVENT_MASTER_LINK_KEY_COMPLETE 376 * @param event packet 377 * @return status 378 * @note: btstack_type 1 379 */ 380 static inline uint8_t hci_event_master_link_key_complete_get_status(const uint8_t * event){ 381 return event[2]; 382 } 383 /** 384 * @brief Get field connection_handle from event HCI_EVENT_MASTER_LINK_KEY_COMPLETE 385 * @param event packet 386 * @return connection_handle 387 * @note: btstack_type 2 388 */ 389 static inline uint16_t hci_event_master_link_key_complete_get_connection_handle(const uint8_t * event){ 390 return little_endian_read_16(event, 3); 391 } 392 /** 393 * @brief Get field key_flag from event HCI_EVENT_MASTER_LINK_KEY_COMPLETE 394 * @param event packet 395 * @return key_flag 396 * @note: btstack_type 1 397 */ 398 static inline uint8_t hci_event_master_link_key_complete_get_key_flag(const uint8_t * event){ 399 return event[5]; 400 } 401 402 /** 403 * @brief Get field num_hci_command_packets from event HCI_EVENT_COMMAND_COMPLETE 404 * @param event packet 405 * @return num_hci_command_packets 406 * @note: btstack_type 1 407 */ 408 static inline uint8_t hci_event_command_complete_get_num_hci_command_packets(const uint8_t * event){ 409 return event[2]; 410 } 411 /** 412 * @brief Get field command_opcode from event HCI_EVENT_COMMAND_COMPLETE 413 * @param event packet 414 * @return command_opcode 415 * @note: btstack_type 2 416 */ 417 static inline uint16_t hci_event_command_complete_get_command_opcode(const uint8_t * event){ 418 return little_endian_read_16(event, 3); 419 } 420 /** 421 * @brief Get field return_parameters from event HCI_EVENT_COMMAND_COMPLETE 422 * @param event packet 423 * @return return_parameters 424 * @note: btstack_type R 425 */ 426 static inline const uint8_t * hci_event_command_complete_get_return_parameters(const uint8_t * event){ 427 return &event[5]; 428 } 429 430 /** 431 * @brief Get field status from event HCI_EVENT_COMMAND_STATUS 432 * @param event packet 433 * @return status 434 * @note: btstack_type 1 435 */ 436 static inline uint8_t hci_event_command_status_get_status(const uint8_t * event){ 437 return event[2]; 438 } 439 /** 440 * @brief Get field num_hci_command_packets from event HCI_EVENT_COMMAND_STATUS 441 * @param event packet 442 * @return num_hci_command_packets 443 * @note: btstack_type 1 444 */ 445 static inline uint8_t hci_event_command_status_get_num_hci_command_packets(const uint8_t * event){ 446 return event[3]; 447 } 448 /** 449 * @brief Get field command_opcode from event HCI_EVENT_COMMAND_STATUS 450 * @param event packet 451 * @return command_opcode 452 * @note: btstack_type 2 453 */ 454 static inline uint16_t hci_event_command_status_get_command_opcode(const uint8_t * event){ 455 return little_endian_read_16(event, 4); 456 } 457 458 /** 459 * @brief Get field hardware_code from event HCI_EVENT_HARDWARE_ERROR 460 * @param event packet 461 * @return hardware_code 462 * @note: btstack_type 1 463 */ 464 static inline uint8_t hci_event_hardware_error_get_hardware_code(const uint8_t * event){ 465 return event[2]; 466 } 467 468 /** 469 * @brief Get field status from event HCI_EVENT_ROLE_CHANGE 470 * @param event packet 471 * @return status 472 * @note: btstack_type 1 473 */ 474 static inline uint8_t hci_event_role_change_get_status(const uint8_t * event){ 475 return event[2]; 476 } 477 /** 478 * @brief Get field bd_addr from event HCI_EVENT_ROLE_CHANGE 479 * @param event packet 480 * @param Pointer to storage for bd_addr 481 * @note: btstack_type B 482 */ 483 static inline void hci_event_role_change_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 484 reverse_bd_addr(&event[3], bd_addr); 485 } 486 /** 487 * @brief Get field role from event HCI_EVENT_ROLE_CHANGE 488 * @param event packet 489 * @return role 490 * @note: btstack_type 1 491 */ 492 static inline uint8_t hci_event_role_change_get_role(const uint8_t * event){ 493 return event[9]; 494 } 495 496 /** 497 * @brief Get field status from event HCI_EVENT_MODE_CHANGE_EVENT 498 * @param event packet 499 * @return status 500 * @note: btstack_type 1 501 */ 502 static inline uint8_t hci_event_mode_change_event_get_status(const uint8_t * event){ 503 return event[2]; 504 } 505 /** 506 * @brief Get field handle from event HCI_EVENT_MODE_CHANGE_EVENT 507 * @param event packet 508 * @return handle 509 * @note: btstack_type H 510 */ 511 static inline hci_con_handle_t hci_event_mode_change_event_get_handle(const uint8_t * event){ 512 return little_endian_read_16(event, 3); 513 } 514 /** 515 * @brief Get field mode from event HCI_EVENT_MODE_CHANGE_EVENT 516 * @param event packet 517 * @return mode 518 * @note: btstack_type 1 519 */ 520 static inline uint8_t hci_event_mode_change_event_get_mode(const uint8_t * event){ 521 return event[5]; 522 } 523 /** 524 * @brief Get field interval from event HCI_EVENT_MODE_CHANGE_EVENT 525 * @param event packet 526 * @return interval 527 * @note: btstack_type 2 528 */ 529 static inline uint16_t hci_event_mode_change_event_get_interval(const uint8_t * event){ 530 return little_endian_read_16(event, 6); 531 } 532 533 /** 534 * @brief Get field bd_addr from event HCI_EVENT_PIN_CODE_REQUEST 535 * @param event packet 536 * @param Pointer to storage for bd_addr 537 * @note: btstack_type B 538 */ 539 static inline void hci_event_pin_code_request_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 540 reverse_bd_addr(&event[2], bd_addr); 541 } 542 543 /** 544 * @brief Get field bd_addr from event HCI_EVENT_LINK_KEY_REQUEST 545 * @param event packet 546 * @param Pointer to storage for bd_addr 547 * @note: btstack_type B 548 */ 549 static inline void hci_event_link_key_request_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 550 reverse_bd_addr(&event[2], bd_addr); 551 } 552 553 /** 554 * @brief Get field link_type from event HCI_EVENT_DATA_BUFFER_OVERFLOW 555 * @param event packet 556 * @return link_type 557 * @note: btstack_type 1 558 */ 559 static inline uint8_t hci_event_data_buffer_overflow_get_link_type(const uint8_t * event){ 560 return event[2]; 561 } 562 563 /** 564 * @brief Get field handle from event HCI_EVENT_MAX_SLOTS_CHANGED 565 * @param event packet 566 * @return handle 567 * @note: btstack_type H 568 */ 569 static inline hci_con_handle_t hci_event_max_slots_changed_get_handle(const uint8_t * event){ 570 return little_endian_read_16(event, 2); 571 } 572 /** 573 * @brief Get field lmp_max_slots from event HCI_EVENT_MAX_SLOTS_CHANGED 574 * @param event packet 575 * @return lmp_max_slots 576 * @note: btstack_type 1 577 */ 578 static inline uint8_t hci_event_max_slots_changed_get_lmp_max_slots(const uint8_t * event){ 579 return event[4]; 580 } 581 582 /** 583 * @brief Get field status from event HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 584 * @param event packet 585 * @return status 586 * @note: btstack_type 1 587 */ 588 static inline uint8_t hci_event_read_clock_offset_complete_get_status(const uint8_t * event){ 589 return event[2]; 590 } 591 /** 592 * @brief Get field handle from event HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 593 * @param event packet 594 * @return handle 595 * @note: btstack_type H 596 */ 597 static inline hci_con_handle_t hci_event_read_clock_offset_complete_get_handle(const uint8_t * event){ 598 return little_endian_read_16(event, 3); 599 } 600 /** 601 * @brief Get field clock_offset from event HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 602 * @param event packet 603 * @return clock_offset 604 * @note: btstack_type 2 605 */ 606 static inline uint16_t hci_event_read_clock_offset_complete_get_clock_offset(const uint8_t * event){ 607 return little_endian_read_16(event, 5); 608 } 609 610 /** 611 * @brief Get field status from event HCI_EVENT_CONNECTION_PACKET_TYPE_CHANGED 612 * @param event packet 613 * @return status 614 * @note: btstack_type 1 615 */ 616 static inline uint8_t hci_event_connection_packet_type_changed_get_status(const uint8_t * event){ 617 return event[2]; 618 } 619 /** 620 * @brief Get field handle from event HCI_EVENT_CONNECTION_PACKET_TYPE_CHANGED 621 * @param event packet 622 * @return handle 623 * @note: btstack_type H 624 */ 625 static inline hci_con_handle_t hci_event_connection_packet_type_changed_get_handle(const uint8_t * event){ 626 return little_endian_read_16(event, 3); 627 } 628 /** 629 * @brief Get field packet_types from event HCI_EVENT_CONNECTION_PACKET_TYPE_CHANGED 630 * @param event packet 631 * @return packet_types 632 * @note: btstack_type 2 633 */ 634 static inline uint16_t hci_event_connection_packet_type_changed_get_packet_types(const uint8_t * event){ 635 return little_endian_read_16(event, 5); 636 } 637 638 /** 639 * @brief Get field num_responses from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 640 * @param event packet 641 * @return num_responses 642 * @note: btstack_type 1 643 */ 644 static inline uint8_t hci_event_inquiry_result_with_rssi_get_num_responses(const uint8_t * event){ 645 return event[2]; 646 } 647 /** 648 * @brief Get field bd_addr from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 649 * @param event packet 650 * @param Pointer to storage for bd_addr 651 * @note: btstack_type B 652 */ 653 static inline void hci_event_inquiry_result_with_rssi_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 654 reverse_bd_addr(&event[3], bd_addr); 655 } 656 /** 657 * @brief Get field page_scan_repetition_mode from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 658 * @param event packet 659 * @return page_scan_repetition_mode 660 * @note: btstack_type 1 661 */ 662 static inline uint8_t hci_event_inquiry_result_with_rssi_get_page_scan_repetition_mode(const uint8_t * event){ 663 return event[9]; 664 } 665 /** 666 * @brief Get field reserved from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 667 * @param event packet 668 * @return reserved 669 * @note: btstack_type 1 670 */ 671 static inline uint8_t hci_event_inquiry_result_with_rssi_get_reserved(const uint8_t * event){ 672 return event[10]; 673 } 674 /** 675 * @brief Get field class_of_device from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 676 * @param event packet 677 * @return class_of_device 678 * @note: btstack_type 3 679 */ 680 static inline uint32_t hci_event_inquiry_result_with_rssi_get_class_of_device(const uint8_t * event){ 681 return little_endian_read_24(event, 11); 682 } 683 /** 684 * @brief Get field clock_offset from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 685 * @param event packet 686 * @return clock_offset 687 * @note: btstack_type 2 688 */ 689 static inline uint16_t hci_event_inquiry_result_with_rssi_get_clock_offset(const uint8_t * event){ 690 return little_endian_read_16(event, 14); 691 } 692 /** 693 * @brief Get field rssi from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 694 * @param event packet 695 * @return rssi 696 * @note: btstack_type 1 697 */ 698 static inline uint8_t hci_event_inquiry_result_with_rssi_get_rssi(const uint8_t * event){ 699 return event[16]; 700 } 701 702 /** 703 * @brief Get field status from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 704 * @param event packet 705 * @return status 706 * @note: btstack_type 1 707 */ 708 static inline uint8_t hci_event_synchronous_connection_complete_get_status(const uint8_t * event){ 709 return event[2]; 710 } 711 /** 712 * @brief Get field handle from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 713 * @param event packet 714 * @return handle 715 * @note: btstack_type H 716 */ 717 static inline hci_con_handle_t hci_event_synchronous_connection_complete_get_handle(const uint8_t * event){ 718 return little_endian_read_16(event, 3); 719 } 720 /** 721 * @brief Get field bd_addr from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 722 * @param event packet 723 * @param Pointer to storage for bd_addr 724 * @note: btstack_type B 725 */ 726 static inline void hci_event_synchronous_connection_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 727 reverse_bd_addr(&event[5], bd_addr); 728 } 729 /** 730 * @brief Get field link_type from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 731 * @param event packet 732 * @return link_type 733 * @note: btstack_type 1 734 */ 735 static inline uint8_t hci_event_synchronous_connection_complete_get_link_type(const uint8_t * event){ 736 return event[11]; 737 } 738 /** 739 * @brief Get field transmission_interval from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 740 * @param event packet 741 * @return transmission_interval 742 * @note: btstack_type 1 743 */ 744 static inline uint8_t hci_event_synchronous_connection_complete_get_transmission_interval(const uint8_t * event){ 745 return event[12]; 746 } 747 /** 748 * @brief Get field retransmission_interval from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 749 * @param event packet 750 * @return retransmission_interval 751 * @note: btstack_type 1 752 */ 753 static inline uint8_t hci_event_synchronous_connection_complete_get_retransmission_interval(const uint8_t * event){ 754 return event[13]; 755 } 756 /** 757 * @brief Get field rx_packet_length from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 758 * @param event packet 759 * @return rx_packet_length 760 * @note: btstack_type 2 761 */ 762 static inline uint16_t hci_event_synchronous_connection_complete_get_rx_packet_length(const uint8_t * event){ 763 return little_endian_read_16(event, 14); 764 } 765 /** 766 * @brief Get field tx_packet_length from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 767 * @param event packet 768 * @return tx_packet_length 769 * @note: btstack_type 2 770 */ 771 static inline uint16_t hci_event_synchronous_connection_complete_get_tx_packet_length(const uint8_t * event){ 772 return little_endian_read_16(event, 16); 773 } 774 /** 775 * @brief Get field air_mode from event HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 776 * @param event packet 777 * @return air_mode 778 * @note: btstack_type 1 779 */ 780 static inline uint8_t hci_event_synchronous_connection_complete_get_air_mode(const uint8_t * event){ 781 return event[18]; 782 } 783 784 /** 785 * @brief Get field num_responses from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 786 * @param event packet 787 * @return num_responses 788 * @note: btstack_type 1 789 */ 790 static inline uint8_t hci_event_extended_inquiry_response_get_num_responses(const uint8_t * event){ 791 return event[2]; 792 } 793 /** 794 * @brief Get field bd_addr from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 795 * @param event packet 796 * @param Pointer to storage for bd_addr 797 * @note: btstack_type B 798 */ 799 static inline void hci_event_extended_inquiry_response_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 800 reverse_bd_addr(&event[3], bd_addr); 801 } 802 /** 803 * @brief Get field page_scan_repetition_mode from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 804 * @param event packet 805 * @return page_scan_repetition_mode 806 * @note: btstack_type 1 807 */ 808 static inline uint8_t hci_event_extended_inquiry_response_get_page_scan_repetition_mode(const uint8_t * event){ 809 return event[9]; 810 } 811 /** 812 * @brief Get field reserved from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 813 * @param event packet 814 * @return reserved 815 * @note: btstack_type 1 816 */ 817 static inline uint8_t hci_event_extended_inquiry_response_get_reserved(const uint8_t * event){ 818 return event[10]; 819 } 820 /** 821 * @brief Get field class_of_device from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 822 * @param event packet 823 * @return class_of_device 824 * @note: btstack_type 3 825 */ 826 static inline uint32_t hci_event_extended_inquiry_response_get_class_of_device(const uint8_t * event){ 827 return little_endian_read_24(event, 11); 828 } 829 /** 830 * @brief Get field clock_offset from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 831 * @param event packet 832 * @return clock_offset 833 * @note: btstack_type 2 834 */ 835 static inline uint16_t hci_event_extended_inquiry_response_get_clock_offset(const uint8_t * event){ 836 return little_endian_read_16(event, 14); 837 } 838 /** 839 * @brief Get field rssi from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 840 * @param event packet 841 * @return rssi 842 * @note: btstack_type 1 843 */ 844 static inline uint8_t hci_event_extended_inquiry_response_get_rssi(const uint8_t * event){ 845 return event[16]; 846 } 847 848 /** 849 * @brief Get field status from event HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE 850 * @param event packet 851 * @return status 852 * @note: btstack_type 1 853 */ 854 static inline uint8_t hci_event_encryption_key_refresh_complete_get_status(const uint8_t * event){ 855 return event[2]; 856 } 857 /** 858 * @brief Get field handle from event HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE 859 * @param event packet 860 * @return handle 861 * @note: btstack_type H 862 */ 863 static inline hci_con_handle_t hci_event_encryption_key_refresh_complete_get_handle(const uint8_t * event){ 864 return little_endian_read_16(event, 3); 865 } 866 867 /** 868 * @brief Get field state from event BTSTACK_EVENT_STATE 869 * @param event packet 870 * @return state 871 * @note: btstack_type 1 872 */ 873 static inline uint8_t btstack_event_state_get_state(const uint8_t * event){ 874 return event[2]; 875 } 876 877 878 /** 879 * @brief Get field discoverable from event BTSTACK_EVENT_DISCOVERABLE_ENABLED 880 * @param event packet 881 * @return discoverable 882 * @note: btstack_type 1 883 */ 884 static inline uint8_t btstack_event_discoverable_enabled_get_discoverable(const uint8_t * event){ 885 return event[2]; 886 } 887 888 /** 889 * @brief Get field handle from event HCI_EVENT_SCO_CAN_SEND_NOW 890 * @param event packet 891 * @param Pointer to storage for handle 892 * @note: btstack_type B 893 */ 894 static inline void hci_event_sco_can_send_now_get_handle(const uint8_t * event, bd_addr_t handle){ 895 reverse_bd_addr(&event[2], handle); 896 } 897 898 /** 899 * @brief Get field status from event L2CAP_EVENT_CHANNEL_OPENED 900 * @param event packet 901 * @return status 902 * @note: btstack_type 1 903 */ 904 static inline uint8_t l2cap_event_channel_opened_get_status(const uint8_t * event){ 905 return event[2]; 906 } 907 /** 908 * @brief Get field address from event L2CAP_EVENT_CHANNEL_OPENED 909 * @param event packet 910 * @param Pointer to storage for address 911 * @note: btstack_type B 912 */ 913 static inline void l2cap_event_channel_opened_get_address(const uint8_t * event, bd_addr_t address){ 914 reverse_bd_addr(&event[3], address); 915 } 916 /** 917 * @brief Get field handle from event L2CAP_EVENT_CHANNEL_OPENED 918 * @param event packet 919 * @return handle 920 * @note: btstack_type H 921 */ 922 static inline hci_con_handle_t l2cap_event_channel_opened_get_handle(const uint8_t * event){ 923 return little_endian_read_16(event, 9); 924 } 925 /** 926 * @brief Get field psm from event L2CAP_EVENT_CHANNEL_OPENED 927 * @param event packet 928 * @return psm 929 * @note: btstack_type 2 930 */ 931 static inline uint16_t l2cap_event_channel_opened_get_psm(const uint8_t * event){ 932 return little_endian_read_16(event, 11); 933 } 934 /** 935 * @brief Get field local_cid from event L2CAP_EVENT_CHANNEL_OPENED 936 * @param event packet 937 * @return local_cid 938 * @note: btstack_type 2 939 */ 940 static inline uint16_t l2cap_event_channel_opened_get_local_cid(const uint8_t * event){ 941 return little_endian_read_16(event, 13); 942 } 943 /** 944 * @brief Get field remote_cid from event L2CAP_EVENT_CHANNEL_OPENED 945 * @param event packet 946 * @return remote_cid 947 * @note: btstack_type 2 948 */ 949 static inline uint16_t l2cap_event_channel_opened_get_remote_cid(const uint8_t * event){ 950 return little_endian_read_16(event, 15); 951 } 952 /** 953 * @brief Get field local_mtu from event L2CAP_EVENT_CHANNEL_OPENED 954 * @param event packet 955 * @return local_mtu 956 * @note: btstack_type 2 957 */ 958 static inline uint16_t l2cap_event_channel_opened_get_local_mtu(const uint8_t * event){ 959 return little_endian_read_16(event, 17); 960 } 961 /** 962 * @brief Get field remote_mtu from event L2CAP_EVENT_CHANNEL_OPENED 963 * @param event packet 964 * @return remote_mtu 965 * @note: btstack_type 2 966 */ 967 static inline uint16_t l2cap_event_channel_opened_get_remote_mtu(const uint8_t * event){ 968 return little_endian_read_16(event, 19); 969 } 970 /** 971 * @brief Get field flush_timeout from event L2CAP_EVENT_CHANNEL_OPENED 972 * @param event packet 973 * @return flush_timeout 974 * @note: btstack_type 2 975 */ 976 static inline uint16_t l2cap_event_channel_opened_get_flush_timeout(const uint8_t * event){ 977 return little_endian_read_16(event, 21); 978 } 979 980 /** 981 * @brief Get field local_cid from event L2CAP_EVENT_CHANNEL_CLOSED 982 * @param event packet 983 * @return local_cid 984 * @note: btstack_type 2 985 */ 986 static inline uint16_t l2cap_event_channel_closed_get_local_cid(const uint8_t * event){ 987 return little_endian_read_16(event, 2); 988 } 989 990 /** 991 * @brief Get field address from event L2CAP_EVENT_INCOMING_CONNECTION 992 * @param event packet 993 * @param Pointer to storage for address 994 * @note: btstack_type B 995 */ 996 static inline void l2cap_event_incoming_connection_get_address(const uint8_t * event, bd_addr_t address){ 997 reverse_bd_addr(&event[2], address); 998 } 999 /** 1000 * @brief Get field handle from event L2CAP_EVENT_INCOMING_CONNECTION 1001 * @param event packet 1002 * @return handle 1003 * @note: btstack_type H 1004 */ 1005 static inline hci_con_handle_t l2cap_event_incoming_connection_get_handle(const uint8_t * event){ 1006 return little_endian_read_16(event, 8); 1007 } 1008 /** 1009 * @brief Get field psm from event L2CAP_EVENT_INCOMING_CONNECTION 1010 * @param event packet 1011 * @return psm 1012 * @note: btstack_type 2 1013 */ 1014 static inline uint16_t l2cap_event_incoming_connection_get_psm(const uint8_t * event){ 1015 return little_endian_read_16(event, 10); 1016 } 1017 /** 1018 * @brief Get field local_cid from event L2CAP_EVENT_INCOMING_CONNECTION 1019 * @param event packet 1020 * @return local_cid 1021 * @note: btstack_type 2 1022 */ 1023 static inline uint16_t l2cap_event_incoming_connection_get_local_cid(const uint8_t * event){ 1024 return little_endian_read_16(event, 12); 1025 } 1026 /** 1027 * @brief Get field remote_cid from event L2CAP_EVENT_INCOMING_CONNECTION 1028 * @param event packet 1029 * @return remote_cid 1030 * @note: btstack_type 2 1031 */ 1032 static inline uint16_t l2cap_event_incoming_connection_get_remote_cid(const uint8_t * event){ 1033 return little_endian_read_16(event, 14); 1034 } 1035 1036 /** 1037 * @brief Get field handle from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 1038 * @param event packet 1039 * @return handle 1040 * @note: btstack_type H 1041 */ 1042 static inline hci_con_handle_t l2cap_event_connection_parameter_update_request_get_handle(const uint8_t * event){ 1043 return little_endian_read_16(event, 2); 1044 } 1045 /** 1046 * @brief Get field interval_min from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 1047 * @param event packet 1048 * @return interval_min 1049 * @note: btstack_type 2 1050 */ 1051 static inline uint16_t l2cap_event_connection_parameter_update_request_get_interval_min(const uint8_t * event){ 1052 return little_endian_read_16(event, 4); 1053 } 1054 /** 1055 * @brief Get field interval_max from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 1056 * @param event packet 1057 * @return interval_max 1058 * @note: btstack_type 2 1059 */ 1060 static inline uint16_t l2cap_event_connection_parameter_update_request_get_interval_max(const uint8_t * event){ 1061 return little_endian_read_16(event, 6); 1062 } 1063 /** 1064 * @brief Get field latencey from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 1065 * @param event packet 1066 * @return latencey 1067 * @note: btstack_type 2 1068 */ 1069 static inline uint16_t l2cap_event_connection_parameter_update_request_get_latencey(const uint8_t * event){ 1070 return little_endian_read_16(event, 8); 1071 } 1072 /** 1073 * @brief Get field timeout_multiplier from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 1074 * @param event packet 1075 * @return timeout_multiplier 1076 * @note: btstack_type 2 1077 */ 1078 static inline uint16_t l2cap_event_connection_parameter_update_request_get_timeout_multiplier(const uint8_t * event){ 1079 return little_endian_read_16(event, 10); 1080 } 1081 1082 /** 1083 * @brief Get field handle from event L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE 1084 * @param event packet 1085 * @return handle 1086 * @note: btstack_type H 1087 */ 1088 static inline hci_con_handle_t l2cap_event_connection_parameter_update_response_get_handle(const uint8_t * event){ 1089 return little_endian_read_16(event, 2); 1090 } 1091 1092 /** 1093 * @brief Get field local_cid from event L2CAP_EVENT_CAN_SEND_NOW 1094 * @param event packet 1095 * @return local_cid 1096 * @note: btstack_type 2 1097 */ 1098 static inline uint16_t l2cap_event_can_send_now_get_local_cid(const uint8_t * event){ 1099 return little_endian_read_16(event, 2); 1100 } 1101 1102 /** 1103 * @brief Get field status from event RFCOMM_EVENT_CHANNEL_OPENED 1104 * @param event packet 1105 * @return status 1106 * @note: btstack_type 1 1107 */ 1108 static inline uint8_t rfcomm_event_channel_opened_get_status(const uint8_t * event){ 1109 return event[2]; 1110 } 1111 /** 1112 * @brief Get field bd_addr from event RFCOMM_EVENT_CHANNEL_OPENED 1113 * @param event packet 1114 * @param Pointer to storage for bd_addr 1115 * @note: btstack_type B 1116 */ 1117 static inline void rfcomm_event_channel_opened_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 1118 reverse_bd_addr(&event[3], bd_addr); 1119 } 1120 /** 1121 * @brief Get field con_handle from event RFCOMM_EVENT_CHANNEL_OPENED 1122 * @param event packet 1123 * @return con_handle 1124 * @note: btstack_type 2 1125 */ 1126 static inline uint16_t rfcomm_event_channel_opened_get_con_handle(const uint8_t * event){ 1127 return little_endian_read_16(event, 9); 1128 } 1129 /** 1130 * @brief Get field server_channel from event RFCOMM_EVENT_CHANNEL_OPENED 1131 * @param event packet 1132 * @return server_channel 1133 * @note: btstack_type 1 1134 */ 1135 static inline uint8_t rfcomm_event_channel_opened_get_server_channel(const uint8_t * event){ 1136 return event[11]; 1137 } 1138 /** 1139 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_CHANNEL_OPENED 1140 * @param event packet 1141 * @return rfcomm_cid 1142 * @note: btstack_type 2 1143 */ 1144 static inline uint16_t rfcomm_event_channel_opened_get_rfcomm_cid(const uint8_t * event){ 1145 return little_endian_read_16(event, 12); 1146 } 1147 /** 1148 * @brief Get field max_frame_size from event RFCOMM_EVENT_CHANNEL_OPENED 1149 * @param event packet 1150 * @return max_frame_size 1151 * @note: btstack_type 2 1152 */ 1153 static inline uint16_t rfcomm_event_channel_opened_get_max_frame_size(const uint8_t * event){ 1154 return little_endian_read_16(event, 14); 1155 } 1156 1157 /** 1158 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_CHANNEL_CLOSED 1159 * @param event packet 1160 * @return rfcomm_cid 1161 * @note: btstack_type 2 1162 */ 1163 static inline uint16_t rfcomm_event_channel_closed_get_rfcomm_cid(const uint8_t * event){ 1164 return little_endian_read_16(event, 2); 1165 } 1166 1167 /** 1168 * @brief Get field bd_addr from event RFCOMM_EVENT_INCOMING_CONNECTION 1169 * @param event packet 1170 * @param Pointer to storage for bd_addr 1171 * @note: btstack_type B 1172 */ 1173 static inline void rfcomm_event_incoming_connection_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 1174 reverse_bd_addr(&event[2], bd_addr); 1175 } 1176 /** 1177 * @brief Get field server_channel from event RFCOMM_EVENT_INCOMING_CONNECTION 1178 * @param event packet 1179 * @return server_channel 1180 * @note: btstack_type 1 1181 */ 1182 static inline uint8_t rfcomm_event_incoming_connection_get_server_channel(const uint8_t * event){ 1183 return event[8]; 1184 } 1185 /** 1186 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_INCOMING_CONNECTION 1187 * @param event packet 1188 * @return rfcomm_cid 1189 * @note: btstack_type 2 1190 */ 1191 static inline uint16_t rfcomm_event_incoming_connection_get_rfcomm_cid(const uint8_t * event){ 1192 return little_endian_read_16(event, 9); 1193 } 1194 1195 /** 1196 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_REMOTE_LINE_STATUS 1197 * @param event packet 1198 * @return rfcomm_cid 1199 * @note: btstack_type 2 1200 */ 1201 static inline uint16_t rfcomm_event_remote_line_status_get_rfcomm_cid(const uint8_t * event){ 1202 return little_endian_read_16(event, 2); 1203 } 1204 /** 1205 * @brief Get field line_status from event RFCOMM_EVENT_REMOTE_LINE_STATUS 1206 * @param event packet 1207 * @return line_status 1208 * @note: btstack_type 1 1209 */ 1210 static inline uint8_t rfcomm_event_remote_line_status_get_line_status(const uint8_t * event){ 1211 return event[4]; 1212 } 1213 1214 /** 1215 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_REMOTE_MODEM_STATUS 1216 * @param event packet 1217 * @return rfcomm_cid 1218 * @note: btstack_type 2 1219 */ 1220 static inline uint16_t rfcomm_event_remote_modem_status_get_rfcomm_cid(const uint8_t * event){ 1221 return little_endian_read_16(event, 2); 1222 } 1223 /** 1224 * @brief Get field modem_status from event RFCOMM_EVENT_REMOTE_MODEM_STATUS 1225 * @param event packet 1226 * @return modem_status 1227 * @note: btstack_type 1 1228 */ 1229 static inline uint8_t rfcomm_event_remote_modem_status_get_modem_status(const uint8_t * event){ 1230 return event[4]; 1231 } 1232 1233 /** 1234 * @brief Get field rfcomm_cid from event RFCOMM_EVENT_CAN_SEND_NOW 1235 * @param event packet 1236 * @return rfcomm_cid 1237 * @note: btstack_type 2 1238 */ 1239 static inline uint16_t rfcomm_event_can_send_now_get_rfcomm_cid(const uint8_t * event){ 1240 return little_endian_read_16(event, 2); 1241 } 1242 1243 /** 1244 * @brief Get field status from event SDP_EVENT_QUERY_COMPLETE 1245 * @param event packet 1246 * @return status 1247 * @note: btstack_type 1 1248 */ 1249 static inline uint8_t sdp_event_query_complete_get_status(const uint8_t * event){ 1250 return event[2]; 1251 } 1252 1253 /** 1254 * @brief Get field rfcomm_channel from event SDP_EVENT_QUERY_RFCOMM_SERVICE 1255 * @param event packet 1256 * @return rfcomm_channel 1257 * @note: btstack_type 1 1258 */ 1259 static inline uint8_t sdp_event_query_rfcomm_service_get_rfcomm_channel(const uint8_t * event){ 1260 return event[2]; 1261 } 1262 /** 1263 * @brief Get field name from event SDP_EVENT_QUERY_RFCOMM_SERVICE 1264 * @param event packet 1265 * @return name 1266 * @note: btstack_type T 1267 */ 1268 static inline const char * sdp_event_query_rfcomm_service_get_name(const uint8_t * event){ 1269 return (const char *) &event[3]; 1270 } 1271 1272 /** 1273 * @brief Get field record_id from event SDP_EVENT_QUERY_ATTRIBUTE_BYTE 1274 * @param event packet 1275 * @return record_id 1276 * @note: btstack_type 2 1277 */ 1278 static inline uint16_t sdp_event_query_attribute_byte_get_record_id(const uint8_t * event){ 1279 return little_endian_read_16(event, 2); 1280 } 1281 /** 1282 * @brief Get field attribute_id from event SDP_EVENT_QUERY_ATTRIBUTE_BYTE 1283 * @param event packet 1284 * @return attribute_id 1285 * @note: btstack_type 2 1286 */ 1287 static inline uint16_t sdp_event_query_attribute_byte_get_attribute_id(const uint8_t * event){ 1288 return little_endian_read_16(event, 4); 1289 } 1290 /** 1291 * @brief Get field attribute_length from event SDP_EVENT_QUERY_ATTRIBUTE_BYTE 1292 * @param event packet 1293 * @return attribute_length 1294 * @note: btstack_type 2 1295 */ 1296 static inline uint16_t sdp_event_query_attribute_byte_get_attribute_length(const uint8_t * event){ 1297 return little_endian_read_16(event, 6); 1298 } 1299 /** 1300 * @brief Get field data_offset from event SDP_EVENT_QUERY_ATTRIBUTE_BYTE 1301 * @param event packet 1302 * @return data_offset 1303 * @note: btstack_type 2 1304 */ 1305 static inline uint16_t sdp_event_query_attribute_byte_get_data_offset(const uint8_t * event){ 1306 return little_endian_read_16(event, 8); 1307 } 1308 /** 1309 * @brief Get field data from event SDP_EVENT_QUERY_ATTRIBUTE_BYTE 1310 * @param event packet 1311 * @return data 1312 * @note: btstack_type 1 1313 */ 1314 static inline uint8_t sdp_event_query_attribute_byte_get_data(const uint8_t * event){ 1315 return event[10]; 1316 } 1317 1318 /** 1319 * @brief Get field record_id from event SDP_EVENT_QUERY_ATTRIBUTE_VALUE 1320 * @param event packet 1321 * @return record_id 1322 * @note: btstack_type 2 1323 */ 1324 static inline uint16_t sdp_event_query_attribute_value_get_record_id(const uint8_t * event){ 1325 return little_endian_read_16(event, 2); 1326 } 1327 /** 1328 * @brief Get field attribute_id from event SDP_EVENT_QUERY_ATTRIBUTE_VALUE 1329 * @param event packet 1330 * @return attribute_id 1331 * @note: btstack_type 2 1332 */ 1333 static inline uint16_t sdp_event_query_attribute_value_get_attribute_id(const uint8_t * event){ 1334 return little_endian_read_16(event, 4); 1335 } 1336 /** 1337 * @brief Get field attribute_length from event SDP_EVENT_QUERY_ATTRIBUTE_VALUE 1338 * @param event packet 1339 * @return attribute_length 1340 * @note: btstack_type L 1341 */ 1342 static inline int sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){ 1343 return little_endian_read_16(event, 6); 1344 } 1345 /** 1346 * @brief Get field attribute_value from event SDP_EVENT_QUERY_ATTRIBUTE_VALUE 1347 * @param event packet 1348 * @return attribute_value 1349 * @note: btstack_type V 1350 */ 1351 static inline const uint8_t * sdp_event_query_attribute_value_get_attribute_value(const uint8_t * event){ 1352 return &event[8]; 1353 } 1354 1355 /** 1356 * @brief Get field total_count from event SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 1357 * @param event packet 1358 * @return total_count 1359 * @note: btstack_type 2 1360 */ 1361 static inline uint16_t sdp_event_query_service_record_handle_get_total_count(const uint8_t * event){ 1362 return little_endian_read_16(event, 2); 1363 } 1364 /** 1365 * @brief Get field record_index from event SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 1366 * @param event packet 1367 * @return record_index 1368 * @note: btstack_type 2 1369 */ 1370 static inline uint16_t sdp_event_query_service_record_handle_get_record_index(const uint8_t * event){ 1371 return little_endian_read_16(event, 4); 1372 } 1373 /** 1374 * @brief Get field record_handle from event SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 1375 * @param event packet 1376 * @return record_handle 1377 * @note: btstack_type 4 1378 */ 1379 static inline uint32_t sdp_event_query_service_record_handle_get_record_handle(const uint8_t * event){ 1380 return little_endian_read_32(event, 6); 1381 } 1382 1383 #ifdef ENABLE_BLE 1384 /** 1385 * @brief Get field handle from event GATT_EVENT_QUERY_COMPLETE 1386 * @param event packet 1387 * @return handle 1388 * @note: btstack_type H 1389 */ 1390 static inline hci_con_handle_t gatt_event_query_complete_get_handle(const uint8_t * event){ 1391 return little_endian_read_16(event, 2); 1392 } 1393 /** 1394 * @brief Get field status from event GATT_EVENT_QUERY_COMPLETE 1395 * @param event packet 1396 * @return status 1397 * @note: btstack_type 1 1398 */ 1399 static inline uint8_t gatt_event_query_complete_get_status(const uint8_t * event){ 1400 return event[4]; 1401 } 1402 #endif 1403 1404 #ifdef ENABLE_BLE 1405 /** 1406 * @brief Get field handle from event GATT_EVENT_SERVICE_QUERY_RESULT 1407 * @param event packet 1408 * @return handle 1409 * @note: btstack_type H 1410 */ 1411 static inline hci_con_handle_t gatt_event_service_query_result_get_handle(const uint8_t * event){ 1412 return little_endian_read_16(event, 2); 1413 } 1414 /** 1415 * @brief Get field service from event GATT_EVENT_SERVICE_QUERY_RESULT 1416 * @param event packet 1417 * @param Pointer to storage for service 1418 * @note: btstack_type X 1419 */ 1420 static inline void gatt_event_service_query_result_get_service(const uint8_t * event, gatt_client_service_t * service){ 1421 gatt_client_deserialize_service(event, 4, service); 1422 } 1423 #endif 1424 1425 #ifdef ENABLE_BLE 1426 /** 1427 * @brief Get field handle from event GATT_EVENT_CHARACTERISTIC_QUERY_RESULT 1428 * @param event packet 1429 * @return handle 1430 * @note: btstack_type H 1431 */ 1432 static inline hci_con_handle_t gatt_event_characteristic_query_result_get_handle(const uint8_t * event){ 1433 return little_endian_read_16(event, 2); 1434 } 1435 /** 1436 * @brief Get field characteristic from event GATT_EVENT_CHARACTERISTIC_QUERY_RESULT 1437 * @param event packet 1438 * @param Pointer to storage for characteristic 1439 * @note: btstack_type Y 1440 */ 1441 static inline void gatt_event_characteristic_query_result_get_characteristic(const uint8_t * event, gatt_client_characteristic_t * characteristic){ 1442 gatt_client_deserialize_characteristic(event, 4, characteristic); 1443 } 1444 #endif 1445 1446 #ifdef ENABLE_BLE 1447 /** 1448 * @brief Get field handle from event GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 1449 * @param event packet 1450 * @return handle 1451 * @note: btstack_type H 1452 */ 1453 static inline hci_con_handle_t gatt_event_included_service_query_result_get_handle(const uint8_t * event){ 1454 return little_endian_read_16(event, 2); 1455 } 1456 /** 1457 * @brief Get field include_handle from event GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 1458 * @param event packet 1459 * @return include_handle 1460 * @note: btstack_type 2 1461 */ 1462 static inline uint16_t gatt_event_included_service_query_result_get_include_handle(const uint8_t * event){ 1463 return little_endian_read_16(event, 4); 1464 } 1465 /** 1466 * @brief Get field service from event GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 1467 * @param event packet 1468 * @param Pointer to storage for service 1469 * @note: btstack_type X 1470 */ 1471 static inline void gatt_event_included_service_query_result_get_service(const uint8_t * event, gatt_client_service_t * service){ 1472 gatt_client_deserialize_service(event, 6, service); 1473 } 1474 #endif 1475 1476 #ifdef ENABLE_BLE 1477 /** 1478 * @brief Get field handle from event GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 1479 * @param event packet 1480 * @return handle 1481 * @note: btstack_type H 1482 */ 1483 static inline hci_con_handle_t gatt_event_all_characteristic_descriptors_query_result_get_handle(const uint8_t * event){ 1484 return little_endian_read_16(event, 2); 1485 } 1486 /** 1487 * @brief Get field characteristic_descriptor from event GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 1488 * @param event packet 1489 * @param Pointer to storage for characteristic_descriptor 1490 * @note: btstack_type Z 1491 */ 1492 static inline void gatt_event_all_characteristic_descriptors_query_result_get_characteristic_descriptor(const uint8_t * event, gatt_client_characteristic_descriptor_t * characteristic_descriptor){ 1493 gatt_client_deserialize_characteristic_descriptor(event, 4, characteristic_descriptor); 1494 } 1495 #endif 1496 1497 #ifdef ENABLE_BLE 1498 /** 1499 * @brief Get field handle from event GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 1500 * @param event packet 1501 * @return handle 1502 * @note: btstack_type H 1503 */ 1504 static inline hci_con_handle_t gatt_event_characteristic_value_query_result_get_handle(const uint8_t * event){ 1505 return little_endian_read_16(event, 2); 1506 } 1507 /** 1508 * @brief Get field value_handle from event GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 1509 * @param event packet 1510 * @return value_handle 1511 * @note: btstack_type 2 1512 */ 1513 static inline uint16_t gatt_event_characteristic_value_query_result_get_value_handle(const uint8_t * event){ 1514 return little_endian_read_16(event, 4); 1515 } 1516 /** 1517 * @brief Get field value_length from event GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 1518 * @param event packet 1519 * @return value_length 1520 * @note: btstack_type L 1521 */ 1522 static inline int gatt_event_characteristic_value_query_result_get_value_length(const uint8_t * event){ 1523 return little_endian_read_16(event, 6); 1524 } 1525 /** 1526 * @brief Get field value from event GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 1527 * @param event packet 1528 * @return value 1529 * @note: btstack_type V 1530 */ 1531 static inline const uint8_t * gatt_event_characteristic_value_query_result_get_value(const uint8_t * event){ 1532 return &event[8]; 1533 } 1534 #endif 1535 1536 #ifdef ENABLE_BLE 1537 /** 1538 * @brief Get field handle from event GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 1539 * @param event packet 1540 * @return handle 1541 * @note: btstack_type H 1542 */ 1543 static inline hci_con_handle_t gatt_event_long_characteristic_value_query_result_get_handle(const uint8_t * event){ 1544 return little_endian_read_16(event, 2); 1545 } 1546 /** 1547 * @brief Get field value_handle from event GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 1548 * @param event packet 1549 * @return value_handle 1550 * @note: btstack_type 2 1551 */ 1552 static inline uint16_t gatt_event_long_characteristic_value_query_result_get_value_handle(const uint8_t * event){ 1553 return little_endian_read_16(event, 4); 1554 } 1555 /** 1556 * @brief Get field value_offset from event GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 1557 * @param event packet 1558 * @return value_offset 1559 * @note: btstack_type 2 1560 */ 1561 static inline uint16_t gatt_event_long_characteristic_value_query_result_get_value_offset(const uint8_t * event){ 1562 return little_endian_read_16(event, 6); 1563 } 1564 /** 1565 * @brief Get field value_length from event GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 1566 * @param event packet 1567 * @return value_length 1568 * @note: btstack_type L 1569 */ 1570 static inline int gatt_event_long_characteristic_value_query_result_get_value_length(const uint8_t * event){ 1571 return little_endian_read_16(event, 8); 1572 } 1573 /** 1574 * @brief Get field value from event GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 1575 * @param event packet 1576 * @return value 1577 * @note: btstack_type V 1578 */ 1579 static inline const uint8_t * gatt_event_long_characteristic_value_query_result_get_value(const uint8_t * event){ 1580 return &event[10]; 1581 } 1582 #endif 1583 1584 #ifdef ENABLE_BLE 1585 /** 1586 * @brief Get field handle from event GATT_EVENT_NOTIFICATION 1587 * @param event packet 1588 * @return handle 1589 * @note: btstack_type H 1590 */ 1591 static inline hci_con_handle_t gatt_event_notification_get_handle(const uint8_t * event){ 1592 return little_endian_read_16(event, 2); 1593 } 1594 /** 1595 * @brief Get field value_handle from event GATT_EVENT_NOTIFICATION 1596 * @param event packet 1597 * @return value_handle 1598 * @note: btstack_type 2 1599 */ 1600 static inline uint16_t gatt_event_notification_get_value_handle(const uint8_t * event){ 1601 return little_endian_read_16(event, 4); 1602 } 1603 /** 1604 * @brief Get field value_length from event GATT_EVENT_NOTIFICATION 1605 * @param event packet 1606 * @return value_length 1607 * @note: btstack_type L 1608 */ 1609 static inline int gatt_event_notification_get_value_length(const uint8_t * event){ 1610 return little_endian_read_16(event, 6); 1611 } 1612 /** 1613 * @brief Get field value from event GATT_EVENT_NOTIFICATION 1614 * @param event packet 1615 * @return value 1616 * @note: btstack_type V 1617 */ 1618 static inline const uint8_t * gatt_event_notification_get_value(const uint8_t * event){ 1619 return &event[8]; 1620 } 1621 #endif 1622 1623 #ifdef ENABLE_BLE 1624 /** 1625 * @brief Get field handle from event GATT_EVENT_INDICATION 1626 * @param event packet 1627 * @return handle 1628 * @note: btstack_type H 1629 */ 1630 static inline hci_con_handle_t gatt_event_indication_get_handle(const uint8_t * event){ 1631 return little_endian_read_16(event, 2); 1632 } 1633 /** 1634 * @brief Get field value_handle from event GATT_EVENT_INDICATION 1635 * @param event packet 1636 * @return value_handle 1637 * @note: btstack_type 2 1638 */ 1639 static inline uint16_t gatt_event_indication_get_value_handle(const uint8_t * event){ 1640 return little_endian_read_16(event, 4); 1641 } 1642 /** 1643 * @brief Get field value_length from event GATT_EVENT_INDICATION 1644 * @param event packet 1645 * @return value_length 1646 * @note: btstack_type L 1647 */ 1648 static inline int gatt_event_indication_get_value_length(const uint8_t * event){ 1649 return little_endian_read_16(event, 6); 1650 } 1651 /** 1652 * @brief Get field value from event GATT_EVENT_INDICATION 1653 * @param event packet 1654 * @return value 1655 * @note: btstack_type V 1656 */ 1657 static inline const uint8_t * gatt_event_indication_get_value(const uint8_t * event){ 1658 return &event[8]; 1659 } 1660 #endif 1661 1662 #ifdef ENABLE_BLE 1663 /** 1664 * @brief Get field descriptor_handle from event GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1665 * @param event packet 1666 * @return descriptor_handle 1667 * @note: btstack_type H 1668 */ 1669 static inline hci_con_handle_t gatt_event_characteristic_descriptor_query_result_get_descriptor_handle(const uint8_t * event){ 1670 return little_endian_read_16(event, 2); 1671 } 1672 /** 1673 * @brief Get field descriptor_length from event GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1674 * @param event packet 1675 * @return descriptor_length 1676 * @note: btstack_type 2 1677 */ 1678 static inline uint16_t gatt_event_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ 1679 return little_endian_read_16(event, 4); 1680 } 1681 /** 1682 * @brief Get field descriptor from event GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1683 * @param event packet 1684 * @return descriptor 1685 * @note: btstack_type L 1686 */ 1687 static inline int gatt_event_characteristic_descriptor_query_result_get_descriptor(const uint8_t * event){ 1688 return little_endian_read_16(event, 6); 1689 } 1690 #endif 1691 1692 #ifdef ENABLE_BLE 1693 /** 1694 * @brief Get field handle from event GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1695 * @param event packet 1696 * @return handle 1697 * @note: btstack_type H 1698 */ 1699 static inline hci_con_handle_t gatt_event_long_characteristic_descriptor_query_result_get_handle(const uint8_t * event){ 1700 return little_endian_read_16(event, 2); 1701 } 1702 /** 1703 * @brief Get field descriptor_offset from event GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1704 * @param event packet 1705 * @return descriptor_offset 1706 * @note: btstack_type 2 1707 */ 1708 static inline uint16_t gatt_event_long_characteristic_descriptor_query_result_get_descriptor_offset(const uint8_t * event){ 1709 return little_endian_read_16(event, 4); 1710 } 1711 /** 1712 * @brief Get field descriptor_length from event GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1713 * @param event packet 1714 * @return descriptor_length 1715 * @note: btstack_type L 1716 */ 1717 static inline int gatt_event_long_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ 1718 return little_endian_read_16(event, 6); 1719 } 1720 /** 1721 * @brief Get field descriptor from event GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 1722 * @param event packet 1723 * @return descriptor 1724 * @note: btstack_type V 1725 */ 1726 static inline const uint8_t * gatt_event_long_characteristic_descriptor_query_result_get_descriptor(const uint8_t * event){ 1727 return &event[8]; 1728 } 1729 #endif 1730 1731 #ifdef ENABLE_BLE 1732 /** 1733 * @brief Get field handle from event GATT_EVENT_MTU 1734 * @param event packet 1735 * @return handle 1736 * @note: btstack_type H 1737 */ 1738 static inline hci_con_handle_t gatt_event_mtu_get_handle(const uint8_t * event){ 1739 return little_endian_read_16(event, 2); 1740 } 1741 /** 1742 * @brief Get field MTU from event GATT_EVENT_MTU 1743 * @param event packet 1744 * @return MTU 1745 * @note: btstack_type 2 1746 */ 1747 static inline uint16_t gatt_event_mtu_get_MTU(const uint8_t * event){ 1748 return little_endian_read_16(event, 4); 1749 } 1750 #endif 1751 1752 /** 1753 * @brief Get field handle from event ATT_EVENT_MTU_EXCHANGE_COMPLETE 1754 * @param event packet 1755 * @return handle 1756 * @note: btstack_type H 1757 */ 1758 static inline hci_con_handle_t att_event_mtu_exchange_complete_get_handle(const uint8_t * event){ 1759 return little_endian_read_16(event, 2); 1760 } 1761 /** 1762 * @brief Get field MTU from event ATT_EVENT_MTU_EXCHANGE_COMPLETE 1763 * @param event packet 1764 * @return MTU 1765 * @note: btstack_type 2 1766 */ 1767 static inline uint16_t att_event_mtu_exchange_complete_get_MTU(const uint8_t * event){ 1768 return little_endian_read_16(event, 4); 1769 } 1770 1771 /** 1772 * @brief Get field status from event ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE 1773 * @param event packet 1774 * @return status 1775 * @note: btstack_type 1 1776 */ 1777 static inline uint8_t att_event_handle_value_indication_complete_get_status(const uint8_t * event){ 1778 return event[2]; 1779 } 1780 /** 1781 * @brief Get field conn_handle from event ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE 1782 * @param event packet 1783 * @return conn_handle 1784 * @note: btstack_type H 1785 */ 1786 static inline hci_con_handle_t att_event_handle_value_indication_complete_get_conn_handle(const uint8_t * event){ 1787 return little_endian_read_16(event, 3); 1788 } 1789 /** 1790 * @brief Get field attribute_handle from event ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE 1791 * @param event packet 1792 * @return attribute_handle 1793 * @note: btstack_type 2 1794 */ 1795 static inline uint16_t att_event_handle_value_indication_complete_get_attribute_handle(const uint8_t * event){ 1796 return little_endian_read_16(event, 5); 1797 } 1798 1799 1800 /** 1801 * @brief Get field status from event BNEP_EVENT_SERVICE_REGISTERED 1802 * @param event packet 1803 * @return status 1804 * @note: btstack_type 1 1805 */ 1806 static inline uint8_t bnep_event_service_registered_get_status(const uint8_t * event){ 1807 return event[2]; 1808 } 1809 /** 1810 * @brief Get field service_uuid from event BNEP_EVENT_SERVICE_REGISTERED 1811 * @param event packet 1812 * @return service_uuid 1813 * @note: btstack_type 2 1814 */ 1815 static inline uint16_t bnep_event_service_registered_get_service_uuid(const uint8_t * event){ 1816 return little_endian_read_16(event, 3); 1817 } 1818 1819 /** 1820 * @brief Get field status from event BNEP_EVENT_CHANNEL_OPENED 1821 * @param event packet 1822 * @return status 1823 * @note: btstack_type 1 1824 */ 1825 static inline uint8_t bnep_event_channel_opened_get_status(const uint8_t * event){ 1826 return event[2]; 1827 } 1828 /** 1829 * @brief Get field bnep_cid from event BNEP_EVENT_CHANNEL_OPENED 1830 * @param event packet 1831 * @return bnep_cid 1832 * @note: btstack_type 2 1833 */ 1834 static inline uint16_t bnep_event_channel_opened_get_bnep_cid(const uint8_t * event){ 1835 return little_endian_read_16(event, 3); 1836 } 1837 /** 1838 * @brief Get field source_uuid from event BNEP_EVENT_CHANNEL_OPENED 1839 * @param event packet 1840 * @return source_uuid 1841 * @note: btstack_type 2 1842 */ 1843 static inline uint16_t bnep_event_channel_opened_get_source_uuid(const uint8_t * event){ 1844 return little_endian_read_16(event, 5); 1845 } 1846 /** 1847 * @brief Get field destination_uuid from event BNEP_EVENT_CHANNEL_OPENED 1848 * @param event packet 1849 * @return destination_uuid 1850 * @note: btstack_type 2 1851 */ 1852 static inline uint16_t bnep_event_channel_opened_get_destination_uuid(const uint8_t * event){ 1853 return little_endian_read_16(event, 7); 1854 } 1855 /** 1856 * @brief Get field mtu from event BNEP_EVENT_CHANNEL_OPENED 1857 * @param event packet 1858 * @return mtu 1859 * @note: btstack_type 2 1860 */ 1861 static inline uint16_t bnep_event_channel_opened_get_mtu(const uint8_t * event){ 1862 return little_endian_read_16(event, 9); 1863 } 1864 /** 1865 * @brief Get field remote_address from event BNEP_EVENT_CHANNEL_OPENED 1866 * @param event packet 1867 * @param Pointer to storage for remote_address 1868 * @note: btstack_type B 1869 */ 1870 static inline void bnep_event_channel_opened_get_remote_address(const uint8_t * event, bd_addr_t remote_address){ 1871 reverse_bd_addr(&event[11], remote_address); 1872 } 1873 1874 /** 1875 * @brief Get field bnep_cid from event BNEP_EVENT_CHANNEL_CLOSED 1876 * @param event packet 1877 * @return bnep_cid 1878 * @note: btstack_type 2 1879 */ 1880 static inline uint16_t bnep_event_channel_closed_get_bnep_cid(const uint8_t * event){ 1881 return little_endian_read_16(event, 2); 1882 } 1883 /** 1884 * @brief Get field source_uuid from event BNEP_EVENT_CHANNEL_CLOSED 1885 * @param event packet 1886 * @return source_uuid 1887 * @note: btstack_type 2 1888 */ 1889 static inline uint16_t bnep_event_channel_closed_get_source_uuid(const uint8_t * event){ 1890 return little_endian_read_16(event, 4); 1891 } 1892 /** 1893 * @brief Get field destination_uuid from event BNEP_EVENT_CHANNEL_CLOSED 1894 * @param event packet 1895 * @return destination_uuid 1896 * @note: btstack_type 2 1897 */ 1898 static inline uint16_t bnep_event_channel_closed_get_destination_uuid(const uint8_t * event){ 1899 return little_endian_read_16(event, 6); 1900 } 1901 /** 1902 * @brief Get field remote_address from event BNEP_EVENT_CHANNEL_CLOSED 1903 * @param event packet 1904 * @param Pointer to storage for remote_address 1905 * @note: btstack_type B 1906 */ 1907 static inline void bnep_event_channel_closed_get_remote_address(const uint8_t * event, bd_addr_t remote_address){ 1908 reverse_bd_addr(&event[8], remote_address); 1909 } 1910 1911 /** 1912 * @brief Get field bnep_cid from event BNEP_EVENT_CHANNEL_TIMEOUT 1913 * @param event packet 1914 * @return bnep_cid 1915 * @note: btstack_type 2 1916 */ 1917 static inline uint16_t bnep_event_channel_timeout_get_bnep_cid(const uint8_t * event){ 1918 return little_endian_read_16(event, 2); 1919 } 1920 /** 1921 * @brief Get field source_uuid from event BNEP_EVENT_CHANNEL_TIMEOUT 1922 * @param event packet 1923 * @return source_uuid 1924 * @note: btstack_type 2 1925 */ 1926 static inline uint16_t bnep_event_channel_timeout_get_source_uuid(const uint8_t * event){ 1927 return little_endian_read_16(event, 4); 1928 } 1929 /** 1930 * @brief Get field destination_uuid from event BNEP_EVENT_CHANNEL_TIMEOUT 1931 * @param event packet 1932 * @return destination_uuid 1933 * @note: btstack_type 2 1934 */ 1935 static inline uint16_t bnep_event_channel_timeout_get_destination_uuid(const uint8_t * event){ 1936 return little_endian_read_16(event, 6); 1937 } 1938 /** 1939 * @brief Get field remote_address from event BNEP_EVENT_CHANNEL_TIMEOUT 1940 * @param event packet 1941 * @param Pointer to storage for remote_address 1942 * @note: btstack_type B 1943 */ 1944 static inline void bnep_event_channel_timeout_get_remote_address(const uint8_t * event, bd_addr_t remote_address){ 1945 reverse_bd_addr(&event[8], remote_address); 1946 } 1947 /** 1948 * @brief Get field channel_state from event BNEP_EVENT_CHANNEL_TIMEOUT 1949 * @param event packet 1950 * @return channel_state 1951 * @note: btstack_type 1 1952 */ 1953 static inline uint8_t bnep_event_channel_timeout_get_channel_state(const uint8_t * event){ 1954 return event[14]; 1955 } 1956 1957 /** 1958 * @brief Get field bnep_cid from event BNEP_EVENT_CAN_SEND_NOW 1959 * @param event packet 1960 * @return bnep_cid 1961 * @note: btstack_type 2 1962 */ 1963 static inline uint16_t bnep_event_can_send_now_get_bnep_cid(const uint8_t * event){ 1964 return little_endian_read_16(event, 2); 1965 } 1966 /** 1967 * @brief Get field source_uuid from event BNEP_EVENT_CAN_SEND_NOW 1968 * @param event packet 1969 * @return source_uuid 1970 * @note: btstack_type 2 1971 */ 1972 static inline uint16_t bnep_event_can_send_now_get_source_uuid(const uint8_t * event){ 1973 return little_endian_read_16(event, 4); 1974 } 1975 /** 1976 * @brief Get field destination_uuid from event BNEP_EVENT_CAN_SEND_NOW 1977 * @param event packet 1978 * @return destination_uuid 1979 * @note: btstack_type 2 1980 */ 1981 static inline uint16_t bnep_event_can_send_now_get_destination_uuid(const uint8_t * event){ 1982 return little_endian_read_16(event, 6); 1983 } 1984 /** 1985 * @brief Get field remote_address from event BNEP_EVENT_CAN_SEND_NOW 1986 * @param event packet 1987 * @param Pointer to storage for remote_address 1988 * @note: btstack_type B 1989 */ 1990 static inline void bnep_event_can_send_now_get_remote_address(const uint8_t * event, bd_addr_t remote_address){ 1991 reverse_bd_addr(&event[8], remote_address); 1992 } 1993 1994 #ifdef ENABLE_BLE 1995 /** 1996 * @brief Get field handle from event SM_EVENT_JUST_WORKS_REQUEST 1997 * @param event packet 1998 * @return handle 1999 * @note: btstack_type H 2000 */ 2001 static inline hci_con_handle_t sm_event_just_works_request_get_handle(const uint8_t * event){ 2002 return little_endian_read_16(event, 2); 2003 } 2004 /** 2005 * @brief Get field addr_type from event SM_EVENT_JUST_WORKS_REQUEST 2006 * @param event packet 2007 * @return addr_type 2008 * @note: btstack_type 1 2009 */ 2010 static inline uint8_t sm_event_just_works_request_get_addr_type(const uint8_t * event){ 2011 return event[4]; 2012 } 2013 /** 2014 * @brief Get field address from event SM_EVENT_JUST_WORKS_REQUEST 2015 * @param event packet 2016 * @param Pointer to storage for address 2017 * @note: btstack_type B 2018 */ 2019 static inline void sm_event_just_works_request_get_address(const uint8_t * event, bd_addr_t address){ 2020 reverse_bd_addr(&event[5], address); 2021 } 2022 #endif 2023 2024 #ifdef ENABLE_BLE 2025 /** 2026 * @brief Get field handle from event SM_EVENT_JUST_WORKS_CANCEL 2027 * @param event packet 2028 * @return handle 2029 * @note: btstack_type H 2030 */ 2031 static inline hci_con_handle_t sm_event_just_works_cancel_get_handle(const uint8_t * event){ 2032 return little_endian_read_16(event, 2); 2033 } 2034 /** 2035 * @brief Get field addr_type from event SM_EVENT_JUST_WORKS_CANCEL 2036 * @param event packet 2037 * @return addr_type 2038 * @note: btstack_type 1 2039 */ 2040 static inline uint8_t sm_event_just_works_cancel_get_addr_type(const uint8_t * event){ 2041 return event[4]; 2042 } 2043 /** 2044 * @brief Get field address from event SM_EVENT_JUST_WORKS_CANCEL 2045 * @param event packet 2046 * @param Pointer to storage for address 2047 * @note: btstack_type B 2048 */ 2049 static inline void sm_event_just_works_cancel_get_address(const uint8_t * event, bd_addr_t address){ 2050 reverse_bd_addr(&event[5], address); 2051 } 2052 #endif 2053 2054 #ifdef ENABLE_BLE 2055 /** 2056 * @brief Get field handle from event SM_EVENT_PASSKEY_DISPLAY_NUMBER 2057 * @param event packet 2058 * @return handle 2059 * @note: btstack_type H 2060 */ 2061 static inline hci_con_handle_t sm_event_passkey_display_number_get_handle(const uint8_t * event){ 2062 return little_endian_read_16(event, 2); 2063 } 2064 /** 2065 * @brief Get field addr_type from event SM_EVENT_PASSKEY_DISPLAY_NUMBER 2066 * @param event packet 2067 * @return addr_type 2068 * @note: btstack_type 1 2069 */ 2070 static inline uint8_t sm_event_passkey_display_number_get_addr_type(const uint8_t * event){ 2071 return event[4]; 2072 } 2073 /** 2074 * @brief Get field address from event SM_EVENT_PASSKEY_DISPLAY_NUMBER 2075 * @param event packet 2076 * @param Pointer to storage for address 2077 * @note: btstack_type B 2078 */ 2079 static inline void sm_event_passkey_display_number_get_address(const uint8_t * event, bd_addr_t address){ 2080 reverse_bd_addr(&event[5], address); 2081 } 2082 /** 2083 * @brief Get field passkey from event SM_EVENT_PASSKEY_DISPLAY_NUMBER 2084 * @param event packet 2085 * @return passkey 2086 * @note: btstack_type 4 2087 */ 2088 static inline uint32_t sm_event_passkey_display_number_get_passkey(const uint8_t * event){ 2089 return little_endian_read_32(event, 11); 2090 } 2091 #endif 2092 2093 #ifdef ENABLE_BLE 2094 /** 2095 * @brief Get field handle from event SM_EVENT_PASSKEY_DISPLAY_CANCEL 2096 * @param event packet 2097 * @return handle 2098 * @note: btstack_type H 2099 */ 2100 static inline hci_con_handle_t sm_event_passkey_display_cancel_get_handle(const uint8_t * event){ 2101 return little_endian_read_16(event, 2); 2102 } 2103 /** 2104 * @brief Get field addr_type from event SM_EVENT_PASSKEY_DISPLAY_CANCEL 2105 * @param event packet 2106 * @return addr_type 2107 * @note: btstack_type 1 2108 */ 2109 static inline uint8_t sm_event_passkey_display_cancel_get_addr_type(const uint8_t * event){ 2110 return event[4]; 2111 } 2112 /** 2113 * @brief Get field address from event SM_EVENT_PASSKEY_DISPLAY_CANCEL 2114 * @param event packet 2115 * @param Pointer to storage for address 2116 * @note: btstack_type B 2117 */ 2118 static inline void sm_event_passkey_display_cancel_get_address(const uint8_t * event, bd_addr_t address){ 2119 reverse_bd_addr(&event[5], address); 2120 } 2121 #endif 2122 2123 #ifdef ENABLE_BLE 2124 /** 2125 * @brief Get field handle from event SM_EVENT_PASSKEY_INPUT_NUMBER 2126 * @param event packet 2127 * @return handle 2128 * @note: btstack_type H 2129 */ 2130 static inline hci_con_handle_t sm_event_passkey_input_number_get_handle(const uint8_t * event){ 2131 return little_endian_read_16(event, 2); 2132 } 2133 /** 2134 * @brief Get field addr_type from event SM_EVENT_PASSKEY_INPUT_NUMBER 2135 * @param event packet 2136 * @return addr_type 2137 * @note: btstack_type 1 2138 */ 2139 static inline uint8_t sm_event_passkey_input_number_get_addr_type(const uint8_t * event){ 2140 return event[4]; 2141 } 2142 /** 2143 * @brief Get field address from event SM_EVENT_PASSKEY_INPUT_NUMBER 2144 * @param event packet 2145 * @param Pointer to storage for address 2146 * @note: btstack_type B 2147 */ 2148 static inline void sm_event_passkey_input_number_get_address(const uint8_t * event, bd_addr_t address){ 2149 reverse_bd_addr(&event[5], address); 2150 } 2151 #endif 2152 2153 #ifdef ENABLE_BLE 2154 /** 2155 * @brief Get field handle from event SM_EVENT_PASSKEY_INPUT_CANCEL 2156 * @param event packet 2157 * @return handle 2158 * @note: btstack_type H 2159 */ 2160 static inline hci_con_handle_t sm_event_passkey_input_cancel_get_handle(const uint8_t * event){ 2161 return little_endian_read_16(event, 2); 2162 } 2163 /** 2164 * @brief Get field addr_type from event SM_EVENT_PASSKEY_INPUT_CANCEL 2165 * @param event packet 2166 * @return addr_type 2167 * @note: btstack_type 1 2168 */ 2169 static inline uint8_t sm_event_passkey_input_cancel_get_addr_type(const uint8_t * event){ 2170 return event[4]; 2171 } 2172 /** 2173 * @brief Get field address from event SM_EVENT_PASSKEY_INPUT_CANCEL 2174 * @param event packet 2175 * @param Pointer to storage for address 2176 * @note: btstack_type B 2177 */ 2178 static inline void sm_event_passkey_input_cancel_get_address(const uint8_t * event, bd_addr_t address){ 2179 reverse_bd_addr(&event[5], address); 2180 } 2181 #endif 2182 2183 #ifdef ENABLE_BLE 2184 /** 2185 * @brief Get field handle from event SM_EVENT_NUMERIC_COMPARISON_REQUEST 2186 * @param event packet 2187 * @return handle 2188 * @note: btstack_type H 2189 */ 2190 static inline hci_con_handle_t sm_event_numeric_comparison_request_get_handle(const uint8_t * event){ 2191 return little_endian_read_16(event, 2); 2192 } 2193 /** 2194 * @brief Get field addr_type from event SM_EVENT_NUMERIC_COMPARISON_REQUEST 2195 * @param event packet 2196 * @return addr_type 2197 * @note: btstack_type 1 2198 */ 2199 static inline uint8_t sm_event_numeric_comparison_request_get_addr_type(const uint8_t * event){ 2200 return event[4]; 2201 } 2202 /** 2203 * @brief Get field address from event SM_EVENT_NUMERIC_COMPARISON_REQUEST 2204 * @param event packet 2205 * @param Pointer to storage for address 2206 * @note: btstack_type B 2207 */ 2208 static inline void sm_event_numeric_comparison_request_get_address(const uint8_t * event, bd_addr_t address){ 2209 reverse_bd_addr(&event[5], address); 2210 } 2211 /** 2212 * @brief Get field passkey from event SM_EVENT_NUMERIC_COMPARISON_REQUEST 2213 * @param event packet 2214 * @return passkey 2215 * @note: btstack_type 4 2216 */ 2217 static inline uint32_t sm_event_numeric_comparison_request_get_passkey(const uint8_t * event){ 2218 return little_endian_read_32(event, 11); 2219 } 2220 #endif 2221 2222 #ifdef ENABLE_BLE 2223 /** 2224 * @brief Get field handle from event SM_EVENT_NUMERIC_COMPARISON_CANCEL 2225 * @param event packet 2226 * @return handle 2227 * @note: btstack_type H 2228 */ 2229 static inline hci_con_handle_t sm_event_numeric_comparison_cancel_get_handle(const uint8_t * event){ 2230 return little_endian_read_16(event, 2); 2231 } 2232 /** 2233 * @brief Get field addr_type from event SM_EVENT_NUMERIC_COMPARISON_CANCEL 2234 * @param event packet 2235 * @return addr_type 2236 * @note: btstack_type 1 2237 */ 2238 static inline uint8_t sm_event_numeric_comparison_cancel_get_addr_type(const uint8_t * event){ 2239 return event[4]; 2240 } 2241 /** 2242 * @brief Get field address from event SM_EVENT_NUMERIC_COMPARISON_CANCEL 2243 * @param event packet 2244 * @param Pointer to storage for address 2245 * @note: btstack_type B 2246 */ 2247 static inline void sm_event_numeric_comparison_cancel_get_address(const uint8_t * event, bd_addr_t address){ 2248 reverse_bd_addr(&event[5], address); 2249 } 2250 #endif 2251 2252 #ifdef ENABLE_BLE 2253 /** 2254 * @brief Get field handle from event SM_EVENT_IDENTITY_RESOLVING_STARTED 2255 * @param event packet 2256 * @return handle 2257 * @note: btstack_type H 2258 */ 2259 static inline hci_con_handle_t sm_event_identity_resolving_started_get_handle(const uint8_t * event){ 2260 return little_endian_read_16(event, 2); 2261 } 2262 /** 2263 * @brief Get field addr_type from event SM_EVENT_IDENTITY_RESOLVING_STARTED 2264 * @param event packet 2265 * @return addr_type 2266 * @note: btstack_type 1 2267 */ 2268 static inline uint8_t sm_event_identity_resolving_started_get_addr_type(const uint8_t * event){ 2269 return event[4]; 2270 } 2271 /** 2272 * @brief Get field address from event SM_EVENT_IDENTITY_RESOLVING_STARTED 2273 * @param event packet 2274 * @param Pointer to storage for address 2275 * @note: btstack_type B 2276 */ 2277 static inline void sm_event_identity_resolving_started_get_address(const uint8_t * event, bd_addr_t address){ 2278 reverse_bd_addr(&event[5], address); 2279 } 2280 #endif 2281 2282 #ifdef ENABLE_BLE 2283 /** 2284 * @brief Get field handle from event SM_EVENT_IDENTITY_RESOLVING_FAILED 2285 * @param event packet 2286 * @return handle 2287 * @note: btstack_type H 2288 */ 2289 static inline hci_con_handle_t sm_event_identity_resolving_failed_get_handle(const uint8_t * event){ 2290 return little_endian_read_16(event, 2); 2291 } 2292 /** 2293 * @brief Get field addr_type from event SM_EVENT_IDENTITY_RESOLVING_FAILED 2294 * @param event packet 2295 * @return addr_type 2296 * @note: btstack_type 1 2297 */ 2298 static inline uint8_t sm_event_identity_resolving_failed_get_addr_type(const uint8_t * event){ 2299 return event[4]; 2300 } 2301 /** 2302 * @brief Get field address from event SM_EVENT_IDENTITY_RESOLVING_FAILED 2303 * @param event packet 2304 * @param Pointer to storage for address 2305 * @note: btstack_type B 2306 */ 2307 static inline void sm_event_identity_resolving_failed_get_address(const uint8_t * event, bd_addr_t address){ 2308 reverse_bd_addr(&event[5], address); 2309 } 2310 #endif 2311 2312 #ifdef ENABLE_BLE 2313 /** 2314 * @brief Get field handle from event SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 2315 * @param event packet 2316 * @return handle 2317 * @note: btstack_type H 2318 */ 2319 static inline hci_con_handle_t sm_event_identity_resolving_succeeded_get_handle(const uint8_t * event){ 2320 return little_endian_read_16(event, 2); 2321 } 2322 /** 2323 * @brief Get field addr_type from event SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 2324 * @param event packet 2325 * @return addr_type 2326 * @note: btstack_type 1 2327 */ 2328 static inline uint8_t sm_event_identity_resolving_succeeded_get_addr_type(const uint8_t * event){ 2329 return event[4]; 2330 } 2331 /** 2332 * @brief Get field address from event SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 2333 * @param event packet 2334 * @param Pointer to storage for address 2335 * @note: btstack_type B 2336 */ 2337 static inline void sm_event_identity_resolving_succeeded_get_address(const uint8_t * event, bd_addr_t address){ 2338 reverse_bd_addr(&event[5], address); 2339 } 2340 /** 2341 * @brief Get field le_device_db_index from event SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 2342 * @param event packet 2343 * @return le_device_db_index 2344 * @note: btstack_type 2 2345 */ 2346 static inline uint16_t sm_event_identity_resolving_succeeded_get_le_device_db_index(const uint8_t * event){ 2347 return little_endian_read_16(event, 11); 2348 } 2349 #endif 2350 2351 #ifdef ENABLE_BLE 2352 /** 2353 * @brief Get field handle from event SM_EVENT_AUTHORIZATION_REQUEST 2354 * @param event packet 2355 * @return handle 2356 * @note: btstack_type H 2357 */ 2358 static inline hci_con_handle_t sm_event_authorization_request_get_handle(const uint8_t * event){ 2359 return little_endian_read_16(event, 2); 2360 } 2361 /** 2362 * @brief Get field addr_type from event SM_EVENT_AUTHORIZATION_REQUEST 2363 * @param event packet 2364 * @return addr_type 2365 * @note: btstack_type 1 2366 */ 2367 static inline uint8_t sm_event_authorization_request_get_addr_type(const uint8_t * event){ 2368 return event[4]; 2369 } 2370 /** 2371 * @brief Get field address from event SM_EVENT_AUTHORIZATION_REQUEST 2372 * @param event packet 2373 * @param Pointer to storage for address 2374 * @note: btstack_type B 2375 */ 2376 static inline void sm_event_authorization_request_get_address(const uint8_t * event, bd_addr_t address){ 2377 reverse_bd_addr(&event[5], address); 2378 } 2379 #endif 2380 2381 #ifdef ENABLE_BLE 2382 /** 2383 * @brief Get field handle from event SM_EVENT_AUTHORIZATION_RESULT 2384 * @param event packet 2385 * @return handle 2386 * @note: btstack_type H 2387 */ 2388 static inline hci_con_handle_t sm_event_authorization_result_get_handle(const uint8_t * event){ 2389 return little_endian_read_16(event, 2); 2390 } 2391 /** 2392 * @brief Get field addr_type from event SM_EVENT_AUTHORIZATION_RESULT 2393 * @param event packet 2394 * @return addr_type 2395 * @note: btstack_type 1 2396 */ 2397 static inline uint8_t sm_event_authorization_result_get_addr_type(const uint8_t * event){ 2398 return event[4]; 2399 } 2400 /** 2401 * @brief Get field address from event SM_EVENT_AUTHORIZATION_RESULT 2402 * @param event packet 2403 * @param Pointer to storage for address 2404 * @note: btstack_type B 2405 */ 2406 static inline void sm_event_authorization_result_get_address(const uint8_t * event, bd_addr_t address){ 2407 reverse_bd_addr(&event[5], address); 2408 } 2409 /** 2410 * @brief Get field authorization_result from event SM_EVENT_AUTHORIZATION_RESULT 2411 * @param event packet 2412 * @return authorization_result 2413 * @note: btstack_type 1 2414 */ 2415 static inline uint8_t sm_event_authorization_result_get_authorization_result(const uint8_t * event){ 2416 return event[11]; 2417 } 2418 #endif 2419 2420 #ifdef ENABLE_BLE 2421 /** 2422 * @brief Get field handle from event SM_EVENT_KEYPRESS_NOTIFICATION 2423 * @param event packet 2424 * @return handle 2425 * @note: btstack_type H 2426 */ 2427 static inline hci_con_handle_t sm_event_keypress_notification_get_handle(const uint8_t * event){ 2428 return little_endian_read_16(event, 2); 2429 } 2430 /** 2431 * @brief Get field action from event SM_EVENT_KEYPRESS_NOTIFICATION 2432 * @param event packet 2433 * @return action 2434 * @note: btstack_type 1 2435 */ 2436 static inline uint8_t sm_event_keypress_notification_get_action(const uint8_t * event){ 2437 return event[4]; 2438 } 2439 #endif 2440 2441 /** 2442 * @brief Get field handle from event GAP_EVENT_SECURITY_LEVEL 2443 * @param event packet 2444 * @return handle 2445 * @note: btstack_type H 2446 */ 2447 static inline hci_con_handle_t gap_event_security_level_get_handle(const uint8_t * event){ 2448 return little_endian_read_16(event, 2); 2449 } 2450 /** 2451 * @brief Get field security_level from event GAP_EVENT_SECURITY_LEVEL 2452 * @param event packet 2453 * @return security_level 2454 * @note: btstack_type 1 2455 */ 2456 static inline uint8_t gap_event_security_level_get_security_level(const uint8_t * event){ 2457 return event[4]; 2458 } 2459 2460 /** 2461 * @brief Get field status from event GAP_EVENT_DEDICATED_BONDING_COMPLETED 2462 * @param event packet 2463 * @return status 2464 * @note: btstack_type 1 2465 */ 2466 static inline uint8_t gap_event_dedicated_bonding_completed_get_status(const uint8_t * event){ 2467 return event[2]; 2468 } 2469 /** 2470 * @brief Get field address from event GAP_EVENT_DEDICATED_BONDING_COMPLETED 2471 * @param event packet 2472 * @param Pointer to storage for address 2473 * @note: btstack_type B 2474 */ 2475 static inline void gap_event_dedicated_bonding_completed_get_address(const uint8_t * event, bd_addr_t address){ 2476 reverse_bd_addr(&event[3], address); 2477 } 2478 2479 /** 2480 * @brief Get field advertising_event_type from event GAP_EVENT_ADVERTISING_REPORT 2481 * @param event packet 2482 * @return advertising_event_type 2483 * @note: btstack_type 1 2484 */ 2485 static inline uint8_t gap_event_advertising_report_get_advertising_event_type(const uint8_t * event){ 2486 return event[2]; 2487 } 2488 /** 2489 * @brief Get field address_type from event GAP_EVENT_ADVERTISING_REPORT 2490 * @param event packet 2491 * @return address_type 2492 * @note: btstack_type 1 2493 */ 2494 static inline uint8_t gap_event_advertising_report_get_address_type(const uint8_t * event){ 2495 return event[3]; 2496 } 2497 /** 2498 * @brief Get field address from event GAP_EVENT_ADVERTISING_REPORT 2499 * @param event packet 2500 * @param Pointer to storage for address 2501 * @note: btstack_type B 2502 */ 2503 static inline void gap_event_advertising_report_get_address(const uint8_t * event, bd_addr_t address){ 2504 reverse_bd_addr(&event[4], address); 2505 } 2506 /** 2507 * @brief Get field rssi from event GAP_EVENT_ADVERTISING_REPORT 2508 * @param event packet 2509 * @return rssi 2510 * @note: btstack_type 1 2511 */ 2512 static inline uint8_t gap_event_advertising_report_get_rssi(const uint8_t * event){ 2513 return event[10]; 2514 } 2515 /** 2516 * @brief Get field data_length from event GAP_EVENT_ADVERTISING_REPORT 2517 * @param event packet 2518 * @return data_length 2519 * @note: btstack_type J 2520 */ 2521 static inline int gap_event_advertising_report_get_data_length(const uint8_t * event){ 2522 return event[11]; 2523 } 2524 /** 2525 * @brief Get field data from event GAP_EVENT_ADVERTISING_REPORT 2526 * @param event packet 2527 * @return data 2528 * @note: btstack_type V 2529 */ 2530 static inline const uint8_t * gap_event_advertising_report_get_data(const uint8_t * event){ 2531 return &event[12]; 2532 } 2533 2534 /** 2535 * @brief Get field status from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2536 * @param event packet 2537 * @return status 2538 * @note: btstack_type 1 2539 */ 2540 static inline uint8_t hci_subevent_le_connection_complete_get_status(const uint8_t * event){ 2541 return event[3]; 2542 } 2543 /** 2544 * @brief Get field connection_handle from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2545 * @param event packet 2546 * @return connection_handle 2547 * @note: btstack_type H 2548 */ 2549 static inline hci_con_handle_t hci_subevent_le_connection_complete_get_connection_handle(const uint8_t * event){ 2550 return little_endian_read_16(event, 4); 2551 } 2552 /** 2553 * @brief Get field role from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2554 * @param event packet 2555 * @return role 2556 * @note: btstack_type 1 2557 */ 2558 static inline uint8_t hci_subevent_le_connection_complete_get_role(const uint8_t * event){ 2559 return event[6]; 2560 } 2561 /** 2562 * @brief Get field peer_address_type from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2563 * @param event packet 2564 * @return peer_address_type 2565 * @note: btstack_type 1 2566 */ 2567 static inline uint8_t hci_subevent_le_connection_complete_get_peer_address_type(const uint8_t * event){ 2568 return event[7]; 2569 } 2570 /** 2571 * @brief Get field peer_address from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2572 * @param event packet 2573 * @param Pointer to storage for peer_address 2574 * @note: btstack_type B 2575 */ 2576 static inline void hci_subevent_le_connection_complete_get_peer_address(const uint8_t * event, bd_addr_t peer_address){ 2577 reverse_bd_addr(&event[8], peer_address); 2578 } 2579 /** 2580 * @brief Get field conn_interval from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2581 * @param event packet 2582 * @return conn_interval 2583 * @note: btstack_type 2 2584 */ 2585 static inline uint16_t hci_subevent_le_connection_complete_get_conn_interval(const uint8_t * event){ 2586 return little_endian_read_16(event, 14); 2587 } 2588 /** 2589 * @brief Get field conn_latency from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2590 * @param event packet 2591 * @return conn_latency 2592 * @note: btstack_type 2 2593 */ 2594 static inline uint16_t hci_subevent_le_connection_complete_get_conn_latency(const uint8_t * event){ 2595 return little_endian_read_16(event, 16); 2596 } 2597 /** 2598 * @brief Get field supervision_timeout from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2599 * @param event packet 2600 * @return supervision_timeout 2601 * @note: btstack_type 2 2602 */ 2603 static inline uint16_t hci_subevent_le_connection_complete_get_supervision_timeout(const uint8_t * event){ 2604 return little_endian_read_16(event, 18); 2605 } 2606 /** 2607 * @brief Get field master_clock_accuracy from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE 2608 * @param event packet 2609 * @return master_clock_accuracy 2610 * @note: btstack_type 1 2611 */ 2612 static inline uint8_t hci_subevent_le_connection_complete_get_master_clock_accuracy(const uint8_t * event){ 2613 return event[20]; 2614 } 2615 2616 /** 2617 * @brief Get field status from event HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE 2618 * @param event packet 2619 * @return status 2620 * @note: btstack_type 1 2621 */ 2622 static inline uint8_t hsp_subevent_rfcomm_connection_complete_get_status(const uint8_t * event){ 2623 return event[3]; 2624 } 2625 2626 /** 2627 * @brief Get field status from event HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE 2628 * @param event packet 2629 * @return status 2630 * @note: btstack_type 1 2631 */ 2632 static inline uint8_t hsp_subevent_rfcomm_disconnection_complete_get_status(const uint8_t * event){ 2633 return event[3]; 2634 } 2635 2636 /** 2637 * @brief Get field status from event HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE 2638 * @param event packet 2639 * @return status 2640 * @note: btstack_type 1 2641 */ 2642 static inline uint8_t hsp_subevent_audio_connection_complete_get_status(const uint8_t * event){ 2643 return event[3]; 2644 } 2645 /** 2646 * @brief Get field handle from event HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE 2647 * @param event packet 2648 * @return handle 2649 * @note: btstack_type H 2650 */ 2651 static inline hci_con_handle_t hsp_subevent_audio_connection_complete_get_handle(const uint8_t * event){ 2652 return little_endian_read_16(event, 4); 2653 } 2654 2655 /** 2656 * @brief Get field status from event HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE 2657 * @param event packet 2658 * @return status 2659 * @note: btstack_type 1 2660 */ 2661 static inline uint8_t hsp_subevent_audio_disconnection_complete_get_status(const uint8_t * event){ 2662 return event[3]; 2663 } 2664 2665 2666 /** 2667 * @brief Get field gain from event HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED 2668 * @param event packet 2669 * @return gain 2670 * @note: btstack_type 1 2671 */ 2672 static inline uint8_t hsp_subevent_microphone_gain_changed_get_gain(const uint8_t * event){ 2673 return event[3]; 2674 } 2675 2676 /** 2677 * @brief Get field gain from event HSP_SUBEVENT_SPEAKER_GAIN_CHANGED 2678 * @param event packet 2679 * @return gain 2680 * @note: btstack_type 1 2681 */ 2682 static inline uint8_t hsp_subevent_speaker_gain_changed_get_gain(const uint8_t * event){ 2683 return event[3]; 2684 } 2685 2686 /** 2687 * @brief Get field value_length from event HSP_SUBEVENT_HS_COMMAND 2688 * @param event packet 2689 * @return value_length 2690 * @note: btstack_type J 2691 */ 2692 static inline int hsp_subevent_hs_command_get_value_length(const uint8_t * event){ 2693 return event[3]; 2694 } 2695 /** 2696 * @brief Get field value from event HSP_SUBEVENT_HS_COMMAND 2697 * @param event packet 2698 * @return value 2699 * @note: btstack_type V 2700 */ 2701 static inline const uint8_t * hsp_subevent_hs_command_get_value(const uint8_t * event){ 2702 return &event[4]; 2703 } 2704 2705 /** 2706 * @brief Get field value_length from event HSP_SUBEVENT_AG_INDICATION 2707 * @param event packet 2708 * @return value_length 2709 * @note: btstack_type J 2710 */ 2711 static inline int hsp_subevent_ag_indication_get_value_length(const uint8_t * event){ 2712 return event[3]; 2713 } 2714 /** 2715 * @brief Get field value from event HSP_SUBEVENT_AG_INDICATION 2716 * @param event packet 2717 * @return value 2718 * @note: btstack_type V 2719 */ 2720 static inline const uint8_t * hsp_subevent_ag_indication_get_value(const uint8_t * event){ 2721 return &event[4]; 2722 } 2723 2724 /** 2725 * @brief Get field status from event HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED 2726 * @param event packet 2727 * @return status 2728 * @note: btstack_type 1 2729 */ 2730 static inline uint8_t hfp_subevent_service_level_connection_established_get_status(const uint8_t * event){ 2731 return event[3]; 2732 } 2733 /** 2734 * @brief Get field con_handle from event HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED 2735 * @param event packet 2736 * @return con_handle 2737 * @note: btstack_type H 2738 */ 2739 static inline hci_con_handle_t hfp_subevent_service_level_connection_established_get_con_handle(const uint8_t * event){ 2740 return little_endian_read_16(event, 4); 2741 } 2742 2743 2744 /** 2745 * @brief Get field status from event HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED 2746 * @param event packet 2747 * @return status 2748 * @note: btstack_type 1 2749 */ 2750 static inline uint8_t hfp_subevent_audio_connection_established_get_status(const uint8_t * event){ 2751 return event[3]; 2752 } 2753 /** 2754 * @brief Get field handle from event HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED 2755 * @param event packet 2756 * @return handle 2757 * @note: btstack_type H 2758 */ 2759 static inline hci_con_handle_t hfp_subevent_audio_connection_established_get_handle(const uint8_t * event){ 2760 return little_endian_read_16(event, 4); 2761 } 2762 2763 2764 /** 2765 * @brief Get field status from event HFP_SUBEVENT_COMPLETE 2766 * @param event packet 2767 * @return status 2768 * @note: btstack_type 1 2769 */ 2770 static inline uint8_t hfp_subevent_complete_get_status(const uint8_t * event){ 2771 return event[3]; 2772 } 2773 2774 /** 2775 * @brief Get field indicator_index from event HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED 2776 * @param event packet 2777 * @return indicator_index 2778 * @note: btstack_type 1 2779 */ 2780 static inline uint8_t hfp_subevent_ag_indicator_status_changed_get_indicator_index(const uint8_t * event){ 2781 return event[3]; 2782 } 2783 /** 2784 * @brief Get field indicator_status from event HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED 2785 * @param event packet 2786 * @return indicator_status 2787 * @note: btstack_type 1 2788 */ 2789 static inline uint8_t hfp_subevent_ag_indicator_status_changed_get_indicator_status(const uint8_t * event){ 2790 return event[4]; 2791 } 2792 /** 2793 * @brief Get field indicator_name from event HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED 2794 * @param event packet 2795 * @return indicator_name 2796 * @note: btstack_type T 2797 */ 2798 static inline const char * hfp_subevent_ag_indicator_status_changed_get_indicator_name(const uint8_t * event){ 2799 return (const char *) &event[5]; 2800 } 2801 2802 /** 2803 * @brief Get field network_operator_mode from event HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED 2804 * @param event packet 2805 * @return network_operator_mode 2806 * @note: btstack_type 1 2807 */ 2808 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_mode(const uint8_t * event){ 2809 return event[3]; 2810 } 2811 /** 2812 * @brief Get field network_operator_format from event HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED 2813 * @param event packet 2814 * @return network_operator_format 2815 * @note: btstack_type 1 2816 */ 2817 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_format(const uint8_t * event){ 2818 return event[4]; 2819 } 2820 /** 2821 * @brief Get field network_operator_name from event HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED 2822 * @param event packet 2823 * @return network_operator_name 2824 * @note: btstack_type 1 2825 */ 2826 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_name(const uint8_t * event){ 2827 return event[5]; 2828 } 2829 2830 /** 2831 * @brief Get field error from event HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR 2832 * @param event packet 2833 * @return error 2834 * @note: btstack_type 1 2835 */ 2836 static inline uint8_t hfp_subevent_extended_audio_gateway_error_get_error(const uint8_t * event){ 2837 return event[3]; 2838 } 2839 2840 /** 2841 * @brief Get field status from event HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE 2842 * @param event packet 2843 * @return status 2844 * @note: btstack_type 1 2845 */ 2846 static inline uint8_t hfp_subevent_codecs_connection_complete_get_status(const uint8_t * event){ 2847 return event[3]; 2848 } 2849 2850 2851 2852 2853 /** 2854 * @brief Get field number from event HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER 2855 * @param event packet 2856 * @return number 2857 * @note: btstack_type T 2858 */ 2859 static inline const char * hfp_subevent_place_call_with_number_get_number(const uint8_t * event){ 2860 return (const char *) &event[3]; 2861 } 2862 2863 2864 /** 2865 * @brief Get field number from event HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG 2866 * @param event packet 2867 * @return number 2868 * @note: btstack_type T 2869 */ 2870 static inline const char * hfp_subevent_number_for_voice_tag_get_number(const uint8_t * event){ 2871 return (const char *) &event[3]; 2872 } 2873 2874 /** 2875 * @brief Get field dtmf from event HFP_SUBEVENT_TRANSMIT_DTMF_CODES 2876 * @param event packet 2877 * @return dtmf 2878 * @note: btstack_type T 2879 */ 2880 static inline const char * hfp_subevent_transmit_dtmf_codes_get_dtmf(const uint8_t * event){ 2881 return (const char *) &event[3]; 2882 } 2883 2884 2885 2886 2887 /** 2888 * @brief Get field status from event HFP_SUBEVENT_SPEAKER_VOLUME 2889 * @param event packet 2890 * @return status 2891 * @note: btstack_type 1 2892 */ 2893 static inline uint8_t hfp_subevent_speaker_volume_get_status(const uint8_t * event){ 2894 return event[3]; 2895 } 2896 /** 2897 * @brief Get field gain from event HFP_SUBEVENT_SPEAKER_VOLUME 2898 * @param event packet 2899 * @return gain 2900 * @note: btstack_type 1 2901 */ 2902 static inline uint8_t hfp_subevent_speaker_volume_get_gain(const uint8_t * event){ 2903 return event[4]; 2904 } 2905 2906 /** 2907 * @brief Get field status from event HFP_SUBEVENT_MICROPHONE_VOLUME 2908 * @param event packet 2909 * @return status 2910 * @note: btstack_type 1 2911 */ 2912 static inline uint8_t hfp_subevent_microphone_volume_get_status(const uint8_t * event){ 2913 return event[3]; 2914 } 2915 /** 2916 * @brief Get field gain from event HFP_SUBEVENT_MICROPHONE_VOLUME 2917 * @param event packet 2918 * @return gain 2919 * @note: btstack_type 1 2920 */ 2921 static inline uint8_t hfp_subevent_microphone_volume_get_gain(const uint8_t * event){ 2922 return event[4]; 2923 } 2924 2925 /** 2926 * @brief Get field type from event HFP_SUBEVENT_CALL_WAITING_NOTIFICATION 2927 * @param event packet 2928 * @return type 2929 * @note: btstack_type 1 2930 */ 2931 static inline uint8_t hfp_subevent_call_waiting_notification_get_type(const uint8_t * event){ 2932 return event[3]; 2933 } 2934 /** 2935 * @brief Get field number from event HFP_SUBEVENT_CALL_WAITING_NOTIFICATION 2936 * @param event packet 2937 * @return number 2938 * @note: btstack_type T 2939 */ 2940 static inline const char * hfp_subevent_call_waiting_notification_get_number(const uint8_t * event){ 2941 return (const char *) &event[4]; 2942 } 2943 2944 /** 2945 * @brief Get field type from event HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 2946 * @param event packet 2947 * @return type 2948 * @note: btstack_type 1 2949 */ 2950 static inline uint8_t hfp_subevent_calling_line_indetification_notification_get_type(const uint8_t * event){ 2951 return event[3]; 2952 } 2953 /** 2954 * @brief Get field number from event HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 2955 * @param event packet 2956 * @return number 2957 * @note: btstack_type T 2958 */ 2959 static inline const char * hfp_subevent_calling_line_indetification_notification_get_number(const uint8_t * event){ 2960 return (const char *) &event[4]; 2961 } 2962 2963 /** 2964 * @brief Get field clcc_idx from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 2965 * @param event packet 2966 * @return clcc_idx 2967 * @note: btstack_type 1 2968 */ 2969 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_idx(const uint8_t * event){ 2970 return event[3]; 2971 } 2972 /** 2973 * @brief Get field clcc_dir from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 2974 * @param event packet 2975 * @return clcc_dir 2976 * @note: btstack_type 1 2977 */ 2978 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_dir(const uint8_t * event){ 2979 return event[4]; 2980 } 2981 /** 2982 * @brief Get field clcc_status from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 2983 * @param event packet 2984 * @return clcc_status 2985 * @note: btstack_type 1 2986 */ 2987 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_status(const uint8_t * event){ 2988 return event[5]; 2989 } 2990 /** 2991 * @brief Get field clcc_mpty from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 2992 * @param event packet 2993 * @return clcc_mpty 2994 * @note: btstack_type 1 2995 */ 2996 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_mpty(const uint8_t * event){ 2997 return event[6]; 2998 } 2999 /** 3000 * @brief Get field bnip_type from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 3001 * @param event packet 3002 * @return bnip_type 3003 * @note: btstack_type 1 3004 */ 3005 static inline uint8_t hfp_subevent_enhanced_call_status_get_bnip_type(const uint8_t * event){ 3006 return event[7]; 3007 } 3008 /** 3009 * @brief Get field bnip_number from event HFP_SUBEVENT_ENHANCED_CALL_STATUS 3010 * @param event packet 3011 * @return bnip_number 3012 * @note: btstack_type T 3013 */ 3014 static inline const char * hfp_subevent_enhanced_call_status_get_bnip_number(const uint8_t * event){ 3015 return (const char *) &event[8]; 3016 } 3017 3018 /** 3019 * @brief Get field status from event HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION 3020 * @param event packet 3021 * @return status 3022 * @note: btstack_type 1 3023 */ 3024 static inline uint8_t hfp_subevent_subscriber_number_information_get_status(const uint8_t * event){ 3025 return event[3]; 3026 } 3027 /** 3028 * @brief Get field bnip_type from event HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION 3029 * @param event packet 3030 * @return bnip_type 3031 * @note: btstack_type 1 3032 */ 3033 static inline uint8_t hfp_subevent_subscriber_number_information_get_bnip_type(const uint8_t * event){ 3034 return event[4]; 3035 } 3036 /** 3037 * @brief Get field bnip_number from event HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION 3038 * @param event packet 3039 * @return bnip_number 3040 * @note: btstack_type T 3041 */ 3042 static inline const char * hfp_subevent_subscriber_number_information_get_bnip_number(const uint8_t * event){ 3043 return (const char *) &event[5]; 3044 } 3045 3046 /** 3047 * @brief Get field value from event HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS 3048 * @param event packet 3049 * @return value 3050 * @note: btstack_type T 3051 */ 3052 static inline const char * hfp_subevent_response_and_hold_status_get_value(const uint8_t * event){ 3053 return (const char *) &event[3]; 3054 } 3055 3056 #ifdef ENABLE_BLE 3057 /** 3058 * @brief Get field handle from event ANCS_SUBEVENT_CLIENT_CONNECTED 3059 * @param event packet 3060 * @return handle 3061 * @note: btstack_type H 3062 */ 3063 static inline hci_con_handle_t ancs_subevent_client_connected_get_handle(const uint8_t * event){ 3064 return little_endian_read_16(event, 3); 3065 } 3066 #endif 3067 3068 #ifdef ENABLE_BLE 3069 /** 3070 * @brief Get field handle from event ANCS_SUBEVENT_CLIENT_NOTIFICATION 3071 * @param event packet 3072 * @return handle 3073 * @note: btstack_type H 3074 */ 3075 static inline hci_con_handle_t ancs_subevent_client_notification_get_handle(const uint8_t * event){ 3076 return little_endian_read_16(event, 3); 3077 } 3078 /** 3079 * @brief Get field attribute_id from event ANCS_SUBEVENT_CLIENT_NOTIFICATION 3080 * @param event packet 3081 * @return attribute_id 3082 * @note: btstack_type 2 3083 */ 3084 static inline uint16_t ancs_subevent_client_notification_get_attribute_id(const uint8_t * event){ 3085 return little_endian_read_16(event, 5); 3086 } 3087 /** 3088 * @brief Get field text from event ANCS_SUBEVENT_CLIENT_NOTIFICATION 3089 * @param event packet 3090 * @return text 3091 * @note: btstack_type T 3092 */ 3093 static inline const char * ancs_subevent_client_notification_get_text(const uint8_t * event){ 3094 return (const char *) &event[7]; 3095 } 3096 #endif 3097 3098 #ifdef ENABLE_BLE 3099 /** 3100 * @brief Get field handle from event ANCS_SUBEVENT_CLIENT_DISCONNECTED 3101 * @param event packet 3102 * @return handle 3103 * @note: btstack_type H 3104 */ 3105 static inline hci_con_handle_t ancs_subevent_client_disconnected_get_handle(const uint8_t * event){ 3106 return little_endian_read_16(event, 3); 3107 } 3108 #endif 3109 3110 3111 3112 /* API_END */ 3113 3114 #if defined __cplusplus 3115 } 3116 #endif 3117 3118 #endif // __BTSTACK_EVENT_H 3119