1 #ifndef CO_LMP_H_ 2 #define CO_LMP_H_ 3 4 /** 5 **************************************************************************************** 6 * @addtogroup CO_BT 7 * @{ 8 **************************************************************************************** 9 */ 10 11 12 /* 13 * INCLUDE FILES 14 **************************************************************************************** 15 */ 16 #include "co_bt.h" 17 /* 18 * DEFINES 19 **************************************************************************************** 20 */ 21 22 //LMP Opcodes 23 #define LMP_NAME_REQ_OPCODE 1 24 #define LMP_NAME_RES_OPCODE 2 25 #define LMP_ACCEPTED_OPCODE 3 26 #define LMP_NOT_ACCEPTED_OPCODE 4 27 #define LMP_CLK_OFF_REQ_OPCODE 5 28 #define LMP_CLK_OFF_RES_OPCODE 6 29 #define LMP_DETACH_OPCODE 7 30 #define LMP_INRAND_OPCODE 8 31 #define LMP_COMBKEY_OPCODE 9 32 #define LMP_UNITKEY_OPCODE 10 33 #define LMP_AURAND_OPCODE 11 34 #define LMP_SRES_OPCODE 12 35 #define LMP_TEMPRAND_OPCODE 13 36 #define LMP_TEMPKEY_OPCODE 14 37 #define LMP_ENC_MODE_REQ_OPCODE 15 38 #define LMP_ENC_KEY_SIZE_REQ_OPCODE 16 39 #define LMP_START_ENC_REQ_OPCODE 17 40 #define LMP_STOP_ENC_REQ_OPCODE 18 41 #define LMP_SWITCH_REQ_OPCODE 19 42 #define LMP_HOLD_OPCODE 20 43 #define LMP_HOLD_REQ_OPCODE 21 44 #define LMP_SNIFF_REQ_OPCODE 23 45 #define LMP_UNSNIFF_REQ_OPCODE 24 46 #define LMP_PARK_REQ_OPCODE 25 47 #define LMP_SET_BSWIN_OPCODE 27 48 #define LMP_MODIF_BEACON_OPCODE 28 49 #define LMP_UNPARK_BD_REQ_OPCODE 29 50 #define LMP_UNPARK_PM_REQ_OPCODE 30 51 #define LMP_INCR_PWR_REQ_OPCODE 31 52 #define LMP_DECR_PWR_REQ_OPCODE 32 53 #define LMP_MAX_PWR_OPCODE 33 54 #define LMP_MIN_PWR_OPCODE 34 55 #define LMP_AUTO_RATE_OPCODE 35 56 #define LMP_PREF_RATE_OPCODE 36 57 #define LMP_VER_REQ_OPCODE 37 58 #define LMP_VER_RES_OPCODE 38 59 #define LMP_FEATS_REQ_OPCODE 39 60 #define LMP_FEATS_RES_OPCODE 40 61 #define LMP_QOS_OPCODE 41 62 #define LMP_QOS_REQ_OPCODE 42 63 #define LMP_SCO_LINK_REQ_OPCODE 43 64 #define LMP_RMV_SCO_LINK_REQ_OPCODE 44 65 #define LMP_MAX_SLOT_OPCODE 45 66 #define LMP_MAX_SLOT_REQ_OPCODE 46 67 #define LMP_TIMING_ACCU_REQ_OPCODE 47 68 #define LMP_TIMING_ACCU_RES_OPCODE 48 69 #define LMP_SETUP_CMP_OPCODE 49 70 #define LMP_USE_SEMI_PERM_KEY_OPCODE 50 71 #define LMP_HOST_CON_REQ_OPCODE 51 72 #define LMP_SLOT_OFF_OPCODE 52 73 #define LMP_PAGE_MODE_REQ_OPCODE 53 74 #define LMP_PAGE_SCAN_MODE_REQ_OPCODE 54 75 #define LMP_SUPV_TO_OPCODE 55 76 #define LMP_TEST_ACTIVATE_OPCODE 56 77 #define LMP_TEST_CTRL_OPCODE 57 78 #define LMP_ENC_KEY_SIZE_MASK_REQ_OPCODE 58 79 #define LMP_ENC_KEY_SIZE_MASK_RES_OPCODE 59 80 #define LMP_SET_AFH_OPCODE 60 81 #define LMP_ENCAPS_HDR_OPCODE 61 82 #define LMP_ENCAPS_PAYL_OPCODE 62 83 #define LMP_SP_CFM_OPCODE 63 84 #define LMP_SP_NB_OPCODE 64 85 #define LMP_DHKEY_CHK_OPCODE 65 86 #define LMP_PAUSE_ENC_AES_REQ_OPCODE 66 87 88 #define LMP_ESC1_OPCODE 124 89 #define LMP_ESC2_OPCODE 125 90 #define LMP_ESC3_OPCODE 126 91 #define LMP_ESC4_OPCODE 127 92 93 ///LMP Escape 4 Extended Opcodes 94 #define LMP_ACCEPTED_EXT_EXTOPCODE 1 95 #define LMP_NOT_ACCEPTED_EXT_EXTOPCODE 2 96 #define LMP_FEATS_REQ_EXT_EXTOPCODE 3 97 #define LMP_FEATS_RES_EXT_EXTOPCODE 4 98 #define LMP_CLK_ADJ_EXTOPCODE 5 99 #define LMP_CLK_ADJ_ACK_EXTOPCODE 6 100 #define LMP_CLK_ADJ_REQ_EXTOPCODE 7 101 #define LMP_PKT_TYPE_TBL_REQ_EXTOPCODE 11 102 #define LMP_ESCO_LINK_REQ_EXTOPCODE 12 103 #define LMP_RMV_ESCO_LINK_REQ_EXTOPCODE 13 104 #define LMP_CH_CLASS_REQ_EXTOPCODE 16 105 #define LMP_CH_CLASS_EXTOPCODE 17 106 #define LMP_SSR_REQ_EXTOPCODE 21 107 #define LMP_SSR_RES_EXTOPCODE 22 108 #define LMP_PAUSE_ENC_REQ_EXTOPCODE 23 109 #define LMP_RESUME_ENC_REQ_EXTOPCODE 24 110 #define LMP_IO_CAP_REQ_EXTOPCODE 25 111 #define LMP_IO_CAP_RES_EXTOPCODE 26 112 #define LMP_NUM_COMPARISON_FAIL_EXTOPCODE 27 113 #define LMP_PASSKEY_FAIL_EXTOPCODE 28 114 #define LMP_OOB_FAIL_EXTOPCODE 29 115 #define LMP_KEYPRESS_NOTIF_EXTOPCODE 30 116 #define LMP_PWR_CTRL_REQ_EXTOPCODE 31 117 #define LMP_PWR_CTRL_RES_EXTOPCODE 32 118 #define LMP_PING_REQ_EXTOPCODE 33 119 #define LMP_PING_RES_EXTOPCODE 34 120 121 /// PDU lengths (including opcode) 122 #define LMP_NAME_REQ_LEN 2 123 #define LMP_NAME_RES_LEN 17 124 #define LMP_ACCEPTED_LEN 2 125 #define LMP_NOT_ACCEPTED_LEN 3 126 #define LMP_CLK_OFF_REQ_LEN 1 127 #define LMP_CLK_OFF_RES_LEN 3 128 #define LMP_DETACH_LEN 2 129 #define LMP_INRAND_LEN 17 130 #define LMP_COMBKEY_LEN 17 131 #define LMP_UNITKEY_LEN 17 132 #define LMP_AURAND_LEN 17 133 #define LMP_SRES_LEN 5 134 #define LMP_TEMPRAND_LEN 17 135 #define LMP_TEMPKEY_LEN 17 136 #define LMP_ENC_MODE_REQ_LEN 2 137 #define LMP_ENC_KEY_SIZE_REQ_LEN 2 138 #define LMP_START_ENC_REQ_LEN 17 139 #define LMP_STOP_ENC_REQ_LEN 1 140 #define LMP_SWITCH_REQ_LEN 5 141 #define LMP_HOLD_LEN 7 142 #define LMP_HOLD_REQ_LEN 7 143 #define LMP_SNIFF_REQ_LEN 10 144 #define LMP_UNSNIFF_REQ_LEN 1 145 #define LMP_PARK_REQ_LEN 17 146 #define LMP_INCR_PWR_REQ_LEN 2 147 #define LMP_DECR_PWR_REQ_LEN 2 148 #define LMP_MAX_PWR_LEN 1 149 #define LMP_MIN_PWR_LEN 1 150 #define LMP_AUTO_RATE_LEN 1 151 #define LMP_PREF_RATE_LEN 2 152 #define LMP_VER_REQ_LEN 6 153 #define LMP_VER_RES_LEN 6 154 #define LMP_FEATS_REQ_LEN 9 155 #define LMP_FEATS_RES_LEN 9 156 #define LMP_QOS_LEN 4 157 #define LMP_QOS_REQ_LEN 4 158 #define LMP_SCO_LINK_REQ_LEN 7 159 #define LMP_RMV_SCO_LINK_REQ_LEN 3 160 #define LMP_MAX_SLOT_LEN 2 161 #define LMP_MAX_SLOT_REQ_LEN 2 162 #define LMP_TIMING_ACCU_REQ_LEN 1 163 #define LMP_TIMING_ACCU_RES_LEN 3 164 #define LMP_SETUP_CMP_LEN 1 165 #define LMP_USE_SEMI_PERM_KEY_LEN 1 166 #define LMP_HOST_CON_REQ_LEN 1 167 #define LMP_SLOT_OFF_LEN 9 168 #define LMP_PAGE_MODE_REQ_LEN 3 169 #define LMP_PAGE_SCAN_MODE_REQ_LEN 3 170 #define LMP_SUPV_TO_LEN 3 171 #define LMP_TEST_ACTIVATE_LEN 1 172 #define LMP_TEST_CTRL_LEN 10 173 #define LMP_ENC_KEY_SIZE_MASK_REQ_LEN 1 174 #define LMP_ENC_KEY_SIZE_MASK_RES_LEN 3 175 #define LMP_SET_AFH_LEN 16 176 #define LMP_ENCAPS_HDR_LEN 4 177 #define LMP_ENCAPS_PAYL_LEN 17 178 #define LMP_SP_CFM_LEN 17 179 #define LMP_SP_NB_LEN 17 180 #define LMP_DHKEY_CHK_LEN 17 181 #define LMP_PAUSE_ENC_AES_REQ_LEN 17 182 183 /// LMP Escape 4 Extended PDU length (including opcode and ext opcode) 184 #define LMP_ACCEPTED_EXT_LEN 4 185 #define LMP_NOT_ACCEPTED_EXT_LEN 5 186 #define LMP_FEATS_REQ_EXT_LEN 12 187 #define LMP_FEATS_RES_EXT_LEN 12 188 #define LMP_CLK_ADJ_LEN 15 189 #define LMP_CLK_ADJ_ACK_LEN 3 190 #define LMP_CLK_ADJ_REQ_LEN 6 191 #define LMP_PKT_TYPE_TBL_REQ_LEN 3 192 #define LMP_ESCO_LINK_REQ_LEN 16 193 #define LMP_RMV_ESCO_LINK_REQ_LEN 4 194 #define LMP_CH_CLASS_REQ_LEN 7 195 #define LMP_CH_CLASS_LEN 12 196 #define LMP_SSR_REQ_LEN 9 197 #define LMP_SSR_RES_LEN 9 198 #define LMP_PAUSE_ENC_REQ_LEN 2 199 #define LMP_RESUME_ENC_REQ_LEN 2 200 #define LMP_IO_CAP_REQ_LEN 5 201 #define LMP_IO_CAP_RES_LEN 5 202 #define LMP_NUM_COMPARISON_FAIL_LEN 2 203 #define LMP_PASSKEY_FAIL_LEN 2 204 #define LMP_OOB_FAIL_LEN 2 205 #define LMP_KEYPRESS_NOTIF_LEN 3 206 #define LMP_PWR_CTRL_REQ_LEN 3 207 #define LMP_PWR_CTRL_RES_LEN 3 208 #define LMP_PING_REQ_LEN 2 209 #define LMP_PING_RES_LEN 2 210 211 /// Maximum LMP PDU size (including opcode and ext opcode) 212 #define LMP_MAX_PDU_SIZE DM1_PACKET_SIZE 213 214 /// Position of transaction ID in 1st byte 215 #define LMP_TR_ID_POS 0 216 #define LMP_TR_ID_MASK 0x01 217 /// Position of opcode in 1st byte 218 #define LMP_OPCODE_POS 1 219 #define LMP_OPCODE_MASK 0xFE 220 221 #define LMP_OPCODE(opcode, tr_id) (((opcode << LMP_OPCODE_POS) & LMP_OPCODE_MASK) | ((tr_id << LMP_TR_ID_POS) & LMP_TR_ID_MASK)) 222 /* 223 * MESSAGES 224 **************************************************************************************** 225 */ 226 227 ///LMP_name_req PDU structure 228 struct lmp_name_req 229 { 230 ///Opcode (including transaction ID) 231 uint8_t opcode; 232 ///Offset 233 uint8_t offset; 234 }; 235 236 ///LMP_name_res PDU structure 237 struct lmp_name_res 238 { 239 ///Opcode (including transaction ID) 240 uint8_t opcode; 241 ///Offset 242 uint8_t offset; 243 ///Name Length 244 uint8_t length; 245 ///Name Fragment 246 struct name_vect name_frag; 247 }; 248 249 ///LMP_accepted PDU structure 250 struct lmp_accepted 251 { 252 ///Opcode (including transaction ID) 253 uint8_t opcode; 254 ///Opcode of the original LMP 255 uint8_t orig_opcode; 256 }; 257 258 ///LMP_not_accepted PDU structure 259 struct lmp_not_accepted 260 { 261 ///Opcode (including transaction ID) 262 uint8_t opcode; 263 ///Opcode of the original LMP 264 uint8_t orig_opcode; 265 ///Reason for not accepting the PDU (error code) 266 uint8_t reason; 267 }; 268 269 ///LMP_clkoffset_req PDU structure 270 struct lmp_clk_off_req 271 { 272 ///Opcode (including transaction ID) 273 uint8_t opcode; 274 }; 275 276 ///LMP_clkoffset_res PDU structure 277 struct lmp_clk_off_res 278 { 279 ///Opcode (including transaction ID) 280 uint8_t opcode; 281 ///Clock Offset value 282 uint16_t clk_offset ; 283 }; 284 285 ///LMP_detach PDU structure 286 struct lmp_detach 287 { 288 ///Opcode (including transaction ID) 289 uint8_t opcode; 290 ///Reason to detach 291 uint8_t reason; 292 }; 293 294 ///LMP_in_rand PDU structure 295 struct lmp_inrand 296 { 297 ///Opcode (including transaction ID) 298 uint8_t opcode; 299 ///Random number 300 struct ltk random; 301 }; 302 303 ///LMP_comb_key PDU structure 304 struct lmp_combkey 305 { 306 ///Opcode (including transaction ID) 307 uint8_t opcode; 308 ///Random number 309 struct ltk random; 310 }; 311 312 ///LMP_unit_key PDU structure 313 struct lmp_unitkey 314 { 315 ///Opcode (including transaction ID) 316 uint8_t opcode; 317 ///Key 318 struct ltk key; 319 }; 320 321 ///LMP_au_rand PDU structure 322 struct lmp_aurand 323 { 324 ///Opcode (including transaction ID) 325 uint8_t opcode; 326 ///Random number 327 struct ltk random; 328 }; 329 330 ///LMP_sres PDU structure 331 struct lmp_sres 332 { 333 ///Opcode (including transaction ID) 334 uint8_t opcode; 335 ///Authentication Response 336 struct sres_nb Sres; 337 }; 338 339 ///LMP_temp_rand PDU structure 340 struct lmp_temprand 341 { 342 ///Opcode (including transaction ID) 343 uint8_t opcode; 344 ///Random number 345 struct ltk random; 346 }; 347 348 ///LMP_temp_key PDU structure 349 struct lmp_tempkey 350 { 351 ///Opcode (including transaction ID) 352 uint8_t opcode; 353 ///Key 354 struct ltk key; 355 }; 356 357 ///LMP_encryption_mode_req PDU structure 358 struct lmp_enc_mode_req 359 { 360 ///Opcode (including transaction ID) 361 uint8_t opcode; 362 ///Encryption Mode 363 uint8_t enc_mode; 364 }; 365 366 ///LMP_encryption_key_size_req PDU structure 367 struct lmp_enc_key_size_req 368 { 369 ///Opcode (including transaction ID) 370 uint8_t opcode; 371 ///Key Size 372 uint8_t key_size; 373 }; 374 375 ///LMP_start_encryption_req PDU structure 376 struct lmp_start_enc_req 377 { 378 ///Opcode (including transaction ID) 379 uint8_t opcode; 380 ///Random number 381 struct ltk random; 382 }; 383 384 ///LMP_stop_encryption_req PDU structure 385 struct lmp_stop_enc_req 386 { 387 ///Opcode (including transaction ID) 388 uint8_t opcode; 389 }; 390 391 ///LMP_switch_req PDU structure 392 struct lmp_switch_req 393 { 394 ///Opcode (including transaction ID) 395 uint8_t opcode; 396 ///Switch Instant 397 uint32_t switch_inst; 398 }; 399 400 ///LMP_sniff_req PDU structure 401 struct lmp_sniff_req 402 { 403 ///Opcode (including transaction ID) 404 uint8_t opcode; 405 ///Timing Control Flags 406 uint8_t flags; 407 ///Dsniff 408 uint16_t d_sniff; 409 ///Tsniff 410 uint16_t t_sniff; 411 ///Sniff attempt 412 uint16_t sniff_attempt; 413 ///Sniff Timeout 414 uint16_t sniff_to; 415 }; 416 417 ///LMP_unsniff_req PDU structure 418 struct lmp_unsniff_req 419 { 420 ///Opcode (including transaction ID) 421 uint8_t opcode; 422 }; 423 424 ///LMP_incr_power_req PDU structure 425 struct lmp_incr_pwr_req 426 { 427 ///Opcode (including transaction ID) 428 uint8_t opcode; 429 ///For future use 430 uint8_t reserved; 431 }; 432 433 ///LMP_decr_power_req PDU structure 434 struct lmp_decr_pwr_req 435 { 436 ///Opcode (including transaction ID) 437 uint8_t opcode; 438 ///For future use 439 uint8_t reserved; 440 }; 441 442 ///LMP_max_power PDU structure 443 struct lmp_max_pwr 444 { 445 ///Opcode (including transaction ID) 446 uint8_t opcode; 447 }; 448 449 ///LMP_min_power PDU structure 450 struct lmp_min_pwr 451 { 452 ///Opcode (including transaction ID) 453 uint8_t opcode; 454 }; 455 456 ///LMP_auto_rate PDU structure 457 struct lmp_auto_rate 458 { 459 ///Opcode (including transaction ID) 460 uint8_t opcode; 461 }; 462 463 ///LMP_preferred_rate PDU structure 464 struct lmp_pref_rate 465 { 466 ///Opcode (including transaction ID) 467 uint8_t opcode; 468 ///Data Rate 469 uint8_t rate; 470 }; 471 472 ///LMP_version_req PDU structure 473 struct lmp_ver_req 474 { 475 ///Opcode (including transaction ID) 476 uint8_t opcode; 477 ///Version number 478 uint8_t ver; 479 ///Company ID 480 uint16_t co_id; 481 ///Subversion number 482 uint16_t subver; 483 }; 484 485 ///LMP_version_res PDU structure 486 struct lmp_ver_res 487 { 488 ///Opcode (including transaction ID) 489 uint8_t opcode; 490 ///Version number 491 uint8_t ver; 492 ///Company ID 493 uint16_t co_id; 494 ///Subversion number 495 uint16_t subver; 496 }; 497 498 ///LMP_features_req PDU structure 499 struct lmp_feats_req 500 { 501 ///Opcode (including transaction ID) 502 uint8_t opcode; 503 ///Features 504 struct features feats; 505 }; 506 507 ///LMP_features_res PDU structure 508 struct lmp_feats_res 509 { 510 ///Opcode (including transaction ID) 511 uint8_t opcode; 512 ///Features 513 struct features feats; 514 }; 515 516 ///LMP_quality_of_service PDU structure 517 struct lmp_qos 518 { 519 ///Opcode (including transaction ID) 520 uint8_t opcode; 521 ///Poll interval 522 uint16_t poll_intv; 523 ///Nbc 524 uint8_t nbc; 525 }; 526 527 528 ///LMP_quality_of_service_req PDU structure 529 struct lmp_qos_req 530 { 531 ///Opcode (including transaction ID) 532 uint8_t opcode; 533 ///Poll interval 534 uint16_t poll_intv; 535 ///Nbc 536 uint8_t nbc; 537 }; 538 539 ///LMP_SCO_link_req PDU structure 540 struct lmp_sco_link_req 541 { 542 ///Opcode (including transaction ID) 543 uint8_t opcode; 544 ///SCO handle 545 uint8_t sco_hdl; 546 ///timing control flags 547 uint8_t flags; 548 ///Dsco 549 uint8_t d_sco; 550 ///Tsco 551 uint8_t t_sco; 552 ///SCO packet 553 uint8_t sco_pkt; 554 ///Air mode 555 uint8_t air_mode; 556 }; 557 558 ///LMP_remove_SCO_link_req PDU structure 559 struct lmp_rmv_sco_link_req 560 { 561 ///Opcode (including transaction ID) 562 uint8_t opcode; 563 ///SCO handle 564 uint8_t sco_hdl; 565 ///Reason for its removal(error code) 566 uint8_t reason; 567 }; 568 569 ///LMP_max_slot PDU structure 570 struct lmp_max_slot 571 { 572 ///Opcode (including transaction ID) 573 uint8_t opcode; 574 ///Max slots 575 uint8_t max_slots; 576 }; 577 578 579 ///LMP_max_slot_req PDU structure 580 struct lmp_max_slot_req 581 { 582 ///Opcode (including transaction ID) 583 uint8_t opcode; 584 ///Max slots 585 uint8_t max_slots; 586 }; 587 588 ///LMP_timing_accuracy_req PDU structure 589 struct lmp_timing_accu_req 590 { 591 ///Opcode (including transaction ID) 592 uint8_t opcode; 593 }; 594 595 ///LMP_timing_accuracy_res PDU structure 596 struct lmp_timing_accu_res 597 { 598 ///Opcode (including transaction ID) 599 uint8_t opcode; 600 ///Drift 601 uint8_t drift; 602 ///Jitter 603 uint8_t jitter; 604 }; 605 606 ///LMP_setup_complete PDU structure 607 struct lmp_setup_cmp 608 { 609 ///Opcode (including transaction ID) 610 uint8_t opcode; 611 }; 612 613 ///LMP_use_semi_permanent_key PDU structure 614 struct lmp_use_semi_perm_key 615 { 616 ///Opcode (including transaction ID) 617 uint8_t opcode; 618 }; 619 620 ///LMP_host_connection_req PDU structure 621 struct lmp_host_con_req 622 { 623 ///Opcode (including transaction ID) 624 uint8_t opcode; 625 }; 626 627 ///LMP_slot_offset PDU structure 628 struct lmp_slot_off 629 { 630 ///Opcode (including transaction ID) 631 uint8_t opcode; 632 ///Slot Offset 633 uint16_t slot_off; 634 ///BD Address 635 struct bd_addr addr; 636 }; 637 638 ///LMP_page_mode_req PDU structure 639 struct lmp_page_mode_req 640 { 641 ///Opcode (including transaction ID) 642 uint8_t opcode; 643 ///Paging scheme 644 uint8_t page_scheme; 645 ///Paging scheme settings 646 uint8_t page_stg; 647 }; 648 649 ///LMP_page_scan_mode_req PDU structure 650 struct lmp_page_scan_mode_req 651 { 652 ///Opcode (including transaction ID) 653 uint8_t opcode; 654 ///Paging scheme 655 uint8_t page_scheme; 656 ///Paging scheme settings 657 uint8_t page_stg; 658 }; 659 660 ///LMP_supervision_timeout PDU structure 661 struct lmp_supv_to 662 { 663 ///Opcode (including transaction ID) 664 uint8_t opcode; 665 ///Supervision Timeout 666 uint16_t supv_to; 667 }; 668 669 ///LMP_test_activate PDU structure 670 struct lmp_test_activate 671 { 672 ///Opcode (including transaction ID) 673 uint8_t opcode; 674 }; 675 676 ///LMP_test_control PDU structure 677 struct lmp_test_ctrl 678 { 679 ///Opcode (including transaction ID) 680 uint8_t opcode; 681 ///Test Scenario 682 uint8_t scenario; 683 ///Hopping Mode 684 uint8_t hop; 685 ///Tx frequency 686 uint8_t tx_freq; 687 ///Rx Frequency 688 uint8_t rx_freq; 689 ///Power Control Mode 690 uint8_t pwr_ctrl; 691 ///Poll period 692 uint8_t poll_period; 693 ///Packet type 694 uint8_t pkt_type; 695 ///length of test data 696 uint16_t data_len; 697 }; 698 699 ///LMP_encryption_key_size_mask_req PDU structure 700 struct lmp_enc_key_size_mask_req 701 { 702 ///Opcode (including transaction ID) 703 uint8_t opcode; 704 }; 705 706 ///LMP_encryption_key_size_mask_res PDU structure 707 struct lmp_enc_key_size_mask_res 708 { 709 ///Opcode (including transaction ID) 710 uint8_t opcode; 711 ///Encryption Key Size Mask 712 uint16_t mask; 713 }; 714 715 ///LMP_set_AFH PDU structure 716 struct lmp_set_afh 717 { 718 ///Opcode (including transaction ID) 719 uint8_t opcode; 720 ///AFH Instant 721 uint32_t instant; 722 ///AFH Mode 723 uint8_t mode; 724 ///AFH channel map 725 struct chnl_map map; 726 }; 727 728 ///LMP_encapsulated_header PDU structure 729 struct lmp_encaps_hdr 730 { 731 ///Opcode (including transaction ID) 732 uint8_t opcode; 733 ///Encapsulated major type 734 uint8_t maj_type; 735 ///Encapsulated minor type 736 uint8_t min_type; 737 ///Encapsulated Payload Length 738 uint8_t payl_len; 739 }; 740 741 ///LMP_encapsulated_payload PDU structure 742 struct lmp_encaps_payl 743 { 744 ///Opcode (including transaction ID) 745 uint8_t opcode; 746 ///Encapsulated data 747 struct byte16 data; 748 }; 749 750 ///LMP_Simple_Pairing_Confirm PDU structure 751 struct lmp_sp_cfm 752 { 753 ///Opcode (including transaction ID) 754 uint8_t opcode; 755 ///Commitment Value 756 struct byte16 commitment_val ; 757 }; 758 759 ///LMP_Simple_Pairing_Number PDU structure 760 struct lmp_sp_nb 761 { 762 ///Opcode (including transaction ID) 763 uint8_t opcode; 764 ///nonce Value 765 struct byte16 nonce; 766 }; 767 768 ///LMP_DHkey_check PDU structure 769 struct lmp_dhkey_chk 770 { 771 ///Opcode (including transaction ID) 772 uint8_t opcode; 773 ///Confirmation Value 774 struct ltk cfm_val; 775 }; 776 777 ///LMP_pause_encryption_aes_req PDU structure 778 struct lmp_pause_enc_aes_req 779 { 780 ///Opcode (including transaction ID) 781 uint8_t opcode; 782 /// Random Number 783 struct ltk rand; 784 }; 785 786 /* 787 * Extended PDUs parameter structures - Escape 4 788 ****************************************************************************************/ 789 790 ///LMP_accepted_ext PDU structure 791 struct lmp_accepted_ext 792 { 793 ///Opcode (including transaction ID) 794 uint8_t opcode; 795 ///Extended opcode 796 uint8_t ext_opcode; 797 ///Escape opcode of the original LMP 798 uint8_t orig_esc_opcode; 799 ///Extended opcode of the original LMP 800 uint8_t orig_ext_opcode; 801 }; 802 803 ///LMP_not_accepted_ext PDU structure 804 struct lmp_not_accepted_ext 805 { 806 ///Opcode (including transaction ID) 807 uint8_t opcode; 808 ///Extended opcode 809 uint8_t ext_opcode; 810 ///Escape opcode of the original LMP 811 uint8_t orig_esc_opcode; 812 ///Extended opcode of the original LMP 813 uint8_t orig_ext_opcode; 814 ///Reason 815 uint8_t reason; 816 }; 817 818 ///LMP_features_req_ext PDU structure 819 struct lmp_feats_req_ext 820 { 821 ///Opcode (including transaction ID) 822 uint8_t opcode; 823 ///Extended opcode 824 uint8_t ext_opcode; 825 ///Features page 826 uint8_t page; 827 ///Max supported page 828 uint8_t max_page; 829 ///Extended features 830 struct features ext_feats; 831 }; 832 833 ///LMP_features_res_ext PDU structure 834 struct lmp_feats_res_ext 835 { 836 ///Opcode (including transaction ID) 837 uint8_t opcode; 838 ///Extended opcode 839 uint8_t ext_opcode; 840 ///Features page 841 uint8_t page; 842 ///Max supported page 843 uint8_t max_page; 844 ///Extended features 845 struct features ext_feats; 846 }; 847 848 ///LMP_clk_adj PDU structure 849 struct lmp_clk_adj 850 { 851 ///Opcode (including transaction ID) 852 uint8_t opcode; 853 ///Extended opcode 854 uint8_t ext_opcode; 855 ///Coarse clock adjustment Event ID 856 uint8_t clk_adj_id; 857 ///Coarse clock adjustment instant 858 uint32_t clk_adj_instant; 859 ///Coarse clock adjustment intraslot alignment offset 860 int16_t clk_adj_us; 861 ///Coarse clock adjustment slot offset 862 uint8_t clk_adj_slots; 863 ///Coarse clock adjustment mode (before/after instant) 864 uint8_t clk_adj_mode; 865 ///Coarse clock adjustment PDU CLK instant 866 uint32_t clk_adj_clk; 867 }; 868 869 ///LMP_clk_adj_ack PDU structure 870 struct lmp_clk_adj_ack 871 { 872 ///Opcode (including transaction ID) 873 uint8_t opcode; 874 ///Extended opcode 875 uint8_t ext_opcode; 876 ///Coarse clock adjustment Event ID 877 uint8_t clk_adj_id; 878 }; 879 880 ///LMP_clk_adj_req PDU structure 881 struct lmp_clk_adj_req 882 { 883 ///Opcode (including transaction ID) 884 uint8_t opcode; 885 ///Extended opcode 886 uint8_t ext_opcode; 887 ///Coarse clock adjustment intraslot alignment offset 888 int16_t clk_adj_us; 889 ///Coarse clock adjustment slot offset 890 uint8_t clk_adj_slots; 891 ///Corase clock adjustment period 892 uint8_t clk_adj_period; 893 }; 894 895 ///LMP_packet_type_table_req PDU structure 896 struct lmp_pkt_type_tbl_req 897 { 898 ///Opcode (including transaction ID) 899 uint8_t opcode; 900 ///Extended opcode 901 uint8_t ext_opcode; 902 ///Packet Type table 903 uint8_t pkt_type_tbl; 904 }; 905 906 ///LMP_eSCO_link_req PDU structure 907 struct lmp_esco_link_req 908 { 909 ///Opcode (including transaction ID) 910 uint8_t opcode; 911 ///Extended opcode 912 uint8_t ext_opcode; 913 ///eSCO handle 914 uint8_t esco_hdl; 915 ///eSCo LT Address 916 uint8_t esco_lt_addr; 917 ///timing control flags 918 uint8_t flags; 919 ///Desco 920 uint8_t d_esco; 921 ///t_esco 922 uint8_t t_esco; 923 ///Wesco 924 uint8_t w_esco; 925 ///eSCO packet type M2S 926 uint8_t m2s_pkt_type; 927 ///eSCO packet type S2M 928 uint8_t s2m_pkt_type; 929 ///Packet Length M2S 930 uint16_t m2s_pkt_len; 931 ///Packet Length S2m 932 uint16_t s2m_pkt_len; 933 ///Air Mode 934 uint8_t air_mode; 935 ///Negotiation state 936 uint8_t negt_st; 937 }; 938 939 ///LMP_remove_eSCO_link_req PDU structure 940 struct lmp_rmv_esco_link_req 941 { 942 ///Opcode (including transaction ID) 943 uint8_t opcode; 944 ///Extended opcode 945 uint8_t ext_opcode; 946 ///eSCO handle 947 uint8_t esco_hdl; 948 ///Reason 949 uint8_t reason; 950 }; 951 952 ///LMP_channel_classification_req PDU structure 953 struct lmp_ch_class_req 954 { 955 ///Opcode (including transaction ID) 956 uint8_t opcode; 957 ///Extended opcode 958 uint8_t ext_opcode; 959 ///AFH reporting mode 960 uint8_t rep_mode; 961 ///AFH min interval 962 uint16_t min_intv; 963 ///AFH max interval 964 uint16_t max_intv; 965 }; 966 967 ///LMP_channel_classification PDU structure 968 struct lmp_ch_class 969 { 970 ///Opcode (including transaction ID) 971 uint8_t opcode; 972 ///Extended opcode 973 uint8_t ext_opcode; 974 ///AFh channel classification 975 struct chnl_map ch_class; 976 }; 977 978 ///LMP_sniff_subrating_req PDU structure 979 struct lmp_ssr_req 980 { 981 ///Opcode (including transaction ID) 982 uint8_t opcode; 983 ///Extended opcode 984 uint8_t ext_opcode; 985 ///Maximum sniff sub-rate 986 uint8_t max_subrate; 987 ///Minimum sniff mode timeout 988 uint16_t min_to; 989 ///Sniff sub-rating instant 990 uint32_t inst; 991 }; 992 993 ///LMP_sniff_subrating_res PDU structure 994 struct lmp_ssr_res 995 { 996 ///Opcode (including transaction ID) 997 uint8_t opcode; 998 ///Extended opcode 999 uint8_t ext_opcode; 1000 ///Maximum sniff sub-rate 1001 uint8_t max_subrate; 1002 ///Minimum sniff mode timeout 1003 uint16_t min_to; 1004 ///Sniff sub-rating instant 1005 uint32_t inst; 1006 }; 1007 1008 ///LMP_pause_encryption_req PDU structure 1009 struct lmp_pause_enc_req 1010 { 1011 ///Opcode (including transaction ID) 1012 uint8_t opcode; 1013 ///Extended opcode 1014 uint8_t ext_opcode; 1015 }; 1016 1017 ///LMP_resume_encryption_req PDU structure 1018 struct lmp_resume_enc_req 1019 { 1020 ///Opcode (including transaction ID) 1021 uint8_t opcode; 1022 ///Extended opcode 1023 uint8_t ext_opcode; 1024 }; 1025 1026 ///LMP_IO_capability_req PDU structure 1027 struct lmp_io_cap_req 1028 { 1029 ///Opcode (including transaction ID) 1030 uint8_t opcode; 1031 ///Extended opcode 1032 uint8_t ext_opcode; 1033 ///IO Capabilities 1034 uint8_t io_cap; 1035 /// OOB Authentication data 1036 uint8_t oob_auth_data; 1037 ///Authentication requirements 1038 uint8_t auth_req; 1039 }; 1040 1041 1042 ///LMP_IO_capability_res PDU structure 1043 struct lmp_io_cap_res 1044 { 1045 ///Opcode (including transaction ID) 1046 uint8_t opcode; 1047 ///Extended opcode 1048 uint8_t ext_opcode; 1049 ///IO Capabilities 1050 uint8_t io_cap; 1051 /// OOB Authentication data 1052 uint8_t oob_auth_data; 1053 ///Authentication requirements 1054 uint8_t auth_req; 1055 }; 1056 1057 ///LMP_numeric_comparison_failed PDU structure 1058 struct lmp_num_comparison_fail 1059 { 1060 ///Opcode (including transaction ID) 1061 uint8_t opcode; 1062 ///Extended opcode 1063 uint8_t ext_opcode; 1064 }; 1065 1066 ///LMP_passkey_failed PDU structure 1067 struct lmp_passkey_fail 1068 { 1069 ///Opcode (including transaction ID) 1070 uint8_t opcode; 1071 ///Extended opcode 1072 uint8_t ext_opcode; 1073 }; 1074 1075 ///LMP_oob_failed PDU structure 1076 struct lmp_oob_fail 1077 { 1078 ///Opcode (including transaction ID) 1079 uint8_t opcode; 1080 ///Extended opcode 1081 uint8_t ext_opcode; 1082 }; 1083 1084 ///LMP_keypress_notification PDU structure 1085 struct lmp_keypress_notif 1086 { 1087 ///Opcode (including transaction ID) 1088 uint8_t opcode; 1089 ///Extended opcode 1090 uint8_t ext_opcode; 1091 ///Notification Type 1092 uint8_t type; 1093 }; 1094 1095 ///LMP_power_control_req PDU structure 1096 struct lmp_pwr_ctrl_req 1097 { 1098 ///Opcode (including transaction ID) 1099 uint8_t opcode; 1100 ///Extended opcode 1101 uint8_t ext_opcode; 1102 ///Power adjustment request 1103 uint8_t pwr_adj; 1104 1105 }; 1106 1107 ///LMP_power_control_res PDU structure 1108 struct lmp_pwr_ctrl_res 1109 { 1110 ///Opcode (including transaction ID) 1111 uint8_t opcode; 1112 ///Extended opcode 1113 uint8_t ext_opcode; 1114 ///Power adjustment response 1115 uint8_t pwr_adj; 1116 }; 1117 1118 /// LMP_ping_req PDU structure 1119 struct lmp_ping_req 1120 { 1121 ///Opcode (including transaction ID) 1122 uint8_t opcode; 1123 ///Extended opcode 1124 uint8_t ext_opcode; 1125 }; 1126 1127 /// LMP_ping_res PDU structure 1128 struct lmp_ping_res 1129 { 1130 ///Opcode (including transaction ID) 1131 uint8_t opcode; 1132 ///Extended opcode 1133 uint8_t ext_opcode; 1134 }; 1135 1136 /// Union of all the LMP message structures 1137 union lmp_pdu_data 1138 { 1139 struct lmp_name_req name_req ; 1140 struct lmp_name_res name_res ; 1141 struct lmp_accepted accepted ; 1142 struct lmp_not_accepted not_accepted ; 1143 struct lmp_clk_off_req clk_off_req ; 1144 struct lmp_clk_off_res clk_off_res ; 1145 struct lmp_detach detach ; 1146 struct lmp_inrand inrand ; 1147 struct lmp_combkey combkey ; 1148 struct lmp_unitkey unitkey ; 1149 struct lmp_aurand aurand ; 1150 struct lmp_sres sres ; 1151 struct lmp_temprand temprand ; 1152 struct lmp_tempkey tempkey ; 1153 struct lmp_enc_mode_req enc_mode_req ; 1154 struct lmp_enc_key_size_req enc_key_size_req ; 1155 struct lmp_start_enc_req start_enc_req ; 1156 struct lmp_stop_enc_req stop_enc_req ; 1157 struct lmp_switch_req switch_req ; 1158 struct lmp_sniff_req sniff_req ; 1159 struct lmp_unsniff_req unsniff_req ; 1160 struct lmp_incr_pwr_req incr_pwr_req ; 1161 struct lmp_decr_pwr_req decr_pwr_req ; 1162 struct lmp_max_pwr max_pwr ; 1163 struct lmp_min_pwr min_pwr ; 1164 struct lmp_auto_rate auto_rate ; 1165 struct lmp_pref_rate pref_rate ; 1166 struct lmp_ver_req ver_req ; 1167 struct lmp_ver_res ver_res ; 1168 struct lmp_feats_req feats_req ; 1169 struct lmp_feats_res feats_res ; 1170 struct lmp_clk_adj clk_adj ; 1171 struct lmp_clk_adj_ack clk_adj_ack ; 1172 struct lmp_clk_adj_req clk_adj_req ; 1173 struct lmp_qos qos ; 1174 struct lmp_qos_req qos_req ; 1175 struct lmp_sco_link_req sco_link_req ; 1176 struct lmp_rmv_sco_link_req rmv_sco_link_req ; 1177 struct lmp_max_slot max_slot ; 1178 struct lmp_max_slot_req max_slot_req ; 1179 struct lmp_timing_accu_req timing_accu_req ; 1180 struct lmp_timing_accu_res timing_accu_res ; 1181 struct lmp_setup_cmp setup_cmp ; 1182 struct lmp_use_semi_perm_key use_semi_perm_key ; 1183 struct lmp_host_con_req host_con_req ; 1184 struct lmp_slot_off slot_off ; 1185 struct lmp_page_mode_req page_mode_req ; 1186 struct lmp_page_scan_mode_req page_scan_mode_req ; 1187 struct lmp_supv_to supv_to ; 1188 struct lmp_test_activate test_activate ; 1189 struct lmp_test_ctrl test_ctrl ; 1190 struct lmp_enc_key_size_mask_req enc_key_size_mask_req ; 1191 struct lmp_enc_key_size_mask_res enc_key_size_mask_res ; 1192 struct lmp_set_afh set_afh ; 1193 struct lmp_encaps_hdr encaps_hdr ; 1194 struct lmp_encaps_payl encaps_payl ; 1195 struct lmp_sp_cfm sp_cfm ; 1196 struct lmp_sp_nb sp_nb ; 1197 struct lmp_dhkey_chk dhkey_chk ; 1198 struct lmp_accepted_ext accepted_ext ; 1199 struct lmp_not_accepted_ext not_accepted_ext ; 1200 struct lmp_feats_req_ext feats_req_ext ; 1201 struct lmp_feats_res_ext feats_res_ext ; 1202 struct lmp_pkt_type_tbl_req pkt_type_tbl_req ; 1203 struct lmp_esco_link_req esco_link_req ; 1204 struct lmp_rmv_esco_link_req rmv_esco_link_req ; 1205 struct lmp_ch_class_req ch_class_req ; 1206 struct lmp_ch_class ch_class ; 1207 struct lmp_ssr_req ssr_req ; 1208 struct lmp_ssr_res ssr_res ; 1209 struct lmp_pause_enc_req pause_enc_req ; 1210 struct lmp_resume_enc_req resume_enc_req ; 1211 struct lmp_io_cap_req io_cap_req ; 1212 struct lmp_io_cap_res io_cap_res ; 1213 struct lmp_num_comparison_fail num_comparison_fail ; 1214 struct lmp_passkey_fail passkey_fail ; 1215 struct lmp_oob_fail oob_fail ; 1216 struct lmp_keypress_notif keypress_notif ; 1217 struct lmp_pwr_ctrl_req pwr_ctrl_req ; 1218 struct lmp_pwr_ctrl_res pwr_ctrl_res ; 1219 struct lmp_ping_req ping_req ; 1220 struct lmp_ping_res ping_res ; 1221 }; 1222 1223 1224 /// @} CO_BT 1225 #endif // CO_LMP_H_ 1226