• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
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
17from acts.test_utils.bt.bt_constants import gatt_characteristic
18from acts.test_utils.bt.bt_constants import gatt_descriptor
19from acts.test_utils.bt.bt_constants import gatt_service_types
20from acts.test_utils.bt.bt_constants import gatt_char_types
21from acts.test_utils.bt.bt_constants import gatt_characteristic_value_format
22from acts.test_utils.bt.bt_constants import gatt_char_desc_uuids
23
24STRING_512BYTES = '''
2511111222223333344444555556666677777888889999900000
2611111222223333344444555556666677777888889999900000
2711111222223333344444555556666677777888889999900000
2811111222223333344444555556666677777888889999900000
2911111222223333344444555556666677777888889999900000
3011111222223333344444555556666677777888889999900000
3111111222223333344444555556666677777888889999900000
3211111222223333344444555556666677777888889999900000
3311111222223333344444555556666677777888889999900000
3411111222223333344444555556666677777888889999900000
35111112222233
36'''
37STRING_50BYTES = '''
3811111222223333344444555556666677777888889999900000
39'''
40STRING_25BYTES = '''
411111122222333334444455555
42'''
43
44INVALID_SMALL_DATABASE = {
45    'services': [{
46        'uuid': '00001800-0000-1000-8000-00805f9b34fb',
47        'type': gatt_service_types['primary'],
48        'characteristics': [{
49            'uuid': gatt_char_types['device_name'],
50            'properties': gatt_characteristic['property_read'],
51            'permissions': gatt_characteristic['permission_read'],
52            'instance_id': 0x0003,
53            'value_type': gatt_characteristic_value_format['string'],
54            'value': 'Test Database'
55        }, {
56            'uuid': gatt_char_types['appearance'],
57            'properties': gatt_characteristic['property_read'],
58            'permissions': gatt_characteristic['permission_read'],
59            'instance_id': 0x0005,
60            'value_type': gatt_characteristic_value_format['sint32'],
61            'offset': 0,
62            'value': 17
63        }, {
64            'uuid': gatt_char_types['peripheral_pref_conn'],
65            'properties': gatt_characteristic['property_read'],
66            'permissions': gatt_characteristic['permission_read'],
67            'instance_id': 0x0007
68        }]
69    }, {
70        'uuid': '00001801-0000-1000-8000-00805f9b34fb',
71        'type': gatt_service_types['primary'],
72        'characteristics': [{
73            'uuid': gatt_char_types['service_changed'],
74            'properties': gatt_characteristic['property_indicate'],
75            'permissions': gatt_characteristic['permission_read'] |
76            gatt_characteristic['permission_write'],
77            'instance_id': 0x0012,
78            'value_type': gatt_characteristic_value_format['byte'],
79            'value': [0x0000],
80            'descriptors': [{
81                'uuid': gatt_char_desc_uuids['client_char_cfg'],
82                'permissions': gatt_descriptor['permission_read'] |
83                gatt_descriptor['permission_write'],
84            }]
85        }, {
86            'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
87            'properties': gatt_characteristic['property_read'],
88            'permissions': gatt_characteristic['permission_read'],
89            'instance_id': 0x0015,
90            'value_type': gatt_characteristic_value_format['byte'],
91            'value': [0x04]
92        }]
93    }]
94}
95
96# Corresponds to the PTS defined LARGE_DB_1
97LARGE_DB_1 = {
98    'services': [
99        {
100            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
101            'type': gatt_service_types['primary'],
102            'handles': 7,
103            'characteristics': [{
104                'uuid': '0000b008-0000-1000-8000-00805f9b34fb',
105                'properties': gatt_characteristic['property_read'] |
106                gatt_characteristic['property_write'] |
107                gatt_characteristic['property_extended_props'],
108                'permissions': gatt_characteristic['permission_read'] |
109                gatt_characteristic['permission_write'],
110                'value_type': gatt_characteristic_value_format['byte'],
111                'value': [0x08],
112                'descriptors': [{
113                    'uuid': '0000b015-0000-1000-8000-00805f9b34fb',
114                    'permissions': gatt_descriptor['permission_read'] |
115                    gatt_descriptor['permission_write'],
116                }, {
117                    'uuid': '0000b016-0000-1000-8000-00805f9b34fb',
118                    'permissions': gatt_descriptor['permission_read'] |
119                    gatt_descriptor['permission_write'],
120                }, {
121                    'uuid': '0000b017-0000-1000-8000-00805f9b34fb',
122                    'permissions': gatt_descriptor['permission_read'] |
123                    gatt_descriptor['permission_write'] |
124                    gatt_characteristic['permission_read_encrypted_mitm'],
125                }]
126            }]
127        },
128        {
129            'uuid': '0000a00d-0000-1000-8000-00805f9b34fb',
130            'type': gatt_service_types['secondary'],
131            'handles': 6,
132            'characteristics': [{
133                'uuid': '0000b00c-0000-1000-8000-00805f9b34fb',
134                'properties': gatt_characteristic['property_extended_props'],
135                'permissions': gatt_characteristic['permission_read'],
136                'value_type': gatt_characteristic_value_format['byte'],
137                'value': [0x0C],
138            }, {
139                'uuid': '0000b00b-0000-0000-0123-456789abcdef',
140                'properties': gatt_characteristic['property_extended_props'],
141                'permissions': gatt_characteristic['permission_read'],
142                'value_type': gatt_characteristic_value_format['byte'],
143                'value': [0x0B],
144            }]
145        },
146        {
147            'uuid': '0000a00a-0000-1000-8000-00805f9b34fb',
148            'type': gatt_service_types['primary'],
149            'handles': 10,
150            'characteristics': [{
151                'uuid': '0000b001-0000-1000-8000-00805f9b34fb',
152                'properties': gatt_characteristic['property_read'] |
153                gatt_characteristic['property_write'],
154                'permissions': gatt_characteristic['permission_read'] |
155                gatt_characteristic['permission_write'],
156                'value_type': gatt_characteristic_value_format['byte'],
157                'value': [0x01],
158            }, {
159                'uuid': '0000b002-0000-0000-0123-456789abcdef',
160                'properties': gatt_characteristic['property_extended_props'],
161                'permissions': gatt_characteristic['permission_read'],
162                'value_type': gatt_characteristic_value_format['string'],
163                'value': STRING_512BYTES,
164            }, {
165                'uuid': '0000b004-0000-0000-0123-456789abcdef',
166                'properties': gatt_characteristic['property_read'],
167                'permissions': gatt_characteristic['permission_read'],
168                'value_type': gatt_characteristic_value_format['string'],
169                'value': STRING_512BYTES,
170            }, {
171                'uuid': '0000b002-0000-0000-0123-456789abcdef',
172                'properties': gatt_characteristic['property_write'],
173                'permissions': gatt_characteristic['permission_write'],
174                'value_type': gatt_characteristic_value_format['string'],
175                'value': '11111222223333344444555556666677777888889999900000',
176            }, {
177                'uuid': '0000b003-0000-0000-0123-456789abcdef',
178                'properties': gatt_characteristic['property_write'],
179                'permissions': gatt_characteristic['permission_write'],
180                'value_type': gatt_characteristic_value_format['byte'],
181                'value': [0x03],
182            }]
183        },
184        {
185            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
186            'type': gatt_service_types['primary'],
187            'handles': 3,
188            'characteristics': [{
189                'uuid': '0000b007-0000-1000-8000-00805f9b34fb',
190                'properties': gatt_characteristic['property_write'],
191                'permissions': gatt_characteristic['permission_write'],
192                'value_type': gatt_characteristic_value_format['byte'],
193                'value': [0x07],
194            }]
195        },
196        {
197            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
198            'type': gatt_service_types['primary'],
199            'handles': 3,
200            'characteristics': [{
201                'uuid': '0000b006-0000-1000-8000-00805f9b34fb',
202                'properties': gatt_characteristic['property_read'] |
203                gatt_characteristic['property_write'] |
204                gatt_characteristic['property_write_no_response'] |
205                gatt_characteristic['property_notify'] |
206                gatt_characteristic['property_indicate'],
207                'permissions': gatt_characteristic['permission_write'] |
208                gatt_characteristic['permission_read'],
209                'value_type': gatt_characteristic_value_format['byte'],
210                'value': [0x06],
211            }]
212        },
213        {
214            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
215            'type': gatt_service_types['primary'],
216            'handles': 12,
217            'characteristics': [
218                {
219                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
220                    'properties': gatt_characteristic['property_read'] |
221                    gatt_characteristic['property_write'],
222                    'permissions': gatt_characteristic['permission_write'] |
223                    gatt_characteristic['permission_read'],
224                    'value_type': gatt_characteristic_value_format['byte'],
225                    'value': [0x04],
226                },
227                {
228                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
229                    'properties': gatt_characteristic['property_read'] |
230                    gatt_characteristic['property_write'],
231                    'permissions': gatt_characteristic['permission_write'] |
232                    gatt_characteristic['permission_read'],
233                    'value_type': gatt_characteristic_value_format['byte'],
234                    'value': [0x04],
235                    'descriptors': [{
236                        'uuid': gatt_char_desc_uuids['server_char_cfg'],
237                        'permissions': gatt_descriptor['permission_read'] |
238                        gatt_descriptor['permission_write'],
239                        'value': gatt_descriptor['disable_notification_value']
240                    }]
241                },
242                {
243                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
244                    'properties': 0x0,
245                    'permissions': 0x0,
246                    'value_type': gatt_characteristic_value_format['byte'],
247                    'value': [0x04],
248                    'descriptors': [{
249                        'uuid': '0000b012-0000-1000-8000-00805f9b34fb',
250                        'permissions': gatt_descriptor['permission_read'] |
251                        gatt_descriptor['permission_write'],
252                        'value': [
253                            0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
254                            0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
255                            0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44,
256                            0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22,
257                            0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
258                            0x11, 0x22, 0x33
259                        ]
260                    }]
261                },
262                {
263                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
264                    'properties': gatt_characteristic['property_read'],
265                    'permissions': gatt_characteristic['permission_read'],
266                    'value_type': gatt_characteristic_value_format['byte'],
267                    'value': [0x04],
268                    'descriptors': [{
269                        'uuid': '0000b012-0000-1000-8000-00805f9b34fb',
270                        'permissions': gatt_descriptor['permission_read'],
271                        'value': [
272                            0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
273                            0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
274                            0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44,
275                            0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22,
276                            0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
277                            0x11, 0x22, 0x33
278                        ]
279                    }]
280                },
281            ]
282        },
283        {
284            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
285            'type': gatt_service_types['primary'],
286            'handles': 7,
287            'characteristics': [{
288                'uuid': '0000b005-0000-1000-8000-00805f9b34fb',
289                'properties': gatt_characteristic['property_write'] |
290                gatt_characteristic['property_extended_props'],
291                'permissions': gatt_characteristic['permission_write'] |
292                gatt_characteristic['permission_read'],
293                'value_type': gatt_characteristic_value_format['byte'],
294                'value': [0x05],
295                'descriptors': [{
296                    'uuid': gatt_char_desc_uuids['char_ext_props'],
297                    'permissions': gatt_descriptor['permission_read'],
298                    'value': [0x03, 0x00]
299                }, {
300                    'uuid': gatt_char_desc_uuids['char_user_desc'],
301                    'permissions': gatt_descriptor['permission_read'] |
302                    gatt_descriptor['permission_write'],
303                    'value': [
304                        0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73,
305                        0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x80, 0x81, 0x82,
306                        0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90
307                    ]
308                }, {
309                    'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
310                    'permissions':
311                    gatt_descriptor['permission_read_encrypted_mitm'],
312                    'value': [0x00, 0x01, 0x30, 0x01, 0x11, 0x31]
313                }, {
314                    'uuid': '0000d5d4-0000-0000-0123-456789abcdef',
315                    'permissions': gatt_descriptor['permission_read'],
316                    'value': [0x44]
317                }]
318            }]
319        },
320        {
321            'uuid': '0000a00c-0000-0000-0123-456789abcdef',
322            'type': gatt_service_types['primary'],
323            'handles': 7,
324            'characteristics': [{
325                'uuid': '0000b009-0000-0000-0123-456789abcdef',
326                'properties': gatt_characteristic['property_write'] |
327                gatt_characteristic['property_extended_props'] |
328                gatt_characteristic['property_read'],
329                'permissions': gatt_characteristic['permission_write'] |
330                gatt_characteristic['permission_read'],
331                'value_type': gatt_characteristic_value_format['byte'],
332                'value': [0x09],
333                'descriptors': [{
334                    'uuid': gatt_char_desc_uuids['char_ext_props'],
335                    'permissions': gatt_descriptor['permission_read'],
336                    'value': gatt_descriptor['enable_notification_value']
337                }, {
338                    'uuid': '0000d9d2-0000-0000-0123-456789abcdef',
339                    'permissions': gatt_descriptor['permission_read'] |
340                    gatt_descriptor['permission_write'],
341                    'value': [0x22]
342                }, {
343                    'uuid': '0000d9d3-0000-0000-0123-456789abcdef',
344                    'permissions': gatt_descriptor['permission_write'],
345                    'value': [0x33]
346                }]
347            }]
348        },
349        {
350            'uuid': '0000a00f-0000-1000-8000-00805f9b34fb',
351            'type': gatt_service_types['primary'],
352            'handles': 18,
353            'characteristics': [
354                {
355                    'uuid': '0000b00e-0000-1000-8000-00805f9b34fb',
356                    'properties': gatt_characteristic['property_read'],
357                    'permissions': gatt_characteristic['permission_read'],
358                    'value_type': gatt_characteristic_value_format['string'],
359                    'value': "Length is ",
360                    'descriptors': [{
361                        'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
362                        'permissions': gatt_descriptor['permission_read'],
363                        'value': [0x19, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00]
364                    }]
365                },
366                {
367                    'uuid': '0000b00f-0000-1000-8000-00805f9b34fb',
368                    'properties': gatt_characteristic['property_read'] |
369                    gatt_characteristic['property_write'],
370                    'permissions': gatt_characteristic['permission_read'] |
371                    gatt_characteristic['permission_write'],
372                    'value_type': gatt_characteristic_value_format['byte'],
373                    'value': [0x65],
374                    'descriptors': [{
375                        'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
376                        'permissions': gatt_descriptor['permission_read'],
377                        'value': [0x04, 0x00, 0x01, 0x27, 0x01, 0x01, 0x00]
378                    }]
379                },
380                {
381                    'uuid': '0000b006-0000-1000-8000-00805f9b34fb',
382                    'properties': gatt_characteristic['property_read'] |
383                    gatt_characteristic['property_write'],
384                    'permissions': gatt_characteristic['permission_read'] |
385                    gatt_characteristic['permission_write'],
386                    'value_type': gatt_characteristic_value_format['byte'],
387                    'value': [0x34, 0x12],
388                    'descriptors': [{
389                        'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
390                        'permissions': gatt_descriptor['permission_read'],
391                        'value': [0x06, 0x00, 0x10, 0x27, 0x01, 0x02, 0x00]
392                    }]
393                },
394                {
395                    'uuid': '0000b007-0000-1000-8000-00805f9b34fb',
396                    'properties': gatt_characteristic['property_read'] |
397                    gatt_characteristic['property_write'],
398                    'permissions': gatt_characteristic['permission_read'] |
399                    gatt_characteristic['permission_write'],
400                    'value_type': gatt_characteristic_value_format['byte'],
401                    'value': [0x04, 0x03, 0x02, 0x01],
402                    'descriptors': [{
403                        'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
404                        'permissions': gatt_descriptor['permission_read'],
405                        'value': [0x08, 0x00, 0x17, 0x27, 0x01, 0x03, 0x00]
406                    }]
407                },
408                {
409                    'uuid': '0000b010-0000-1000-8000-00805f9b34fb',
410                    'properties': gatt_characteristic['property_read'],
411                    'permissions': gatt_characteristic['permission_read'],
412                    'value_type': gatt_characteristic_value_format['byte'],
413                    'value': [0x65, 0x34, 0x12, 0x04, 0x03, 0x02, 0x01],
414                    'descriptors': [{
415                        'uuid': gatt_char_desc_uuids['char_agreg_fmt'],
416                        'permissions': gatt_descriptor['permission_read'],
417                        'value': [0xa6, 0x00, 0xa9, 0x00, 0xac, 0x00]
418                    }]
419                },
420                {
421                    'uuid': '0000b011-0000-1000-8000-00805f9b34fb',
422                    'properties': gatt_characteristic['write_type_signed']
423                    |  #for some reason 0x40 is not working...
424                    gatt_characteristic['property_read'],
425                    'permissions': gatt_characteristic['permission_read'] |
426                    gatt_characteristic['permission_write'],
427                    'value_type': gatt_characteristic_value_format['byte'],
428                    'value': [0x12]
429                }
430            ]
431        },
432        {
433            'uuid': '0000a00c-0000-1000-8000-00805f9b34fb',
434            'type': gatt_service_types['primary'],
435            'handles': 30,
436            'characteristics': [{
437                'uuid': '0000b00a-0000-1000-8000-00805f9b34fb',
438                'properties': gatt_characteristic['property_read'],
439                'permissions': gatt_characteristic['permission_read'],
440                'value_type': gatt_characteristic_value_format['byte'],
441                'value': [0x0a],
442            }, {
443                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
444                'properties': gatt_characteristic['property_read'] |
445                gatt_characteristic['property_write'],
446                'permissions': gatt_characteristic['permission_read'] |
447                gatt_characteristic['permission_write'],
448                'value_type': gatt_characteristic_value_format['string'],
449                'value': "111112222233333444445",
450                'descriptors': [{
451                    'uuid': '0000b012-0000-1000-8000-00805f9b34fb',
452                    'permissions': gatt_descriptor['permission_read'] |
453                    gatt_descriptor['permission_write'],
454                    'value': [
455                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
456                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11
457                    ]
458                }]
459            }, {
460                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
461                'properties': gatt_characteristic['property_read'] |
462                gatt_characteristic['property_write'],
463                'permissions': gatt_characteristic['permission_read'] |
464                gatt_characteristic['permission_write'],
465                'value_type': gatt_characteristic_value_format['string'],
466                'value': "2222233333444445555566",
467                'descriptors': [{
468                    'uuid': '0000b013-0000-1000-8000-00805f9b34fb',
469                    'permissions': gatt_descriptor['permission_read'] |
470                    gatt_descriptor['permission_write'],
471                    'value': [
472                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
473                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22
474                    ]
475                }]
476            }, {
477                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
478                'properties': gatt_characteristic['property_read'] |
479                gatt_characteristic['property_write'],
480                'permissions': gatt_characteristic['permission_read'] |
481                gatt_characteristic['permission_write'],
482                'value_type': gatt_characteristic_value_format['string'],
483                'value': "33333444445555566666777",
484                'descriptors': [{
485                    'uuid': '0000b014-0000-1000-8000-00805f9b34fb',
486                    'permissions': gatt_descriptor['permission_read'] |
487                    gatt_descriptor['permission_write'],
488                    'value': [
489                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
490                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22, 0x33
491                    ]
492                }]
493            }, {
494                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
495                'properties': gatt_characteristic['property_read'] |
496                gatt_characteristic['property_write'],
497                'permissions': gatt_characteristic['permission_read'] |
498                gatt_characteristic['permission_write'],
499                'value_type': gatt_characteristic_value_format['byte'],
500                'value': [
501                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
502                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
503                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
504                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
505                    0x11, 0x22, 0x33
506                ],
507                'descriptors': [{
508                    'uuid': '0000b012-0000-1000-8000-00805f9b34fb',
509                    'permissions': gatt_descriptor['permission_read'] |
510                    gatt_descriptor['permission_write'],
511                    'value': [
512                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
513                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
514                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
515                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
516                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33
517                    ]
518                }]
519            }, {
520                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
521                'properties': gatt_characteristic['property_read'] |
522                gatt_characteristic['property_write'],
523                'permissions': gatt_characteristic['permission_read'] |
524                gatt_characteristic['permission_write'],
525                'value_type': gatt_characteristic_value_format['byte'],
526                'value': [
527                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
528                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
529                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
530                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
531                    0x11, 0x22, 0x33, 0x44
532                ],
533                'descriptors': [{
534                    'uuid': '0000b013-0000-1000-8000-00805f9b34fb',
535                    'permissions': gatt_descriptor['permission_read'] |
536                    gatt_descriptor['permission_write'],
537                    'value': [
538                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
539                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
540                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
541                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
542                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44
543                    ]
544                }]
545            }, {
546                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
547                'properties': gatt_characteristic['property_read'] |
548                gatt_characteristic['property_write'],
549                'permissions': gatt_characteristic['permission_read'] |
550                gatt_characteristic['permission_write'],
551                'value_type': gatt_characteristic_value_format['byte'],
552                'value': [
553                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
554                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
555                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
556                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
557                    0x11, 0x22, 0x33, 0x44, 0x55
558                ],
559                'descriptors': [{
560                    'uuid': '0000b014-0000-1000-8000-00805f9b34fb',
561                    'permissions': gatt_descriptor['permission_read'] |
562                    gatt_descriptor['permission_write'],
563                    'value': [
564                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
565                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
566                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
567                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
568                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55
569                    ]
570                }]
571            }, {
572                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
573                'properties': gatt_characteristic['property_read'] |
574                gatt_characteristic['property_write'],
575                'permissions': gatt_characteristic['permission_read'] |
576                gatt_characteristic['permission_write'],
577                'value_type': gatt_characteristic_value_format['string'],
578                'value': "1111122222333334444455555666667777788888999",
579                'descriptors': [{
580                    'uuid': '0000b012-0000-1000-8000-00805f9b34fb',
581                    'permissions': gatt_descriptor['permission_read'] |
582                    gatt_descriptor['permission_write'],
583                    'value': [
584                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
585                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
586                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
587                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
588                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33
589                    ]
590                }]
591            }, {
592                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
593                'properties': gatt_characteristic['property_read'] |
594                gatt_characteristic['property_write'],
595                'permissions': gatt_characteristic['permission_read'] |
596                gatt_characteristic['permission_write'],
597                'value_type': gatt_characteristic_value_format['string'],
598                'value': "22222333334444455555666667777788888999990000",
599                'descriptors': [{
600                    'uuid': '0000b013-0000-1000-8000-00805f9b34fb',
601                    'permissions': gatt_descriptor['permission_read'] |
602                    gatt_descriptor['permission_write'],
603                    'value': [
604                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
605                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
606                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
607                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
608                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44
609                    ]
610                }]
611            }, {
612                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
613                'properties': gatt_characteristic['property_read'] |
614                gatt_characteristic['property_write'],
615                'permissions': gatt_characteristic['permission_read'] |
616                gatt_characteristic['permission_write'],
617                'value_type': gatt_characteristic_value_format['string'],
618                'value': "333334444455555666667777788888999990000011111",
619                'descriptors': [{
620                    'uuid': '0000b014-0000-1000-8000-00805f9b34fb',
621                    'permissions': gatt_descriptor['permission_read'] |
622                    gatt_descriptor['permission_write'],
623                    'value': [
624                        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
625                        0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
626                        0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34,
627                        0x56, 0x78, 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
628                        0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55
629                    ]
630                }]
631            }]
632        },
633    ]
634}
635
636# Corresponds to the PTS defined LARGE_DB_2
637LARGE_DB_2 = {
638    'services': [
639        {
640            'uuid': '0000a00c-0000-0000-0123-456789abdcef',
641            'type': gatt_service_types['primary'],
642            'characteristics': [{
643                'uuid': '0000b00a-0000-1000-8000-00805f9b34fb',
644                'instance_id': 0x0003,
645                'properties': gatt_characteristic['property_read'],
646                'permissions': gatt_characteristic['permission_read'],
647                'value_type': gatt_characteristic_value_format['byte'],
648                'value': [0x04],
649            }, {
650                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
651                'instance_id': 0x0005,
652                'properties': 0x0a,
653                'permissions': gatt_characteristic['permission_read'] |
654                gatt_characteristic['permission_write'],
655                'value_type': gatt_characteristic_value_format['string'],
656                'value': '111112222233333444445',
657            }, {
658                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
659                'instance_id': 0x0007,
660                'properties': 0x0a,
661                'permissions': gatt_characteristic['permission_read'] |
662                gatt_characteristic['permission_write'],
663                'value_type': gatt_characteristic_value_format['string'],
664                'value': '2222233333444445555566',
665            }, {
666                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
667                'instance_id': 0x0009,
668                'properties': 0x0a,
669                'permissions': gatt_characteristic['permission_read'] |
670                gatt_characteristic['permission_write'],
671                'value_type': gatt_characteristic_value_format['string'],
672                'value': '33333444445555566666777',
673            }, {
674                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
675                'instance_id': 0x000b,
676                'properties': 0x0a0,
677                'permissions': gatt_characteristic['permission_read'] |
678                gatt_characteristic['permission_write'],
679                'value_type': gatt_characteristic_value_format['string'],
680                'value': '1111122222333334444455555666667777788888999',
681            }, {
682                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
683                'instance_id': 0x000d,
684                'properties': 0x0a,
685                'permissions': gatt_characteristic['permission_read'] |
686                gatt_characteristic['permission_write'],
687                'value_type': gatt_characteristic_value_format['string'],
688                'value': '22222333334444455555666667777788888999990000',
689            }, {
690                'uuid': '0000b0002-0000-1000-8000-00805f9b34fb',
691                'instance_id': 0x000f,
692                'properties': 0x0a,
693                'permissions': gatt_characteristic['permission_read'] |
694                gatt_characteristic['permission_write'],
695                'value_type': gatt_characteristic_value_format['string'],
696                'value': '333334444455555666667777788888999990000011111',
697            }]
698        },
699        {
700            'uuid': '0000a00c-0000-0000-0123-456789abcdef',
701            'handles': 5,
702            'type': gatt_service_types['primary'],
703            'characteristics': [{
704                'uuid': '0000b009-0000-0000-0123-456789abcdef',
705                'instance_id': 0x0023,
706                'properties': 0x8a,
707                'permissions': gatt_characteristic['permission_read'] |
708                gatt_characteristic['permission_write'],
709                'value_type': gatt_characteristic_value_format['byte'],
710                'value': [0x09],
711                'descriptors': [{
712                    'uuid': '0000d9d2-0000-0000-0123-456789abcdef',
713                    'permissions': gatt_descriptor['permission_read'] |
714                    gatt_descriptor['permission_write'],
715                    'value': [0x22]
716                }, {
717                    'uuid': '0000d9d3-0000-0000-0123-456789abcdef',
718                    'permissions': gatt_descriptor['permission_write'],
719                    'value': [0x33]
720                }, {
721                    'uuid': gatt_char_desc_uuids['char_ext_props'],
722                    'permissions': gatt_descriptor['permission_write'],
723                    'value': gatt_descriptor['enable_notification_value']
724                }]
725            }]
726        },
727        {
728            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
729            'type': gatt_service_types['primary'],
730            'characteristics': [{
731                'uuid': '0000b007-0000-1000-8000-00805f9b34fb',
732                'instance_id': 0x0012,
733                'properties': 0x0a,
734                'permissions': gatt_characteristic['permission_read'] |
735                gatt_characteristic['permission_write'],
736                'value_type': gatt_characteristic_value_format['byte'],
737                'value': [0x04],
738            }]
739        },
740    ]
741}
742
743DB_TEST = {
744    'services': [{
745        'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
746        'type': gatt_service_types['primary'],
747        'characteristics': [{
748            'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
749            'properties': 0x02 | 0x08,
750            'permissions': 0x10 | 0x01,
751            'value_type': gatt_characteristic_value_format['byte'],
752            'value': [0x01],
753            'descriptors': [{
754                'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
755                'permissions': gatt_descriptor['permission_read'] |
756                gatt_descriptor['permission_write'],
757                'value': [0x01] * 30
758            }]
759        }, ]
760    }]
761}
762
763PTS_TEST2 = {
764    'services': [{
765        'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
766        'type': gatt_service_types['primary'],
767        'characteristics': [
768            {
769                'uuid': '000018ba-0000-1000-8000-00805f9b34fb',
770                'properties': 0x02,
771                'permissions': 0x10 | 0x01,
772                'value_type': gatt_characteristic_value_format['string'],
773                'value': STRING_512BYTES,
774            },
775            {
776                'uuid': '000060aa-0000-0000-0123-456789abcdef',
777                'properties': 0x02,
778                'permissions': 0x10 | 0x01,
779                'value_type': gatt_characteristic_value_format['string'],
780                'value': STRING_512BYTES,
781            },
782            {
783                'uuid': '00000af2-0000-1000-8000-00805f9b34fb',
784                'properties': 0x20,
785                'permissions': 0x10 | 0x01,
786                'value_type': gatt_characteristic_value_format['string'],
787                'value': STRING_512BYTES,
788            },
789            {
790                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
791                'properties': 0x08,
792                'permissions': 0x10 | 0x01,
793                'value_type': gatt_characteristic_value_format['string'],
794                'value': STRING_512BYTES,
795            },
796            {
797                'uuid': '000004d5e-0000-1000-8000-00805f9b34fb',
798                'properties': 0x08,
799                'permissions': 0x10 | 0x01,
800                'value_type': gatt_characteristic_value_format['string'],
801                'value': STRING_512BYTES,
802            },
803            {
804                'uuid': '000001b44-0000-1000-8000-00805f9b34fb',
805                'properties': 0x08,
806                'permissions': 0x10 | 0x01,
807                'value_type': gatt_characteristic_value_format['string'],
808                'value': STRING_512BYTES,
809            },
810            {
811                'uuid': '000006b98-0000-1000-8000-00805f9b34fb',
812                'properties': 0x02 | 0x08 | 0x10 | 0x04,
813                'permissions': 0x10 | 0x01,
814                'value_type': gatt_characteristic_value_format['string'],
815                'value': STRING_512BYTES,
816            },
817            {
818                'uuid': '00000247f-0000-1000-8000-00805f9b34fb',
819                'properties': 0x02 | 0x08,
820                'permissions': 0x10 | 0x01,
821                'value_type': gatt_characteristic_value_format['string'],
822                'value': STRING_512BYTES,
823            },
824            {
825                'uuid': '00000247f-0000-1000-8000-00805f9b34fb',
826                'properties': 0x02 | 0x08,
827                'permissions': 0x10 | 0x01,
828                'value_type': gatt_characteristic_value_format['string'],
829                'value': STRING_512BYTES,
830            },
831            {
832                'uuid': '00000247f-0000-1000-8000-00805f9b34fb',
833                'properties': 0x00,
834                'permissions': 0x00,
835                'value_type': gatt_characteristic_value_format['string'],
836                'value': STRING_512BYTES,
837            },
838            {
839                'uuid': '00000247f-0000-1000-8000-00805f9b34fb',
840                'properties': 0x02,
841                'permissions': 0x10,
842                'value_type': gatt_characteristic_value_format['string'],
843                'value': STRING_512BYTES,
844            },
845            {
846                'uuid': '000000d62-0000-1000-8000-00805f9b34fb',
847                'properties': 0x02 | 0x08 | 0x80,
848                'permissions': 0x10 | 0x01,
849                'value_type': gatt_characteristic_value_format['string'],
850                'value': STRING_512BYTES,
851            },
852            {
853                'uuid': '000002e85-0000-1000-8000-00805f9b34fb',
854                'properties': 0x02 | 0x08,
855                'permissions': 0x10 | 0x01,
856                'value_type': gatt_characteristic_value_format['string'],
857                'value': STRING_512BYTES,
858            },
859            {
860                'uuid': '000004a64-0000-0000-0123-456789abcdef',
861                'properties': 0x02 | 0x08 | 0x80,
862                'permissions': 0x10 | 0x01,
863                'value_type': gatt_characteristic_value_format['string'],
864                'value': STRING_512BYTES,
865            },
866            {
867                'uuid': '000005b4a-0000-1000-8000-00805f9b34fb',
868                'properties': 0x02,
869                'permissions': 0x10,
870                'value_type': gatt_characteristic_value_format['string'],
871                'value': STRING_512BYTES,
872            },
873            {
874                'uuid': '000001c81-0000-1000-8000-00805f9b34fb',
875                'properties': 0x02,
876                'permissions': 0x10,
877                'value_type': gatt_characteristic_value_format['string'],
878                'value': STRING_512BYTES,
879            },
880            {
881                'uuid': '000006b98-0000-1000-8000-00805f9b34fb',
882                'properties': 0x02 | 0x08,
883                'permissions': 0x10 | 0x01,
884                'value_type': gatt_characteristic_value_format['string'],
885                'value': STRING_512BYTES,
886            },
887            {
888                'uuid': '000001b44-0000-1000-8000-00805f9b34fb',
889                'properties': 0x02 | 0x08,
890                'permissions': 0x10 | 0x01,
891                'value_type': gatt_characteristic_value_format['string'],
892                'value': STRING_512BYTES,
893            },
894            {
895                'uuid': '000000c55-0000-1000-8000-00805f9b34fb',
896                'properties': 0x02,
897                'permissions': 0x10,
898                'value_type': gatt_characteristic_value_format['string'],
899                'value': STRING_512BYTES,
900            },
901            {
902                'uuid': '0000014dd-0000-1000-8000-00805f9b34fb',
903                'properties': 0x02,
904                'permissions': 0x10,
905                'value_type': gatt_characteristic_value_format['string'],
906                'value': STRING_512BYTES,
907            },
908            {
909                'uuid': '000000c55-0000-1000-8000-00805f9b34fb',
910                'properties': 0x02,
911                'permissions': 0x10,
912                'value_type': gatt_characteristic_value_format['string'],
913                'value': STRING_512BYTES,
914            },
915            {
916                'uuid': '000000c55-0000-1000-8000-00805f9b34fb',
917                'properties': 0x02,
918                'permissions': 0x10,
919                'value_type': gatt_characteristic_value_format['string'],
920                'value': STRING_512BYTES,
921            },
922            {
923                'uuid': '000000c55-0000-1000-8000-00805f9b34fb',
924                'properties': 0x02,
925                'permissions': 0x10,
926                'value_type': gatt_characteristic_value_format['string'],
927                'value': STRING_512BYTES,
928            },
929            {
930                'uuid': '000000c55-0000-1000-8000-00805f9b34fb',
931                'properties': 0x02,
932                'permissions': 0x10,
933                'value_type': gatt_characteristic_value_format['string'],
934                'value': STRING_512BYTES,
935            },
936            {
937                'uuid': '00000008f-0000-1000-8000-00805f9b34fb',
938                'properties': 0x02,
939                'permissions': 0x10,
940                'value_type': gatt_characteristic_value_format['string'],
941                'value': STRING_512BYTES,
942            },
943            {
944                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
945                'properties': 0x02 | 0x08,
946                'permissions': 0x10 | 0x01,
947                'value_type': gatt_characteristic_value_format['byte'],
948                'value': [
949                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
950                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
951                ],
952            },
953            {
954                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
955                'properties': 0x02 | 0x08,
956                'permissions': 0x10 | 0x01,
957                'value_type': gatt_characteristic_value_format['byte'],
958                'value': [
959                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
960                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
961                ],
962            },
963            {
964                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
965                'properties': 0x02 | 0x08,
966                'permissions': 0x10 | 0x01,
967                'value_type': gatt_characteristic_value_format['byte'],
968                'value': [
969                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
970                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
971                ],
972            },
973            {
974                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
975                'properties': 0x02 | 0x08,
976                'permissions': 0x10 | 0x01,
977                'value_type': gatt_characteristic_value_format['byte'],
978                'value': [
979                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
980                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
981                ],
982            },
983            {
984                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
985                'properties': 0x02 | 0x08,
986                'permissions': 0x10 | 0x01,
987                'value_type': gatt_characteristic_value_format['byte'],
988                'value': [
989                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
990                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
991                ],
992            },
993            {
994                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
995                'properties': 0x02 | 0x08,
996                'permissions': 0x10 | 0x01,
997                'value_type': gatt_characteristic_value_format['byte'],
998                'value': [
999                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
1000                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
1001                ],
1002            },
1003            {
1004                'uuid': '000000af2-0000-1000-8000-00805f9b34fb',
1005                'properties': 0x02 | 0x08,
1006                'permissions': 0x10 | 0x01,
1007                'value_type': gatt_characteristic_value_format['byte'],
1008                'value': [
1009                    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
1010                    0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x32
1011                ],
1012            },
1013            {
1014                'uuid': '000002aad-0000-1000-8000-00805f9b34fb',
1015                'properties': 0x02 | 0x08,
1016                'permissions': 0x10 | 0x01,
1017                'value_type': gatt_characteristic_value_format['string'],
1018                'value': STRING_512BYTES,
1019            },
1020            {
1021                'uuid': '000002ab0-0000-1000-8000-00805f9b34fb',
1022                'properties': 0x02 | 0x08,
1023                'permissions': 0x10 | 0x01,
1024                'value_type': gatt_characteristic_value_format['string'],
1025                'value': STRING_512BYTES,
1026            },
1027            {
1028                'uuid': '000002ab3-0000-1000-8000-00805f9b34fb',
1029                'properties': 0x02 | 0x08,
1030                'permissions': 0x10 | 0x01,
1031                'value_type': gatt_characteristic_value_format['string'],
1032                'value': STRING_512BYTES,
1033            },
1034        ]
1035    }]
1036}
1037
1038PTS_TEST = {
1039    'services': [{
1040        'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
1041        'type': gatt_service_types['primary'],
1042        'characteristics': [
1043            {
1044                'uuid': '000018ba-0000-1000-8000-00805f9b34fb',
1045                'properties': 0x02 | 0x08,
1046                'permissions': 0x10 | 0x01,
1047                'value_type': gatt_characteristic_value_format['string'],
1048                'value': STRING_25BYTES,
1049            },
1050            {
1051                'uuid': '000060aa-0000-1000-8000-00805f9b34fb',
1052                'properties': 0x02 | 0x08,
1053                'permissions': 0x10 | 0x01,
1054                'value_type': gatt_characteristic_value_format['string'],
1055                'value': STRING_25BYTES,
1056            },
1057        ]
1058    }]
1059}
1060
1061# Corresponds to the PTS defined LARGE_DB_3
1062LARGE_DB_3 = {
1063    'services': [
1064        {
1065            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
1066            'type': gatt_service_types['primary'],
1067            'characteristics': [
1068                {
1069                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
1070                    'instance_id': 0x0003,
1071                    'properties': 0x0a,
1072                    'permissions': gatt_characteristic['permission_read'] |
1073                    gatt_characteristic['permission_write'],
1074                    'value_type': gatt_characteristic_value_format['byte'],
1075                    'value': [0x04],
1076                },
1077                {
1078                    'uuid': '0000b004-0000-1000-8000-00805f9b34fb',
1079                    'instance_id': 0x0013,
1080                    'properties': 0x10,
1081                    'permissions': 0x17,
1082                    'value_type': gatt_characteristic_value_format['byte'],
1083                    'value': [0x04],
1084                    'descriptors': [
1085                        {
1086                            'uuid': gatt_char_desc_uuids['char_ext_props'],
1087                            'permissions': gatt_descriptor['permission_read'] |
1088                            gatt_descriptor['permission_write'],
1089                            'value': [0x09]
1090                        },
1091                        {
1092                            'uuid': gatt_char_desc_uuids['char_user_desc'],
1093                            'permissions': gatt_descriptor['permission_read'] |
1094                            gatt_descriptor['permission_write'],
1095                            'value': [0x22]
1096                        },
1097                        {
1098                            'uuid': gatt_char_desc_uuids['client_char_cfg'],
1099                            'permissions': gatt_descriptor['permission_read'] |
1100                            gatt_descriptor['permission_write'],
1101                            'value': [0x01, 0x00]
1102                        },
1103                        {
1104                            'uuid': gatt_char_desc_uuids['server_char_cfg'],
1105                            'permissions': gatt_descriptor['permission_read'] |
1106                            gatt_descriptor['permission_write'],
1107                            'value': [0x22]
1108                        },
1109                        {
1110                            'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
1111                            'permissions': gatt_descriptor['permission_read'] |
1112                            gatt_descriptor['permission_write'],
1113                            'value': [0x22]
1114                        },
1115                        {
1116                            'uuid': gatt_char_desc_uuids['char_agreg_fmt'],
1117                            'permissions': gatt_descriptor['permission_read'] |
1118                            gatt_descriptor['permission_write'],
1119                            'value': [0x22]
1120                        },
1121                        {
1122                            'uuid': gatt_char_desc_uuids['char_valid_range'],
1123                            'permissions': gatt_descriptor['permission_read'] |
1124                            gatt_descriptor['permission_write'],
1125                            'value': [0x22]
1126                        },
1127                        {
1128                            'uuid':
1129                            gatt_char_desc_uuids['external_report_reference'],
1130                            'permissions': gatt_descriptor['permission_read'] |
1131                            gatt_descriptor['permission_write'],
1132                            'value': [0x22]
1133                        },
1134                        {
1135                            'uuid': gatt_char_desc_uuids['report_reference'],
1136                            'permissions': gatt_descriptor['permission_read'] |
1137                            gatt_descriptor['permission_write'],
1138                            'value': [0x22]
1139                        },
1140                    ]
1141                },
1142                {
1143                    'uuid': gatt_char_types['service_changed'],
1144                    'instance_id': 0x0023,
1145                    'properties': gatt_characteristic['property_read'],
1146                    'permissions': gatt_characteristic['permission_read'] |
1147                    gatt_characteristic['permission_write'],
1148                    'value_type': gatt_characteristic_value_format['string'],
1149                    'value': '333334444455555666667777788888999990000011111',
1150                },
1151                {
1152                    'uuid': gatt_char_types['appearance'],
1153                    'properties': gatt_characteristic['property_read'],
1154                    'permissions': gatt_characteristic['permission_read'] |
1155                    gatt_characteristic['permission_write'],
1156                    'value_type': gatt_characteristic_value_format['string'],
1157                    'value': '333334444455555666667777788888999990000011111',
1158                },
1159                {
1160                    'uuid': gatt_char_types['peripheral_priv_flag'],
1161                    'properties': gatt_characteristic['property_read'],
1162                    'permissions': gatt_characteristic['permission_read'] |
1163                    gatt_characteristic['permission_write'],
1164                    'value_type': gatt_characteristic_value_format['string'],
1165                    'value': '333334444455555666667777788888999990000011111',
1166                },
1167                {
1168                    'uuid': gatt_char_types['reconnection_address'],
1169                    'properties': gatt_characteristic['property_read'],
1170                    'permissions': gatt_characteristic['permission_read'] |
1171                    gatt_characteristic['permission_write'],
1172                    'value_type': gatt_characteristic_value_format['string'],
1173                    'value': '333334444455555666667777788888999990000011111',
1174                },
1175                {
1176                    'uuid': gatt_char_types['system_id'],
1177                    'properties': gatt_characteristic['property_read'],
1178                    'permissions': gatt_characteristic['permission_read'] |
1179                    gatt_characteristic['permission_write'],
1180                    'value_type': gatt_characteristic_value_format['string'],
1181                    'value': '333334444455555666667777788888999990000011111',
1182                },
1183                {
1184                    'uuid': gatt_char_types['model_number_string'],
1185                    'properties': gatt_characteristic['property_read'],
1186                    'permissions': gatt_characteristic['permission_read'] |
1187                    gatt_characteristic['permission_write'],
1188                    'value_type': gatt_characteristic_value_format['string'],
1189                    'value': '333334444455555666667777788888999990000011111',
1190                },
1191                {
1192                    'uuid': gatt_char_types['serial_number_string'],
1193                    'properties': gatt_characteristic['property_read'],
1194                    'permissions': gatt_characteristic['permission_read'] |
1195                    gatt_characteristic['permission_write'],
1196                    'value_type': gatt_characteristic_value_format['string'],
1197                    'value': '333334444455555666667777788888999990000011111',
1198                },
1199                {
1200                    'uuid': gatt_char_types['firmware_revision_string'],
1201                    'properties': gatt_characteristic['property_read'],
1202                    'permissions': gatt_characteristic['permission_read'] |
1203                    gatt_characteristic['permission_write'],
1204                    'value_type': gatt_characteristic_value_format['string'],
1205                    'value': '333334444455555666667777788888999990000011111',
1206                },
1207                {
1208                    'uuid': gatt_char_types['hardware_revision_string'],
1209                    'properties': gatt_characteristic['property_read'],
1210                    'permissions': gatt_characteristic['permission_read'] |
1211                    gatt_characteristic['permission_write'],
1212                    'value_type': gatt_characteristic_value_format['string'],
1213                    'value': '333334444455555666667777788888999990000011111',
1214                },
1215                {
1216                    'uuid': gatt_char_types['software_revision_string'],
1217                    'properties': gatt_characteristic['property_read'],
1218                    'permissions': gatt_characteristic['permission_read'] |
1219                    gatt_characteristic['permission_write'],
1220                    'value_type': gatt_characteristic_value_format['string'],
1221                    'value': '333334444455555666667777788888999990000011111',
1222                },
1223                {
1224                    'uuid': gatt_char_types['manufacturer_name_string'],
1225                    'properties': gatt_characteristic['property_read'],
1226                    'permissions': gatt_characteristic['permission_read'] |
1227                    gatt_characteristic['permission_write'],
1228                    'value_type': gatt_characteristic_value_format['string'],
1229                    'value': '333334444455555666667777788888999990000011111',
1230                },
1231                {
1232                    'uuid': gatt_char_types['pnp_id'],
1233                    'properties': gatt_characteristic['property_read'],
1234                    'permissions': gatt_characteristic['permission_read'] |
1235                    gatt_characteristic['permission_write'],
1236                    'value_type': gatt_characteristic_value_format['string'],
1237                    'value': '333334444455555666667777788888999990000011111',
1238                },
1239            ]
1240        },
1241        {
1242            'uuid': '0000a00d-0000-1000-8000-00805f9b34fb',
1243            'type': gatt_service_types['secondary'],
1244            'handles': 5,
1245            'characteristics': [{
1246                'uuid': '0000b00c-0000-1000-8000-00805f9b34fb',
1247                'instance_id': 0x0023,
1248                'properties': gatt_characteristic['property_read'],
1249                'permissions': gatt_characteristic['permission_read'],
1250                'value_type': gatt_characteristic_value_format['byte'],
1251                'value': [0x0c],
1252            }, {
1253                'uuid': '0000b00b-0000-0000-0123-456789abcdef',
1254                'instance_id': 0x0025,
1255                'properties': gatt_characteristic['property_read'],
1256                'permissions': gatt_characteristic['permission_read'],
1257                'value_type': gatt_characteristic_value_format['byte'],
1258                'value': [0x0b],
1259            }]
1260        },
1261        {
1262            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
1263            'type': gatt_service_types['primary'],
1264            'characteristics': [{
1265                'uuid': '0000b008-0000-1000-8000-00805f9b34fb',
1266                'instance_id': 0x0032,
1267                'properties': gatt_characteristic['property_read'],
1268                'permissions': gatt_characteristic['permission_read'],
1269                'value_type': gatt_characteristic_value_format['byte'],
1270                'value': [0x08],
1271            }]
1272        },
1273        {
1274            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
1275            'type': gatt_service_types['primary'],
1276            'characteristics': [{
1277                'uuid': '0000b007-0000-1000-8000-00805f9b34fb',
1278                'instance_id': 0x0042,
1279                'properties': gatt_characteristic['property_write'],
1280                'permissions': gatt_characteristic['permission_write'],
1281                'value_type': gatt_characteristic_value_format['byte'],
1282                'value': [0x07],
1283            }]
1284        },
1285        {
1286            'uuid': '0000a00b-0000-1000-8000-00805f9b34fb',
1287            'type': gatt_service_types['primary'],
1288            'characteristics': [{
1289                'uuid': '0000b006-0000-1000-8000-00805f9b34fb',
1290                'instance_id': 0x0052,
1291                'properties': 0x3e,
1292                'permissions': gatt_characteristic['permission_write'] |
1293                gatt_characteristic['permission_read'],
1294                'value_type': gatt_characteristic_value_format['byte'],
1295                'value': [0x06],
1296            }]
1297        },
1298        {
1299            'uuid': '0000a00a-0000-1000-8000-00805f9b34fb',
1300            'type': gatt_service_types['primary'],
1301            'handles': 10,
1302            'characteristics': [{
1303                'uuid': '0000b001-0000-1000-8000-00805f9b34fb',
1304                'instance_id': 0x0074,
1305                'properties': gatt_characteristic['property_read'],
1306                'permissions': gatt_characteristic['permission_read'],
1307                'value_type': gatt_characteristic_value_format['byte'],
1308                'value': [0x01],
1309            }, {
1310                'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1311                'instance_id': 0x0076,
1312                'properties': 0x0a,
1313                'permissions': gatt_characteristic['permission_read'] |
1314                gatt_characteristic['permission_write'],
1315                'value_type': gatt_characteristic_value_format['string'],
1316                'value': '11111222223333344444555556666677777888889999900000',
1317            }, {
1318                'uuid': '0000b003-0000-1000-8000-00805f9b34fb',
1319                'instance_id': 0x0078,
1320                'properties': gatt_characteristic['property_write'],
1321                'permissions': gatt_characteristic['permission_write'],
1322                'value_type': gatt_characteristic_value_format['byte'],
1323                'value': [0x03],
1324            }]
1325        },
1326        {
1327            'uuid': '0000a00c-0000-0000-0123-456789abcdef',
1328            'type': gatt_service_types['primary'],
1329            'handles': 10,
1330            'characteristics': [{
1331                'uuid': '0000b009-0000-0000-0123-456789abcdef',
1332                'instance_id': 0x0082,
1333                'properties': 0x8a,
1334                'permissions': gatt_characteristic['permission_read'] |
1335                gatt_characteristic['permission_write'],
1336                'value_type': gatt_characteristic_value_format['byte'],
1337                'value': [0x09],
1338                'descriptors': [
1339                    {
1340                        'uuid': '0000b009-0000-0000-0123-456789abcdef',
1341                        'permissions': gatt_descriptor['permission_read'] |
1342                        gatt_descriptor['permission_write'],
1343                        'value': [0x09]
1344                    },
1345                    {
1346                        'uuid': '0000d9d2-0000-0000-0123-456789abcdef',
1347                        'permissions': gatt_descriptor['permission_read'] |
1348                        gatt_descriptor['permission_write'],
1349                        'value': [0x22]
1350                    },
1351                    {
1352                        'uuid': gatt_char_desc_uuids['char_ext_props'],
1353                        'permissions': gatt_descriptor['permission_read'],
1354                        'value': [0x01, 0x00]
1355                    },
1356                    {
1357                        'uuid': '0000d9d3-0000-0000-0123-456789abcdef',
1358                        'permissions': gatt_descriptor['permission_write'],
1359                        'value': [0x22]
1360                    },
1361                ]
1362            }]
1363        },
1364        {
1365            'uuid': '0000a00b-0000-0000-0123-456789abcdef',
1366            'type': gatt_service_types['primary'],
1367            'characteristics': [{
1368                'uuid': '0000b009-0000-0000-0123-456789abcdef',
1369                'instance_id': 0x0092,
1370                'properties': 0x8a,
1371                'permissions': gatt_characteristic['permission_read'] |
1372                gatt_characteristic['permission_write'],
1373                'value_type': gatt_characteristic_value_format['byte'],
1374                'value': [0x05],
1375                'descriptors': [
1376                    {
1377                        'uuid': gatt_char_desc_uuids['char_user_desc'],
1378                        'permissions': gatt_descriptor['permission_read'] |
1379                        gatt_descriptor['permission_write'],
1380                        'value': [0] * 26
1381                    },
1382                    {
1383                        'uuid': gatt_char_desc_uuids['char_ext_props'],
1384                        'permissions': gatt_descriptor['permission_read'],
1385                        'value': [0x03, 0x00]
1386                    },
1387                    {
1388                        'uuid': '0000d5d4-0000-0000-0123-456789abcdef',
1389                        'permissions': gatt_descriptor['permission_read'],
1390                        'value': [0x44]
1391                    },
1392                    {
1393                        'uuid': gatt_char_desc_uuids['char_fmt_uuid'],
1394                        'permissions': gatt_descriptor['permission_read'],
1395                        'value': [0x04, 0x00, 0x01, 0x30, 0x01, 0x11, 0x31]
1396                    },
1397                ]
1398            }]
1399        },
1400        {
1401            'uuid': '0000a00c-0000-0000-0123-456789abcdef',
1402            'type': gatt_service_types['primary'],
1403            'characteristics': [
1404                {
1405                    'uuid': '0000b00a-0000-1000-8000-00805f9b34fb',
1406                    'instance_id': 0x00a2,
1407                    'properties': gatt_characteristic['property_read'],
1408                    'permissions': gatt_characteristic['permission_read'],
1409                    'value_type': gatt_characteristic_value_format['byte'],
1410                    'value': [0x0a],
1411                },
1412                {
1413                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1414                    'instance_id': 0x00a4,
1415                    'properties': 0x0a,
1416                    'permissions': gatt_characteristic['permission_read'] |
1417                    gatt_characteristic['permission_write'],
1418                    'value_type': gatt_characteristic_value_format['string'],
1419                    'value': '111112222233333444445',
1420                },
1421                {
1422                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1423                    'instance_id': 0x00a6,
1424                    'properties': 0x0a,
1425                    'permissions': gatt_characteristic['permission_read'] |
1426                    gatt_characteristic['permission_write'],
1427                    'value_type': gatt_characteristic_value_format['string'],
1428                    'value': '2222233333444445555566',
1429                },
1430                {
1431                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1432                    'instance_id': 0x00a8,
1433                    'properties': 0x0a,
1434                    'permissions': gatt_characteristic['permission_read'] |
1435                    gatt_characteristic['permission_write'],
1436                    'value_type': gatt_characteristic_value_format['string'],
1437                    'value': '33333444445555566666777',
1438                },
1439                {
1440                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1441                    'instance_id': 0x00aa,
1442                    'properties': 0x0a,
1443                    'permissions': gatt_characteristic['permission_read'] |
1444                    gatt_characteristic['permission_write'],
1445                    'value_type': gatt_characteristic_value_format['string'],
1446                    'value': '1111122222333334444455555666667777788888999',
1447                },
1448                {
1449                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1450                    'instance_id': 0x00ac,
1451                    'properties': 0x0a,
1452                    'permissions': gatt_characteristic['permission_read'] |
1453                    gatt_characteristic['permission_write'],
1454                    'value_type': gatt_characteristic_value_format['string'],
1455                    'value': '22222333334444455555666667777788888999990000',
1456                },
1457                {
1458                    'uuid': '0000b002-0000-1000-8000-00805f9b34fb',
1459                    'instance_id': 0x00ae,
1460                    'properties': 0x0a,
1461                    'permissions': gatt_characteristic['permission_read'] |
1462                    gatt_characteristic['permission_write'],
1463                    'value_type': gatt_characteristic_value_format['string'],
1464                    'value': '333334444455555666667777788888999990000011111',
1465                },
1466            ]
1467        },
1468        {
1469            'uuid': '0000a00e-0000-1000-8000-00805f9b34fb',
1470            'type': gatt_service_types['primary'],
1471            'characteristics': [{
1472                'uuid': '0000b00d-0000-1000-8000-00805f9b34fb',
1473                'instance_id': 0xffff,
1474                'properties': gatt_characteristic['property_read'],
1475                'permissions': gatt_characteristic['permission_read'],
1476                'value_type': gatt_characteristic_value_format['byte'],
1477                'value': [0x0d],
1478            }]
1479        },
1480    ]
1481}
1482
1483TEST_DB_1 = {
1484    'services': [{
1485        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1486        'type': gatt_service_types['primary'],
1487        'handles': 4,
1488        'characteristics': [{
1489            'uuid': '00002a29-0000-1000-8000-00805f9b34fb',
1490            'properties': gatt_characteristic['property_read'] |
1491            gatt_characteristic['property_write'],
1492            'permissions': gatt_characteristic['permission_read'] |
1493            gatt_characteristic['permission_write'],
1494            'value_type': gatt_characteristic_value_format['string'],
1495            'value': 'test',
1496            'instance_id': 0x002a,
1497            'descriptors': [{
1498                'uuid': gatt_char_desc_uuids['char_user_desc'],
1499                'permissions': gatt_descriptor['permission_read'],
1500                'value': [0x01]
1501            }]
1502        }]
1503    }]
1504}
1505
1506TEST_DB_2 = {
1507    'services': [{
1508        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1509        'type': gatt_service_types['primary'],
1510        'handles': 4,
1511        'characteristics': [{
1512            'uuid': '00002a29-0000-1000-8000-00805f9b34fb',
1513            'properties': gatt_characteristic['property_read'],
1514            'permissions':
1515            gatt_characteristic['permission_read_encrypted_mitm'],
1516            'value_type': gatt_characteristic_value_format['string'],
1517            'value': 'test',
1518            'instance_id': 0x002a,
1519        }, {
1520            'uuid': '00002a30-0000-1000-8000-00805f9b34fb',
1521            'properties': gatt_characteristic['property_read'],
1522            'permissions':
1523            gatt_characteristic['permission_read_encrypted_mitm'],
1524            'value_type': gatt_characteristic_value_format['string'],
1525            'value': 'test',
1526            'instance_id': 0x002b,
1527        }]
1528    }]
1529}
1530
1531TEST_DB_3 = {
1532    'services': [{
1533        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1534        'type': gatt_service_types['primary'],
1535        'handles': 4,
1536        'characteristics': [{
1537            'uuid': '00002a29-0000-1000-8000-00805f9b34fb',
1538            'properties': gatt_characteristic['property_read'] |
1539            gatt_characteristic['property_write'],
1540            'permissions': gatt_characteristic['permission_read'] |
1541            gatt_characteristic['permission_write'],
1542            'value_type': gatt_characteristic_value_format['string'],
1543            'value': 'test',
1544            'instance_id': 0x002a,
1545            'descriptors': [{
1546                'uuid': gatt_char_desc_uuids['char_user_desc'],
1547                'permissions': gatt_descriptor['permission_read'],
1548                'value': [0x01]
1549            }, {
1550                'uuid': '00002a20-0000-1000-8000-00805f9b34fb',
1551                'permissions': gatt_descriptor['permission_read'] |
1552                gatt_descriptor['permission_write'],
1553                'instance_id': 0x002c,
1554                'value': [0x01]
1555            }]
1556        }, {
1557            'uuid': '00002a30-0000-1000-8000-00805f9b34fb',
1558            'properties': gatt_characteristic['property_read'] |
1559            gatt_characteristic['property_write'],
1560            'permissions': gatt_characteristic['permission_read'] |
1561            gatt_characteristic['permission_write'],
1562            'value_type': gatt_characteristic_value_format['string'],
1563            'value': 'test',
1564            'instance_id': 0x002b,
1565        }]
1566    }]
1567}
1568
1569TEST_DB_4 = {
1570    'services': [{
1571        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1572        'type': gatt_service_types['primary'],
1573        'handles': 4,
1574        'characteristics': [{
1575            'uuid': '00002a29-0000-1000-8000-00805f9b34fb',
1576            'properties': gatt_characteristic['property_write_no_response'],
1577            'permissions': gatt_characteristic['permission_read'],
1578            'value_type': gatt_characteristic_value_format['string'],
1579            'value': "test",
1580            'instance_id': 0x002a,
1581            'descriptors': [{
1582                'uuid': gatt_char_desc_uuids['char_user_desc'],
1583                'permissions':
1584                gatt_descriptor['permission_read_encrypted_mitm'],
1585                'value': [0] * 512
1586            }]
1587        }]
1588    }]
1589}
1590
1591TEST_DB_5 = {
1592    'services': [{
1593        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1594        'type': gatt_service_types['primary'],
1595        'characteristics': [{
1596            'uuid': 'b2c83efa-34ca-11e6-ac61-9e71128cae77',
1597            'properties': gatt_characteristic['property_write'] |
1598            gatt_characteristic['property_read'] |
1599            gatt_characteristic['property_notify'],
1600            'permissions': gatt_characteristic['permission_read'] |
1601            gatt_characteristic['permission_write'],
1602            'value_type': gatt_characteristic_value_format['byte'],
1603            'value': [0x1],
1604            'instance_id': 0x002c,
1605            'descriptors': [{
1606                'uuid': '00002902-0000-1000-8000-00805f9b34fb',
1607                'permissions': gatt_descriptor['permission_read'] |
1608                gatt_descriptor['permission_write'],
1609            }]
1610        }]
1611    }]
1612}
1613
1614TEST_DB_6 = {
1615    'services': [{
1616        'uuid': '0000180d-0000-1000-8000-00805f9b34fb',
1617        'type': gatt_service_types['primary'],
1618        'handles': 4,
1619        'characteristics': [{
1620            'uuid': '00002a29-0000-1000-8000-00805f9b34fb',
1621            'properties': gatt_characteristic['property_read'],
1622            'permissions': gatt_characteristic['permission_read'],
1623            'value_type': gatt_characteristic_value_format['string'],
1624            'value': 'test',
1625            'instance_id': 0x002a,
1626            'descriptors': [{
1627                'uuid': '00002a19-0000-1000-8000-00805f9b34fb',
1628                'permissions': gatt_descriptor['permission_read'],
1629                'value': [0x01] * 30
1630            }]
1631        }]
1632    }]
1633}
1634
1635SIMPLE_READ_DESCRIPTOR = {
1636    'services': [{
1637        'uuid': '0000a00a-0000-1000-8000-00805f9b34fb',
1638        'type': gatt_service_types['primary'],
1639        'characteristics': [{
1640            'uuid': 'aa7edd5a-4d1d-4f0e-883a-d145616a1630',
1641            'properties': gatt_characteristic['property_read'],
1642            'permissions': gatt_characteristic['permission_read'],
1643            'instance_id': 0x002a,
1644            'value_type': gatt_characteristic_value_format['string'],
1645            'value': 'Test Database',
1646            'descriptors': [{
1647                'uuid': gatt_char_desc_uuids['client_char_cfg'],
1648                'permissions': gatt_descriptor['permission_read'],
1649            }]
1650        }]
1651    }]
1652}
1653
1654CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = {
1655    'services': [{
1656        'uuid': '0000a00a-0000-1000-8000-00805f9b34fb',
1657        'type': gatt_service_types['primary'],
1658        'characteristics': [{
1659            'uuid': 'aa7edd5a-4d1d-4f0e-883a-d145616a1630',
1660            'properties': gatt_characteristic['property_write_no_response'],
1661            'permissions': gatt_characteristic['permission_write'] |
1662            gatt_characteristic['permission_read'],
1663            'instance_id': 0x0042,
1664            'value_type': gatt_characteristic_value_format['string'],
1665            'value': 'Test Database'
1666        }, {
1667            'uuid': 'aa7edd6a-4d1d-4f0e-883a-d145616a1630',
1668            'properties': gatt_characteristic['property_write_no_response'],
1669            'permissions': gatt_characteristic['permission_write'] |
1670            gatt_characteristic['permission_read'],
1671            'instance_id': 0x004d,
1672            'value_type': gatt_characteristic_value_format['string'],
1673            'value': 'Test Database'
1674        }]
1675    }]
1676}
1677
1678GATT_SERVER_DB_MAPPING = {
1679    'LARGE_DB_1': LARGE_DB_1,
1680    'LARGE_DB_3': LARGE_DB_3,
1681    'INVALID_SMALL_DATABASE': INVALID_SMALL_DATABASE,
1682    'SIMPLE_READ_DESCRIPTOR': SIMPLE_READ_DESCRIPTOR,
1683    'CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE':
1684    CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE,
1685    'TEST_DB_1': TEST_DB_1,
1686    'TEST_DB_2': TEST_DB_2,
1687    'TEST_DB_3': TEST_DB_3,
1688    'TEST_DB_4': TEST_DB_4,
1689    'TEST_DB_5': TEST_DB_5,
1690    'LARGE_DB_3_PLUS': LARGE_DB_3,
1691    'DB_TEST': DB_TEST,
1692    'PTS_TEST': PTS_TEST,
1693    'PTS_TEST2': PTS_TEST2,
1694    'TEST_DB_6': TEST_DB_6,
1695}
1696