1 #/usr/bin/env python3.4 2 # 3 # Copyright (C) 2016 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 # use this file except in compliance with the License. You may obtain a copy of 7 # the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 # License for the specific language governing permissions and limitations under 15 # the License. 16 17 from acts.test_utils.bt.GattEnum import CharacteristicValueFormat 18 from acts.test_utils.bt.GattEnum import GattCharacteristic 19 from acts.test_utils.bt.GattEnum import GattDescriptor 20 from acts.test_utils.bt.GattEnum import GattService 21 from acts.test_utils.bt.GattEnum import GattCharTypes 22 from acts.test_utils.bt.GattEnum import GattCharDesc 23 24 STRING_512BYTES = ''' 25 11111222223333344444555556666677777888889999900000 26 11111222223333344444555556666677777888889999900000 27 11111222223333344444555556666677777888889999900000 28 11111222223333344444555556666677777888889999900000 29 11111222223333344444555556666677777888889999900000 30 11111222223333344444555556666677777888889999900000 31 11111222223333344444555556666677777888889999900000 32 11111222223333344444555556666677777888889999900000 33 11111222223333344444555556666677777888889999900000 34 11111222223333344444555556666677777888889999900000 35 111112222233 36 ''' 37 STRING_50BYTES = ''' 38 11111222223333344444555556666677777888889999900000 39 ''' 40 STRING_25BYTES = ''' 41 1111122222333334444455555 42 ''' 43 44 INVALID_SMALL_DATABASE = { 45 'services': [{ 46 'uuid': 47 '00001800-0000-1000-8000-00805f9b34fb', 48 'type': 49 GattService.SERVICE_TYPE_PRIMARY.value, 50 'characteristics': [{ 51 'uuid': 52 GattCharTypes.GATT_CHARAC_DEVICE_NAME.value, 53 'properties': 54 GattCharacteristic.PROPERTY_READ.value, 55 'permissions': 56 GattCharacteristic.PERMISSION_READ.value, 57 'instance_id': 58 0x0003, 59 'value_type': 60 CharacteristicValueFormat.STRING.value, 61 'value': 62 'Test Database' 63 }, { 64 'uuid': 65 GattCharTypes.GATT_CHARAC_APPEARANCE.value, 66 'properties': 67 GattCharacteristic.PROPERTY_READ.value, 68 'permissions': 69 GattCharacteristic.PERMISSION_READ.value, 70 'instance_id': 71 0x0005, 72 'value_type': 73 CharacteristicValueFormat.FORMAT_SINT32.value, 74 'offset': 75 0, 76 'value': 77 17 78 }, { 79 'uuid': 80 GattCharTypes.GATT_CHARAC_PERIPHERAL_PREF_CONN.value, 81 'properties': 82 GattCharacteristic.PROPERTY_READ.value, 83 'permissions': 84 GattCharacteristic.PERMISSION_READ.value, 85 'instance_id': 86 0x0007 87 }] 88 }, { 89 'uuid': 90 '00001801-0000-1000-8000-00805f9b34fb', 91 'type': 92 GattService.SERVICE_TYPE_PRIMARY.value, 93 'characteristics': [{ 94 'uuid': 95 GattCharTypes.GATT_CHARAC_SERVICE_CHANGED.value, 96 'properties': 97 GattCharacteristic.PROPERTY_INDICATE.value, 98 'permissions': 99 GattCharacteristic.PERMISSION_READ.value | 100 GattCharacteristic.PERMISSION_WRITE.value, 101 'instance_id': 102 0x0012, 103 'value_type': 104 CharacteristicValueFormat.BYTE.value, 105 'value': [0x0000], 106 'descriptors': [{ 107 'uuid': 108 GattCharDesc.GATT_CLIENT_CHARAC_CFG_UUID.value, 109 'permissions': 110 GattDescriptor.PERMISSION_READ.value | 111 GattDescriptor.PERMISSION_WRITE.value, 112 }] 113 }, { 114 'uuid': 115 '0000b004-0000-1000-8000-00805f9b34fb', 116 'properties': 117 GattCharacteristic.PROPERTY_READ.value, 118 'permissions': 119 GattCharacteristic.PERMISSION_READ.value, 120 'instance_id': 121 0x0015, 122 'value_type': 123 CharacteristicValueFormat.BYTE.value, 124 'value': [0x04] 125 }] 126 }] 127 } 128 129 # Corresponds to the PTS defined LARGE_DB_1 130 LARGE_DB_1 = { 131 'services': [ 132 { 133 'uuid': 134 '0000a00b-0000-1000-8000-00805f9b34fb', 135 'type': 136 GattService.SERVICE_TYPE_PRIMARY.value, 137 'handles': 138 7, 139 'characteristics': [{ 140 'uuid': 141 '0000b008-0000-1000-8000-00805f9b34fb', 142 'properties': 143 GattCharacteristic.PROPERTY_READ.value | 144 GattCharacteristic.PROPERTY_WRITE.value | 145 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value, 146 'permissions': 147 GattCharacteristic.PERMISSION_READ.value | 148 GattCharacteristic.PERMISSION_WRITE.value, 149 'value_type': 150 CharacteristicValueFormat.BYTE.value, 151 'value': [0x08], 152 'descriptors': [{ 153 'uuid': 154 '0000b015-0000-1000-8000-00805f9b34fb', 155 'permissions': 156 GattDescriptor.PERMISSION_READ.value | 157 GattDescriptor.PERMISSION_WRITE.value, 158 }, { 159 'uuid': 160 '0000b016-0000-1000-8000-00805f9b34fb', 161 'permissions': 162 GattDescriptor.PERMISSION_READ.value | 163 GattDescriptor.PERMISSION_WRITE.value, 164 }, { 165 'uuid': 166 '0000b017-0000-1000-8000-00805f9b34fb', 167 'permissions': 168 GattDescriptor.PERMISSION_READ.value | 169 GattDescriptor.PERMISSION_WRITE.value | 170 GattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM.value, 171 }] 172 }] 173 }, 174 { 175 'uuid': 176 '0000a00d-0000-1000-8000-00805f9b34fb', 177 'type': 178 GattService.SERVICE_TYPE_SECONDARY.value, 179 'handles': 180 6, 181 'characteristics': [{ 182 'uuid': 183 '0000b00c-0000-1000-8000-00805f9b34fb', 184 'properties': 185 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value, 186 'permissions': 187 GattCharacteristic.PERMISSION_READ.value, 188 'value_type': 189 CharacteristicValueFormat.BYTE.value, 190 'value': [0x0C], 191 }, { 192 'uuid': 193 '0000b00b-0000-0000-0123-456789abcdef', 194 'properties': 195 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value, 196 'permissions': 197 GattCharacteristic.PERMISSION_READ.value, 198 'value_type': 199 CharacteristicValueFormat.BYTE.value, 200 'value': [0x0B], 201 }] 202 }, 203 { 204 'uuid': 205 '0000a00a-0000-1000-8000-00805f9b34fb', 206 'type': 207 GattService.SERVICE_TYPE_PRIMARY.value, 208 'handles': 209 10, 210 'characteristics': [{ 211 'uuid': 212 '0000b001-0000-1000-8000-00805f9b34fb', 213 'properties': 214 GattCharacteristic.PROPERTY_READ.value | 215 GattCharacteristic.PROPERTY_WRITE.value, 216 'permissions': 217 GattCharacteristic.PERMISSION_READ.value | 218 GattCharacteristic.PERMISSION_WRITE.value, 219 'value_type': 220 CharacteristicValueFormat.BYTE.value, 221 'value': [0x01], 222 }, { 223 'uuid': 224 '0000b002-0000-0000-0123-456789abcdef', 225 'properties': 226 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value, 227 'permissions': 228 GattCharacteristic.PERMISSION_READ.value, 229 'value_type': 230 CharacteristicValueFormat.STRING.value, 231 'value': 232 STRING_512BYTES, 233 }, { 234 'uuid': 235 '0000b004-0000-0000-0123-456789abcdef', 236 'properties': 237 GattCharacteristic.PROPERTY_READ.value, 238 'permissions': 239 GattCharacteristic.PERMISSION_READ.value, 240 'value_type': 241 CharacteristicValueFormat.STRING.value, 242 'value': 243 STRING_512BYTES, 244 }, { 245 'uuid': 246 '0000b002-0000-0000-0123-456789abcdef', 247 'properties': 248 GattCharacteristic.PROPERTY_WRITE.value, 249 'permissions': 250 GattCharacteristic.PERMISSION_WRITE.value, 251 'value_type': 252 CharacteristicValueFormat.STRING.value, 253 'value': 254 '11111222223333344444555556666677777888889999900000', 255 }, { 256 'uuid': 257 '0000b003-0000-0000-0123-456789abcdef', 258 'properties': 259 GattCharacteristic.PROPERTY_WRITE.value, 260 'permissions': 261 GattCharacteristic.PERMISSION_WRITE.value, 262 'value_type': 263 CharacteristicValueFormat.BYTE.value, 264 'value': [0x03], 265 }] 266 }, 267 { 268 'uuid': 269 '0000a00b-0000-1000-8000-00805f9b34fb', 270 'type': 271 GattService.SERVICE_TYPE_PRIMARY.value, 272 'handles': 273 3, 274 'characteristics': [{ 275 'uuid': 276 '0000b007-0000-1000-8000-00805f9b34fb', 277 'properties': 278 GattCharacteristic.PROPERTY_WRITE.value, 279 'permissions': 280 GattCharacteristic.PERMISSION_WRITE.value, 281 'value_type': 282 CharacteristicValueFormat.BYTE.value, 283 'value': [0x07], 284 }] 285 }, 286 { 287 'uuid': 288 '0000a00b-0000-1000-8000-00805f9b34fb', 289 'type': 290 GattService.SERVICE_TYPE_PRIMARY.value, 291 'handles': 292 3, 293 'characteristics': [{ 294 'uuid': 295 '0000b006-0000-1000-8000-00805f9b34fb', 296 'properties': 297 GattCharacteristic.PROPERTY_READ.value | 298 GattCharacteristic.PROPERTY_WRITE.value | 299 GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE.value | 300 GattCharacteristic.PROPERTY_NOTIFY.value | 301 GattCharacteristic.PROPERTY_INDICATE.value, 302 'permissions': 303 GattCharacteristic.PERMISSION_WRITE.value | 304 GattCharacteristic.PERMISSION_READ.value, 305 'value_type': 306 CharacteristicValueFormat.BYTE.value, 307 'value': [0x06], 308 }] 309 }, 310 { 311 'uuid': 312 '0000a00b-0000-1000-8000-00805f9b34fb', 313 'type': 314 GattService.SERVICE_TYPE_PRIMARY.value, 315 'handles': 316 12, 317 'characteristics': [ 318 { 319 'uuid': 320 '0000b004-0000-1000-8000-00805f9b34fb', 321 'properties': 322 GattCharacteristic.PROPERTY_READ.value | 323 GattCharacteristic.PROPERTY_WRITE.value, 324 'permissions': 325 GattCharacteristic.PERMISSION_WRITE.value | 326 GattCharacteristic.PERMISSION_READ.value, 327 'value_type': 328 CharacteristicValueFormat.BYTE.value, 329 'value': [0x04], 330 }, 331 { 332 'uuid': 333 '0000b004-0000-1000-8000-00805f9b34fb', 334 'properties': 335 GattCharacteristic.PROPERTY_READ.value | 336 GattCharacteristic.PROPERTY_WRITE.value, 337 'permissions': 338 GattCharacteristic.PERMISSION_WRITE.value | 339 GattCharacteristic.PERMISSION_READ.value, 340 'value_type': 341 CharacteristicValueFormat.BYTE.value, 342 'value': [0x04], 343 'descriptors': [{ 344 'uuid': 345 GattCharDesc.GATT_SERVER_CHARAC_CFG_UUID.value, 346 'permissions': 347 GattDescriptor.PERMISSION_READ.value | 348 GattDescriptor.PERMISSION_WRITE.value, 349 'value': 350 GattDescriptor.DISABLE_NOTIFICATION_VALUE.value 351 }] 352 }, 353 { 354 'uuid': 355 '0000b004-0000-1000-8000-00805f9b34fb', 356 'properties': 357 0x0, 358 'permissions': 359 0x0, 360 'value_type': 361 CharacteristicValueFormat.BYTE.value, 362 'value': [0x04], 363 'descriptors': [{ 364 'uuid': 365 '0000b012-0000-1000-8000-00805f9b34fb', 366 'permissions': 367 GattDescriptor.PERMISSION_READ.value | 368 GattDescriptor.PERMISSION_WRITE.value, 369 'value': [ 370 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 371 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 372 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 373 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 374 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 375 0x11, 0x22, 0x33 376 ] 377 }] 378 }, 379 { 380 'uuid': 381 '0000b004-0000-1000-8000-00805f9b34fb', 382 'properties': 383 GattCharacteristic.PROPERTY_READ.value, 384 'permissions': 385 GattCharacteristic.PERMISSION_READ.value, 386 'value_type': 387 CharacteristicValueFormat.BYTE.value, 388 'value': [0x04], 389 'descriptors': [{ 390 'uuid': 391 '0000b012-0000-1000-8000-00805f9b34fb', 392 'permissions': 393 GattDescriptor.PERMISSION_READ.value, 394 'value': [ 395 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 396 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 397 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 398 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 399 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 400 0x11, 0x22, 0x33 401 ] 402 }] 403 }, 404 ] 405 }, 406 { 407 'uuid': 408 '0000a00b-0000-1000-8000-00805f9b34fb', 409 'type': 410 GattService.SERVICE_TYPE_PRIMARY.value, 411 'handles': 412 7, 413 'characteristics': [{ 414 'uuid': 415 '0000b005-0000-1000-8000-00805f9b34fb', 416 'properties': 417 GattCharacteristic.PROPERTY_WRITE.value | 418 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value, 419 'permissions': 420 GattCharacteristic.PERMISSION_WRITE.value | 421 GattCharacteristic.PERMISSION_READ.value, 422 'value_type': 423 CharacteristicValueFormat.BYTE.value, 424 'value': [0x05], 425 'descriptors': [{ 426 'uuid': 427 GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 428 'permissions': 429 GattDescriptor.PERMISSION_READ.value, 430 'value': [0x03, 0x00] 431 }, { 432 'uuid': 433 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 434 'permissions': 435 GattDescriptor.PERMISSION_READ.value | 436 GattDescriptor.PERMISSION_WRITE.value, 437 'value': [ 438 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 439 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x80, 0x81, 0x82, 440 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90 441 ] 442 }, { 443 'uuid': 444 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 445 'permissions': 446 GattDescriptor.PERMISSION_READ_ENCRYPTED_MITM.value, 447 'value': [0x00, 0x01, 0x30, 0x01, 0x11, 0x31] 448 }, { 449 'uuid': 450 '0000d5d4-0000-0000-0123-456789abcdef', 451 'permissions': 452 GattDescriptor.PERMISSION_READ.value, 453 'value': [0x44] 454 }] 455 }] 456 }, 457 { 458 'uuid': 459 '0000a00c-0000-0000-0123-456789abcdef', 460 'type': 461 GattService.SERVICE_TYPE_PRIMARY.value, 462 'handles': 463 7, 464 'characteristics': [{ 465 'uuid': 466 '0000b009-0000-0000-0123-456789abcdef', 467 'properties': 468 GattCharacteristic.PROPERTY_WRITE.value | 469 GattCharacteristic.PROPERTY_EXTENDED_PROPS.value | 470 GattCharacteristic.PROPERTY_READ.value, 471 'permissions': 472 GattCharacteristic.PERMISSION_WRITE.value | 473 GattCharacteristic.PERMISSION_READ.value, 474 'value_type': 475 CharacteristicValueFormat.BYTE.value, 476 'value': [0x09], 477 'descriptors': [{ 478 'uuid': 479 GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 480 'permissions': 481 GattDescriptor.PERMISSION_READ.value, 482 'value': 483 GattDescriptor.ENABLE_NOTIFICATION_VALUE.value 484 }, { 485 'uuid': 486 '0000d9d2-0000-0000-0123-456789abcdef', 487 'permissions': 488 GattDescriptor.PERMISSION_READ.value | 489 GattDescriptor.PERMISSION_WRITE.value, 490 'value': [0x22] 491 }, { 492 'uuid': 493 '0000d9d3-0000-0000-0123-456789abcdef', 494 'permissions': 495 GattDescriptor.PERMISSION_WRITE.value, 496 'value': [0x33] 497 }] 498 }] 499 }, 500 { 501 'uuid': 502 '0000a00f-0000-1000-8000-00805f9b34fb', 503 'type': 504 GattService.SERVICE_TYPE_PRIMARY.value, 505 'handles': 506 18, 507 'characteristics': [ 508 { 509 'uuid': 510 '0000b00e-0000-1000-8000-00805f9b34fb', 511 'properties': 512 GattCharacteristic.PROPERTY_READ.value, 513 'permissions': 514 GattCharacteristic.PERMISSION_READ.value, 515 'value_type': 516 CharacteristicValueFormat.STRING.value, 517 'value': 518 "Length is ", 519 'descriptors': [{ 520 'uuid': 521 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 522 'permissions': 523 GattDescriptor.PERMISSION_READ.value, 524 'value': [0x19, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00] 525 }] 526 }, 527 { 528 'uuid': 529 '0000b00f-0000-1000-8000-00805f9b34fb', 530 'properties': 531 GattCharacteristic.PROPERTY_READ.value | 532 GattCharacteristic.PROPERTY_WRITE.value, 533 'permissions': 534 GattCharacteristic.PERMISSION_READ.value | 535 GattCharacteristic.PERMISSION_WRITE.value, 536 'value_type': 537 CharacteristicValueFormat.BYTE.value, 538 'value': [0x65], 539 'descriptors': [{ 540 'uuid': 541 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 542 'permissions': 543 GattDescriptor.PERMISSION_READ.value, 544 'value': [0x04, 0x00, 0x01, 0x27, 0x01, 0x01, 0x00] 545 }] 546 }, 547 { 548 'uuid': 549 '0000b006-0000-1000-8000-00805f9b34fb', 550 'properties': 551 GattCharacteristic.PROPERTY_READ.value | 552 GattCharacteristic.PROPERTY_WRITE.value, 553 'permissions': 554 GattCharacteristic.PERMISSION_READ.value | 555 GattCharacteristic.PERMISSION_WRITE.value, 556 'value_type': 557 CharacteristicValueFormat.BYTE.value, 558 'value': [0x34, 0x12], 559 'descriptors': [{ 560 'uuid': 561 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 562 'permissions': 563 GattDescriptor.PERMISSION_READ.value, 564 'value': [0x06, 0x00, 0x10, 0x27, 0x01, 0x02, 0x00] 565 }] 566 }, 567 { 568 'uuid': 569 '0000b007-0000-1000-8000-00805f9b34fb', 570 'properties': 571 GattCharacteristic.PROPERTY_READ.value | 572 GattCharacteristic.PROPERTY_WRITE.value, 573 'permissions': 574 GattCharacteristic.PERMISSION_READ.value | 575 GattCharacteristic.PERMISSION_WRITE.value, 576 'value_type': 577 CharacteristicValueFormat.BYTE.value, 578 'value': [0x04, 0x03, 0x02, 0x01], 579 'descriptors': [{ 580 'uuid': 581 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 582 'permissions': 583 GattDescriptor.PERMISSION_READ.value, 584 'value': [0x08, 0x00, 0x17, 0x27, 0x01, 0x03, 0x00] 585 }] 586 }, 587 { 588 'uuid': 589 '0000b010-0000-1000-8000-00805f9b34fb', 590 'properties': 591 GattCharacteristic.PROPERTY_READ.value, 592 'permissions': 593 GattCharacteristic.PERMISSION_READ.value, 594 'value_type': 595 CharacteristicValueFormat.BYTE.value, 596 'value': [0x65, 0x34, 0x12, 0x04, 0x03, 0x02, 0x01], 597 'descriptors': [{ 598 'uuid': 599 GattCharDesc.GATT_CHARAC_AGREG_FMT_UUID.value, 600 'permissions': 601 GattDescriptor.PERMISSION_READ.value, 602 'value': [0xa6, 0x00, 0xa9, 0x00, 0xac, 0x00] 603 }] 604 }, 605 { 606 'uuid': 607 '0000b011-0000-1000-8000-00805f9b34fb', 608 'properties': 609 GattCharacteristic.WRITE_TYPE_SIGNED.value 610 | #for some reason 0x40 is not working... 611 GattCharacteristic.PROPERTY_READ.value, 612 'permissions': 613 GattCharacteristic.PERMISSION_READ.value | 614 GattCharacteristic.PERMISSION_WRITE.value, 615 'value_type': 616 CharacteristicValueFormat.BYTE.value, 617 'value': [0x12] 618 } 619 ] 620 }, 621 { 622 'uuid': 623 '0000a00c-0000-1000-8000-00805f9b34fb', 624 'type': 625 GattService.SERVICE_TYPE_PRIMARY.value, 626 'handles': 627 30, 628 'characteristics': [{ 629 'uuid': 630 '0000b00a-0000-1000-8000-00805f9b34fb', 631 'properties': 632 GattCharacteristic.PROPERTY_READ.value, 633 'permissions': 634 GattCharacteristic.PERMISSION_READ.value, 635 'value_type': 636 CharacteristicValueFormat.BYTE.value, 637 'value': [0x0a], 638 }, { 639 'uuid': 640 '0000b002-0000-1000-8000-00805f9b34fb', 641 'properties': 642 GattCharacteristic.PROPERTY_READ.value | 643 GattCharacteristic.PROPERTY_WRITE.value, 644 'permissions': 645 GattCharacteristic.PERMISSION_READ.value | 646 GattCharacteristic.PERMISSION_WRITE.value, 647 'value_type': 648 CharacteristicValueFormat.STRING.value, 649 'value': 650 "111112222233333444445", 651 'descriptors': [{ 652 'uuid': 653 '0000b012-0000-1000-8000-00805f9b34fb', 654 'permissions': 655 GattDescriptor.PERMISSION_READ.value | 656 GattDescriptor.PERMISSION_WRITE.value, 657 'value': [ 658 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 659 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11 660 ] 661 }] 662 }, { 663 'uuid': 664 '0000b002-0000-1000-8000-00805f9b34fb', 665 'properties': 666 GattCharacteristic.PROPERTY_READ.value | 667 GattCharacteristic.PROPERTY_WRITE.value, 668 'permissions': 669 GattCharacteristic.PERMISSION_READ.value | 670 GattCharacteristic.PERMISSION_WRITE.value, 671 'value_type': 672 CharacteristicValueFormat.STRING.value, 673 'value': 674 "2222233333444445555566", 675 'descriptors': [{ 676 'uuid': 677 '0000b013-0000-1000-8000-00805f9b34fb', 678 'permissions': 679 GattDescriptor.PERMISSION_READ.value | 680 GattDescriptor.PERMISSION_WRITE.value, 681 'value': [ 682 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 683 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22 684 ] 685 }] 686 }, { 687 'uuid': 688 '0000b002-0000-1000-8000-00805f9b34fb', 689 'properties': 690 GattCharacteristic.PROPERTY_READ.value | 691 GattCharacteristic.PROPERTY_WRITE.value, 692 'permissions': 693 GattCharacteristic.PERMISSION_READ.value | 694 GattCharacteristic.PERMISSION_WRITE.value, 695 'value_type': 696 CharacteristicValueFormat.STRING.value, 697 'value': 698 "33333444445555566666777", 699 'descriptors': [{ 700 'uuid': 701 '0000b014-0000-1000-8000-00805f9b34fb', 702 'permissions': 703 GattDescriptor.PERMISSION_READ.value | 704 GattDescriptor.PERMISSION_WRITE.value, 705 'value': [ 706 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 707 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22, 0x33 708 ] 709 }] 710 }, { 711 'uuid': 712 '0000b002-0000-1000-8000-00805f9b34fb', 713 'properties': 714 GattCharacteristic.PROPERTY_READ.value | 715 GattCharacteristic.PROPERTY_WRITE.value, 716 'permissions': 717 GattCharacteristic.PERMISSION_READ.value | 718 GattCharacteristic.PERMISSION_WRITE.value, 719 'value_type': 720 CharacteristicValueFormat.BYTE.value, 721 'value': [ 722 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 723 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 724 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 725 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 726 0x11, 0x22, 0x33 727 ], 728 'descriptors': [{ 729 'uuid': 730 '0000b012-0000-1000-8000-00805f9b34fb', 731 'permissions': 732 GattDescriptor.PERMISSION_READ.value | 733 GattDescriptor.PERMISSION_WRITE.value, 734 'value': [ 735 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 736 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 737 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 738 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 739 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33 740 ] 741 }] 742 }, { 743 'uuid': 744 '0000b002-0000-1000-8000-00805f9b34fb', 745 'properties': 746 GattCharacteristic.PROPERTY_READ.value | 747 GattCharacteristic.PROPERTY_WRITE.value, 748 'permissions': 749 GattCharacteristic.PERMISSION_READ.value | 750 GattCharacteristic.PERMISSION_WRITE.value, 751 'value_type': 752 CharacteristicValueFormat.BYTE.value, 753 'value': [ 754 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 755 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 756 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 757 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 758 0x11, 0x22, 0x33, 0x44 759 ], 760 'descriptors': [{ 761 'uuid': 762 '0000b013-0000-1000-8000-00805f9b34fb', 763 'permissions': 764 GattDescriptor.PERMISSION_READ.value | 765 GattDescriptor.PERMISSION_WRITE.value, 766 'value': [ 767 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 768 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 769 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 770 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 771 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44 772 ] 773 }] 774 }, { 775 'uuid': 776 '0000b002-0000-1000-8000-00805f9b34fb', 777 'properties': 778 GattCharacteristic.PROPERTY_READ.value | 779 GattCharacteristic.PROPERTY_WRITE.value, 780 'permissions': 781 GattCharacteristic.PERMISSION_READ.value | 782 GattCharacteristic.PERMISSION_WRITE.value, 783 'value_type': 784 CharacteristicValueFormat.BYTE.value, 785 'value': [ 786 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 787 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 788 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 789 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 790 0x11, 0x22, 0x33, 0x44, 0x55 791 ], 792 'descriptors': [{ 793 'uuid': 794 '0000b014-0000-1000-8000-00805f9b34fb', 795 'permissions': 796 GattDescriptor.PERMISSION_READ.value | 797 GattDescriptor.PERMISSION_WRITE.value, 798 'value': [ 799 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 800 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 801 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 802 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 803 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 804 ] 805 }] 806 }, { 807 'uuid': 808 '0000b002-0000-1000-8000-00805f9b34fb', 809 'properties': 810 GattCharacteristic.PROPERTY_READ.value | 811 GattCharacteristic.PROPERTY_WRITE.value, 812 'permissions': 813 GattCharacteristic.PERMISSION_READ.value | 814 GattCharacteristic.PERMISSION_WRITE.value, 815 'value_type': 816 CharacteristicValueFormat.STRING.value, 817 'value': 818 "1111122222333334444455555666667777788888999", 819 'descriptors': [{ 820 'uuid': 821 '0000b012-0000-1000-8000-00805f9b34fb', 822 'permissions': 823 GattDescriptor.PERMISSION_READ.value | 824 GattDescriptor.PERMISSION_WRITE.value, 825 'value': [ 826 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 827 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 828 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 829 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 830 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33 831 ] 832 }] 833 }, { 834 'uuid': 835 '0000b002-0000-1000-8000-00805f9b34fb', 836 'properties': 837 GattCharacteristic.PROPERTY_READ.value | 838 GattCharacteristic.PROPERTY_WRITE.value, 839 'permissions': 840 GattCharacteristic.PERMISSION_READ.value | 841 GattCharacteristic.PERMISSION_WRITE.value, 842 'value_type': 843 CharacteristicValueFormat.STRING.value, 844 'value': 845 "22222333334444455555666667777788888999990000", 846 'descriptors': [{ 847 'uuid': 848 '0000b013-0000-1000-8000-00805f9b34fb', 849 'permissions': 850 GattDescriptor.PERMISSION_READ.value | 851 GattDescriptor.PERMISSION_WRITE.value, 852 'value': [ 853 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 854 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 855 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 856 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 857 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44 858 ] 859 }] 860 }, { 861 'uuid': 862 '0000b002-0000-1000-8000-00805f9b34fb', 863 'properties': 864 GattCharacteristic.PROPERTY_READ.value | 865 GattCharacteristic.PROPERTY_WRITE.value, 866 'permissions': 867 GattCharacteristic.PERMISSION_READ.value | 868 GattCharacteristic.PERMISSION_WRITE.value, 869 'value_type': 870 CharacteristicValueFormat.STRING.value, 871 'value': 872 "333334444455555666667777788888999990000011111", 873 'descriptors': [{ 874 'uuid': 875 '0000b014-0000-1000-8000-00805f9b34fb', 876 'permissions': 877 GattDescriptor.PERMISSION_READ.value | 878 GattDescriptor.PERMISSION_WRITE.value, 879 'value': [ 880 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 881 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 882 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 883 0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 884 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 885 ] 886 }] 887 }] 888 }, 889 ] 890 } 891 892 # Corresponds to the PTS defined LARGE_DB_2 893 LARGE_DB_2 = { 894 'services': [ 895 { 896 'uuid': 897 '0000a00c-0000-0000-0123-456789abdcef', 898 'type': 899 GattService.SERVICE_TYPE_PRIMARY.value, 900 'characteristics': [{ 901 'uuid': 902 '0000b00a-0000-1000-8000-00805f9b34fb', 903 'instance_id': 904 0x0003, 905 'properties': 906 GattCharacteristic.PROPERTY_READ.value, 907 'permissions': 908 GattCharacteristic.PERMISSION_READ.value, 909 'value_type': 910 CharacteristicValueFormat.BYTE.value, 911 'value': [0x04], 912 }, { 913 'uuid': 914 '0000b0002-0000-1000-8000-00805f9b34fb', 915 'instance_id': 916 0x0005, 917 'properties': 918 0x0a, 919 'permissions': 920 GattCharacteristic.PERMISSION_READ.value | 921 GattCharacteristic.PERMISSION_WRITE.value, 922 'value_type': 923 CharacteristicValueFormat.STRING.value, 924 'value': 925 '111112222233333444445', 926 }, { 927 'uuid': 928 '0000b0002-0000-1000-8000-00805f9b34fb', 929 'instance_id': 930 0x0007, 931 'properties': 932 0x0a, 933 'permissions': 934 GattCharacteristic.PERMISSION_READ.value | 935 GattCharacteristic.PERMISSION_WRITE.value, 936 'value_type': 937 CharacteristicValueFormat.STRING.value, 938 'value': 939 '2222233333444445555566', 940 }, { 941 'uuid': 942 '0000b0002-0000-1000-8000-00805f9b34fb', 943 'instance_id': 944 0x0009, 945 'properties': 946 0x0a, 947 'permissions': 948 GattCharacteristic.PERMISSION_READ.value | 949 GattCharacteristic.PERMISSION_WRITE.value, 950 'value_type': 951 CharacteristicValueFormat.STRING.value, 952 'value': 953 '33333444445555566666777', 954 }, { 955 'uuid': 956 '0000b0002-0000-1000-8000-00805f9b34fb', 957 'instance_id': 958 0x000b, 959 'properties': 960 0x0a0, 961 'permissions': 962 GattCharacteristic.PERMISSION_READ.value | 963 GattCharacteristic.PERMISSION_WRITE.value, 964 'value_type': 965 CharacteristicValueFormat.STRING.value, 966 'value': 967 '1111122222333334444455555666667777788888999', 968 }, { 969 'uuid': 970 '0000b0002-0000-1000-8000-00805f9b34fb', 971 'instance_id': 972 0x000d, 973 'properties': 974 0x0a, 975 'permissions': 976 GattCharacteristic.PERMISSION_READ.value | 977 GattCharacteristic.PERMISSION_WRITE.value, 978 'value_type': 979 CharacteristicValueFormat.STRING.value, 980 'value': 981 '22222333334444455555666667777788888999990000', 982 }, { 983 'uuid': 984 '0000b0002-0000-1000-8000-00805f9b34fb', 985 'instance_id': 986 0x000f, 987 'properties': 988 0x0a, 989 'permissions': 990 GattCharacteristic.PERMISSION_READ.value | 991 GattCharacteristic.PERMISSION_WRITE.value, 992 'value_type': 993 CharacteristicValueFormat.STRING.value, 994 'value': 995 '333334444455555666667777788888999990000011111', 996 }] 997 }, 998 { 999 'uuid': 1000 '0000a00c-0000-0000-0123-456789abcdef', 1001 'handles': 1002 5, 1003 'type': 1004 GattService.SERVICE_TYPE_PRIMARY.value, 1005 'characteristics': [{ 1006 'uuid': 1007 '0000b009-0000-0000-0123-456789abcdef', 1008 'instance_id': 1009 0x0023, 1010 'properties': 1011 0x8a, 1012 'permissions': 1013 GattCharacteristic.PERMISSION_READ.value | 1014 GattCharacteristic.PERMISSION_WRITE.value, 1015 'value_type': 1016 CharacteristicValueFormat.BYTE.value, 1017 'value': [0x09], 1018 'descriptors': [{ 1019 'uuid': 1020 '0000d9d2-0000-0000-0123-456789abcdef', 1021 'permissions': 1022 GattDescriptor.PERMISSION_READ.value | 1023 GattDescriptor.PERMISSION_WRITE.value, 1024 'value': [0x22] 1025 }, { 1026 'uuid': 1027 '0000d9d3-0000-0000-0123-456789abcdef', 1028 'permissions': 1029 GattDescriptor.PERMISSION_WRITE.value, 1030 'value': [0x33] 1031 }, { 1032 'uuid': 1033 GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 1034 'permissions': 1035 GattDescriptor.PERMISSION_WRITE.value, 1036 'value': 1037 GattDescriptor.ENABLE_NOTIFICATION_VALUE.value 1038 }] 1039 }] 1040 }, 1041 { 1042 'uuid': 1043 '0000a00b-0000-1000-8000-00805f9b34fb', 1044 'type': 1045 GattService.SERVICE_TYPE_PRIMARY.value, 1046 'characteristics': [{ 1047 'uuid': 1048 '0000b007-0000-1000-8000-00805f9b34fb', 1049 'instance_id': 1050 0x0012, 1051 'properties': 1052 0x0a, 1053 'permissions': 1054 GattCharacteristic.PERMISSION_READ.value | 1055 GattCharacteristic.PERMISSION_WRITE.value, 1056 'value_type': 1057 CharacteristicValueFormat.BYTE.value, 1058 'value': [0x04], 1059 }] 1060 }, 1061 ] 1062 } 1063 1064 DB_TEST = { 1065 'services': [{ 1066 'uuid': 1067 '0000a00b-0000-1000-8000-00805f9b34fb', 1068 'type': 1069 GattService.SERVICE_TYPE_PRIMARY.value, 1070 'characteristics': [ 1071 { 1072 'uuid': 1073 '0000b004-0000-1000-8000-00805f9b34fb', 1074 'properties': 1075 0x02 | 0x08, 1076 'permissions': 1077 0x10 | 0x01, 1078 'value_type': 1079 CharacteristicValueFormat.BYTE.value, 1080 'value': [0x01], 1081 'descriptors': [{ 1082 'uuid': 1083 '0000b004-0000-1000-8000-00805f9b34fb', 1084 'permissions': 1085 GattDescriptor.PERMISSION_READ.value | 1086 GattDescriptor.PERMISSION_WRITE.value, 1087 'value': [0x01] * 30 1088 }] 1089 }, 1090 ] 1091 }] 1092 } 1093 1094 PTS_TEST2 = { 1095 'services': [{ 1096 'uuid': 1097 '0000a00b-0000-1000-8000-00805f9b34fb', 1098 'type': 1099 GattService.SERVICE_TYPE_PRIMARY.value, 1100 'characteristics': [ 1101 { 1102 'uuid': '000018ba-0000-1000-8000-00805f9b34fb', 1103 'properties': 0x02, 1104 'permissions': 0x10 | 0x01, 1105 'value_type': CharacteristicValueFormat.STRING.value, 1106 'value': STRING_512BYTES, 1107 }, 1108 { 1109 'uuid': '000060aa-0000-0000-0123-456789abcdef', 1110 'properties': 0x02, 1111 'permissions': 0x10 | 0x01, 1112 'value_type': CharacteristicValueFormat.STRING.value, 1113 'value': STRING_512BYTES, 1114 }, 1115 { 1116 'uuid': '00000af2-0000-1000-8000-00805f9b34fb', 1117 'properties': 0x20, 1118 'permissions': 0x10 | 0x01, 1119 'value_type': CharacteristicValueFormat.STRING.value, 1120 'value': STRING_512BYTES, 1121 }, 1122 { 1123 'uuid': '000000af2-0000-1000-8000-00805f9b34fb', 1124 'properties': 0x08, 1125 'permissions': 0x10 | 0x01, 1126 'value_type': CharacteristicValueFormat.STRING.value, 1127 'value': STRING_512BYTES, 1128 }, 1129 { 1130 'uuid': '000004d5e-0000-1000-8000-00805f9b34fb', 1131 'properties': 0x08, 1132 'permissions': 0x10 | 0x01, 1133 'value_type': CharacteristicValueFormat.STRING.value, 1134 'value': STRING_512BYTES, 1135 }, 1136 { 1137 'uuid': '000001b44-0000-1000-8000-00805f9b34fb', 1138 'properties': 0x08, 1139 'permissions': 0x10 | 0x01, 1140 'value_type': CharacteristicValueFormat.STRING.value, 1141 'value': STRING_512BYTES, 1142 }, 1143 { 1144 'uuid': '000006b98-0000-1000-8000-00805f9b34fb', 1145 'properties': 0x02 | 0x08 | 0x10 | 0x04, 1146 'permissions': 0x10 | 0x01, 1147 'value_type': CharacteristicValueFormat.STRING.value, 1148 'value': STRING_512BYTES, 1149 }, 1150 { 1151 'uuid': '00000247f-0000-1000-8000-00805f9b34fb', 1152 'properties': 0x02 | 0x08, 1153 'permissions': 0x10 | 0x01, 1154 'value_type': CharacteristicValueFormat.STRING.value, 1155 'value': STRING_512BYTES, 1156 }, 1157 { 1158 'uuid': '00000247f-0000-1000-8000-00805f9b34fb', 1159 'properties': 0x02 | 0x08, 1160 'permissions': 0x10 | 0x01, 1161 'value_type': CharacteristicValueFormat.STRING.value, 1162 'value': STRING_512BYTES, 1163 }, 1164 { 1165 'uuid': '00000247f-0000-1000-8000-00805f9b34fb', 1166 'properties': 0x00, 1167 'permissions': 0x00, 1168 'value_type': CharacteristicValueFormat.STRING.value, 1169 'value': STRING_512BYTES, 1170 }, 1171 { 1172 'uuid': '00000247f-0000-1000-8000-00805f9b34fb', 1173 'properties': 0x02, 1174 'permissions': 0x10, 1175 'value_type': CharacteristicValueFormat.STRING.value, 1176 'value': STRING_512BYTES, 1177 }, 1178 { 1179 'uuid': '000000d62-0000-1000-8000-00805f9b34fb', 1180 'properties': 0x02 | 0x08 | 0x80, 1181 'permissions': 0x10 | 0x01, 1182 'value_type': CharacteristicValueFormat.STRING.value, 1183 'value': STRING_512BYTES, 1184 }, 1185 { 1186 'uuid': '000002e85-0000-1000-8000-00805f9b34fb', 1187 'properties': 0x02 | 0x08, 1188 'permissions': 0x10 | 0x01, 1189 'value_type': CharacteristicValueFormat.STRING.value, 1190 'value': STRING_512BYTES, 1191 }, 1192 { 1193 'uuid': '000004a64-0000-0000-0123-456789abcdef', 1194 'properties': 0x02 | 0x08 | 0x80, 1195 'permissions': 0x10 | 0x01, 1196 'value_type': CharacteristicValueFormat.STRING.value, 1197 'value': STRING_512BYTES, 1198 }, 1199 { 1200 'uuid': '000005b4a-0000-1000-8000-00805f9b34fb', 1201 'properties': 0x02, 1202 'permissions': 0x10, 1203 'value_type': CharacteristicValueFormat.STRING.value, 1204 'value': STRING_512BYTES, 1205 }, 1206 { 1207 'uuid': '000001c81-0000-1000-8000-00805f9b34fb', 1208 'properties': 0x02, 1209 'permissions': 0x10, 1210 'value_type': CharacteristicValueFormat.STRING.value, 1211 'value': STRING_512BYTES, 1212 }, 1213 { 1214 'uuid': '000006b98-0000-1000-8000-00805f9b34fb', 1215 'properties': 0x02 | 0x08, 1216 'permissions': 0x10 | 0x01, 1217 'value_type': CharacteristicValueFormat.STRING.value, 1218 'value': STRING_512BYTES, 1219 }, 1220 { 1221 'uuid': '000001b44-0000-1000-8000-00805f9b34fb', 1222 'properties': 0x02 | 0x08, 1223 'permissions': 0x10 | 0x01, 1224 'value_type': CharacteristicValueFormat.STRING.value, 1225 'value': STRING_512BYTES, 1226 }, 1227 { 1228 'uuid': '000000c55-0000-1000-8000-00805f9b34fb', 1229 'properties': 0x02, 1230 'permissions': 0x10, 1231 'value_type': CharacteristicValueFormat.STRING.value, 1232 'value': STRING_512BYTES, 1233 }, 1234 { 1235 'uuid': '0000014dd-0000-1000-8000-00805f9b34fb', 1236 'properties': 0x02, 1237 'permissions': 0x10, 1238 'value_type': CharacteristicValueFormat.STRING.value, 1239 'value': STRING_512BYTES, 1240 }, 1241 { 1242 'uuid': '000000c55-0000-1000-8000-00805f9b34fb', 1243 'properties': 0x02, 1244 'permissions': 0x10, 1245 'value_type': CharacteristicValueFormat.STRING.value, 1246 'value': STRING_512BYTES, 1247 }, 1248 { 1249 'uuid': '000000c55-0000-1000-8000-00805f9b34fb', 1250 'properties': 0x02, 1251 'permissions': 0x10, 1252 'value_type': CharacteristicValueFormat.STRING.value, 1253 'value': STRING_512BYTES, 1254 }, 1255 { 1256 'uuid': '000000c55-0000-1000-8000-00805f9b34fb', 1257 'properties': 0x02, 1258 'permissions': 0x10, 1259 'value_type': CharacteristicValueFormat.STRING.value, 1260 'value': STRING_512BYTES, 1261 }, 1262 { 1263 'uuid': '000000c55-0000-1000-8000-00805f9b34fb', 1264 'properties': 0x02, 1265 'permissions': 0x10, 1266 'value_type': CharacteristicValueFormat.STRING.value, 1267 'value': STRING_512BYTES, 1268 }, 1269 { 1270 'uuid': '00000008f-0000-1000-8000-00805f9b34fb', 1271 'properties': 0x02, 1272 'permissions': 0x10, 1273 'value_type': CharacteristicValueFormat.STRING.value, 1274 'value': STRING_512BYTES, 1275 }, 1276 { 1277 'uuid': 1278 '000000af2-0000-1000-8000-00805f9b34fb', 1279 'properties': 1280 0x02 | 0x08, 1281 'permissions': 1282 0x10 | 0x01, 1283 'value_type': 1284 CharacteristicValueFormat.BYTE.value, 1285 'value': [ 1286 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1287 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1288 ], 1289 }, 1290 { 1291 'uuid': 1292 '000000af2-0000-1000-8000-00805f9b34fb', 1293 'properties': 1294 0x02 | 0x08, 1295 'permissions': 1296 0x10 | 0x01, 1297 'value_type': 1298 CharacteristicValueFormat.BYTE.value, 1299 'value': [ 1300 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1301 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1302 ], 1303 }, 1304 { 1305 'uuid': 1306 '000000af2-0000-1000-8000-00805f9b34fb', 1307 'properties': 1308 0x02 | 0x08, 1309 'permissions': 1310 0x10 | 0x01, 1311 'value_type': 1312 CharacteristicValueFormat.BYTE.value, 1313 'value': [ 1314 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1315 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1316 ], 1317 }, 1318 { 1319 'uuid': 1320 '000000af2-0000-1000-8000-00805f9b34fb', 1321 'properties': 1322 0x02 | 0x08, 1323 'permissions': 1324 0x10 | 0x01, 1325 'value_type': 1326 CharacteristicValueFormat.BYTE.value, 1327 'value': [ 1328 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1329 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1330 ], 1331 }, 1332 { 1333 'uuid': 1334 '000000af2-0000-1000-8000-00805f9b34fb', 1335 'properties': 1336 0x02 | 0x08, 1337 'permissions': 1338 0x10 | 0x01, 1339 'value_type': 1340 CharacteristicValueFormat.BYTE.value, 1341 'value': [ 1342 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1343 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1344 ], 1345 }, 1346 { 1347 'uuid': 1348 '000000af2-0000-1000-8000-00805f9b34fb', 1349 'properties': 1350 0x02 | 0x08, 1351 'permissions': 1352 0x10 | 0x01, 1353 'value_type': 1354 CharacteristicValueFormat.BYTE.value, 1355 'value': [ 1356 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1357 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1358 ], 1359 }, 1360 { 1361 'uuid': 1362 '000000af2-0000-1000-8000-00805f9b34fb', 1363 'properties': 1364 0x02 | 0x08, 1365 'permissions': 1366 0x10 | 0x01, 1367 'value_type': 1368 CharacteristicValueFormat.BYTE.value, 1369 'value': [ 1370 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 1371 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32 1372 ], 1373 }, 1374 { 1375 'uuid': '000002aad-0000-1000-8000-00805f9b34fb', 1376 'properties': 0x02 | 0x08, 1377 'permissions': 0x10 | 0x01, 1378 'value_type': CharacteristicValueFormat.STRING.value, 1379 'value': STRING_512BYTES, 1380 }, 1381 { 1382 'uuid': '000002ab0-0000-1000-8000-00805f9b34fb', 1383 'properties': 0x02 | 0x08, 1384 'permissions': 0x10 | 0x01, 1385 'value_type': CharacteristicValueFormat.STRING.value, 1386 'value': STRING_512BYTES, 1387 }, 1388 { 1389 'uuid': '000002ab3-0000-1000-8000-00805f9b34fb', 1390 'properties': 0x02 | 0x08, 1391 'permissions': 0x10 | 0x01, 1392 'value_type': CharacteristicValueFormat.STRING.value, 1393 'value': STRING_512BYTES, 1394 }, 1395 ] 1396 }] 1397 } 1398 1399 PTS_TEST = { 1400 'services': [{ 1401 'uuid': 1402 '0000a00b-0000-1000-8000-00805f9b34fb', 1403 'type': 1404 GattService.SERVICE_TYPE_PRIMARY.value, 1405 'characteristics': [ 1406 { 1407 'uuid': '000018ba-0000-1000-8000-00805f9b34fb', 1408 'properties': 0x02 | 0x08, 1409 'permissions': 0x10 | 0x01, 1410 'value_type': CharacteristicValueFormat.STRING.value, 1411 'value': STRING_25BYTES, 1412 }, 1413 { 1414 'uuid': '000060aa-0000-1000-8000-00805f9b34fb', 1415 'properties': 0x02 | 0x08, 1416 'permissions': 0x10 | 0x01, 1417 'value_type': CharacteristicValueFormat.STRING.value, 1418 'value': STRING_25BYTES, 1419 }, 1420 ] 1421 }] 1422 } 1423 1424 # Corresponds to the PTS defined LARGE_DB_3 1425 LARGE_DB_3 = { 1426 'services': [ 1427 { 1428 'uuid': 1429 '0000a00b-0000-1000-8000-00805f9b34fb', 1430 'type': 1431 GattService.SERVICE_TYPE_PRIMARY.value, 1432 'characteristics': [ 1433 { 1434 'uuid': 1435 '0000b004-0000-1000-8000-00805f9b34fb', 1436 'instance_id': 1437 0x0003, 1438 'properties': 1439 0x0a, 1440 'permissions': 1441 GattCharacteristic.PERMISSION_READ.value | 1442 GattCharacteristic.PERMISSION_WRITE.value, 1443 'value_type': 1444 CharacteristicValueFormat.BYTE.value, 1445 'value': [0x04], 1446 }, 1447 { 1448 'uuid': 1449 '0000b004-0000-1000-8000-00805f9b34fb', 1450 'instance_id': 1451 0x0013, 1452 'properties': 1453 0x10, 1454 'permissions': 1455 0x17, 1456 'value_type': 1457 CharacteristicValueFormat.BYTE.value, 1458 'value': [0x04], 1459 'descriptors': [ 1460 { 1461 'uuid': 1462 GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 1463 'permissions': 1464 GattDescriptor.PERMISSION_READ.value | 1465 GattDescriptor.PERMISSION_WRITE.value, 1466 'value': [0x09] 1467 }, 1468 { 1469 'uuid': 1470 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 1471 'permissions': 1472 GattDescriptor.PERMISSION_READ.value | 1473 GattDescriptor.PERMISSION_WRITE.value, 1474 'value': [0x22] 1475 }, 1476 { 1477 'uuid': 1478 GattCharDesc.GATT_CLIENT_CHARAC_CFG_UUID.value, 1479 'permissions': 1480 GattDescriptor.PERMISSION_READ.value | 1481 GattDescriptor.PERMISSION_WRITE.value, 1482 'value': [0x01, 0x00] 1483 }, 1484 { 1485 'uuid': 1486 GattCharDesc.GATT_SERVER_CHARAC_CFG_UUID.value, 1487 'permissions': 1488 GattDescriptor.PERMISSION_READ.value | 1489 GattDescriptor.PERMISSION_WRITE.value, 1490 'value': [0x22] 1491 }, 1492 { 1493 'uuid': 1494 GattCharDesc.GATT_CHARAC_FMT_UUID.value, 1495 'permissions': 1496 GattDescriptor.PERMISSION_READ.value | 1497 GattDescriptor.PERMISSION_WRITE.value, 1498 'value': [0x22] 1499 }, 1500 { 1501 'uuid': 1502 GattCharDesc.GATT_CHARAC_AGREG_FMT_UUID.value, 1503 'permissions': 1504 GattDescriptor.PERMISSION_READ.value | 1505 GattDescriptor.PERMISSION_WRITE.value, 1506 'value': [0x22] 1507 }, 1508 { 1509 'uuid': 1510 GattCharDesc.GATT_CHARAC_VALID_RANGE_UUID.value, 1511 'permissions': 1512 GattDescriptor.PERMISSION_READ.value | 1513 GattDescriptor.PERMISSION_WRITE.value, 1514 'value': [0x22] 1515 }, 1516 { 1517 'uuid': 1518 GattCharDesc.GATT_EXTERNAL_REPORT_REFERENCE.value, 1519 'permissions': 1520 GattDescriptor.PERMISSION_READ.value | 1521 GattDescriptor.PERMISSION_WRITE.value, 1522 'value': [0x22] 1523 }, 1524 { 1525 'uuid': 1526 GattCharDesc.GATT_REPORT_REFERENCE.value, 1527 'permissions': 1528 GattDescriptor.PERMISSION_READ.value | 1529 GattDescriptor.PERMISSION_WRITE.value, 1530 'value': [0x22] 1531 }, 1532 ] 1533 }, 1534 { 1535 'uuid': 1536 GattCharTypes.GATT_CHARAC_SERVICE_CHANGED.value, 1537 'instance_id': 1538 0x0023, 1539 'properties': 1540 GattCharacteristic.PROPERTY_READ.value, 1541 'permissions': 1542 GattCharacteristic.PERMISSION_READ.value | 1543 GattCharacteristic.PERMISSION_WRITE.value, 1544 'value_type': 1545 CharacteristicValueFormat.STRING.value, 1546 'value': 1547 '333334444455555666667777788888999990000011111', 1548 }, 1549 { 1550 'uuid': 1551 GattCharTypes.GATT_CHARAC_APPEARANCE.value, 1552 'properties': 1553 GattCharacteristic.PROPERTY_READ.value, 1554 'permissions': 1555 GattCharacteristic.PERMISSION_READ.value | 1556 GattCharacteristic.PERMISSION_WRITE.value, 1557 'value_type': 1558 CharacteristicValueFormat.STRING.value, 1559 'value': 1560 '333334444455555666667777788888999990000011111', 1561 }, 1562 { 1563 'uuid': 1564 GattCharTypes.GATT_CHARAC_PERIPHERAL_PRIV_FLAG.value, 1565 'properties': 1566 GattCharacteristic.PROPERTY_READ.value, 1567 'permissions': 1568 GattCharacteristic.PERMISSION_READ.value | 1569 GattCharacteristic.PERMISSION_WRITE.value, 1570 'value_type': 1571 CharacteristicValueFormat.STRING.value, 1572 'value': 1573 '333334444455555666667777788888999990000011111', 1574 }, 1575 { 1576 'uuid': 1577 GattCharTypes.GATT_CHARAC_RECONNECTION_ADDRESS.value, 1578 'properties': 1579 GattCharacteristic.PROPERTY_READ.value, 1580 'permissions': 1581 GattCharacteristic.PERMISSION_READ.value | 1582 GattCharacteristic.PERMISSION_WRITE.value, 1583 'value_type': 1584 CharacteristicValueFormat.STRING.value, 1585 'value': 1586 '333334444455555666667777788888999990000011111', 1587 }, 1588 { 1589 'uuid': 1590 GattCharTypes.GATT_CHARAC_SYSTEM_ID.value, 1591 'properties': 1592 GattCharacteristic.PROPERTY_READ.value, 1593 'permissions': 1594 GattCharacteristic.PERMISSION_READ.value | 1595 GattCharacteristic.PERMISSION_WRITE.value, 1596 'value_type': 1597 CharacteristicValueFormat.STRING.value, 1598 'value': 1599 '333334444455555666667777788888999990000011111', 1600 }, 1601 { 1602 'uuid': 1603 GattCharTypes.GATT_CHARAC_MODEL_NUMBER_STRING.value, 1604 'properties': 1605 GattCharacteristic.PROPERTY_READ.value, 1606 'permissions': 1607 GattCharacteristic.PERMISSION_READ.value | 1608 GattCharacteristic.PERMISSION_WRITE.value, 1609 'value_type': 1610 CharacteristicValueFormat.STRING.value, 1611 'value': 1612 '333334444455555666667777788888999990000011111', 1613 }, 1614 { 1615 'uuid': 1616 GattCharTypes.GATT_CHARAC_SERIAL_NUMBER_STRING.value, 1617 'properties': 1618 GattCharacteristic.PROPERTY_READ.value, 1619 'permissions': 1620 GattCharacteristic.PERMISSION_READ.value | 1621 GattCharacteristic.PERMISSION_WRITE.value, 1622 'value_type': 1623 CharacteristicValueFormat.STRING.value, 1624 'value': 1625 '333334444455555666667777788888999990000011111', 1626 }, 1627 { 1628 'uuid': 1629 GattCharTypes.GATT_CHARAC_FIRMWARE_REVISION_STRING.value, 1630 'properties': 1631 GattCharacteristic.PROPERTY_READ.value, 1632 'permissions': 1633 GattCharacteristic.PERMISSION_READ.value | 1634 GattCharacteristic.PERMISSION_WRITE.value, 1635 'value_type': 1636 CharacteristicValueFormat.STRING.value, 1637 'value': 1638 '333334444455555666667777788888999990000011111', 1639 }, 1640 { 1641 'uuid': 1642 GattCharTypes.GATT_CHARAC_HARDWARE_REVISION_STRING.value, 1643 'properties': 1644 GattCharacteristic.PROPERTY_READ.value, 1645 'permissions': 1646 GattCharacteristic.PERMISSION_READ.value | 1647 GattCharacteristic.PERMISSION_WRITE.value, 1648 'value_type': 1649 CharacteristicValueFormat.STRING.value, 1650 'value': 1651 '333334444455555666667777788888999990000011111', 1652 }, 1653 { 1654 'uuid': 1655 GattCharTypes.GATT_CHARAC_SOFTWARE_REVISION_STRING.value, 1656 'properties': 1657 GattCharacteristic.PROPERTY_READ.value, 1658 'permissions': 1659 GattCharacteristic.PERMISSION_READ.value | 1660 GattCharacteristic.PERMISSION_WRITE.value, 1661 'value_type': 1662 CharacteristicValueFormat.STRING.value, 1663 'value': 1664 '333334444455555666667777788888999990000011111', 1665 }, 1666 { 1667 'uuid': 1668 GattCharTypes.GATT_CHARAC_MANUFACTURER_NAME_STRING.value, 1669 'properties': 1670 GattCharacteristic.PROPERTY_READ.value, 1671 'permissions': 1672 GattCharacteristic.PERMISSION_READ.value | 1673 GattCharacteristic.PERMISSION_WRITE.value, 1674 'value_type': 1675 CharacteristicValueFormat.STRING.value, 1676 'value': 1677 '333334444455555666667777788888999990000011111', 1678 }, 1679 { 1680 'uuid': 1681 GattCharTypes.GATT_CHARAC_PNP_ID.value, 1682 'properties': 1683 GattCharacteristic.PROPERTY_READ.value, 1684 'permissions': 1685 GattCharacteristic.PERMISSION_READ.value | 1686 GattCharacteristic.PERMISSION_WRITE.value, 1687 'value_type': 1688 CharacteristicValueFormat.STRING.value, 1689 'value': 1690 '333334444455555666667777788888999990000011111', 1691 }, 1692 ] 1693 }, 1694 { 1695 'uuid': 1696 '0000a00d-0000-1000-8000-00805f9b34fb', 1697 'type': 1698 GattService.SERVICE_TYPE_SECONDARY.value, 1699 'handles': 1700 5, 1701 'characteristics': [{ 1702 'uuid': 1703 '0000b00c-0000-1000-8000-00805f9b34fb', 1704 'instance_id': 1705 0x0023, 1706 'properties': 1707 GattCharacteristic.PROPERTY_READ.value, 1708 'permissions': 1709 GattCharacteristic.PERMISSION_READ.value, 1710 'value_type': 1711 CharacteristicValueFormat.BYTE.value, 1712 'value': [0x0c], 1713 }, { 1714 'uuid': 1715 '0000b00b-0000-0000-0123-456789abcdef', 1716 'instance_id': 1717 0x0025, 1718 'properties': 1719 GattCharacteristic.PROPERTY_READ.value, 1720 'permissions': 1721 GattCharacteristic.PERMISSION_READ.value, 1722 'value_type': 1723 CharacteristicValueFormat.BYTE.value, 1724 'value': [0x0b], 1725 }] 1726 }, 1727 { 1728 'uuid': 1729 '0000a00b-0000-1000-8000-00805f9b34fb', 1730 'type': 1731 GattService.SERVICE_TYPE_PRIMARY.value, 1732 'characteristics': [{ 1733 'uuid': 1734 '0000b008-0000-1000-8000-00805f9b34fb', 1735 'instance_id': 1736 0x0032, 1737 'properties': 1738 GattCharacteristic.PROPERTY_READ.value, 1739 'permissions': 1740 GattCharacteristic.PERMISSION_READ.value, 1741 'value_type': 1742 CharacteristicValueFormat.BYTE.value, 1743 'value': [0x08], 1744 }] 1745 }, 1746 { 1747 'uuid': 1748 '0000a00b-0000-1000-8000-00805f9b34fb', 1749 'type': 1750 GattService.SERVICE_TYPE_PRIMARY.value, 1751 'characteristics': [{ 1752 'uuid': 1753 '0000b007-0000-1000-8000-00805f9b34fb', 1754 'instance_id': 1755 0x0042, 1756 'properties': 1757 GattCharacteristic.PROPERTY_WRITE.value, 1758 'permissions': 1759 GattCharacteristic.PERMISSION_WRITE.value, 1760 'value_type': 1761 CharacteristicValueFormat.BYTE.value, 1762 'value': [0x07], 1763 }] 1764 }, 1765 { 1766 'uuid': 1767 '0000a00b-0000-1000-8000-00805f9b34fb', 1768 'type': 1769 GattService.SERVICE_TYPE_PRIMARY.value, 1770 'characteristics': [{ 1771 'uuid': 1772 '0000b006-0000-1000-8000-00805f9b34fb', 1773 'instance_id': 1774 0x0052, 1775 'properties': 1776 0x3e, 1777 'permissions': 1778 GattCharacteristic.PERMISSION_WRITE.value | 1779 GattCharacteristic.PERMISSION_READ.value, 1780 'value_type': 1781 CharacteristicValueFormat.BYTE.value, 1782 'value': [0x06], 1783 }] 1784 }, 1785 { 1786 'uuid': 1787 '0000a00a-0000-1000-8000-00805f9b34fb', 1788 'type': 1789 GattService.SERVICE_TYPE_PRIMARY.value, 1790 'handles': 1791 10, 1792 'characteristics': [{ 1793 'uuid': 1794 '0000b001-0000-1000-8000-00805f9b34fb', 1795 'instance_id': 1796 0x0074, 1797 'properties': 1798 GattCharacteristic.PROPERTY_READ.value, 1799 'permissions': 1800 GattCharacteristic.PERMISSION_READ.value, 1801 'value_type': 1802 CharacteristicValueFormat.BYTE.value, 1803 'value': [0x01], 1804 }, { 1805 'uuid': 1806 '0000b002-0000-1000-8000-00805f9b34fb', 1807 'instance_id': 1808 0x0076, 1809 'properties': 1810 0x0a, 1811 'permissions': 1812 GattCharacteristic.PERMISSION_READ.value | 1813 GattCharacteristic.PERMISSION_WRITE.value, 1814 'value_type': 1815 CharacteristicValueFormat.STRING.value, 1816 'value': 1817 '11111222223333344444555556666677777888889999900000', 1818 }, { 1819 'uuid': 1820 '0000b003-0000-1000-8000-00805f9b34fb', 1821 'instance_id': 1822 0x0078, 1823 'properties': 1824 GattCharacteristic.PROPERTY_WRITE.value, 1825 'permissions': 1826 GattCharacteristic.PERMISSION_WRITE.value, 1827 'value_type': 1828 CharacteristicValueFormat.BYTE.value, 1829 'value': [0x03], 1830 }] 1831 }, 1832 { 1833 'uuid': 1834 '0000a00c-0000-0000-0123-456789abcdef', 1835 'type': 1836 GattService.SERVICE_TYPE_PRIMARY.value, 1837 'handles': 1838 10, 1839 'characteristics': [{ 1840 'uuid': 1841 '0000b009-0000-0000-0123-456789abcdef', 1842 'instance_id': 1843 0x0082, 1844 'properties': 1845 0x8a, 1846 'permissions': 1847 GattCharacteristic.PERMISSION_READ.value | 1848 GattCharacteristic.PERMISSION_WRITE.value, 1849 'value_type': 1850 CharacteristicValueFormat.BYTE.value, 1851 'value': [0x09], 1852 'descriptors': [ 1853 { 1854 'uuid': 1855 '0000b009-0000-0000-0123-456789abcdef', 1856 'permissions': 1857 GattDescriptor.PERMISSION_READ.value | 1858 GattDescriptor.PERMISSION_WRITE.value, 1859 'value': [0x09] 1860 }, 1861 { 1862 'uuid': 1863 '0000d9d2-0000-0000-0123-456789abcdef', 1864 'permissions': 1865 GattDescriptor.PERMISSION_READ.value | 1866 GattDescriptor.PERMISSION_WRITE.value, 1867 'value': [0x22] 1868 }, 1869 { 1870 'uuid': GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 1871 'permissions': GattDescriptor.PERMISSION_READ.value, 1872 'value': [0x01, 0x00] 1873 }, 1874 { 1875 'uuid': '0000d9d3-0000-0000-0123-456789abcdef', 1876 'permissions': GattDescriptor.PERMISSION_WRITE.value, 1877 'value': [0x22] 1878 }, 1879 ] 1880 }] 1881 }, 1882 { 1883 'uuid': 1884 '0000a00b-0000-0000-0123-456789abcdef', 1885 'type': 1886 GattService.SERVICE_TYPE_PRIMARY.value, 1887 'characteristics': [{ 1888 'uuid': 1889 '0000b009-0000-0000-0123-456789abcdef', 1890 'instance_id': 1891 0x0092, 1892 'properties': 1893 0x8a, 1894 'permissions': 1895 GattCharacteristic.PERMISSION_READ.value | 1896 GattCharacteristic.PERMISSION_WRITE.value, 1897 'value_type': 1898 CharacteristicValueFormat.BYTE.value, 1899 'value': [0x05], 1900 'descriptors': [ 1901 { 1902 'uuid': 1903 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 1904 'permissions': 1905 GattDescriptor.PERMISSION_READ.value | 1906 GattDescriptor.PERMISSION_WRITE.value, 1907 'value': [0] * 26 1908 }, 1909 { 1910 'uuid': GattCharDesc.GATT_CHARAC_EXT_PROPER_UUID.value, 1911 'permissions': GattDescriptor.PERMISSION_READ.value, 1912 'value': [0x03, 0x00] 1913 }, 1914 { 1915 'uuid': '0000d5d4-0000-0000-0123-456789abcdef', 1916 'permissions': GattDescriptor.PERMISSION_READ.value, 1917 'value': [0x44] 1918 }, 1919 { 1920 'uuid': GattCharDesc.GATT_CHARAC_FMT_UUID.value, 1921 'permissions': GattDescriptor.PERMISSION_READ.value, 1922 'value': [0x04, 0x00, 0x01, 0x30, 0x01, 0x11, 0x31] 1923 }, 1924 ] 1925 }] 1926 }, 1927 { 1928 'uuid': 1929 '0000a00c-0000-0000-0123-456789abcdef', 1930 'type': 1931 GattService.SERVICE_TYPE_PRIMARY.value, 1932 'characteristics': [ 1933 { 1934 'uuid': '0000b00a-0000-1000-8000-00805f9b34fb', 1935 'instance_id': 0x00a2, 1936 'properties': GattCharacteristic.PROPERTY_READ.value, 1937 'permissions': GattCharacteristic.PERMISSION_READ.value, 1938 'value_type': CharacteristicValueFormat.BYTE.value, 1939 'value': [0x0a], 1940 }, 1941 { 1942 'uuid': 1943 '0000b002-0000-1000-8000-00805f9b34fb', 1944 'instance_id': 1945 0x00a4, 1946 'properties': 1947 0x0a, 1948 'permissions': 1949 GattCharacteristic.PERMISSION_READ.value | 1950 GattCharacteristic.PERMISSION_WRITE.value, 1951 'value_type': 1952 CharacteristicValueFormat.STRING.value, 1953 'value': 1954 '111112222233333444445', 1955 }, 1956 { 1957 'uuid': 1958 '0000b002-0000-1000-8000-00805f9b34fb', 1959 'instance_id': 1960 0x00a6, 1961 'properties': 1962 0x0a, 1963 'permissions': 1964 GattCharacteristic.PERMISSION_READ.value | 1965 GattCharacteristic.PERMISSION_WRITE.value, 1966 'value_type': 1967 CharacteristicValueFormat.STRING.value, 1968 'value': 1969 '2222233333444445555566', 1970 }, 1971 { 1972 'uuid': 1973 '0000b002-0000-1000-8000-00805f9b34fb', 1974 'instance_id': 1975 0x00a8, 1976 'properties': 1977 0x0a, 1978 'permissions': 1979 GattCharacteristic.PERMISSION_READ.value | 1980 GattCharacteristic.PERMISSION_WRITE.value, 1981 'value_type': 1982 CharacteristicValueFormat.STRING.value, 1983 'value': 1984 '33333444445555566666777', 1985 }, 1986 { 1987 'uuid': 1988 '0000b002-0000-1000-8000-00805f9b34fb', 1989 'instance_id': 1990 0x00aa, 1991 'properties': 1992 0x0a, 1993 'permissions': 1994 GattCharacteristic.PERMISSION_READ.value | 1995 GattCharacteristic.PERMISSION_WRITE.value, 1996 'value_type': 1997 CharacteristicValueFormat.STRING.value, 1998 'value': 1999 '1111122222333334444455555666667777788888999', 2000 }, 2001 { 2002 'uuid': 2003 '0000b002-0000-1000-8000-00805f9b34fb', 2004 'instance_id': 2005 0x00ac, 2006 'properties': 2007 0x0a, 2008 'permissions': 2009 GattCharacteristic.PERMISSION_READ.value | 2010 GattCharacteristic.PERMISSION_WRITE.value, 2011 'value_type': 2012 CharacteristicValueFormat.STRING.value, 2013 'value': 2014 '22222333334444455555666667777788888999990000', 2015 }, 2016 { 2017 'uuid': 2018 '0000b002-0000-1000-8000-00805f9b34fb', 2019 'instance_id': 2020 0x00ae, 2021 'properties': 2022 0x0a, 2023 'permissions': 2024 GattCharacteristic.PERMISSION_READ.value | 2025 GattCharacteristic.PERMISSION_WRITE.value, 2026 'value_type': 2027 CharacteristicValueFormat.STRING.value, 2028 'value': 2029 '333334444455555666667777788888999990000011111', 2030 }, 2031 ] 2032 }, 2033 { 2034 'uuid': 2035 '0000a00e-0000-1000-8000-00805f9b34fb', 2036 'type': 2037 GattService.SERVICE_TYPE_PRIMARY.value, 2038 'characteristics': [{ 2039 'uuid': 2040 '0000b00d-0000-1000-8000-00805f9b34fb', 2041 'instance_id': 2042 0xffff, 2043 'properties': 2044 GattCharacteristic.PROPERTY_READ.value, 2045 'permissions': 2046 GattCharacteristic.PERMISSION_READ.value, 2047 'value_type': 2048 CharacteristicValueFormat.BYTE.value, 2049 'value': [0x0d], 2050 }] 2051 }, 2052 ] 2053 } 2054 2055 TEST_DB_1 = { 2056 'services': [{ 2057 'uuid': 2058 '0000180d-0000-1000-8000-00805f9b34fb', 2059 'type': 2060 GattService.SERVICE_TYPE_PRIMARY.value, 2061 'handles': 2062 4, 2063 'characteristics': [{ 2064 'uuid': 2065 '00002a29-0000-1000-8000-00805f9b34fb', 2066 'properties': 2067 GattCharacteristic.PROPERTY_READ.value | 2068 GattCharacteristic.PROPERTY_WRITE.value, 2069 'permissions': 2070 GattCharacteristic.PERMISSION_READ.value | 2071 GattCharacteristic.PERMISSION_WRITE.value, 2072 'value_type': 2073 CharacteristicValueFormat.STRING.value, 2074 'value': 2075 'test', 2076 'instance_id': 2077 0x002a, 2078 'descriptors': [{ 2079 'uuid': 2080 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 2081 'permissions': 2082 GattDescriptor.PERMISSION_READ.value, 2083 'value': [0x01] 2084 }] 2085 }] 2086 }] 2087 } 2088 2089 TEST_DB_2 = { 2090 'services': [{ 2091 'uuid': 2092 '0000180d-0000-1000-8000-00805f9b34fb', 2093 'type': 2094 GattService.SERVICE_TYPE_PRIMARY.value, 2095 'handles': 2096 4, 2097 'characteristics': [{ 2098 'uuid': 2099 '00002a29-0000-1000-8000-00805f9b34fb', 2100 'properties': 2101 GattCharacteristic.PROPERTY_READ.value, 2102 'permissions': 2103 GattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM.value, 2104 'value_type': 2105 CharacteristicValueFormat.STRING.value, 2106 'value': 2107 'test', 2108 'instance_id': 2109 0x002a, 2110 }, { 2111 'uuid': 2112 '00002a30-0000-1000-8000-00805f9b34fb', 2113 'properties': 2114 GattCharacteristic.PROPERTY_READ.value, 2115 'permissions': 2116 GattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM.value, 2117 'value_type': 2118 CharacteristicValueFormat.STRING.value, 2119 'value': 2120 'test', 2121 'instance_id': 2122 0x002b, 2123 }] 2124 }] 2125 } 2126 2127 TEST_DB_3 = { 2128 'services': [{ 2129 'uuid': 2130 '0000180d-0000-1000-8000-00805f9b34fb', 2131 'type': 2132 GattService.SERVICE_TYPE_PRIMARY.value, 2133 'handles': 2134 4, 2135 'characteristics': [{ 2136 'uuid': 2137 '00002a29-0000-1000-8000-00805f9b34fb', 2138 'properties': 2139 GattCharacteristic.PROPERTY_READ.value | 2140 GattCharacteristic.PROPERTY_WRITE.value, 2141 'permissions': 2142 GattCharacteristic.PERMISSION_READ.value | 2143 GattCharacteristic.PERMISSION_WRITE.value, 2144 'value_type': 2145 CharacteristicValueFormat.STRING.value, 2146 'value': 2147 'test', 2148 'instance_id': 2149 0x002a, 2150 'descriptors': [{ 2151 'uuid': 2152 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 2153 'permissions': 2154 GattDescriptor.PERMISSION_READ.value, 2155 'value': [0x01] 2156 }, { 2157 'uuid': 2158 '00002a20-0000-1000-8000-00805f9b34fb', 2159 'permissions': 2160 GattDescriptor.PERMISSION_READ.value | 2161 GattDescriptor.PERMISSION_WRITE.value, 2162 'instance_id': 2163 0x002c, 2164 'value': [0x01] 2165 }] 2166 }, { 2167 'uuid': 2168 '00002a30-0000-1000-8000-00805f9b34fb', 2169 'properties': 2170 GattCharacteristic.PROPERTY_READ.value | 2171 GattCharacteristic.PROPERTY_WRITE.value, 2172 'permissions': 2173 GattCharacteristic.PERMISSION_READ.value | 2174 GattCharacteristic.PERMISSION_WRITE.value, 2175 'value_type': 2176 CharacteristicValueFormat.STRING.value, 2177 'value': 2178 'test', 2179 'instance_id': 2180 0x002b, 2181 }] 2182 }] 2183 } 2184 2185 TEST_DB_4 = { 2186 'services': [{ 2187 'uuid': 2188 '0000180d-0000-1000-8000-00805f9b34fb', 2189 'type': 2190 GattService.SERVICE_TYPE_PRIMARY.value, 2191 'handles': 2192 4, 2193 'characteristics': [{ 2194 'uuid': 2195 '00002a29-0000-1000-8000-00805f9b34fb', 2196 'properties': 2197 GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE.value, 2198 'permissions': 2199 GattCharacteristic.PERMISSION_READ.value, 2200 'value_type': 2201 CharacteristicValueFormat.STRING.value, 2202 'value': 2203 "test", 2204 'instance_id': 2205 0x002a, 2206 'descriptors': [{ 2207 'uuid': 2208 GattCharDesc.GATT_CHARAC_USER_DESC_UUID.value, 2209 'permissions': 2210 GattDescriptor.PERMISSION_READ_ENCRYPTED_MITM.value, 2211 'value': [0] * 512 2212 }] 2213 }] 2214 }] 2215 } 2216 2217 TEST_DB_5 = { 2218 'services': [{ 2219 'uuid': 2220 '0000180d-0000-1000-8000-00805f9b34fb', 2221 'type': 2222 GattService.SERVICE_TYPE_PRIMARY.value, 2223 'characteristics': [{ 2224 'uuid': 2225 'b2c83efa-34ca-11e6-ac61-9e71128cae77', 2226 'properties': 2227 GattCharacteristic.PROPERTY_WRITE.value | 2228 GattCharacteristic.PROPERTY_READ.value | 2229 GattCharacteristic.PROPERTY_NOTIFY.value, 2230 'permissions': 2231 GattCharacteristic.PERMISSION_READ.value | 2232 GattCharacteristic.PERMISSION_WRITE.value, 2233 'value_type': 2234 CharacteristicValueFormat.BYTE.value, 2235 'value': [0x1], 2236 'instance_id': 2237 0x002c, 2238 'descriptors': [{ 2239 'uuid': 2240 '00002902-0000-1000-8000-00805f9b34fb', 2241 'permissions': 2242 GattDescriptor.PERMISSION_READ.value | 2243 GattDescriptor.PERMISSION_WRITE.value, 2244 }] 2245 }] 2246 }] 2247 } 2248 2249 TEST_DB_6 = { 2250 'services': [{ 2251 'uuid': 2252 '0000180d-0000-1000-8000-00805f9b34fb', 2253 'type': 2254 GattService.SERVICE_TYPE_PRIMARY.value, 2255 'handles': 2256 4, 2257 'characteristics': [{ 2258 'uuid': 2259 '00002a29-0000-1000-8000-00805f9b34fb', 2260 'properties': 2261 GattCharacteristic.PROPERTY_READ.value, 2262 'permissions': 2263 GattCharacteristic.PERMISSION_READ.value, 2264 'value_type': 2265 CharacteristicValueFormat.STRING.value, 2266 'value': 2267 'test', 2268 'instance_id': 2269 0x002a, 2270 'descriptors': [{ 2271 'uuid': 2272 '00002a19-0000-1000-8000-00805f9b34fb', 2273 'permissions': 2274 GattDescriptor.PERMISSION_READ.value, 2275 'value': [0x01] * 30 2276 }] 2277 }] 2278 }] 2279 } 2280 2281 SIMPLE_READ_DESCRIPTOR = { 2282 'services': [{ 2283 'uuid': 2284 '0000a00a-0000-1000-8000-00805f9b34fb', 2285 'type': 2286 GattService.SERVICE_TYPE_PRIMARY.value, 2287 'characteristics': [{ 2288 'uuid': 2289 'aa7edd5a-4d1d-4f0e-883a-d145616a1630', 2290 'properties': 2291 GattCharacteristic.PROPERTY_READ.value, 2292 'permissions': 2293 GattCharacteristic.PERMISSION_READ.value, 2294 'instance_id': 2295 0x002a, 2296 'value_type': 2297 CharacteristicValueFormat.STRING.value, 2298 'value': 2299 'Test Database', 2300 'descriptors': [{ 2301 'uuid': 2302 GattCharDesc.GATT_CLIENT_CHARAC_CFG_UUID.value, 2303 'permissions': 2304 GattDescriptor.PERMISSION_READ.value, 2305 }] 2306 }] 2307 }] 2308 } 2309 2310 CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = { 2311 'services': [{ 2312 'uuid': 2313 '0000a00a-0000-1000-8000-00805f9b34fb', 2314 'type': 2315 GattService.SERVICE_TYPE_PRIMARY.value, 2316 'characteristics': [{ 2317 'uuid': 2318 'aa7edd5a-4d1d-4f0e-883a-d145616a1630', 2319 'properties': 2320 GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE.value, 2321 'permissions': 2322 GattCharacteristic.PERMISSION_WRITE.value | 2323 GattCharacteristic.PERMISSION_READ.value, 2324 'instance_id': 2325 0x0042, 2326 'value_type': 2327 CharacteristicValueFormat.STRING.value, 2328 'value': 2329 'Test Database' 2330 }, { 2331 'uuid': 2332 'aa7edd6a-4d1d-4f0e-883a-d145616a1630', 2333 'properties': 2334 GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE.value, 2335 'permissions': 2336 GattCharacteristic.PERMISSION_WRITE.value | 2337 GattCharacteristic.PERMISSION_READ.value, 2338 'instance_id': 2339 0x004d, 2340 'value_type': 2341 CharacteristicValueFormat.STRING.value, 2342 'value': 2343 'Test Database' 2344 }] 2345 }] 2346 } 2347 2348 GATT_SERVER_DB_MAPPING = { 2349 'LARGE_DB_1': 2350 LARGE_DB_1, 2351 'LARGE_DB_3': 2352 LARGE_DB_3, 2353 'INVALID_SMALL_DATABASE': 2354 INVALID_SMALL_DATABASE, 2355 'SIMPLE_READ_DESCRIPTOR': 2356 SIMPLE_READ_DESCRIPTOR, 2357 'CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE': 2358 CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE, 2359 'TEST_DB_1': 2360 TEST_DB_1, 2361 'TEST_DB_2': 2362 TEST_DB_2, 2363 'TEST_DB_3': 2364 TEST_DB_3, 2365 'TEST_DB_4': 2366 TEST_DB_4, 2367 'TEST_DB_5': 2368 TEST_DB_5, 2369 'LARGE_DB_3_PLUS': 2370 LARGE_DB_3, 2371 'DB_TEST': 2372 DB_TEST, 2373 'PTS_TEST': 2374 PTS_TEST, 2375 'PTS_TEST2': 2376 PTS_TEST2, 2377 'TEST_DB_6': 2378 TEST_DB_6, 2379 } 2380