1 /* mesh.h - Bluetooth tester headers */ 2 3 /* 4 * Copyright (c) 2015-2016 Intel Corporation 5 * Copyright (c) 2022 Codecoup 6 * 7 * SPDX-License-Identifier: Apache-2.0 8 */ 9 10 #include <zephyr/sys/util.h> 11 #include <zephyr/bluetooth/addr.h> 12 13 /* MESH Service */ 14 /* commands */ 15 #define BTP_MESH_READ_SUPPORTED_COMMANDS 0x01 16 struct btp_mesh_read_supported_commands_rp { 17 uint8_t data[0]; 18 } __packed; 19 20 #define BTP_MESH_OUT_BLINK BIT(0) 21 #define BTP_MESH_OUT_BEEP BIT(1) 22 #define BTP_MESH_OUT_VIBRATE BIT(2) 23 #define BTP_MESH_OUT_DISPLAY_NUMBER BIT(3) 24 #define BTP_MESH_OUT_DISPLAY_STRING BIT(4) 25 26 #define BTP_MESH_IN_PUSH BIT(0) 27 #define BTP_MESH_IN_TWIST BIT(1) 28 #define BTP_MESH_IN_ENTER_NUMBER BIT(2) 29 #define BTP_MESH_IN_ENTER_STRING BIT(3) 30 31 #define BTP_MESH_CONFIG_PROVISIONING 0x02 32 33 #define BTP_MESH_PROV_AUTH_MAX_LEN 32 34 35 struct btp_mesh_config_provisioning_cmd { 36 uint8_t uuid[16]; 37 uint8_t static_auth[BTP_MESH_PROV_AUTH_MAX_LEN]; 38 uint8_t static_auth_size; 39 uint8_t out_size; 40 uint16_t out_actions; 41 uint8_t in_size; 42 uint16_t in_actions; 43 uint8_t auth_method; 44 } __packed; 45 struct btp_mesh_config_provisioning_cmd_v2 { 46 uint8_t uuid[16]; 47 uint8_t static_auth[BTP_MESH_PROV_AUTH_MAX_LEN]; 48 uint8_t static_auth_size; 49 uint8_t out_size; 50 uint16_t out_actions; 51 uint8_t in_size; 52 uint16_t in_actions; 53 uint8_t auth_method; 54 uint8_t set_pub_key[64]; 55 uint8_t set_priv_key[32]; 56 } __packed; 57 58 #define BTP_MESH_PROVISION_NODE 0x03 59 struct btp_mesh_provision_node_cmd { 60 uint8_t net_key[16]; 61 uint16_t net_key_idx; 62 uint8_t flags; 63 uint32_t iv_index; 64 uint32_t seq_num; 65 uint16_t addr; 66 uint8_t dev_key[16]; 67 } __packed; 68 struct btp_mesh_provision_node_cmd_v2 { 69 uint8_t net_key[16]; 70 uint16_t net_key_idx; 71 uint8_t flags; 72 uint32_t iv_index; 73 uint32_t seq_num; 74 uint16_t addr; 75 uint8_t dev_key[16]; 76 uint8_t pub_key[64]; 77 } __packed; 78 79 #define BTP_MESH_INIT 0x04 80 struct btp_mesh_init_cmd { 81 uint8_t comp; 82 } __packed; 83 84 #define BTP_MESH_RESET 0x05 85 #define BTP_MESH_INPUT_NUMBER 0x06 86 struct btp_mesh_input_number_cmd { 87 uint32_t number; 88 } __packed; 89 90 #define BTP_MESH_INPUT_STRING 0x07 91 struct btp_mesh_input_string_cmd { 92 uint8_t string_len; 93 uint8_t string[]; 94 } __packed; 95 96 #define BTP_MESH_IVU_TEST_MODE 0x08 97 struct btp_mesh_ivu_test_mode_cmd { 98 uint8_t enable; 99 } __packed; 100 101 #define BTP_MESH_IVU_TOGGLE_STATE 0x09 102 103 #define BTP_MESH_NET_SEND 0x0a 104 struct btp_mesh_net_send_cmd { 105 uint8_t ttl; 106 uint16_t src; 107 uint16_t dst; 108 uint8_t payload_len; 109 uint8_t payload[]; 110 } __packed; 111 112 #define BTP_MESH_HEALTH_GENERATE_FAULTS 0x0b 113 struct btp_mesh_health_generate_faults_rp { 114 uint8_t test_id; 115 uint8_t cur_faults_count; 116 uint8_t reg_faults_count; 117 uint8_t faults[]; 118 } __packed; 119 120 #define BTP_MESH_HEALTH_CLEAR_FAULTS 0x0c 121 122 #define BTP_MESH_LPN 0x0d 123 struct btp_mesh_lpn_set_cmd { 124 uint8_t enable; 125 } __packed; 126 127 #define BTP_MESH_LPN_POLL 0x0e 128 129 #define BTP_MESH_MODEL_SEND 0x0f 130 struct btp_mesh_model_send_cmd { 131 uint8_t ttl; 132 uint16_t src; 133 uint16_t dst; 134 uint8_t payload_len; 135 uint8_t payload[]; 136 } __packed; 137 138 #define BTP_MESH_LPN_SUBSCRIBE 0x10 139 struct btp_mesh_lpn_subscribe_cmd { 140 uint16_t address; 141 } __packed; 142 143 #define BTP_MESH_LPN_UNSUBSCRIBE 0x11 144 struct btp_mesh_lpn_unsubscribe_cmd { 145 uint16_t address; 146 } __packed; 147 148 #define BTP_MESH_RPL_CLEAR 0x12 149 #define BTP_MESH_PROXY_IDENTITY 0x13 150 #define BTP_MESH_COMP_DATA_GET 0x14 151 struct btp_mesh_comp_data_get_cmd { 152 uint16_t net_idx; 153 uint16_t address; 154 uint8_t page; 155 } __packed; 156 struct btp_mesh_comp_data_get_rp { 157 uint8_t data[0]; 158 } __packed; 159 160 #define BTP_MESH_CFG_BEACON_GET 0x15 161 struct btp_mesh_cfg_beacon_get_cmd { 162 uint16_t net_idx; 163 uint16_t address; 164 } __packed; 165 struct btp_mesh_cfg_beacon_get_rp { 166 uint8_t status; 167 } __packed; 168 169 #define BTP_MESH_CFG_BEACON_SET 0x16 170 struct btp_mesh_cfg_beacon_set_cmd { 171 uint16_t net_idx; 172 uint16_t address; 173 uint8_t val; 174 } __packed; 175 struct btp_mesh_cfg_beacon_set_rp { 176 uint8_t status; 177 } __packed; 178 179 #define BTP_MESH_CFG_DEFAULT_TTL_GET 0x18 180 struct btp_mesh_cfg_default_ttl_get_cmd { 181 uint16_t net_idx; 182 uint16_t address; 183 } __packed; 184 struct btp_mesh_cfg_default_ttl_get_rp { 185 uint8_t status; 186 } __packed; 187 188 #define BTP_MESH_CFG_DEFAULT_TTL_SET 0x19 189 struct btp_mesh_cfg_default_ttl_set_cmd { 190 uint16_t net_idx; 191 uint16_t address; 192 uint8_t val; 193 } __packed; 194 struct btp_mesh_cfg_default_ttl_set_rp { 195 uint8_t status; 196 } __packed; 197 198 #define BTP_MESH_CFG_GATT_PROXY_GET 0x1a 199 struct btp_mesh_cfg_gatt_proxy_get_cmd { 200 uint16_t net_idx; 201 uint16_t address; 202 } __packed; 203 struct btp_mesh_cfg_gatt_proxy_get_rp { 204 uint8_t status; 205 } __packed; 206 207 #define BTP_MESH_CFG_GATT_PROXY_SET 0x1b 208 struct btp_mesh_cfg_gatt_proxy_set_cmd { 209 uint16_t net_idx; 210 uint16_t address; 211 uint8_t val; 212 } __packed; 213 struct btp_mesh_cfg_gatt_proxy_set_rp { 214 uint8_t status; 215 } __packed; 216 217 #define BTP_MESH_CFG_FRIEND_GET 0x1c 218 struct btp_mesh_cfg_friend_get_cmd { 219 uint16_t net_idx; 220 uint16_t address; 221 } __packed; 222 struct btp_mesh_cfg_friend_get_rp { 223 uint8_t status; 224 } __packed; 225 226 #define BTP_MESH_CFG_FRIEND_SET 0x1d 227 struct btp_mesh_cfg_friend_set_cmd { 228 uint16_t net_idx; 229 uint16_t address; 230 uint8_t val; 231 } __packed; 232 struct btp_mesh_cfg_friend_set_rp { 233 uint8_t status; 234 } __packed; 235 236 #define BTP_MESH_CFG_RELAY_GET 0x1e 237 struct btp_mesh_cfg_relay_get_cmd { 238 uint16_t net_idx; 239 uint16_t address; 240 } __packed; 241 struct btp_mesh_cfg_relay_get_rp { 242 uint8_t status; 243 } __packed; 244 245 #define BTP_MESH_CFG_RELAY_SET 0x1f 246 struct btp_mesh_cfg_relay_set_cmd { 247 uint16_t net_idx; 248 uint16_t address; 249 uint8_t new_relay; 250 uint8_t new_transmit; 251 } __packed; 252 struct btp_mesh_cfg_relay_set_rp { 253 uint8_t status; 254 } __packed; 255 256 #define BTP_MESH_CFG_MODEL_PUB_GET 0x20 257 struct btp_mesh_cfg_model_pub_get_cmd { 258 uint16_t net_idx; 259 uint16_t address; 260 uint16_t elem_address; 261 uint16_t model_id; 262 } __packed; 263 struct btp_mesh_cfg_model_pub_get_rp { 264 uint8_t status; 265 } __packed; 266 267 #define BTP_MESH_CFG_MODEL_PUB_SET 0x21 268 struct btp_mesh_cfg_model_pub_set_cmd { 269 uint16_t net_idx; 270 uint16_t address; 271 uint16_t elem_address; 272 uint16_t model_id; 273 uint16_t pub_addr; 274 uint16_t app_idx; 275 uint8_t cred_flag; 276 uint8_t ttl; 277 uint8_t period; 278 uint8_t transmit; 279 } __packed; 280 struct btp_mesh_cfg_model_pub_set_rp { 281 uint8_t status; 282 } __packed; 283 284 #define BTP_MESH_CFG_MODEL_SUB_ADD 0x22 285 struct btp_mesh_cfg_model_sub_add_cmd { 286 uint16_t net_idx; 287 uint16_t address; 288 uint16_t elem_address; 289 uint16_t sub_addr; 290 uint16_t model_id; 291 } __packed; 292 struct btp_mesh_cfg_model_sub_add_rp { 293 uint8_t status; 294 } __packed; 295 296 #define BTP_MESH_CFG_MODEL_SUB_DEL 0x23 297 struct btp_mesh_cfg_model_sub_del_cmd { 298 uint16_t net_idx; 299 uint16_t address; 300 uint16_t elem_address; 301 uint16_t sub_addr; 302 uint16_t model_id; 303 } __packed; 304 struct btp_mesh_cfg_model_sub_del_rp { 305 uint8_t status; 306 } __packed; 307 308 #define BTP_MESH_CFG_NETKEY_ADD 0x24 309 struct btp_mesh_cfg_netkey_add_cmd { 310 uint16_t net_idx; 311 uint16_t address; 312 uint8_t net_key[16]; 313 uint16_t net_key_idx; 314 } __packed; 315 struct btp_mesh_cfg_netkey_add_rp { 316 uint8_t status; 317 } __packed; 318 319 #define BTP_MESH_CFG_NETKEY_GET 0x25 320 struct btp_mesh_cfg_netkey_get_cmd { 321 uint16_t net_idx; 322 uint16_t address; 323 uint16_t net_key_idx; 324 } __packed; 325 struct btp_mesh_cfg_netkey_get_rp { 326 uint8_t status; 327 } __packed; 328 329 #define BTP_MESH_CFG_NETKEY_DEL 0x26 330 struct btp_mesh_cfg_netkey_del_cmd { 331 uint16_t net_idx; 332 uint16_t address; 333 uint16_t net_key_idx; 334 } __packed; 335 struct btp_mesh_cfg_netkey_del_rp { 336 uint8_t status; 337 } __packed; 338 339 #define BTP_MESH_CFG_APPKEY_ADD 0x27 340 struct btp_mesh_cfg_appkey_add_cmd { 341 uint16_t net_idx; 342 uint16_t address; 343 uint16_t net_key_idx; 344 uint8_t app_key[16]; 345 uint16_t app_key_idx; 346 } __packed; 347 struct btp_mesh_cfg_appkey_add_rp { 348 uint8_t status; 349 } __packed; 350 351 #define BTP_MESH_CFG_APPKEY_DEL 0x28 352 struct btp_mesh_cfg_appkey_del_cmd { 353 uint16_t net_idx; 354 uint16_t address; 355 uint16_t net_key_idx; 356 uint16_t app_key_idx; 357 } __packed; 358 struct btp_mesh_cfg_appkey_del_rp { 359 uint8_t status; 360 } __packed; 361 362 #define BTP_MESH_CFG_APPKEY_GET 0x29 363 struct btp_mesh_cfg_appkey_get_cmd { 364 uint16_t net_idx; 365 uint16_t address; 366 uint16_t net_key_idx; 367 } __packed; 368 struct btp_mesh_cfg_appkey_get_rp { 369 uint8_t status; 370 } __packed; 371 372 #define BTP_MESH_CFG_MODEL_APP_BIND 0x2A 373 struct btp_mesh_cfg_model_app_bind_cmd { 374 uint16_t net_idx; 375 uint16_t address; 376 uint16_t elem_address; 377 uint16_t app_key_idx; 378 uint16_t mod_id; 379 } __packed; 380 struct btp_mesh_cfg_model_app_bind_rp { 381 uint8_t status; 382 } __packed; 383 384 #define BTP_MESH_CFG_MODEL_APP_UNBIND 0x2B 385 struct btp_mesh_cfg_model_app_unbind_cmd { 386 uint16_t net_idx; 387 uint16_t address; 388 uint16_t elem_address; 389 uint16_t app_key_idx; 390 uint16_t mod_id; 391 } __packed; 392 struct btp_mesh_cfg_model_app_unbind_rp { 393 uint8_t status; 394 } __packed; 395 396 #define BTP_MESH_CFG_MODEL_APP_GET 0x2C 397 struct btp_mesh_cfg_model_app_get_cmd { 398 uint16_t net_idx; 399 uint16_t address; 400 uint16_t elem_address; 401 uint16_t mod_id; 402 } __packed; 403 struct btp_mesh_cfg_model_app_get_rp { 404 uint8_t status; 405 } __packed; 406 407 #define BTP_MESH_CFG_MODEL_APP_VND_GET 0x2D 408 struct btp_mesh_cfg_model_app_vnd_get_cmd { 409 uint16_t net_idx; 410 uint16_t address; 411 uint16_t elem_address; 412 uint16_t mod_id; 413 uint16_t cid; 414 } __packed; 415 struct btp_mesh_cfg_model_app_vnd_get_rp { 416 uint8_t status; 417 } __packed; 418 419 #define BTP_MESH_CFG_HEARTBEAT_PUB_SET 0x2E 420 struct btp_mesh_cfg_heartbeat_pub_set_cmd { 421 uint16_t net_idx; 422 uint16_t address; 423 uint16_t net_key_idx; 424 uint16_t destination; 425 uint8_t count_log; 426 uint8_t period_log; 427 uint8_t ttl; 428 uint16_t features; 429 } __packed; 430 struct btp_mesh_cfg_heartbeat_pub_set_rp { 431 uint8_t status; 432 } __packed; 433 434 #define BTP_MESH_CFG_HEARTBEAT_PUB_GET 0x2F 435 struct btp_mesh_cfg_heartbeat_pub_get_cmd { 436 uint16_t net_idx; 437 uint16_t address; 438 } __packed; 439 struct btp_mesh_cfg_heartbeat_pub_get_rp { 440 uint8_t status; 441 } __packed; 442 443 #define BTP_MESH_CFG_HEARTBEAT_SUB_SET 0x30 444 struct btp_mesh_cfg_heartbeat_sub_set_cmd { 445 uint16_t net_idx; 446 uint16_t address; 447 uint16_t source; 448 uint16_t destination; 449 uint8_t period_log; 450 } __packed; 451 struct btp_mesh_cfg_heartbeat_sub_set_rp { 452 uint8_t status; 453 } __packed; 454 455 #define BTP_MESH_CFG_HEARTBEAT_SUB_GET 0x31 456 struct btp_mesh_cfg_heartbeat_sub_get_cmd { 457 uint16_t net_idx; 458 uint16_t address; 459 } __packed; 460 struct btp_mesh_cfg_heartbeat_sub_get_rp { 461 uint8_t status; 462 } __packed; 463 464 #define BTP_MESH_CFG_NET_TRANS_GET 0x32 465 struct btp_mesh_cfg_net_trans_get_cmd { 466 uint16_t net_idx; 467 uint16_t address; 468 } __packed; 469 struct btp_mesh_cfg_net_trans_get_rp { 470 uint8_t transmit; 471 } __packed; 472 473 #define BTP_MESH_CFG_NET_TRANS_SET 0x33 474 struct btp_mesh_cfg_net_trans_set_cmd { 475 uint16_t net_idx; 476 uint16_t address; 477 uint8_t transmit; 478 } __packed; 479 struct btp_mesh_cfg_net_trans_set_rp { 480 uint8_t transmit; 481 } __packed; 482 483 #define BTP_MESH_CFG_MODEL_SUB_OVW 0x34 484 struct btp_mesh_cfg_model_sub_ovw_cmd { 485 uint16_t net_idx; 486 uint16_t address; 487 uint16_t elem_address; 488 uint16_t sub_addr; 489 uint16_t model_id; 490 } __packed; 491 struct btp_mesh_cfg_model_sub_ovw_rp { 492 uint8_t status; 493 } __packed; 494 495 #define BTP_MESH_CFG_MODEL_SUB_DEL_ALL 0x35 496 struct btp_mesh_cfg_model_sub_del_all_cmd { 497 uint16_t net_idx; 498 uint16_t address; 499 uint16_t elem_address; 500 uint16_t model_id; 501 } __packed; 502 struct btp_mesh_cfg_model_sub_del_all_rp { 503 uint8_t status; 504 } __packed; 505 506 #define BTP_MESH_CFG_MODEL_SUB_GET 0x36 507 struct btp_mesh_cfg_model_sub_get_cmd { 508 uint16_t net_idx; 509 uint16_t address; 510 uint16_t elem_address; 511 uint16_t model_id; 512 } __packed; 513 struct btp_mesh_cfg_model_sub_get_rp { 514 uint8_t status; 515 } __packed; 516 517 #define BTP_MESH_CFG_MODEL_SUB_GET_VND 0x37 518 struct btp_mesh_cfg_model_sub_get_vnd_cmd { 519 uint16_t net_idx; 520 uint16_t address; 521 uint16_t elem_address; 522 uint16_t model_id; 523 uint16_t cid; 524 } __packed; 525 struct btp_mesh_cfg_model_sub_get_vnd_rp { 526 uint8_t status; 527 } __packed; 528 529 #define BTP_MESH_CFG_MODEL_SUB_VA_ADD 0x38 530 struct btp_mesh_cfg_model_sub_va_add_cmd { 531 uint16_t net_idx; 532 uint16_t address; 533 uint16_t elem_address; 534 uint16_t model_id; 535 uint8_t uuid[16]; 536 } __packed; 537 struct btp_mesh_cfg_model_sub_va_add_rp { 538 uint8_t status; 539 } __packed; 540 541 #define BTP_MESH_CFG_MODEL_SUB_VA_DEL 0x39 542 struct btp_mesh_cfg_model_sub_va_del_cmd { 543 uint16_t net_idx; 544 uint16_t address; 545 uint16_t elem_address; 546 uint16_t model_id; 547 uint8_t uuid[16]; 548 } __packed; 549 struct btp_mesh_cfg_model_sub_va_del_rp { 550 uint8_t status; 551 } __packed; 552 553 #define BTP_MESH_CFG_MODEL_SUB_VA_OVW 0x3A 554 struct btp_mesh_cfg_model_sub_va_ovw_cmd { 555 uint16_t net_idx; 556 uint16_t address; 557 uint16_t elem_address; 558 uint16_t model_id; 559 uint8_t uuid[16]; 560 } __packed; 561 struct btp_mesh_cfg_model_sub_va_ovw_rp { 562 uint8_t status; 563 } __packed; 564 565 #define BTP_MESH_CFG_NETKEY_UPDATE 0x3B 566 struct btp_mesh_cfg_netkey_update_cmd { 567 uint16_t net_idx; 568 uint16_t address; 569 uint8_t net_key[16]; 570 uint16_t net_key_idx; 571 } __packed; 572 struct btp_mesh_cfg_netkey_update_rp { 573 uint8_t status; 574 } __packed; 575 576 #define BTP_MESH_CFG_APPKEY_UPDATE 0x3C 577 struct btp_mesh_cfg_appkey_update_cmd { 578 uint16_t net_idx; 579 uint16_t address; 580 uint16_t net_key_idx; 581 uint8_t app_key[16]; 582 uint16_t app_key_idx; 583 } __packed; 584 struct btp_mesh_cfg_appkey_update_rp { 585 uint8_t status; 586 } __packed; 587 588 #define BTP_MESH_CFG_NODE_IDT_SET 0x3D 589 struct btp_mesh_cfg_node_idt_set_cmd { 590 uint16_t net_idx; 591 uint16_t address; 592 uint16_t net_key_idx; 593 uint8_t new_identity; 594 } __packed; 595 struct btp_mesh_cfg_node_idt_set_rp { 596 uint8_t status; 597 uint8_t identity; 598 } __packed; 599 600 #define BTP_MESH_CFG_NODE_IDT_GET 0x3E 601 struct btp_mesh_cfg_node_idt_get_cmd { 602 uint16_t net_idx; 603 uint16_t address; 604 uint16_t net_key_idx; 605 } __packed; 606 struct btp_mesh_cfg_node_idt_get_rp { 607 uint8_t status; 608 uint8_t identity; 609 } __packed; 610 611 #define BTP_MESH_CFG_NODE_RESET 0x3F 612 struct btp_mesh_cfg_node_reset_cmd { 613 uint16_t net_idx; 614 uint16_t address; 615 } __packed; 616 struct btp_mesh_cfg_node_reset_rp { 617 uint8_t status; 618 } __packed; 619 620 #define BTP_MESH_CFG_LPN_TIMEOUT_GET 0x40 621 struct btp_mesh_cfg_lpn_timeout_cmd { 622 uint16_t net_idx; 623 uint16_t address; 624 uint16_t unicast_addr; 625 } __packed; 626 struct btp_mesh_cfg_lpn_timeout_rp { 627 int32_t timeout; 628 } __packed; 629 630 #define BTP_MESH_CFG_MODEL_PUB_VA_SET 0x41 631 struct btp_mesh_cfg_model_pub_va_set_cmd { 632 uint16_t net_idx; 633 uint16_t address; 634 uint16_t elem_address; 635 uint16_t model_id; 636 uint16_t app_idx; 637 uint8_t cred_flag; 638 uint8_t ttl; 639 uint8_t period; 640 uint8_t transmit; 641 uint8_t uuid[16]; 642 } __packed; 643 struct btp_mesh_cfg_model_pub_va_set_rp { 644 uint8_t status; 645 } __packed; 646 647 #define BTP_MESH_CFG_MODEL_APP_BIND_VND 0x42 648 struct btp_mesh_cfg_model_app_bind_vnd_cmd { 649 uint16_t net_idx; 650 uint16_t address; 651 uint16_t elem_address; 652 uint16_t app_key_idx; 653 uint16_t mod_id; 654 uint16_t cid; 655 } __packed; 656 struct btp_mesh_cfg_model_app_bind_vnd_rp { 657 uint8_t status; 658 } __packed; 659 660 #define BTP_MESH_HEALTH_FAULT_GET 0x43 661 struct btp_mesh_health_fault_get_cmd { 662 uint16_t address; 663 uint16_t app_idx; 664 uint16_t cid; 665 } __packed; 666 667 #define BTP_MESH_HEALTH_FAULT_CLEAR 0x44 668 struct btp_mesh_health_fault_clear_cmd { 669 uint16_t address; 670 uint16_t app_idx; 671 uint16_t cid; 672 uint8_t ack; 673 } __packed; 674 struct btp_mesh_health_fault_clear_rp { 675 uint8_t test_id; 676 } __packed; 677 678 #define BTP_MESH_HEALTH_FAULT_TEST 0x45 679 struct btp_mesh_health_fault_test_cmd { 680 uint16_t address; 681 uint16_t app_idx; 682 uint16_t cid; 683 uint8_t test_id; 684 uint8_t ack; 685 } __packed; 686 struct btp_mesh_health_fault_test_rp { 687 uint8_t test_id; 688 uint16_t cid; 689 uint8_t faults[]; 690 } __packed; 691 692 #define BTP_MESH_HEALTH_PERIOD_GET 0x46 693 struct btp_mesh_health_period_get_cmd { 694 uint16_t address; 695 uint16_t app_idx; 696 } __packed; 697 698 #define BTP_MESH_HEALTH_PERIOD_SET 0x47 699 struct btp_mesh_health_period_set_cmd { 700 uint16_t address; 701 uint16_t app_idx; 702 uint8_t divisor; 703 uint8_t ack; 704 } __packed; 705 struct btp_mesh_health_period_set_rp { 706 uint8_t divisor; 707 } __packed; 708 709 #define BTP_MESH_HEALTH_ATTENTION_GET 0x48 710 struct btp_mesh_health_attention_get_cmd { 711 uint16_t address; 712 uint16_t app_idx; 713 } __packed; 714 715 #define BTP_MESH_HEALTH_ATTENTION_SET 0x49 716 struct btp_mesh_health_attention_set_cmd { 717 uint16_t address; 718 uint16_t app_idx; 719 uint8_t attention; 720 uint8_t ack; 721 } __packed; 722 struct btp_mesh_health_attention_set_rp { 723 uint8_t attention; 724 } __packed; 725 726 #define BTP_MESH_PROVISION_ADV 0x4A 727 struct btp_mesh_provision_adv_cmd { 728 uint8_t uuid[16]; 729 uint16_t net_idx; 730 uint16_t address; 731 uint8_t attention_duration; 732 uint8_t net_key[16]; 733 } __packed; 734 735 #define BTP_MESH_CFG_KRP_GET 0x4B 736 struct btp_mesh_cfg_krp_get_cmd { 737 uint16_t net_idx; 738 uint16_t address; 739 uint16_t key_net_idx; 740 } __packed; 741 struct btp_mesh_cfg_krp_get_rp { 742 uint8_t status; 743 uint8_t phase; 744 } __packed; 745 746 #define BTP_MESH_CFG_KRP_SET 0x4C 747 struct btp_mesh_cfg_krp_set_cmd { 748 uint16_t net_idx; 749 uint16_t address; 750 uint16_t key_net_idx; 751 uint8_t transition; 752 } __packed; 753 struct btp_mesh_cfg_krp_set_rp { 754 uint8_t status; 755 uint8_t phase; 756 } __packed; 757 758 #define BTP_MESH_VA_ADD 0x4D 759 struct btp_mesh_va_add_cmd { 760 uint8_t label_uuid[16]; 761 } __packed; 762 struct btp_mesh_va_add_rp { 763 uint16_t addr; 764 } __packed; 765 766 #define BTP_MESH_VA_DEL 0x4E 767 struct btp_mesh_va_del_cmd { 768 uint8_t label_uuid[16]; 769 } __packed; 770 771 #define BTP_MESH_PROXY_CONNECT 0x77 772 773 struct btp_proxy_connect_cmd { 774 uint16_t net_idx; 775 } __packed; 776 777 struct sar_transmitter { 778 uint8_t seg_int_step; 779 uint8_t unicast_retrans_count; 780 uint8_t unicast_retrans_without_prog_count; 781 uint8_t unicast_retrans_int_step; 782 uint8_t unicast_retrans_int_inc; 783 uint8_t multicast_retrans_count; 784 uint8_t multicast_retrans_int; 785 } __packed; 786 787 struct sar_receiver { 788 uint8_t seg_thresh; 789 uint8_t ack_delay_inc; 790 uint8_t ack_retrans_count; 791 uint8_t discard_timeout; 792 uint8_t rx_seg_int_step; 793 } __packed; 794 795 #define BTP_MESH_SAR_TRANSMITTER_GET 0x4f 796 struct btp_mesh_sar_transmitter_get_cmd { 797 uint16_t dst; 798 } __packed; 799 800 #define BTP_MESH_SAR_TRANSMITTER_SET 0x50 801 struct btp_mesh_sar_transmitter_set_cmd { 802 uint16_t dst; 803 struct sar_transmitter tx; 804 } __packed; 805 806 #define BTP_MESH_SAR_RECEIVER_GET 0x51 807 struct btp_mesh_sar_receiver_get_cmd { 808 uint16_t dst; 809 } __packed; 810 811 #define BTP_MESH_SAR_RECEIVER_SET 0x52 812 struct btp_mesh_sar_receiver_set_cmd { 813 uint16_t dst; 814 struct sar_receiver rx; 815 } __packed; 816 817 #define BTP_MESH_LARGE_COMP_DATA_GET 0x53 818 struct btp_mesh_large_comp_data_get_cmd { 819 uint16_t net_idx; 820 uint16_t addr; 821 uint8_t page; 822 uint16_t offset; 823 } __packed; 824 struct btp_mesh_large_comp_data_get_rp { 825 uint8_t data[0]; 826 } __packed; 827 828 #define BTP_MESH_MODELS_METADATA_GET 0x54 829 struct btp_mesh_models_metadata_get_cmd { 830 uint16_t net_idx; 831 uint16_t addr; 832 uint8_t page; 833 uint16_t offset; 834 } __packed; 835 struct btp_mesh_models_metadata_get_rp { 836 uint8_t data[0]; 837 } __packed; 838 839 #define BTP_MESH_OPCODES_AGGREGATOR_INIT 0x55 840 struct btp_mesh_opcodes_aggregator_init_cmd { 841 uint16_t net_idx; 842 uint16_t app_idx; 843 uint16_t dst; 844 uint16_t elem_addr; 845 } __packed; 846 847 #define BTP_MESH_OPCODES_AGGREGATOR_SEND 0x56 848 849 #define BTP_MESH_COMP_CHANGE_PREPARE 0x57 850 851 #define BTP_MESH_RPR_SCAN_START 0x59 852 struct btp_rpr_scan_start_cmd { 853 uint16_t dst; 854 uint8_t timeout; 855 uint8_t uuid[16]; 856 } __packed; 857 858 #define BTP_MESH_RPR_EXT_SCAN_START 0x5a 859 struct btp_rpr_ext_scan_start_cmd { 860 uint16_t dst; 861 uint8_t timeout; 862 uint8_t uuid[16]; 863 uint8_t ad_count; 864 uint8_t ad_types[]; 865 } __packed; 866 867 #define BTP_MESH_RPR_SCAN_CAPS_GET 0x5b 868 struct btp_rpr_scan_caps_get_cmd { 869 uint16_t dst; 870 } __packed; 871 872 #define BTP_MESH_RPR_SCAN_GET 0x5c 873 struct btp_rpr_scan_get_cmd { 874 uint16_t dst; 875 } __packed; 876 877 #define BTP_MESH_RPR_SCAN_STOP 0x5d 878 struct btp_rpr_scan_stop_cmd { 879 uint16_t dst; 880 } __packed; 881 882 #define BTP_MESH_RPR_LINK_GET 0x5e 883 struct btp_rpr_link_get_cmd { 884 uint16_t dst; 885 } __packed; 886 887 #define BTP_MESH_RPR_LINK_CLOSE 0x5f 888 struct btp_rpr_link_close_cmd { 889 uint16_t dst; 890 } __packed; 891 892 #define BTP_MESH_RPR_PROV_REMOTE 0x60 893 struct btp_rpr_prov_remote_cmd { 894 uint16_t dst; 895 uint8_t uuid[16]; 896 uint16_t net_idx; 897 uint16_t addr; 898 } __packed; 899 900 #define BTP_MESH_RPR_REPROV_REMOTE 0x61 901 struct btp_rpr_reprov_remote_cmd { 902 uint16_t dst; 903 uint16_t addr; 904 bool comp_change; 905 } __packed; 906 907 #define BTP_MMDL_DFU_INFO_GET 0x5f 908 struct btp_mmdl_dfu_info_get_cmd { 909 uint8_t limit; 910 } __packed; 911 912 #define BTP_MMDL_BLOB_INFO_GET 0x60 913 struct btp_mmdl_blob_info_get_cmd { 914 uint8_t addr_cnt; 915 uint8_t addr[]; 916 } __packed; 917 918 #define BTP_MMDL_DFU_UPDATE_METADATA_CHECK 0x61 919 struct btp_mmdl_dfu_metadata_check_cmd { 920 uint8_t index; 921 uint8_t slot_idx; 922 uint8_t slot_size; 923 uint8_t fwid_len; 924 uint8_t metadata_len; 925 uint8_t data[]; 926 } __packed; 927 928 struct btp_mmdl_dfu_metadata_check_rp { 929 uint8_t idx; 930 uint8_t status; 931 uint8_t effect; 932 } __packed; 933 934 #define BTP_MMDL_DFU_FIRMWARE_UPDATE_GET 0x62 935 #define BTP_MMDL_DFU_FIRMWARE_UPDATE_CANCEL 0x63 936 #define BTP_MMDL_DFU_FIRMWARE_UPDATE_START 0x64 937 struct btp_mmdl_dfu_firmware_update_cmd { 938 uint8_t addr_cnt; 939 uint8_t slot_idx; 940 uint8_t slot_size; 941 uint8_t fwid_len; 942 uint8_t metadata_len; 943 uint8_t block_size; 944 uint16_t chunk_size; 945 uint8_t data[]; 946 } __packed; 947 948 struct btp_mmdl_dfu_firmware_update_rp { 949 uint8_t status; 950 } __packed; 951 952 #define BTP_MMDL_BLOB_SRV_RECV 0x65 953 struct btp_mmdl_blob_srv_recv_cmd { 954 uint64_t id; 955 uint16_t timeout; 956 uint8_t ttl; 957 } __packed; 958 959 #define BTP_MMDL_BLOB_TRANSFER_START 0x66 960 struct btp_mmdl_blob_transfer_start_cmd { 961 uint64_t id; 962 uint16_t size; 963 uint8_t block_size; 964 uint16_t chunk_size; 965 uint16_t timeout; 966 uint8_t ttl; 967 } __packed; 968 969 #define BTP_MMDL_BLOB_TRANSFER_CANCEL 0x67 970 #define BTP_MMDL_BLOB_TRANSFER_GET 0x68 971 #define BTP_MMDL_BLOB_SRV_CANCEL 0x69 972 #define BTP_MMDL_DFU_FIRMWARE_UPDATE_APPLY 0x6A 973 #define BTP_MMDL_DFU_SRV_APPLY 0x6B 974 975 #define BTP_MESH_PRIV_BEACON_GET 0x6c 976 struct btp_priv_beacon_get_cmd { 977 uint16_t dst; 978 } __packed; 979 980 #define BTP_MESH_PRIV_BEACON_SET 0x6d 981 struct btp_priv_beacon_set_cmd { 982 uint16_t dst; 983 uint8_t enabled; 984 uint8_t rand_interval; 985 } __packed; 986 987 #define BTP_MESH_PRIV_GATT_PROXY_GET 0x6e 988 struct btp_priv_gatt_proxy_get_cmd { 989 uint16_t dst; 990 } __packed; 991 992 #define BTP_MESH_PRIV_GATT_PROXY_SET 0x6f 993 struct btp_priv_gatt_proxy_set_cmd { 994 uint16_t dst; 995 uint8_t state; 996 } __packed; 997 998 #define BTP_MESH_PRIV_NODE_ID_GET 0x70 999 struct btp_priv_node_id_get_cmd { 1000 uint16_t dst; 1001 uint16_t key_net_idx; 1002 } __packed; 1003 1004 #define BTP_MESH_PRIV_NODE_ID_SET 0x71 1005 struct btp_priv_node_id_set_cmd { 1006 uint16_t dst; 1007 uint16_t net_idx; 1008 uint8_t state; 1009 } __packed; 1010 1011 #define BTP_MESH_PROXY_PRIVATE_IDENTITY 0x72 1012 1013 #define BTP_MESH_OD_PRIV_PROXY_GET 0x73 1014 struct btp_od_priv_proxy_get_cmd { 1015 uint16_t dst; 1016 } __packed; 1017 1018 #define BTP_MESH_OD_PRIV_PROXY_SET 0x74 1019 1020 struct btp_od_priv_proxy_set_cmd { 1021 uint16_t dst; 1022 uint8_t val; 1023 } __packed; 1024 1025 #define BTP_MESH_SRPL_CLEAR 0x75 1026 1027 struct btp_srpl_clear_cmd { 1028 uint16_t dst; 1029 uint16_t range_start; 1030 uint8_t range_len; 1031 uint8_t acked; 1032 } __packed; 1033 1034 #define BTP_MESH_PROXY_SOLICIT 0x76 1035 1036 struct btp_proxy_solicit_cmd { 1037 uint16_t net_idx; 1038 } __packed; 1039 1040 #define BTP_MESH_START 0x78 1041 1042 /* events */ 1043 #define BTP_MESH_EV_OUT_NUMBER_ACTION 0x80 1044 struct btp_mesh_out_number_action_ev { 1045 uint16_t action; 1046 uint32_t number; 1047 } __packed; 1048 1049 #define BTP_MESH_EV_OUT_STRING_ACTION 0x81 1050 struct btp_mesh_out_string_action_ev { 1051 uint8_t string_len; 1052 uint8_t string[]; 1053 } __packed; 1054 1055 #define BTP_MESH_EV_IN_ACTION 0x82 1056 struct btp_mesh_in_action_ev { 1057 uint16_t action; 1058 uint8_t size; 1059 } __packed; 1060 1061 #define BTP_MESH_EV_PROVISIONED 0x83 1062 1063 #define BTP_MESH_PROV_BEARER_PB_ADV 0x00 1064 #define BTP_MESH_PROV_BEARER_PB_GATT 0x01 1065 #define BTP_MESH_PROV_BEARER_REMOTE 0x04 1066 #define BTP_MESH_EV_PROV_LINK_OPEN 0x84 1067 struct btp_mesh_prov_link_open_ev { 1068 uint8_t bearer; 1069 } __packed; 1070 1071 #define BTP_MESH_EV_PROV_LINK_CLOSED 0x85 1072 struct btp_mesh_prov_link_closed_ev { 1073 uint8_t bearer; 1074 } __packed; 1075 1076 #define BTP_MESH_EV_NET_RECV 0x86 1077 struct btp_mesh_net_recv_ev { 1078 uint8_t ttl; 1079 uint8_t ctl; 1080 uint16_t src; 1081 uint16_t dst; 1082 uint8_t payload_len; 1083 uint8_t payload[]; 1084 } __packed; 1085 1086 #define BTP_MESH_EV_INVALID_BEARER 0x87 1087 struct btp_mesh_invalid_bearer_ev { 1088 uint8_t opcode; 1089 } __packed; 1090 1091 #define BTP_MESH_EV_INCOMP_TIMER_EXP 0x88 1092 1093 #define BTP_MESH_EV_FRND_ESTABLISHED 0x89 1094 struct btp_mesh_frnd_established_ev { 1095 uint16_t net_idx; 1096 uint16_t lpn_addr; 1097 uint8_t recv_delay; 1098 uint32_t polltimeout; 1099 } __packed; 1100 1101 #define BTP_MESH_EV_FRND_TERMINATED 0x8a 1102 struct btp_mesh_frnd_terminated_ev { 1103 uint16_t net_idx; 1104 uint16_t lpn_addr; 1105 } __packed; 1106 1107 #define BTP_MESH_EV_LPN_ESTABLISHED 0x8b 1108 struct btp_mesh_lpn_established_ev { 1109 uint16_t net_idx; 1110 uint16_t friend_addr; 1111 uint8_t queue_size; 1112 uint8_t recv_win; 1113 } __packed; 1114 1115 #define BTP_MESH_EV_LPN_TERMINATED 0x8c 1116 struct btp_mesh_lpn_terminated_ev { 1117 uint16_t net_idx; 1118 uint16_t friend_addr; 1119 } __packed; 1120 1121 #define BTP_MESH_EV_LPN_POLLED 0x8d 1122 struct btp_mesh_lpn_polled_ev { 1123 uint16_t net_idx; 1124 uint16_t friend_addr; 1125 uint8_t retry; 1126 } __packed; 1127 1128 #define BTP_MESH_EV_PROV_NODE_ADDED 0x8e 1129 struct btp_mesh_prov_node_added_ev { 1130 uint16_t net_idx; 1131 uint16_t addr; 1132 uint8_t uuid[16]; 1133 uint8_t num_elems; 1134 } __packed; 1135 1136 #define BTP_MESH_EV_MODEL_RECV 0x8f 1137 struct btp_mesh_model_recv_ev { 1138 uint16_t src; 1139 uint16_t dst; 1140 uint8_t payload_len; 1141 uint8_t payload[]; 1142 } __packed; 1143 1144 #define MESH_EV_BLOB_LOST_TARGET 0x90 1145