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 field status from event hci_event_inquiry_complete 98 * @param event packet 99 * @return status 100 * @note: btstack_type 1 101 */ 102 static inline uint8_t hci_event_inquiry_complete_get_status(const uint8_t * event){ 103 return event[2]; 104 } 105 106 /** 107 * @brief Get field num_responses from event hci_event_inquiry_result 108 * @param event packet 109 * @return num_responses 110 * @note: btstack_type 1 111 */ 112 static inline uint8_t hci_event_inquiry_result_get_num_responses(const uint8_t * event){ 113 return event[2]; 114 } 115 /** 116 * @brief Get field bd_addr from event hci_event_inquiry_result 117 * @param event packet 118 * @param Pointer to storage for bd_addr 119 * @note: btstack_type B 120 */ 121 static inline void hci_event_inquiry_result_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 122 reverse_bd_addr(&event[3], bd_addr); 123 } 124 /** 125 * @brief Get field page_scan_repetition_mode from event hci_event_inquiry_result 126 * @param event packet 127 * @return page_scan_repetition_mode 128 * @note: btstack_type 1 129 */ 130 static inline uint8_t hci_event_inquiry_result_get_page_scan_repetition_mode(const uint8_t * event){ 131 return event[9]; 132 } 133 /** 134 * @brief Get field reserved1 from event hci_event_inquiry_result 135 * @param event packet 136 * @return reserved1 137 * @note: btstack_type 1 138 */ 139 static inline uint8_t hci_event_inquiry_result_get_reserved1(const uint8_t * event){ 140 return event[10]; 141 } 142 /** 143 * @brief Get field reserved2 from event hci_event_inquiry_result 144 * @param event packet 145 * @return reserved2 146 * @note: btstack_type 1 147 */ 148 static inline uint8_t hci_event_inquiry_result_get_reserved2(const uint8_t * event){ 149 return event[11]; 150 } 151 /** 152 * @brief Get field class_of_device from event hci_event_inquiry_result 153 * @param event packet 154 * @return class_of_device 155 * @note: btstack_type 3 156 */ 157 static inline uint32_t hci_event_inquiry_result_get_class_of_device(const uint8_t * event){ 158 return little_endian_read_24(event, 12); 159 } 160 /** 161 * @brief Get field clock_offset from event hci_event_inquiry_result 162 * @param event packet 163 * @return clock_offset 164 * @note: btstack_type 2 165 */ 166 static inline uint16_t hci_event_inquiry_result_get_clock_offset(const uint8_t * event){ 167 return little_endian_read_16(event, 15); 168 } 169 170 /** 171 * @brief Get field status from event hci_event_connection_complete 172 * @param event packet 173 * @return status 174 * @note: btstack_type 1 175 */ 176 static inline uint8_t hci_event_connection_complete_get_status(const uint8_t * event){ 177 return event[2]; 178 } 179 /** 180 * @brief Get field connection_handle from event hci_event_connection_complete 181 * @param event packet 182 * @return connection_handle 183 * @note: btstack_type 2 184 */ 185 static inline uint16_t hci_event_connection_complete_get_connection_handle(const uint8_t * event){ 186 return little_endian_read_16(event, 3); 187 } 188 /** 189 * @brief Get field bd_addr from event hci_event_connection_complete 190 * @param event packet 191 * @param Pointer to storage for bd_addr 192 * @note: btstack_type B 193 */ 194 static inline void hci_event_connection_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 195 reverse_bd_addr(&event[5], bd_addr); 196 } 197 /** 198 * @brief Get field link_type from event hci_event_connection_complete 199 * @param event packet 200 * @return link_type 201 * @note: btstack_type 1 202 */ 203 static inline uint8_t hci_event_connection_complete_get_link_type(const uint8_t * event){ 204 return event[11]; 205 } 206 /** 207 * @brief Get field encryption_enabled from event hci_event_connection_complete 208 * @param event packet 209 * @return encryption_enabled 210 * @note: btstack_type 1 211 */ 212 static inline uint8_t hci_event_connection_complete_get_encryption_enabled(const uint8_t * event){ 213 return event[12]; 214 } 215 216 /** 217 * @brief Get field bd_addr from event hci_event_connection_request 218 * @param event packet 219 * @param Pointer to storage for bd_addr 220 * @note: btstack_type B 221 */ 222 static inline void hci_event_connection_request_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 223 reverse_bd_addr(&event[2], bd_addr); 224 } 225 /** 226 * @brief Get field class_of_device from event hci_event_connection_request 227 * @param event packet 228 * @return class_of_device 229 * @note: btstack_type 3 230 */ 231 static inline uint32_t hci_event_connection_request_get_class_of_device(const uint8_t * event){ 232 return little_endian_read_24(event, 8); 233 } 234 /** 235 * @brief Get field link_type from event hci_event_connection_request 236 * @param event packet 237 * @return link_type 238 * @note: btstack_type 1 239 */ 240 static inline uint8_t hci_event_connection_request_get_link_type(const uint8_t * event){ 241 return event[11]; 242 } 243 244 /** 245 * @brief Get field status from event hci_event_disconnection_complete 246 * @param event packet 247 * @return status 248 * @note: btstack_type 1 249 */ 250 static inline uint8_t hci_event_disconnection_complete_get_status(const uint8_t * event){ 251 return event[2]; 252 } 253 /** 254 * @brief Get field connection_handle from event hci_event_disconnection_complete 255 * @param event packet 256 * @return connection_handle 257 * @note: btstack_type 2 258 */ 259 static inline uint16_t hci_event_disconnection_complete_get_connection_handle(const uint8_t * event){ 260 return little_endian_read_16(event, 3); 261 } 262 /** 263 * @brief Get field reason from event hci_event_disconnection_complete 264 * @param event packet 265 * @return reason 266 * @note: btstack_type 1 267 */ 268 static inline uint8_t hci_event_disconnection_complete_get_reason(const uint8_t * event){ 269 return event[5]; 270 } 271 272 /** 273 * @brief Get field status from event hci_event_authentication_complete_event 274 * @param event packet 275 * @return status 276 * @note: btstack_type 1 277 */ 278 static inline uint8_t hci_event_authentication_complete_event_get_status(const uint8_t * event){ 279 return event[2]; 280 } 281 /** 282 * @brief Get field connection_handle from event hci_event_authentication_complete_event 283 * @param event packet 284 * @return connection_handle 285 * @note: btstack_type 2 286 */ 287 static inline uint16_t hci_event_authentication_complete_event_get_connection_handle(const uint8_t * event){ 288 return little_endian_read_16(event, 3); 289 } 290 291 /** 292 * @brief Get field status from event hci_event_remote_name_request_complete 293 * @param event packet 294 * @return status 295 * @note: btstack_type 1 296 */ 297 // static inline uint8_t hci_event_remote_name_request_complete_get_status(const uint8_t * event){ 298 // not implemented yet 299 // } 300 /** 301 * @brief Get field bd_addr from event hci_event_remote_name_request_complete 302 * @param event packet 303 * @return bd_addr 304 * @note: btstack_type B 305 */ 306 // static inline bd_addr_t hci_event_remote_name_request_complete_get_bd_addr(const uint8_t * event){ 307 // not implemented yet 308 // } 309 /** 310 * @brief Get field remote_name from event hci_event_remote_name_request_complete 311 * @param event packet 312 * @return remote_name 313 * @note: btstack_type N 314 */ 315 // static inline String hci_event_remote_name_request_complete_get_remote_name(const uint8_t * event){ 316 // not implemented yet 317 // } 318 319 /** 320 * @brief Get field status from event hci_event_encryption_change 321 * @param event packet 322 * @return status 323 * @note: btstack_type 1 324 */ 325 static inline uint8_t hci_event_encryption_change_get_status(const uint8_t * event){ 326 return event[2]; 327 } 328 /** 329 * @brief Get field connection_handle from event hci_event_encryption_change 330 * @param event packet 331 * @return connection_handle 332 * @note: btstack_type 2 333 */ 334 static inline uint16_t hci_event_encryption_change_get_connection_handle(const uint8_t * event){ 335 return little_endian_read_16(event, 3); 336 } 337 /** 338 * @brief Get field encryption_enabled from event hci_event_encryption_change 339 * @param event packet 340 * @return encryption_enabled 341 * @note: btstack_type 1 342 */ 343 static inline uint8_t hci_event_encryption_change_get_encryption_enabled(const uint8_t * event){ 344 return event[5]; 345 } 346 347 /** 348 * @brief Get field status from event hci_event_change_connection_link_key_complete 349 * @param event packet 350 * @return status 351 * @note: btstack_type 1 352 */ 353 static inline uint8_t hci_event_change_connection_link_key_complete_get_status(const uint8_t * event){ 354 return event[2]; 355 } 356 /** 357 * @brief Get field connection_handle from event hci_event_change_connection_link_key_complete 358 * @param event packet 359 * @return connection_handle 360 * @note: btstack_type 2 361 */ 362 static inline uint16_t hci_event_change_connection_link_key_complete_get_connection_handle(const uint8_t * event){ 363 return little_endian_read_16(event, 3); 364 } 365 366 /** 367 * @brief Get field status from event hci_event_master_link_key_complete 368 * @param event packet 369 * @return status 370 * @note: btstack_type 1 371 */ 372 static inline uint8_t hci_event_master_link_key_complete_get_status(const uint8_t * event){ 373 return event[2]; 374 } 375 /** 376 * @brief Get field connection_handle from event hci_event_master_link_key_complete 377 * @param event packet 378 * @return connection_handle 379 * @note: btstack_type 2 380 */ 381 static inline uint16_t hci_event_master_link_key_complete_get_connection_handle(const uint8_t * event){ 382 return little_endian_read_16(event, 3); 383 } 384 /** 385 * @brief Get field key_flag from event hci_event_master_link_key_complete 386 * @param event packet 387 * @return key_flag 388 * @note: btstack_type 1 389 */ 390 static inline uint8_t hci_event_master_link_key_complete_get_key_flag(const uint8_t * event){ 391 return event[5]; 392 } 393 394 /** 395 * @brief Get field num_hci_command_packets from event hci_event_command_complete 396 * @param event packet 397 * @return num_hci_command_packets 398 * @note: btstack_type 1 399 */ 400 static inline uint8_t hci_event_command_complete_get_num_hci_command_packets(const uint8_t * event){ 401 return event[2]; 402 } 403 /** 404 * @brief Get field command_opcode from event hci_event_command_complete 405 * @param event packet 406 * @return command_opcode 407 * @note: btstack_type 2 408 */ 409 static inline uint16_t hci_event_command_complete_get_command_opcode(const uint8_t * event){ 410 return little_endian_read_16(event, 3); 411 } 412 /** 413 * @brief Get field return_parameters from event hci_event_command_complete 414 * @param event packet 415 * @return return_parameters 416 * @note: btstack_type R 417 */ 418 static inline const uint8_t * hci_event_command_complete_get_return_parameters(const uint8_t * event){ 419 return &event[5]; 420 } 421 422 /** 423 * @brief Get field status from event hci_event_command_status 424 * @param event packet 425 * @return status 426 * @note: btstack_type 1 427 */ 428 static inline uint8_t hci_event_command_status_get_status(const uint8_t * event){ 429 return event[2]; 430 } 431 /** 432 * @brief Get field num_hci_command_packets from event hci_event_command_status 433 * @param event packet 434 * @return num_hci_command_packets 435 * @note: btstack_type 1 436 */ 437 static inline uint8_t hci_event_command_status_get_num_hci_command_packets(const uint8_t * event){ 438 return event[3]; 439 } 440 /** 441 * @brief Get field command_opcode from event hci_event_command_status 442 * @param event packet 443 * @return command_opcode 444 * @note: btstack_type 2 445 */ 446 static inline uint16_t hci_event_command_status_get_command_opcode(const uint8_t * event){ 447 return little_endian_read_16(event, 4); 448 } 449 450 /** 451 * @brief Get field hardware_code from event hci_event_hardware_error 452 * @param event packet 453 * @return hardware_code 454 * @note: btstack_type 1 455 */ 456 static inline uint8_t hci_event_hardware_error_get_hardware_code(const uint8_t * event){ 457 return event[2]; 458 } 459 460 /** 461 * @brief Get field status from event hci_event_role_change 462 * @param event packet 463 * @return status 464 * @note: btstack_type 1 465 */ 466 static inline uint8_t hci_event_role_change_get_status(const uint8_t * event){ 467 return event[2]; 468 } 469 /** 470 * @brief Get field bd_addr from event hci_event_role_change 471 * @param event packet 472 * @param Pointer to storage for bd_addr 473 * @note: btstack_type B 474 */ 475 static inline void hci_event_role_change_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 476 reverse_bd_addr(&event[3], bd_addr); 477 } 478 /** 479 * @brief Get field role from event hci_event_role_change 480 * @param event packet 481 * @return role 482 * @note: btstack_type 1 483 */ 484 static inline uint8_t hci_event_role_change_get_role(const uint8_t * event){ 485 return event[9]; 486 } 487 488 /** 489 * @brief Get field num_responses from event hci_event_inquiry_result_with_rssi 490 * @param event packet 491 * @return num_responses 492 * @note: btstack_type 1 493 */ 494 static inline uint8_t hci_event_inquiry_result_with_rssi_get_num_responses(const uint8_t * event){ 495 return event[2]; 496 } 497 /** 498 * @brief Get field bd_addr from event hci_event_inquiry_result_with_rssi 499 * @param event packet 500 * @param Pointer to storage for bd_addr 501 * @note: btstack_type B 502 */ 503 static inline void hci_event_inquiry_result_with_rssi_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 504 reverse_bd_addr(&event[3], bd_addr); 505 } 506 /** 507 * @brief Get field page_scan_repetition_mode from event hci_event_inquiry_result_with_rssi 508 * @param event packet 509 * @return page_scan_repetition_mode 510 * @note: btstack_type 1 511 */ 512 static inline uint8_t hci_event_inquiry_result_with_rssi_get_page_scan_repetition_mode(const uint8_t * event){ 513 return event[9]; 514 } 515 /** 516 * @brief Get field reserved from event hci_event_inquiry_result_with_rssi 517 * @param event packet 518 * @return reserved 519 * @note: btstack_type 1 520 */ 521 static inline uint8_t hci_event_inquiry_result_with_rssi_get_reserved(const uint8_t * event){ 522 return event[10]; 523 } 524 /** 525 * @brief Get field class_of_device from event hci_event_inquiry_result_with_rssi 526 * @param event packet 527 * @return class_of_device 528 * @note: btstack_type 3 529 */ 530 static inline uint32_t hci_event_inquiry_result_with_rssi_get_class_of_device(const uint8_t * event){ 531 return little_endian_read_24(event, 11); 532 } 533 /** 534 * @brief Get field clock_offset from event hci_event_inquiry_result_with_rssi 535 * @param event packet 536 * @return clock_offset 537 * @note: btstack_type 2 538 */ 539 static inline uint16_t hci_event_inquiry_result_with_rssi_get_clock_offset(const uint8_t * event){ 540 return little_endian_read_16(event, 14); 541 } 542 /** 543 * @brief Get field rssi from event hci_event_inquiry_result_with_rssi 544 * @param event packet 545 * @return rssi 546 * @note: btstack_type 1 547 */ 548 static inline uint8_t hci_event_inquiry_result_with_rssi_get_rssi(const uint8_t * event){ 549 return event[16]; 550 } 551 552 /** 553 * @brief Get field status from event hci_event_synchronous_connection_complete 554 * @param event packet 555 * @return status 556 * @note: btstack_type 1 557 */ 558 static inline uint8_t hci_event_synchronous_connection_complete_get_status(const uint8_t * event){ 559 return event[2]; 560 } 561 /** 562 * @brief Get field handle from event hci_event_synchronous_connection_complete 563 * @param event packet 564 * @return handle 565 * @note: btstack_type H 566 */ 567 static inline hci_con_handle_t hci_event_synchronous_connection_complete_get_handle(const uint8_t * event){ 568 return little_endian_read_16(event, 3); 569 } 570 /** 571 * @brief Get field bd_addr from event hci_event_synchronous_connection_complete 572 * @param event packet 573 * @param Pointer to storage for bd_addr 574 * @note: btstack_type B 575 */ 576 static inline void hci_event_synchronous_connection_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 577 reverse_bd_addr(&event[5], bd_addr); 578 } 579 /** 580 * @brief Get field link_type from event hci_event_synchronous_connection_complete 581 * @param event packet 582 * @return link_type 583 * @note: btstack_type 1 584 */ 585 static inline uint8_t hci_event_synchronous_connection_complete_get_link_type(const uint8_t * event){ 586 return event[11]; 587 } 588 /** 589 * @brief Get field transmission_interval from event hci_event_synchronous_connection_complete 590 * @param event packet 591 * @return transmission_interval 592 * @note: btstack_type 1 593 */ 594 static inline uint8_t hci_event_synchronous_connection_complete_get_transmission_interval(const uint8_t * event){ 595 return event[12]; 596 } 597 /** 598 * @brief Get field retransmission_interval from event hci_event_synchronous_connection_complete 599 * @param event packet 600 * @return retransmission_interval 601 * @note: btstack_type 1 602 */ 603 static inline uint8_t hci_event_synchronous_connection_complete_get_retransmission_interval(const uint8_t * event){ 604 return event[13]; 605 } 606 /** 607 * @brief Get field rx_packet_length from event hci_event_synchronous_connection_complete 608 * @param event packet 609 * @return rx_packet_length 610 * @note: btstack_type 2 611 */ 612 static inline uint16_t hci_event_synchronous_connection_complete_get_rx_packet_length(const uint8_t * event){ 613 return little_endian_read_16(event, 14); 614 } 615 /** 616 * @brief Get field tx_packet_length from event hci_event_synchronous_connection_complete 617 * @param event packet 618 * @return tx_packet_length 619 * @note: btstack_type 2 620 */ 621 static inline uint16_t hci_event_synchronous_connection_complete_get_tx_packet_length(const uint8_t * event){ 622 return little_endian_read_16(event, 16); 623 } 624 /** 625 * @brief Get field air_mode from event hci_event_synchronous_connection_complete 626 * @param event packet 627 * @return air_mode 628 * @note: btstack_type 1 629 */ 630 static inline uint8_t hci_event_synchronous_connection_complete_get_air_mode(const uint8_t * event){ 631 return event[18]; 632 } 633 634 /** 635 * @brief Get field num_responses from event hci_event_extended_inquiry_response 636 * @param event packet 637 * @return num_responses 638 * @note: btstack_type 1 639 */ 640 static inline uint8_t hci_event_extended_inquiry_response_get_num_responses(const uint8_t * event){ 641 return event[2]; 642 } 643 /** 644 * @brief Get field bd_addr from event hci_event_extended_inquiry_response 645 * @param event packet 646 * @param Pointer to storage for bd_addr 647 * @note: btstack_type B 648 */ 649 static inline void hci_event_extended_inquiry_response_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 650 reverse_bd_addr(&event[3], bd_addr); 651 } 652 /** 653 * @brief Get field page_scan_repetition_mode from event hci_event_extended_inquiry_response 654 * @param event packet 655 * @return page_scan_repetition_mode 656 * @note: btstack_type 1 657 */ 658 static inline uint8_t hci_event_extended_inquiry_response_get_page_scan_repetition_mode(const uint8_t * event){ 659 return event[9]; 660 } 661 /** 662 * @brief Get field reserved from event hci_event_extended_inquiry_response 663 * @param event packet 664 * @return reserved 665 * @note: btstack_type 1 666 */ 667 static inline uint8_t hci_event_extended_inquiry_response_get_reserved(const uint8_t * event){ 668 return event[10]; 669 } 670 /** 671 * @brief Get field class_of_device from event hci_event_extended_inquiry_response 672 * @param event packet 673 * @return class_of_device 674 * @note: btstack_type 3 675 */ 676 static inline uint32_t hci_event_extended_inquiry_response_get_class_of_device(const uint8_t * event){ 677 return little_endian_read_24(event, 11); 678 } 679 /** 680 * @brief Get field clock_offset from event hci_event_extended_inquiry_response 681 * @param event packet 682 * @return clock_offset 683 * @note: btstack_type 2 684 */ 685 static inline uint16_t hci_event_extended_inquiry_response_get_clock_offset(const uint8_t * event){ 686 return little_endian_read_16(event, 14); 687 } 688 /** 689 * @brief Get field rssi from event hci_event_extended_inquiry_response 690 * @param event packet 691 * @return rssi 692 * @note: btstack_type 1 693 */ 694 static inline uint8_t hci_event_extended_inquiry_response_get_rssi(const uint8_t * event){ 695 return event[16]; 696 } 697 698 /** 699 * @brief Get field status from event hci_event_encryption_key_refresh_complete 700 * @param event packet 701 * @return status 702 * @note: btstack_type 1 703 */ 704 static inline uint8_t hci_event_encryption_key_refresh_complete_get_status(const uint8_t * event){ 705 return event[2]; 706 } 707 /** 708 * @brief Get field handle from event hci_event_encryption_key_refresh_complete 709 * @param event packet 710 * @return handle 711 * @note: btstack_type H 712 */ 713 static inline hci_con_handle_t hci_event_encryption_key_refresh_complete_get_handle(const uint8_t * event){ 714 return little_endian_read_16(event, 3); 715 } 716 717 /** 718 * @brief Get field state from event btstack_event_state 719 * @param event packet 720 * @return state 721 * @note: btstack_type 1 722 */ 723 static inline uint8_t btstack_event_state_get_state(const uint8_t * event){ 724 return event[2]; 725 } 726 727 728 /** 729 * @brief Get field discoverable from event btstack_event_discoverable_enabled 730 * @param event packet 731 * @return discoverable 732 * @note: btstack_type 1 733 */ 734 static inline uint8_t btstack_event_discoverable_enabled_get_discoverable(const uint8_t * event){ 735 return event[2]; 736 } 737 738 /** 739 * @brief Get field handle from event hci_event_sco_can_send_now 740 * @param event packet 741 * @param Pointer to storage for handle 742 * @note: btstack_type B 743 */ 744 static inline void hci_event_sco_can_send_now_get_handle(const uint8_t * event, bd_addr_t handle){ 745 reverse_bd_addr(&event[2], handle); 746 } 747 748 /** 749 * @brief Get field status from event l2cap_event_channel_opened 750 * @param event packet 751 * @return status 752 * @note: btstack_type 1 753 */ 754 static inline uint8_t l2cap_event_channel_opened_get_status(const uint8_t * event){ 755 return event[2]; 756 } 757 /** 758 * @brief Get field address from event l2cap_event_channel_opened 759 * @param event packet 760 * @param Pointer to storage for address 761 * @note: btstack_type B 762 */ 763 static inline void l2cap_event_channel_opened_get_address(const uint8_t * event, bd_addr_t address){ 764 reverse_bd_addr(&event[3], address); 765 } 766 /** 767 * @brief Get field handle from event l2cap_event_channel_opened 768 * @param event packet 769 * @return handle 770 * @note: btstack_type H 771 */ 772 static inline hci_con_handle_t l2cap_event_channel_opened_get_handle(const uint8_t * event){ 773 return little_endian_read_16(event, 9); 774 } 775 /** 776 * @brief Get field psm from event l2cap_event_channel_opened 777 * @param event packet 778 * @return psm 779 * @note: btstack_type 2 780 */ 781 static inline uint16_t l2cap_event_channel_opened_get_psm(const uint8_t * event){ 782 return little_endian_read_16(event, 11); 783 } 784 /** 785 * @brief Get field local_cid from event l2cap_event_channel_opened 786 * @param event packet 787 * @return local_cid 788 * @note: btstack_type 2 789 */ 790 static inline uint16_t l2cap_event_channel_opened_get_local_cid(const uint8_t * event){ 791 return little_endian_read_16(event, 13); 792 } 793 /** 794 * @brief Get field remote_cid from event l2cap_event_channel_opened 795 * @param event packet 796 * @return remote_cid 797 * @note: btstack_type 2 798 */ 799 static inline uint16_t l2cap_event_channel_opened_get_remote_cid(const uint8_t * event){ 800 return little_endian_read_16(event, 15); 801 } 802 /** 803 * @brief Get field local_mtu from event l2cap_event_channel_opened 804 * @param event packet 805 * @return local_mtu 806 * @note: btstack_type 2 807 */ 808 static inline uint16_t l2cap_event_channel_opened_get_local_mtu(const uint8_t * event){ 809 return little_endian_read_16(event, 17); 810 } 811 /** 812 * @brief Get field remote_mtu from event l2cap_event_channel_opened 813 * @param event packet 814 * @return remote_mtu 815 * @note: btstack_type 2 816 */ 817 static inline uint16_t l2cap_event_channel_opened_get_remote_mtu(const uint8_t * event){ 818 return little_endian_read_16(event, 19); 819 } 820 /** 821 * @brief Get field flush_timeout from event l2cap_event_channel_opened 822 * @param event packet 823 * @return flush_timeout 824 * @note: btstack_type 2 825 */ 826 static inline uint16_t l2cap_event_channel_opened_get_flush_timeout(const uint8_t * event){ 827 return little_endian_read_16(event, 21); 828 } 829 830 /** 831 * @brief Get field local_cid from event l2cap_event_channel_closed 832 * @param event packet 833 * @return local_cid 834 * @note: btstack_type 2 835 */ 836 static inline uint16_t l2cap_event_channel_closed_get_local_cid(const uint8_t * event){ 837 return little_endian_read_16(event, 2); 838 } 839 840 /** 841 * @brief Get field status from event l2cap_event_incoming_connection 842 * @param event packet 843 * @return status 844 * @note: btstack_type 1 845 */ 846 static inline uint8_t l2cap_event_incoming_connection_get_status(const uint8_t * event){ 847 return event[2]; 848 } 849 /** 850 * @brief Get field address from event l2cap_event_incoming_connection 851 * @param event packet 852 * @param Pointer to storage for address 853 * @note: btstack_type B 854 */ 855 static inline void l2cap_event_incoming_connection_get_address(const uint8_t * event, bd_addr_t address){ 856 reverse_bd_addr(&event[3], address); 857 } 858 /** 859 * @brief Get field handle from event l2cap_event_incoming_connection 860 * @param event packet 861 * @return handle 862 * @note: btstack_type H 863 */ 864 static inline hci_con_handle_t l2cap_event_incoming_connection_get_handle(const uint8_t * event){ 865 return little_endian_read_16(event, 9); 866 } 867 /** 868 * @brief Get field psm from event l2cap_event_incoming_connection 869 * @param event packet 870 * @return psm 871 * @note: btstack_type 2 872 */ 873 static inline uint16_t l2cap_event_incoming_connection_get_psm(const uint8_t * event){ 874 return little_endian_read_16(event, 11); 875 } 876 /** 877 * @brief Get field local_cid from event l2cap_event_incoming_connection 878 * @param event packet 879 * @return local_cid 880 * @note: btstack_type 2 881 */ 882 static inline uint16_t l2cap_event_incoming_connection_get_local_cid(const uint8_t * event){ 883 return little_endian_read_16(event, 13); 884 } 885 /** 886 * @brief Get field remote_cid from event l2cap_event_incoming_connection 887 * @param event packet 888 * @return remote_cid 889 * @note: btstack_type 2 890 */ 891 static inline uint16_t l2cap_event_incoming_connection_get_remote_cid(const uint8_t * event){ 892 return little_endian_read_16(event, 15); 893 } 894 895 /** 896 * @brief Get field status from event l2cap_event_service_registered 897 * @param event packet 898 * @return status 899 * @note: btstack_type 1 900 */ 901 static inline uint8_t l2cap_event_service_registered_get_status(const uint8_t * event){ 902 return event[2]; 903 } 904 /** 905 * @brief Get field psm from event l2cap_event_service_registered 906 * @param event packet 907 * @return psm 908 * @note: btstack_type 2 909 */ 910 static inline uint16_t l2cap_event_service_registered_get_psm(const uint8_t * event){ 911 return little_endian_read_16(event, 3); 912 } 913 914 /** 915 * @brief Get field handle from event l2cap_event_connection_parameter_update_request 916 * @param event packet 917 * @return handle 918 * @note: btstack_type H 919 */ 920 static inline hci_con_handle_t l2cap_event_connection_parameter_update_request_get_handle(const uint8_t * event){ 921 return little_endian_read_16(event, 2); 922 } 923 /** 924 * @brief Get field interval_min from event l2cap_event_connection_parameter_update_request 925 * @param event packet 926 * @return interval_min 927 * @note: btstack_type 2 928 */ 929 static inline uint16_t l2cap_event_connection_parameter_update_request_get_interval_min(const uint8_t * event){ 930 return little_endian_read_16(event, 4); 931 } 932 /** 933 * @brief Get field interval_max from event l2cap_event_connection_parameter_update_request 934 * @param event packet 935 * @return interval_max 936 * @note: btstack_type 2 937 */ 938 static inline uint16_t l2cap_event_connection_parameter_update_request_get_interval_max(const uint8_t * event){ 939 return little_endian_read_16(event, 6); 940 } 941 /** 942 * @brief Get field latencey from event l2cap_event_connection_parameter_update_request 943 * @param event packet 944 * @return latencey 945 * @note: btstack_type 2 946 */ 947 static inline uint16_t l2cap_event_connection_parameter_update_request_get_latencey(const uint8_t * event){ 948 return little_endian_read_16(event, 8); 949 } 950 /** 951 * @brief Get field timeout_multiplier from event l2cap_event_connection_parameter_update_request 952 * @param event packet 953 * @return timeout_multiplier 954 * @note: btstack_type 2 955 */ 956 static inline uint16_t l2cap_event_connection_parameter_update_request_get_timeout_multiplier(const uint8_t * event){ 957 return little_endian_read_16(event, 10); 958 } 959 960 /** 961 * @brief Get field handle from event l2cap_event_connection_parameter_update_response 962 * @param event packet 963 * @return handle 964 * @note: btstack_type H 965 */ 966 static inline hci_con_handle_t l2cap_event_connection_parameter_update_response_get_handle(const uint8_t * event){ 967 return little_endian_read_16(event, 2); 968 } 969 970 /** 971 * @brief Get field local_cid from event l2cap_event_can_send_now 972 * @param event packet 973 * @return local_cid 974 * @note: btstack_type 2 975 */ 976 static inline uint16_t l2cap_event_can_send_now_get_local_cid(const uint8_t * event){ 977 return little_endian_read_16(event, 2); 978 } 979 980 /** 981 * @brief Get field status from event rfcomm_event_open_channel_complete 982 * @param event packet 983 * @return status 984 * @note: btstack_type 1 985 */ 986 static inline uint8_t rfcomm_event_open_channel_complete_get_status(const uint8_t * event){ 987 return event[2]; 988 } 989 /** 990 * @brief Get field bd_addr from event rfcomm_event_open_channel_complete 991 * @param event packet 992 * @param Pointer to storage for bd_addr 993 * @note: btstack_type B 994 */ 995 static inline void rfcomm_event_open_channel_complete_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 996 reverse_bd_addr(&event[3], bd_addr); 997 } 998 /** 999 * @brief Get field con_handle from event rfcomm_event_open_channel_complete 1000 * @param event packet 1001 * @return con_handle 1002 * @note: btstack_type 2 1003 */ 1004 static inline uint16_t rfcomm_event_open_channel_complete_get_con_handle(const uint8_t * event){ 1005 return little_endian_read_16(event, 9); 1006 } 1007 /** 1008 * @brief Get field server_channel from event rfcomm_event_open_channel_complete 1009 * @param event packet 1010 * @return server_channel 1011 * @note: btstack_type 1 1012 */ 1013 static inline uint8_t rfcomm_event_open_channel_complete_get_server_channel(const uint8_t * event){ 1014 return event[11]; 1015 } 1016 /** 1017 * @brief Get field rfcomm_cid from event rfcomm_event_open_channel_complete 1018 * @param event packet 1019 * @return rfcomm_cid 1020 * @note: btstack_type 2 1021 */ 1022 static inline uint16_t rfcomm_event_open_channel_complete_get_rfcomm_cid(const uint8_t * event){ 1023 return little_endian_read_16(event, 12); 1024 } 1025 /** 1026 * @brief Get field max_frame_size from event rfcomm_event_open_channel_complete 1027 * @param event packet 1028 * @return max_frame_size 1029 * @note: btstack_type 2 1030 */ 1031 static inline uint16_t rfcomm_event_open_channel_complete_get_max_frame_size(const uint8_t * event){ 1032 return little_endian_read_16(event, 14); 1033 } 1034 1035 /** 1036 * @brief Get field rfcomm_cid from event rfcomm_event_channel_closed 1037 * @param event packet 1038 * @return rfcomm_cid 1039 * @note: btstack_type 2 1040 */ 1041 static inline uint16_t rfcomm_event_channel_closed_get_rfcomm_cid(const uint8_t * event){ 1042 return little_endian_read_16(event, 2); 1043 } 1044 1045 /** 1046 * @brief Get field bd_addr from event rfcomm_event_incoming_connection 1047 * @param event packet 1048 * @param Pointer to storage for bd_addr 1049 * @note: btstack_type B 1050 */ 1051 static inline void rfcomm_event_incoming_connection_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){ 1052 reverse_bd_addr(&event[2], bd_addr); 1053 } 1054 /** 1055 * @brief Get field server_channel from event rfcomm_event_incoming_connection 1056 * @param event packet 1057 * @return server_channel 1058 * @note: btstack_type 1 1059 */ 1060 static inline uint8_t rfcomm_event_incoming_connection_get_server_channel(const uint8_t * event){ 1061 return event[8]; 1062 } 1063 /** 1064 * @brief Get field rfcomm_cid from event rfcomm_event_incoming_connection 1065 * @param event packet 1066 * @return rfcomm_cid 1067 * @note: btstack_type 2 1068 */ 1069 static inline uint16_t rfcomm_event_incoming_connection_get_rfcomm_cid(const uint8_t * event){ 1070 return little_endian_read_16(event, 9); 1071 } 1072 1073 /** 1074 * @brief Get field rfcomm_cid from event rfcomm_event_remote_line_status 1075 * @param event packet 1076 * @return rfcomm_cid 1077 * @note: btstack_type 2 1078 */ 1079 static inline uint16_t rfcomm_event_remote_line_status_get_rfcomm_cid(const uint8_t * event){ 1080 return little_endian_read_16(event, 2); 1081 } 1082 /** 1083 * @brief Get field line_status from event rfcomm_event_remote_line_status 1084 * @param event packet 1085 * @return line_status 1086 * @note: btstack_type 1 1087 */ 1088 static inline uint8_t rfcomm_event_remote_line_status_get_line_status(const uint8_t * event){ 1089 return event[4]; 1090 } 1091 1092 /** 1093 * @brief Get field rfcomm_cid from event rfcomm_event_credits 1094 * @param event packet 1095 * @return rfcomm_cid 1096 * @note: btstack_type 2 1097 */ 1098 static inline uint16_t rfcomm_event_credits_get_rfcomm_cid(const uint8_t * event){ 1099 return little_endian_read_16(event, 2); 1100 } 1101 /** 1102 * @brief Get field credits from event rfcomm_event_credits 1103 * @param event packet 1104 * @return credits 1105 * @note: btstack_type 1 1106 */ 1107 static inline uint8_t rfcomm_event_credits_get_credits(const uint8_t * event){ 1108 return event[4]; 1109 } 1110 1111 /** 1112 * @brief Get field status from event rfcomm_event_service_registered 1113 * @param event packet 1114 * @return status 1115 * @note: btstack_type 1 1116 */ 1117 static inline uint8_t rfcomm_event_service_registered_get_status(const uint8_t * event){ 1118 return event[2]; 1119 } 1120 /** 1121 * @brief Get field channel_id from event rfcomm_event_service_registered 1122 * @param event packet 1123 * @return channel_id 1124 * @note: btstack_type 1 1125 */ 1126 static inline uint8_t rfcomm_event_service_registered_get_channel_id(const uint8_t * event){ 1127 return event[3]; 1128 } 1129 1130 /** 1131 * @brief Get field status from event rfcomm_event_persistent_channel 1132 * @param event packet 1133 * @return status 1134 * @note: btstack_type 1 1135 */ 1136 static inline uint8_t rfcomm_event_persistent_channel_get_status(const uint8_t * event){ 1137 return event[2]; 1138 } 1139 /** 1140 * @brief Get field server_channel_id from event rfcomm_event_persistent_channel 1141 * @param event packet 1142 * @return server_channel_id 1143 * @note: btstack_type 1 1144 */ 1145 static inline uint8_t rfcomm_event_persistent_channel_get_server_channel_id(const uint8_t * event){ 1146 return event[3]; 1147 } 1148 1149 /** 1150 * @brief Get field rfcomm_cid from event rfcomm_event_remote_modem_status 1151 * @param event packet 1152 * @return rfcomm_cid 1153 * @note: btstack_type 2 1154 */ 1155 static inline uint16_t rfcomm_event_remote_modem_status_get_rfcomm_cid(const uint8_t * event){ 1156 return little_endian_read_16(event, 2); 1157 } 1158 /** 1159 * @brief Get field modem_status from event rfcomm_event_remote_modem_status 1160 * @param event packet 1161 * @return modem_status 1162 * @note: btstack_type 1 1163 */ 1164 static inline uint8_t rfcomm_event_remote_modem_status_get_modem_status(const uint8_t * event){ 1165 return event[4]; 1166 } 1167 1168 /** 1169 * @brief Get field local_cid from event rfcomm_event_can_send_now 1170 * @param event packet 1171 * @return local_cid 1172 * @note: btstack_type 2 1173 */ 1174 static inline uint16_t rfcomm_event_can_send_now_get_local_cid(const uint8_t * event){ 1175 return little_endian_read_16(event, 2); 1176 } 1177 1178 /** 1179 * @brief Get field status from event sdp_event_service_registered 1180 * @param event packet 1181 * @return status 1182 * @note: btstack_type 1 1183 */ 1184 static inline uint8_t sdp_event_service_registered_get_status(const uint8_t * event){ 1185 return event[2]; 1186 } 1187 /** 1188 * @brief Get field service_record_handle from event sdp_event_service_registered 1189 * @param event packet 1190 * @return service_record_handle 1191 * @note: btstack_type 4 1192 */ 1193 static inline uint32_t sdp_event_service_registered_get_service_record_handle(const uint8_t * event){ 1194 return little_endian_read_32(event, 3); 1195 } 1196 1197 /** 1198 * @brief Get field status from event sdp_event_query_complete 1199 * @param event packet 1200 * @return status 1201 * @note: btstack_type 1 1202 */ 1203 static inline uint8_t sdp_event_query_complete_get_status(const uint8_t * event){ 1204 return event[2]; 1205 } 1206 1207 /** 1208 * @brief Get field rfcomm_channel from event sdp_event_query_rfcomm_service 1209 * @param event packet 1210 * @return rfcomm_channel 1211 * @note: btstack_type 1 1212 */ 1213 static inline uint8_t sdp_event_query_rfcomm_service_get_rfcomm_channel(const uint8_t * event){ 1214 return event[2]; 1215 } 1216 /** 1217 * @brief Get field name from event sdp_event_query_rfcomm_service 1218 * @param event packet 1219 * @return name 1220 * @note: btstack_type T 1221 */ 1222 static inline const char * sdp_event_query_rfcomm_service_get_name(const uint8_t * event){ 1223 return (const char *) &event[3]; 1224 } 1225 1226 /** 1227 * @brief Get field record_id from event sdp_event_query_attribute_byte 1228 * @param event packet 1229 * @return record_id 1230 * @note: btstack_type 2 1231 */ 1232 static inline uint16_t sdp_event_query_attribute_byte_get_record_id(const uint8_t * event){ 1233 return little_endian_read_16(event, 2); 1234 } 1235 /** 1236 * @brief Get field attribute_id from event sdp_event_query_attribute_byte 1237 * @param event packet 1238 * @return attribute_id 1239 * @note: btstack_type 2 1240 */ 1241 static inline uint16_t sdp_event_query_attribute_byte_get_attribute_id(const uint8_t * event){ 1242 return little_endian_read_16(event, 4); 1243 } 1244 /** 1245 * @brief Get field attribute_length from event sdp_event_query_attribute_byte 1246 * @param event packet 1247 * @return attribute_length 1248 * @note: btstack_type 2 1249 */ 1250 static inline uint16_t sdp_event_query_attribute_byte_get_attribute_length(const uint8_t * event){ 1251 return little_endian_read_16(event, 6); 1252 } 1253 /** 1254 * @brief Get field data_offset from event sdp_event_query_attribute_byte 1255 * @param event packet 1256 * @return data_offset 1257 * @note: btstack_type 2 1258 */ 1259 static inline uint16_t sdp_event_query_attribute_byte_get_data_offset(const uint8_t * event){ 1260 return little_endian_read_16(event, 8); 1261 } 1262 /** 1263 * @brief Get field data from event sdp_event_query_attribute_byte 1264 * @param event packet 1265 * @return data 1266 * @note: btstack_type 1 1267 */ 1268 static inline uint8_t sdp_event_query_attribute_byte_get_data(const uint8_t * event){ 1269 return event[10]; 1270 } 1271 1272 /** 1273 * @brief Get field record_id from event sdp_event_query_attribute_value 1274 * @param event packet 1275 * @return record_id 1276 * @note: btstack_type 2 1277 */ 1278 static inline uint16_t sdp_event_query_attribute_value_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_value 1283 * @param event packet 1284 * @return attribute_id 1285 * @note: btstack_type 2 1286 */ 1287 static inline uint16_t sdp_event_query_attribute_value_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_value 1292 * @param event packet 1293 * @return attribute_length 1294 * @note: btstack_type L 1295 */ 1296 static inline int sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){ 1297 return little_endian_read_16(event, 6); 1298 } 1299 /** 1300 * @brief Get field attribute_value from event sdp_event_query_attribute_value 1301 * @param event packet 1302 * @return attribute_value 1303 * @note: btstack_type V 1304 */ 1305 static inline const uint8_t * sdp_event_query_attribute_value_get_attribute_value(const uint8_t * event){ 1306 return &event[8]; 1307 } 1308 1309 /** 1310 * @brief Get field total_count from event sdp_event_query_service_record_handle 1311 * @param event packet 1312 * @return total_count 1313 * @note: btstack_type 2 1314 */ 1315 static inline uint16_t sdp_event_query_service_record_handle_get_total_count(const uint8_t * event){ 1316 return little_endian_read_16(event, 2); 1317 } 1318 /** 1319 * @brief Get field record_index from event sdp_event_query_service_record_handle 1320 * @param event packet 1321 * @return record_index 1322 * @note: btstack_type 2 1323 */ 1324 static inline uint16_t sdp_event_query_service_record_handle_get_record_index(const uint8_t * event){ 1325 return little_endian_read_16(event, 4); 1326 } 1327 /** 1328 * @brief Get field record_handle from event sdp_event_query_service_record_handle 1329 * @param event packet 1330 * @return record_handle 1331 * @note: btstack_type 4 1332 */ 1333 static inline uint32_t sdp_event_query_service_record_handle_get_record_handle(const uint8_t * event){ 1334 return little_endian_read_32(event, 6); 1335 } 1336 1337 #ifdef ENABLE_BLE 1338 /** 1339 * @brief Get field handle from event gatt_event_query_complete 1340 * @param event packet 1341 * @return handle 1342 * @note: btstack_type H 1343 */ 1344 static inline hci_con_handle_t gatt_event_query_complete_get_handle(const uint8_t * event){ 1345 return little_endian_read_16(event, 2); 1346 } 1347 /** 1348 * @brief Get field status from event gatt_event_query_complete 1349 * @param event packet 1350 * @return status 1351 * @note: btstack_type 1 1352 */ 1353 static inline uint8_t gatt_event_query_complete_get_status(const uint8_t * event){ 1354 return event[4]; 1355 } 1356 #endif 1357 1358 #ifdef ENABLE_BLE 1359 /** 1360 * @brief Get field handle from event gatt_event_service_query_result 1361 * @param event packet 1362 * @return handle 1363 * @note: btstack_type H 1364 */ 1365 static inline hci_con_handle_t gatt_event_service_query_result_get_handle(const uint8_t * event){ 1366 return little_endian_read_16(event, 2); 1367 } 1368 /** 1369 * @brief Get field service from event gatt_event_service_query_result 1370 * @param event packet 1371 * @param Pointer to storage for service 1372 * @note: btstack_type X 1373 */ 1374 static inline void gatt_event_service_query_result_get_service(const uint8_t * event, gatt_client_service_t * service){ 1375 gatt_client_deserialize_service(event, 4, service); 1376 } 1377 #endif 1378 1379 #ifdef ENABLE_BLE 1380 /** 1381 * @brief Get field handle from event gatt_event_characteristic_query_result 1382 * @param event packet 1383 * @return handle 1384 * @note: btstack_type H 1385 */ 1386 static inline hci_con_handle_t gatt_event_characteristic_query_result_get_handle(const uint8_t * event){ 1387 return little_endian_read_16(event, 2); 1388 } 1389 /** 1390 * @brief Get field characteristic from event gatt_event_characteristic_query_result 1391 * @param event packet 1392 * @param Pointer to storage for characteristic 1393 * @note: btstack_type Y 1394 */ 1395 static inline void gatt_event_characteristic_query_result_get_characteristic(const uint8_t * event, gatt_client_characteristic_t * characteristic){ 1396 gatt_client_deserialize_characteristic(event, 4, characteristic); 1397 } 1398 #endif 1399 1400 #ifdef ENABLE_BLE 1401 /** 1402 * @brief Get field handle from event gatt_event_included_service_query_result 1403 * @param event packet 1404 * @return handle 1405 * @note: btstack_type H 1406 */ 1407 static inline hci_con_handle_t gatt_event_included_service_query_result_get_handle(const uint8_t * event){ 1408 return little_endian_read_16(event, 2); 1409 } 1410 /** 1411 * @brief Get field include_handle from event gatt_event_included_service_query_result 1412 * @param event packet 1413 * @return include_handle 1414 * @note: btstack_type 2 1415 */ 1416 static inline uint16_t gatt_event_included_service_query_result_get_include_handle(const uint8_t * event){ 1417 return little_endian_read_16(event, 4); 1418 } 1419 /** 1420 * @brief Get field service from event gatt_event_included_service_query_result 1421 * @param event packet 1422 * @param Pointer to storage for service 1423 * @note: btstack_type X 1424 */ 1425 static inline void gatt_event_included_service_query_result_get_service(const uint8_t * event, gatt_client_service_t * service){ 1426 gatt_client_deserialize_service(event, 6, service); 1427 } 1428 #endif 1429 1430 #ifdef ENABLE_BLE 1431 /** 1432 * @brief Get field handle from event gatt_event_all_characteristic_descriptors_query_result 1433 * @param event packet 1434 * @return handle 1435 * @note: btstack_type H 1436 */ 1437 static inline hci_con_handle_t gatt_event_all_characteristic_descriptors_query_result_get_handle(const uint8_t * event){ 1438 return little_endian_read_16(event, 2); 1439 } 1440 /** 1441 * @brief Get field characteristic_descriptor from event gatt_event_all_characteristic_descriptors_query_result 1442 * @param event packet 1443 * @param Pointer to storage for characteristic_descriptor 1444 * @note: btstack_type Z 1445 */ 1446 static inline void gatt_event_all_characteristic_descriptors_query_result_get_characteristic_descriptor(const uint8_t * event, gatt_client_characteristic_descriptor_t * characteristic_descriptor){ 1447 gatt_client_deserialize_characteristic_descriptor(event, 4, characteristic_descriptor); 1448 } 1449 #endif 1450 1451 #ifdef ENABLE_BLE 1452 /** 1453 * @brief Get field handle from event gatt_event_characteristic_value_query_result 1454 * @param event packet 1455 * @return handle 1456 * @note: btstack_type H 1457 */ 1458 static inline hci_con_handle_t gatt_event_characteristic_value_query_result_get_handle(const uint8_t * event){ 1459 return little_endian_read_16(event, 2); 1460 } 1461 /** 1462 * @brief Get field value_handle from event gatt_event_characteristic_value_query_result 1463 * @param event packet 1464 * @return value_handle 1465 * @note: btstack_type 2 1466 */ 1467 static inline uint16_t gatt_event_characteristic_value_query_result_get_value_handle(const uint8_t * event){ 1468 return little_endian_read_16(event, 4); 1469 } 1470 /** 1471 * @brief Get field value_length from event gatt_event_characteristic_value_query_result 1472 * @param event packet 1473 * @return value_length 1474 * @note: btstack_type L 1475 */ 1476 static inline int gatt_event_characteristic_value_query_result_get_value_length(const uint8_t * event){ 1477 return little_endian_read_16(event, 6); 1478 } 1479 /** 1480 * @brief Get field value from event gatt_event_characteristic_value_query_result 1481 * @param event packet 1482 * @return value 1483 * @note: btstack_type V 1484 */ 1485 static inline const uint8_t * gatt_event_characteristic_value_query_result_get_value(const uint8_t * event){ 1486 return &event[8]; 1487 } 1488 #endif 1489 1490 #ifdef ENABLE_BLE 1491 /** 1492 * @brief Get field handle from event gatt_event_long_characteristic_value_query_result 1493 * @param event packet 1494 * @return handle 1495 * @note: btstack_type H 1496 */ 1497 static inline hci_con_handle_t gatt_event_long_characteristic_value_query_result_get_handle(const uint8_t * event){ 1498 return little_endian_read_16(event, 2); 1499 } 1500 /** 1501 * @brief Get field value_handle from event gatt_event_long_characteristic_value_query_result 1502 * @param event packet 1503 * @return value_handle 1504 * @note: btstack_type 2 1505 */ 1506 static inline uint16_t gatt_event_long_characteristic_value_query_result_get_value_handle(const uint8_t * event){ 1507 return little_endian_read_16(event, 4); 1508 } 1509 /** 1510 * @brief Get field value_offset from event gatt_event_long_characteristic_value_query_result 1511 * @param event packet 1512 * @return value_offset 1513 * @note: btstack_type 2 1514 */ 1515 static inline uint16_t gatt_event_long_characteristic_value_query_result_get_value_offset(const uint8_t * event){ 1516 return little_endian_read_16(event, 6); 1517 } 1518 /** 1519 * @brief Get field value_length from event gatt_event_long_characteristic_value_query_result 1520 * @param event packet 1521 * @return value_length 1522 * @note: btstack_type L 1523 */ 1524 static inline int gatt_event_long_characteristic_value_query_result_get_value_length(const uint8_t * event){ 1525 return little_endian_read_16(event, 8); 1526 } 1527 /** 1528 * @brief Get field value from event gatt_event_long_characteristic_value_query_result 1529 * @param event packet 1530 * @return value 1531 * @note: btstack_type V 1532 */ 1533 static inline const uint8_t * gatt_event_long_characteristic_value_query_result_get_value(const uint8_t * event){ 1534 return &event[10]; 1535 } 1536 #endif 1537 1538 #ifdef ENABLE_BLE 1539 /** 1540 * @brief Get field handle from event gatt_event_notification 1541 * @param event packet 1542 * @return handle 1543 * @note: btstack_type H 1544 */ 1545 static inline hci_con_handle_t gatt_event_notification_get_handle(const uint8_t * event){ 1546 return little_endian_read_16(event, 2); 1547 } 1548 /** 1549 * @brief Get field value_handle from event gatt_event_notification 1550 * @param event packet 1551 * @return value_handle 1552 * @note: btstack_type 2 1553 */ 1554 static inline uint16_t gatt_event_notification_get_value_handle(const uint8_t * event){ 1555 return little_endian_read_16(event, 4); 1556 } 1557 /** 1558 * @brief Get field value_length from event gatt_event_notification 1559 * @param event packet 1560 * @return value_length 1561 * @note: btstack_type L 1562 */ 1563 static inline int gatt_event_notification_get_value_length(const uint8_t * event){ 1564 return little_endian_read_16(event, 6); 1565 } 1566 /** 1567 * @brief Get field value from event gatt_event_notification 1568 * @param event packet 1569 * @return value 1570 * @note: btstack_type V 1571 */ 1572 static inline const uint8_t * gatt_event_notification_get_value(const uint8_t * event){ 1573 return &event[8]; 1574 } 1575 #endif 1576 1577 #ifdef ENABLE_BLE 1578 /** 1579 * @brief Get field handle from event gatt_event_indication 1580 * @param event packet 1581 * @return handle 1582 * @note: btstack_type H 1583 */ 1584 static inline hci_con_handle_t gatt_event_indication_get_handle(const uint8_t * event){ 1585 return little_endian_read_16(event, 2); 1586 } 1587 /** 1588 * @brief Get field value_handle from event gatt_event_indication 1589 * @param event packet 1590 * @return value_handle 1591 * @note: btstack_type 2 1592 */ 1593 static inline uint16_t gatt_event_indication_get_value_handle(const uint8_t * event){ 1594 return little_endian_read_16(event, 4); 1595 } 1596 /** 1597 * @brief Get field value_length from event gatt_event_indication 1598 * @param event packet 1599 * @return value_length 1600 * @note: btstack_type L 1601 */ 1602 static inline int gatt_event_indication_get_value_length(const uint8_t * event){ 1603 return little_endian_read_16(event, 6); 1604 } 1605 /** 1606 * @brief Get field value from event gatt_event_indication 1607 * @param event packet 1608 * @return value 1609 * @note: btstack_type V 1610 */ 1611 static inline const uint8_t * gatt_event_indication_get_value(const uint8_t * event){ 1612 return &event[8]; 1613 } 1614 #endif 1615 1616 #ifdef ENABLE_BLE 1617 /** 1618 * @brief Get field descriptor_handle from event gatt_event_characteristic_descriptor_query_result 1619 * @param event packet 1620 * @return descriptor_handle 1621 * @note: btstack_type H 1622 */ 1623 static inline hci_con_handle_t gatt_event_characteristic_descriptor_query_result_get_descriptor_handle(const uint8_t * event){ 1624 return little_endian_read_16(event, 2); 1625 } 1626 /** 1627 * @brief Get field descriptor_length from event gatt_event_characteristic_descriptor_query_result 1628 * @param event packet 1629 * @return descriptor_length 1630 * @note: btstack_type 2 1631 */ 1632 static inline uint16_t gatt_event_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ 1633 return little_endian_read_16(event, 4); 1634 } 1635 /** 1636 * @brief Get field descriptor from event gatt_event_characteristic_descriptor_query_result 1637 * @param event packet 1638 * @return descriptor 1639 * @note: btstack_type L 1640 */ 1641 static inline int gatt_event_characteristic_descriptor_query_result_get_descriptor(const uint8_t * event){ 1642 return little_endian_read_16(event, 6); 1643 } 1644 #endif 1645 1646 #ifdef ENABLE_BLE 1647 /** 1648 * @brief Get field handle from event gatt_event_long_characteristic_descriptor_query_result 1649 * @param event packet 1650 * @return handle 1651 * @note: btstack_type H 1652 */ 1653 static inline hci_con_handle_t gatt_event_long_characteristic_descriptor_query_result_get_handle(const uint8_t * event){ 1654 return little_endian_read_16(event, 2); 1655 } 1656 /** 1657 * @brief Get field descriptor_offset from event gatt_event_long_characteristic_descriptor_query_result 1658 * @param event packet 1659 * @return descriptor_offset 1660 * @note: btstack_type 2 1661 */ 1662 static inline uint16_t gatt_event_long_characteristic_descriptor_query_result_get_descriptor_offset(const uint8_t * event){ 1663 return little_endian_read_16(event, 4); 1664 } 1665 /** 1666 * @brief Get field descriptor_length from event gatt_event_long_characteristic_descriptor_query_result 1667 * @param event packet 1668 * @return descriptor_length 1669 * @note: btstack_type L 1670 */ 1671 static inline int gatt_event_long_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ 1672 return little_endian_read_16(event, 6); 1673 } 1674 /** 1675 * @brief Get field descriptor from event gatt_event_long_characteristic_descriptor_query_result 1676 * @param event packet 1677 * @return descriptor 1678 * @note: btstack_type V 1679 */ 1680 static inline const uint8_t * gatt_event_long_characteristic_descriptor_query_result_get_descriptor(const uint8_t * event){ 1681 return &event[8]; 1682 } 1683 #endif 1684 1685 #ifdef ENABLE_BLE 1686 /** 1687 * @brief Get field handle from event gatt_event_mtu 1688 * @param event packet 1689 * @return handle 1690 * @note: btstack_type H 1691 */ 1692 static inline hci_con_handle_t gatt_event_mtu_get_handle(const uint8_t * event){ 1693 return little_endian_read_16(event, 2); 1694 } 1695 /** 1696 * @brief Get field MTU from event gatt_event_mtu 1697 * @param event packet 1698 * @return MTU 1699 * @note: btstack_type 2 1700 */ 1701 static inline uint16_t gatt_event_mtu_get_MTU(const uint8_t * event){ 1702 return little_endian_read_16(event, 4); 1703 } 1704 #endif 1705 1706 #ifdef ENABLE_BLE 1707 /** 1708 * @brief Get field handle from event sm_event_just_works_request 1709 * @param event packet 1710 * @return handle 1711 * @note: btstack_type H 1712 */ 1713 static inline hci_con_handle_t sm_event_just_works_request_get_handle(const uint8_t * event){ 1714 return little_endian_read_16(event, 2); 1715 } 1716 /** 1717 * @brief Get field addr_type from event sm_event_just_works_request 1718 * @param event packet 1719 * @return addr_type 1720 * @note: btstack_type 1 1721 */ 1722 static inline uint8_t sm_event_just_works_request_get_addr_type(const uint8_t * event){ 1723 return event[4]; 1724 } 1725 /** 1726 * @brief Get field address from event sm_event_just_works_request 1727 * @param event packet 1728 * @param Pointer to storage for address 1729 * @note: btstack_type B 1730 */ 1731 static inline void sm_event_just_works_request_get_address(const uint8_t * event, bd_addr_t address){ 1732 reverse_bd_addr(&event[5], address); 1733 } 1734 #endif 1735 1736 #ifdef ENABLE_BLE 1737 /** 1738 * @brief Get field handle from event sm_event_just_works_cancel 1739 * @param event packet 1740 * @return handle 1741 * @note: btstack_type H 1742 */ 1743 static inline hci_con_handle_t sm_event_just_works_cancel_get_handle(const uint8_t * event){ 1744 return little_endian_read_16(event, 2); 1745 } 1746 /** 1747 * @brief Get field addr_type from event sm_event_just_works_cancel 1748 * @param event packet 1749 * @return addr_type 1750 * @note: btstack_type 1 1751 */ 1752 static inline uint8_t sm_event_just_works_cancel_get_addr_type(const uint8_t * event){ 1753 return event[4]; 1754 } 1755 /** 1756 * @brief Get field address from event sm_event_just_works_cancel 1757 * @param event packet 1758 * @param Pointer to storage for address 1759 * @note: btstack_type B 1760 */ 1761 static inline void sm_event_just_works_cancel_get_address(const uint8_t * event, bd_addr_t address){ 1762 reverse_bd_addr(&event[5], address); 1763 } 1764 #endif 1765 1766 #ifdef ENABLE_BLE 1767 /** 1768 * @brief Get field handle from event sm_event_passkey_display_number 1769 * @param event packet 1770 * @return handle 1771 * @note: btstack_type H 1772 */ 1773 static inline hci_con_handle_t sm_event_passkey_display_number_get_handle(const uint8_t * event){ 1774 return little_endian_read_16(event, 2); 1775 } 1776 /** 1777 * @brief Get field addr_type from event sm_event_passkey_display_number 1778 * @param event packet 1779 * @return addr_type 1780 * @note: btstack_type 1 1781 */ 1782 static inline uint8_t sm_event_passkey_display_number_get_addr_type(const uint8_t * event){ 1783 return event[4]; 1784 } 1785 /** 1786 * @brief Get field address from event sm_event_passkey_display_number 1787 * @param event packet 1788 * @param Pointer to storage for address 1789 * @note: btstack_type B 1790 */ 1791 static inline void sm_event_passkey_display_number_get_address(const uint8_t * event, bd_addr_t address){ 1792 reverse_bd_addr(&event[5], address); 1793 } 1794 /** 1795 * @brief Get field passkey from event sm_event_passkey_display_number 1796 * @param event packet 1797 * @return passkey 1798 * @note: btstack_type 4 1799 */ 1800 static inline uint32_t sm_event_passkey_display_number_get_passkey(const uint8_t * event){ 1801 return little_endian_read_32(event, 11); 1802 } 1803 #endif 1804 1805 #ifdef ENABLE_BLE 1806 /** 1807 * @brief Get field handle from event sm_event_passkey_display_cancel 1808 * @param event packet 1809 * @return handle 1810 * @note: btstack_type H 1811 */ 1812 static inline hci_con_handle_t sm_event_passkey_display_cancel_get_handle(const uint8_t * event){ 1813 return little_endian_read_16(event, 2); 1814 } 1815 /** 1816 * @brief Get field addr_type from event sm_event_passkey_display_cancel 1817 * @param event packet 1818 * @return addr_type 1819 * @note: btstack_type 1 1820 */ 1821 static inline uint8_t sm_event_passkey_display_cancel_get_addr_type(const uint8_t * event){ 1822 return event[4]; 1823 } 1824 /** 1825 * @brief Get field address from event sm_event_passkey_display_cancel 1826 * @param event packet 1827 * @param Pointer to storage for address 1828 * @note: btstack_type B 1829 */ 1830 static inline void sm_event_passkey_display_cancel_get_address(const uint8_t * event, bd_addr_t address){ 1831 reverse_bd_addr(&event[5], address); 1832 } 1833 #endif 1834 1835 #ifdef ENABLE_BLE 1836 /** 1837 * @brief Get field handle from event sm_event_passkey_input_number 1838 * @param event packet 1839 * @return handle 1840 * @note: btstack_type H 1841 */ 1842 static inline hci_con_handle_t sm_event_passkey_input_number_get_handle(const uint8_t * event){ 1843 return little_endian_read_16(event, 2); 1844 } 1845 /** 1846 * @brief Get field addr_type from event sm_event_passkey_input_number 1847 * @param event packet 1848 * @return addr_type 1849 * @note: btstack_type 1 1850 */ 1851 static inline uint8_t sm_event_passkey_input_number_get_addr_type(const uint8_t * event){ 1852 return event[4]; 1853 } 1854 /** 1855 * @brief Get field address from event sm_event_passkey_input_number 1856 * @param event packet 1857 * @param Pointer to storage for address 1858 * @note: btstack_type B 1859 */ 1860 static inline void sm_event_passkey_input_number_get_address(const uint8_t * event, bd_addr_t address){ 1861 reverse_bd_addr(&event[5], address); 1862 } 1863 #endif 1864 1865 #ifdef ENABLE_BLE 1866 /** 1867 * @brief Get field handle from event sm_event_passkey_input_cancel 1868 * @param event packet 1869 * @return handle 1870 * @note: btstack_type H 1871 */ 1872 static inline hci_con_handle_t sm_event_passkey_input_cancel_get_handle(const uint8_t * event){ 1873 return little_endian_read_16(event, 2); 1874 } 1875 /** 1876 * @brief Get field addr_type from event sm_event_passkey_input_cancel 1877 * @param event packet 1878 * @return addr_type 1879 * @note: btstack_type 1 1880 */ 1881 static inline uint8_t sm_event_passkey_input_cancel_get_addr_type(const uint8_t * event){ 1882 return event[4]; 1883 } 1884 /** 1885 * @brief Get field address from event sm_event_passkey_input_cancel 1886 * @param event packet 1887 * @param Pointer to storage for address 1888 * @note: btstack_type B 1889 */ 1890 static inline void sm_event_passkey_input_cancel_get_address(const uint8_t * event, bd_addr_t address){ 1891 reverse_bd_addr(&event[5], address); 1892 } 1893 #endif 1894 1895 #ifdef ENABLE_BLE 1896 /** 1897 * @brief Get field handle from event sm_event_identity_resolving_started 1898 * @param event packet 1899 * @return handle 1900 * @note: btstack_type H 1901 */ 1902 static inline hci_con_handle_t sm_event_identity_resolving_started_get_handle(const uint8_t * event){ 1903 return little_endian_read_16(event, 2); 1904 } 1905 /** 1906 * @brief Get field addr_type from event sm_event_identity_resolving_started 1907 * @param event packet 1908 * @return addr_type 1909 * @note: btstack_type 1 1910 */ 1911 static inline uint8_t sm_event_identity_resolving_started_get_addr_type(const uint8_t * event){ 1912 return event[4]; 1913 } 1914 /** 1915 * @brief Get field address from event sm_event_identity_resolving_started 1916 * @param event packet 1917 * @param Pointer to storage for address 1918 * @note: btstack_type B 1919 */ 1920 static inline void sm_event_identity_resolving_started_get_address(const uint8_t * event, bd_addr_t address){ 1921 reverse_bd_addr(&event[5], address); 1922 } 1923 #endif 1924 1925 #ifdef ENABLE_BLE 1926 /** 1927 * @brief Get field handle from event sm_event_identity_resolving_failed 1928 * @param event packet 1929 * @return handle 1930 * @note: btstack_type H 1931 */ 1932 static inline hci_con_handle_t sm_event_identity_resolving_failed_get_handle(const uint8_t * event){ 1933 return little_endian_read_16(event, 2); 1934 } 1935 /** 1936 * @brief Get field addr_type from event sm_event_identity_resolving_failed 1937 * @param event packet 1938 * @return addr_type 1939 * @note: btstack_type 1 1940 */ 1941 static inline uint8_t sm_event_identity_resolving_failed_get_addr_type(const uint8_t * event){ 1942 return event[4]; 1943 } 1944 /** 1945 * @brief Get field address from event sm_event_identity_resolving_failed 1946 * @param event packet 1947 * @param Pointer to storage for address 1948 * @note: btstack_type B 1949 */ 1950 static inline void sm_event_identity_resolving_failed_get_address(const uint8_t * event, bd_addr_t address){ 1951 reverse_bd_addr(&event[5], address); 1952 } 1953 #endif 1954 1955 #ifdef ENABLE_BLE 1956 /** 1957 * @brief Get field handle from event sm_event_identity_resolving_succeeded 1958 * @param event packet 1959 * @return handle 1960 * @note: btstack_type H 1961 */ 1962 static inline hci_con_handle_t sm_event_identity_resolving_succeeded_get_handle(const uint8_t * event){ 1963 return little_endian_read_16(event, 2); 1964 } 1965 /** 1966 * @brief Get field addr_type from event sm_event_identity_resolving_succeeded 1967 * @param event packet 1968 * @return addr_type 1969 * @note: btstack_type 1 1970 */ 1971 static inline uint8_t sm_event_identity_resolving_succeeded_get_addr_type(const uint8_t * event){ 1972 return event[4]; 1973 } 1974 /** 1975 * @brief Get field address from event sm_event_identity_resolving_succeeded 1976 * @param event packet 1977 * @param Pointer to storage for address 1978 * @note: btstack_type B 1979 */ 1980 static inline void sm_event_identity_resolving_succeeded_get_address(const uint8_t * event, bd_addr_t address){ 1981 reverse_bd_addr(&event[5], address); 1982 } 1983 /** 1984 * @brief Get field le_device_db_index from event sm_event_identity_resolving_succeeded 1985 * @param event packet 1986 * @return le_device_db_index 1987 * @note: btstack_type 2 1988 */ 1989 static inline uint16_t sm_event_identity_resolving_succeeded_get_le_device_db_index(const uint8_t * event){ 1990 return little_endian_read_16(event, 11); 1991 } 1992 #endif 1993 1994 #ifdef ENABLE_BLE 1995 /** 1996 * @brief Get field handle from event sm_event_authorization_request 1997 * @param event packet 1998 * @return handle 1999 * @note: btstack_type H 2000 */ 2001 static inline hci_con_handle_t sm_event_authorization_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_authorization_request 2006 * @param event packet 2007 * @return addr_type 2008 * @note: btstack_type 1 2009 */ 2010 static inline uint8_t sm_event_authorization_request_get_addr_type(const uint8_t * event){ 2011 return event[4]; 2012 } 2013 /** 2014 * @brief Get field address from event sm_event_authorization_request 2015 * @param event packet 2016 * @param Pointer to storage for address 2017 * @note: btstack_type B 2018 */ 2019 static inline void sm_event_authorization_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_authorization_result 2027 * @param event packet 2028 * @return handle 2029 * @note: btstack_type H 2030 */ 2031 static inline hci_con_handle_t sm_event_authorization_result_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_authorization_result 2036 * @param event packet 2037 * @return addr_type 2038 * @note: btstack_type 1 2039 */ 2040 static inline uint8_t sm_event_authorization_result_get_addr_type(const uint8_t * event){ 2041 return event[4]; 2042 } 2043 /** 2044 * @brief Get field address from event sm_event_authorization_result 2045 * @param event packet 2046 * @param Pointer to storage for address 2047 * @note: btstack_type B 2048 */ 2049 static inline void sm_event_authorization_result_get_address(const uint8_t * event, bd_addr_t address){ 2050 reverse_bd_addr(&event[5], address); 2051 } 2052 /** 2053 * @brief Get field authorization_result from event sm_event_authorization_result 2054 * @param event packet 2055 * @return authorization_result 2056 * @note: btstack_type 1 2057 */ 2058 static inline uint8_t sm_event_authorization_result_get_authorization_result(const uint8_t * event){ 2059 return event[11]; 2060 } 2061 #endif 2062 2063 /** 2064 * @brief Get field advertising_event_type from event gap_event_advertising_report 2065 * @param event packet 2066 * @return advertising_event_type 2067 * @note: btstack_type 1 2068 */ 2069 static inline uint8_t gap_event_advertising_report_get_advertising_event_type(const uint8_t * event){ 2070 return event[2]; 2071 } 2072 /** 2073 * @brief Get field address_type from event gap_event_advertising_report 2074 * @param event packet 2075 * @return address_type 2076 * @note: btstack_type 1 2077 */ 2078 static inline uint8_t gap_event_advertising_report_get_address_type(const uint8_t * event){ 2079 return event[3]; 2080 } 2081 /** 2082 * @brief Get field address from event gap_event_advertising_report 2083 * @param event packet 2084 * @param Pointer to storage for address 2085 * @note: btstack_type B 2086 */ 2087 static inline void gap_event_advertising_report_get_address(const uint8_t * event, bd_addr_t address){ 2088 reverse_bd_addr(&event[4], address); 2089 } 2090 /** 2091 * @brief Get field rssi from event gap_event_advertising_report 2092 * @param event packet 2093 * @return rssi 2094 * @note: btstack_type 1 2095 */ 2096 static inline uint8_t gap_event_advertising_report_get_rssi(const uint8_t * event){ 2097 return event[10]; 2098 } 2099 /** 2100 * @brief Get field data_length from event gap_event_advertising_report 2101 * @param event packet 2102 * @return data_length 2103 * @note: btstack_type J 2104 */ 2105 static inline int gap_event_advertising_report_get_data_length(const uint8_t * event){ 2106 return event[11]; 2107 } 2108 /** 2109 * @brief Get field data from event gap_event_advertising_report 2110 * @param event packet 2111 * @return data 2112 * @note: btstack_type V 2113 */ 2114 static inline const uint8_t * gap_event_advertising_report_get_data(const uint8_t * event){ 2115 return &event[12]; 2116 } 2117 2118 /** 2119 * @brief Get field status from event hci_subevent_le_connection_complete 2120 * @param event packet 2121 * @return status 2122 * @note: btstack_type 1 2123 */ 2124 static inline uint8_t hci_subevent_le_connection_complete_get_status(const uint8_t * event){ 2125 return event[3]; 2126 } 2127 /** 2128 * @brief Get field connection_handle from event hci_subevent_le_connection_complete 2129 * @param event packet 2130 * @return connection_handle 2131 * @note: btstack_type H 2132 */ 2133 static inline hci_con_handle_t hci_subevent_le_connection_complete_get_connection_handle(const uint8_t * event){ 2134 return little_endian_read_16(event, 4); 2135 } 2136 /** 2137 * @brief Get field role from event hci_subevent_le_connection_complete 2138 * @param event packet 2139 * @return role 2140 * @note: btstack_type 1 2141 */ 2142 static inline uint8_t hci_subevent_le_connection_complete_get_role(const uint8_t * event){ 2143 return event[6]; 2144 } 2145 /** 2146 * @brief Get field peer_address_type from event hci_subevent_le_connection_complete 2147 * @param event packet 2148 * @return peer_address_type 2149 * @note: btstack_type 1 2150 */ 2151 static inline uint8_t hci_subevent_le_connection_complete_get_peer_address_type(const uint8_t * event){ 2152 return event[7]; 2153 } 2154 /** 2155 * @brief Get field peer_address from event hci_subevent_le_connection_complete 2156 * @param event packet 2157 * @param Pointer to storage for peer_address 2158 * @note: btstack_type B 2159 */ 2160 static inline void hci_subevent_le_connection_complete_get_peer_address(const uint8_t * event, bd_addr_t peer_address){ 2161 reverse_bd_addr(&event[8], peer_address); 2162 } 2163 /** 2164 * @brief Get field conn_interval from event hci_subevent_le_connection_complete 2165 * @param event packet 2166 * @return conn_interval 2167 * @note: btstack_type 2 2168 */ 2169 static inline uint16_t hci_subevent_le_connection_complete_get_conn_interval(const uint8_t * event){ 2170 return little_endian_read_16(event, 14); 2171 } 2172 /** 2173 * @brief Get field conn_latency from event hci_subevent_le_connection_complete 2174 * @param event packet 2175 * @return conn_latency 2176 * @note: btstack_type 2 2177 */ 2178 static inline uint16_t hci_subevent_le_connection_complete_get_conn_latency(const uint8_t * event){ 2179 return little_endian_read_16(event, 16); 2180 } 2181 /** 2182 * @brief Get field supervision_timeout from event hci_subevent_le_connection_complete 2183 * @param event packet 2184 * @return supervision_timeout 2185 * @note: btstack_type 2 2186 */ 2187 static inline uint16_t hci_subevent_le_connection_complete_get_supervision_timeout(const uint8_t * event){ 2188 return little_endian_read_16(event, 18); 2189 } 2190 /** 2191 * @brief Get field master_clock_accuracy from event hci_subevent_le_connection_complete 2192 * @param event packet 2193 * @return master_clock_accuracy 2194 * @note: btstack_type 1 2195 */ 2196 static inline uint8_t hci_subevent_le_connection_complete_get_master_clock_accuracy(const uint8_t * event){ 2197 return event[20]; 2198 } 2199 2200 /** 2201 * @brief Get field status from event hsp_subevent_audio_connection_complete 2202 * @param event packet 2203 * @return status 2204 * @note: btstack_type 1 2205 */ 2206 static inline uint8_t hsp_subevent_audio_connection_complete_get_status(const uint8_t * event){ 2207 return event[3]; 2208 } 2209 2210 /** 2211 * @brief Get field status from event hsp_subevent_audio_disconnection_complete 2212 * @param event packet 2213 * @return status 2214 * @note: btstack_type 1 2215 */ 2216 static inline uint8_t hsp_subevent_audio_disconnection_complete_get_status(const uint8_t * event){ 2217 return event[3]; 2218 } 2219 2220 2221 /** 2222 * @brief Get field gain from event hsp_subevent_microphone_gain_changed 2223 * @param event packet 2224 * @return gain 2225 * @note: btstack_type 1 2226 */ 2227 static inline uint8_t hsp_subevent_microphone_gain_changed_get_gain(const uint8_t * event){ 2228 return event[3]; 2229 } 2230 2231 /** 2232 * @brief Get field gain from event hsp_subevent_speaker_gain_changed 2233 * @param event packet 2234 * @return gain 2235 * @note: btstack_type 1 2236 */ 2237 static inline uint8_t hsp_subevent_speaker_gain_changed_get_gain(const uint8_t * event){ 2238 return event[3]; 2239 } 2240 2241 /** 2242 * @brief Get field value_length from event hsp_subevent_hs_command 2243 * @param event packet 2244 * @return value_length 2245 * @note: btstack_type J 2246 */ 2247 static inline int hsp_subevent_hs_command_get_value_length(const uint8_t * event){ 2248 return event[3]; 2249 } 2250 /** 2251 * @brief Get field value from event hsp_subevent_hs_command 2252 * @param event packet 2253 * @return value 2254 * @note: btstack_type V 2255 */ 2256 static inline const uint8_t * hsp_subevent_hs_command_get_value(const uint8_t * event){ 2257 return &event[4]; 2258 } 2259 2260 /** 2261 * @brief Get field value_length from event hsp_subevent_ag_indication 2262 * @param event packet 2263 * @return value_length 2264 * @note: btstack_type J 2265 */ 2266 static inline int hsp_subevent_ag_indication_get_value_length(const uint8_t * event){ 2267 return event[3]; 2268 } 2269 /** 2270 * @brief Get field value from event hsp_subevent_ag_indication 2271 * @param event packet 2272 * @return value 2273 * @note: btstack_type V 2274 */ 2275 static inline const uint8_t * hsp_subevent_ag_indication_get_value(const uint8_t * event){ 2276 return &event[4]; 2277 } 2278 2279 /** 2280 * @brief Get field status from event hfp_subevent_service_level_connection_established 2281 * @param event packet 2282 * @return status 2283 * @note: btstack_type 1 2284 */ 2285 static inline uint8_t hfp_subevent_service_level_connection_established_get_status(const uint8_t * event){ 2286 return event[3]; 2287 } 2288 2289 2290 /** 2291 * @brief Get field status from event hfp_subevent_audio_connection_established 2292 * @param event packet 2293 * @return status 2294 * @note: btstack_type 1 2295 */ 2296 static inline uint8_t hfp_subevent_audio_connection_established_get_status(const uint8_t * event){ 2297 return event[3]; 2298 } 2299 2300 2301 /** 2302 * @brief Get field status from event hfp_subevent_complete 2303 * @param event packet 2304 * @return status 2305 * @note: btstack_type 1 2306 */ 2307 static inline uint8_t hfp_subevent_complete_get_status(const uint8_t * event){ 2308 return event[3]; 2309 } 2310 2311 /** 2312 * @brief Get field indicator_index from event hfp_subevent_ag_indicator_status_changed 2313 * @param event packet 2314 * @return indicator_index 2315 * @note: btstack_type 1 2316 */ 2317 static inline uint8_t hfp_subevent_ag_indicator_status_changed_get_indicator_index(const uint8_t * event){ 2318 return event[3]; 2319 } 2320 /** 2321 * @brief Get field indicator_status from event hfp_subevent_ag_indicator_status_changed 2322 * @param event packet 2323 * @return indicator_status 2324 * @note: btstack_type 1 2325 */ 2326 static inline uint8_t hfp_subevent_ag_indicator_status_changed_get_indicator_status(const uint8_t * event){ 2327 return event[4]; 2328 } 2329 /** 2330 * @brief Get field indicator_name from event hfp_subevent_ag_indicator_status_changed 2331 * @param event packet 2332 * @return indicator_name 2333 * @note: btstack_type T 2334 */ 2335 static inline const char * hfp_subevent_ag_indicator_status_changed_get_indicator_name(const uint8_t * event){ 2336 return (const char *) &event[5]; 2337 } 2338 2339 /** 2340 * @brief Get field network_operator_mode from event hfp_subevent_network_operator_changed 2341 * @param event packet 2342 * @return network_operator_mode 2343 * @note: btstack_type 1 2344 */ 2345 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_mode(const uint8_t * event){ 2346 return event[3]; 2347 } 2348 /** 2349 * @brief Get field network_operator_format from event hfp_subevent_network_operator_changed 2350 * @param event packet 2351 * @return network_operator_format 2352 * @note: btstack_type 1 2353 */ 2354 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_format(const uint8_t * event){ 2355 return event[4]; 2356 } 2357 /** 2358 * @brief Get field network_operator_name from event hfp_subevent_network_operator_changed 2359 * @param event packet 2360 * @return network_operator_name 2361 * @note: btstack_type 1 2362 */ 2363 static inline uint8_t hfp_subevent_network_operator_changed_get_network_operator_name(const uint8_t * event){ 2364 return event[5]; 2365 } 2366 2367 /** 2368 * @brief Get field error from event hfp_subevent_extended_audio_gateway_error 2369 * @param event packet 2370 * @return error 2371 * @note: btstack_type 1 2372 */ 2373 static inline uint8_t hfp_subevent_extended_audio_gateway_error_get_error(const uint8_t * event){ 2374 return event[3]; 2375 } 2376 2377 /** 2378 * @brief Get field status from event hfp_subevent_codecs_connection_complete 2379 * @param event packet 2380 * @return status 2381 * @note: btstack_type 1 2382 */ 2383 static inline uint8_t hfp_subevent_codecs_connection_complete_get_status(const uint8_t * event){ 2384 return event[3]; 2385 } 2386 2387 2388 2389 2390 /** 2391 * @brief Get field number from event hfp_subevent_place_call_with_number 2392 * @param event packet 2393 * @return number 2394 * @note: btstack_type T 2395 */ 2396 static inline const char * hfp_subevent_place_call_with_number_get_number(const uint8_t * event){ 2397 return (const char *) &event[3]; 2398 } 2399 2400 2401 /** 2402 * @brief Get field number from event hfp_subevent_number_for_voice_tag 2403 * @param event packet 2404 * @return number 2405 * @note: btstack_type T 2406 */ 2407 static inline const char * hfp_subevent_number_for_voice_tag_get_number(const uint8_t * event){ 2408 return (const char *) &event[3]; 2409 } 2410 2411 /** 2412 * @brief Get field dtmf from event hfp_subevent_transmit_dtmf_codes 2413 * @param event packet 2414 * @return dtmf 2415 * @note: btstack_type T 2416 */ 2417 static inline const char * hfp_subevent_transmit_dtmf_codes_get_dtmf(const uint8_t * event){ 2418 return (const char *) &event[3]; 2419 } 2420 2421 2422 2423 2424 /** 2425 * @brief Get field status from event hfp_subevent_speaker_volume 2426 * @param event packet 2427 * @return status 2428 * @note: btstack_type 1 2429 */ 2430 static inline uint8_t hfp_subevent_speaker_volume_get_status(const uint8_t * event){ 2431 return event[3]; 2432 } 2433 /** 2434 * @brief Get field gain from event hfp_subevent_speaker_volume 2435 * @param event packet 2436 * @return gain 2437 * @note: btstack_type 1 2438 */ 2439 static inline uint8_t hfp_subevent_speaker_volume_get_gain(const uint8_t * event){ 2440 return event[4]; 2441 } 2442 2443 /** 2444 * @brief Get field status from event hfp_subevent_microphone_volume 2445 * @param event packet 2446 * @return status 2447 * @note: btstack_type 1 2448 */ 2449 static inline uint8_t hfp_subevent_microphone_volume_get_status(const uint8_t * event){ 2450 return event[3]; 2451 } 2452 /** 2453 * @brief Get field gain from event hfp_subevent_microphone_volume 2454 * @param event packet 2455 * @return gain 2456 * @note: btstack_type 1 2457 */ 2458 static inline uint8_t hfp_subevent_microphone_volume_get_gain(const uint8_t * event){ 2459 return event[4]; 2460 } 2461 2462 /** 2463 * @brief Get field type from event hfp_subevent_call_waiting_notification 2464 * @param event packet 2465 * @return type 2466 * @note: btstack_type 1 2467 */ 2468 static inline uint8_t hfp_subevent_call_waiting_notification_get_type(const uint8_t * event){ 2469 return event[3]; 2470 } 2471 /** 2472 * @brief Get field number from event hfp_subevent_call_waiting_notification 2473 * @param event packet 2474 * @return number 2475 * @note: btstack_type T 2476 */ 2477 static inline const char * hfp_subevent_call_waiting_notification_get_number(const uint8_t * event){ 2478 return (const char *) &event[4]; 2479 } 2480 2481 /** 2482 * @brief Get field type from event hfp_subevent_calling_line_indetification_notification 2483 * @param event packet 2484 * @return type 2485 * @note: btstack_type 1 2486 */ 2487 static inline uint8_t hfp_subevent_calling_line_indetification_notification_get_type(const uint8_t * event){ 2488 return event[3]; 2489 } 2490 /** 2491 * @brief Get field number from event hfp_subevent_calling_line_indetification_notification 2492 * @param event packet 2493 * @return number 2494 * @note: btstack_type T 2495 */ 2496 static inline const char * hfp_subevent_calling_line_indetification_notification_get_number(const uint8_t * event){ 2497 return (const char *) &event[4]; 2498 } 2499 2500 /** 2501 * @brief Get field clcc_idx from event hfp_subevent_enhanced_call_status 2502 * @param event packet 2503 * @return clcc_idx 2504 * @note: btstack_type 1 2505 */ 2506 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_idx(const uint8_t * event){ 2507 return event[3]; 2508 } 2509 /** 2510 * @brief Get field clcc_dir from event hfp_subevent_enhanced_call_status 2511 * @param event packet 2512 * @return clcc_dir 2513 * @note: btstack_type 1 2514 */ 2515 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_dir(const uint8_t * event){ 2516 return event[4]; 2517 } 2518 /** 2519 * @brief Get field clcc_status from event hfp_subevent_enhanced_call_status 2520 * @param event packet 2521 * @return clcc_status 2522 * @note: btstack_type 1 2523 */ 2524 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_status(const uint8_t * event){ 2525 return event[5]; 2526 } 2527 /** 2528 * @brief Get field clcc_mpty from event hfp_subevent_enhanced_call_status 2529 * @param event packet 2530 * @return clcc_mpty 2531 * @note: btstack_type 1 2532 */ 2533 static inline uint8_t hfp_subevent_enhanced_call_status_get_clcc_mpty(const uint8_t * event){ 2534 return event[6]; 2535 } 2536 /** 2537 * @brief Get field bnip_type from event hfp_subevent_enhanced_call_status 2538 * @param event packet 2539 * @return bnip_type 2540 * @note: btstack_type 1 2541 */ 2542 static inline uint8_t hfp_subevent_enhanced_call_status_get_bnip_type(const uint8_t * event){ 2543 return event[7]; 2544 } 2545 /** 2546 * @brief Get field bnip_number from event hfp_subevent_enhanced_call_status 2547 * @param event packet 2548 * @return bnip_number 2549 * @note: btstack_type T 2550 */ 2551 static inline const char * hfp_subevent_enhanced_call_status_get_bnip_number(const uint8_t * event){ 2552 return (const char *) &event[8]; 2553 } 2554 2555 /** 2556 * @brief Get field status from event hfp_subevent_subscriber_number_information 2557 * @param event packet 2558 * @return status 2559 * @note: btstack_type 1 2560 */ 2561 static inline uint8_t hfp_subevent_subscriber_number_information_get_status(const uint8_t * event){ 2562 return event[3]; 2563 } 2564 /** 2565 * @brief Get field bnip_type from event hfp_subevent_subscriber_number_information 2566 * @param event packet 2567 * @return bnip_type 2568 * @note: btstack_type 1 2569 */ 2570 static inline uint8_t hfp_subevent_subscriber_number_information_get_bnip_type(const uint8_t * event){ 2571 return event[4]; 2572 } 2573 /** 2574 * @brief Get field bnip_number from event hfp_subevent_subscriber_number_information 2575 * @param event packet 2576 * @return bnip_number 2577 * @note: btstack_type T 2578 */ 2579 static inline const char * hfp_subevent_subscriber_number_information_get_bnip_number(const uint8_t * event){ 2580 return (const char *) &event[5]; 2581 } 2582 2583 /** 2584 * @brief Get field value from event hfp_subevent_response_and_hold_status 2585 * @param event packet 2586 * @return value 2587 * @note: btstack_type T 2588 */ 2589 static inline const char * hfp_subevent_response_and_hold_status_get_value(const uint8_t * event){ 2590 return (const char *) &event[3]; 2591 } 2592 2593 #ifdef ENABLE_BLE 2594 /** 2595 * @brief Get field handle from event ancs_subevent_client_connected 2596 * @param event packet 2597 * @return handle 2598 * @note: btstack_type H 2599 */ 2600 static inline hci_con_handle_t ancs_subevent_client_connected_get_handle(const uint8_t * event){ 2601 return little_endian_read_16(event, 3); 2602 } 2603 #endif 2604 2605 #ifdef ENABLE_BLE 2606 /** 2607 * @brief Get field handle from event ancs_subevent_client_notification 2608 * @param event packet 2609 * @return handle 2610 * @note: btstack_type H 2611 */ 2612 static inline hci_con_handle_t ancs_subevent_client_notification_get_handle(const uint8_t * event){ 2613 return little_endian_read_16(event, 3); 2614 } 2615 /** 2616 * @brief Get field attribute_id from event ancs_subevent_client_notification 2617 * @param event packet 2618 * @return attribute_id 2619 * @note: btstack_type 2 2620 */ 2621 static inline uint16_t ancs_subevent_client_notification_get_attribute_id(const uint8_t * event){ 2622 return little_endian_read_16(event, 5); 2623 } 2624 /** 2625 * @brief Get field text from event ancs_subevent_client_notification 2626 * @param event packet 2627 * @return text 2628 * @note: btstack_type T 2629 */ 2630 static inline const char * ancs_subevent_client_notification_get_text(const uint8_t * event){ 2631 return (const char *) &event[7]; 2632 } 2633 #endif 2634 2635 #ifdef ENABLE_BLE 2636 /** 2637 * @brief Get field handle from event ancs_subevent_client_disconnected 2638 * @param event packet 2639 * @return handle 2640 * @note: btstack_type H 2641 */ 2642 static inline hci_con_handle_t ancs_subevent_client_disconnected_get_handle(const uint8_t * event){ 2643 return little_endian_read_16(event, 3); 2644 } 2645 #endif 2646 2647 2648 2649 /* API_END */ 2650 2651 #if defined __cplusplus 2652 } 2653 #endif 2654 2655 #endif // __BTSTACK_EVENT_H 2656