• 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
17### Generic Constants Begin ###
18
19bt_default_timeout = 15
20default_rfcomm_timeout_ms = 10000
21default_bluetooth_socket_timeout_ms = 10000
22pan_connect_timeout = 5
23bt_discovery_timeout = 3
24small_timeout = 0.0001
25
26# Time delay (in seconds) at the end of each LE CoC Test to give sufficient time
27# for the ACL LE link to be disconnected. The ACL link stays connected after
28# L2CAP disconnects.  An example of the timeout is L2CAP_LINK_INACTIVITY_TOUT.
29# This delay must be greater than the maximum of these timeouts.
30# TODO: Investigate the use of broadcast intent
31# BluetoothDevice.ACTION_ACL_DISCONNECTED to replace this delay method.
32l2cap_max_inactivity_delay_after_disconnect = 5
33
34# LE specifications related constants
35le_connection_interval_time_step_ms = 1.25
36le_default_supervision_timeout = 2000
37default_le_data_length = 23
38default_le_connection_interval_ms = 30
39le_connection_event_time_step_ms = 0.625
40
41# Headers of LE L2CAP Connection-oriented Channels. See section 3.4, Vol 3, Part A, Version 5.0.
42l2cap_header_size = 4
43l2cap_coc_sdu_length_field_size = 2
44l2cap_coc_header_size = l2cap_header_size + l2cap_coc_sdu_length_field_size
45
46java_integer = {"min": -2147483648, "max": 2147483647}
47
48btsnoop_log_path_on_device = "/data/misc/bluetooth/logs/btsnoop_hci.log"
49btsnoop_last_log_path_on_device = \
50    "/data/misc/bluetooth/logs/btsnoop_hci.log.last"
51pairing_variant_passkey_confirmation = 2
52
53# Callback strings
54scan_result = "BleScan{}onScanResults"
55scan_failed = "BleScan{}onScanFailed"
56batch_scan_result = "BleScan{}onBatchScanResult"
57adv_fail = "BleAdvertise{}onFailure"
58adv_succ = "BleAdvertise{}onSuccess"
59bluetooth_off = "BluetoothStateChangedOff"
60bluetooth_on = "BluetoothStateChangedOn"
61mtu_changed = "GattConnect{}onMtuChanged"
62advertising_set_started = "AdvertisingSet{}onAdvertisingSetStarted"
63advertising_set_stopped = "AdvertisingSet{}onAdvertisingSetStopped"
64advertising_set_on_own_address_read = "AdvertisingSet{}onOwnAddressRead"
65advertising_set_enabled = "AdvertisingSet{}onAdvertisingEnabled"
66advertising_set_data_set = "AdvertisingSet{}onAdvertisingDataSet"
67advertising_set_scan_response_set = "AdvertisingSet{}onScanResponseDataSet"
68advertising_set_parameters_update = \
69    "AdvertisingSet{}onAdvertisingParametersUpdated"
70advertising_set_periodic_parameters_updated = \
71    "AdvertisingSet{}onPeriodicAdvertisingParametersUpdated"
72advertising_set_periodic_data_set = \
73    "AdvertisingSet{}onPeriodicAdvertisingDataSet"
74advertising_set_periodic_enable = "AdvertisingSet{}onPeriodicAdvertisingEnable"
75bluetooth_profile_connection_state_changed = \
76    "BluetoothProfileConnectionStateChanged"
77bluetooth_le_on = "BleStateChangedOn"
78bluetooth_le_off = "BleStateChangedOff"
79bluetooth_a2dp_codec_config_changed = "BluetoothA2dpCodecConfigChanged"
80# End Callback Strings
81
82batch_scan_not_supported_list = [
83    "Nexus 4",
84    "Nexus 5",
85    "Nexus 7",
86]
87
88### Generic Constants End ###
89
90### Bluetooth Constants Begin ###
91
92# rfcomm test uuids
93rfcomm_secure_uuid = "fa87c0d0-afac-11de-8a39-0800200c9a66"
94rfcomm_insecure_uuid = "8ce255c0-200a-11e0-ac64-0800200c9a66"
95
96# bluetooth socket connection test uuid
97bluetooth_socket_conn_test_uuid = "12345678-1234-5678-9abc-123456789abc"
98
99# Bluetooth Adapter Scan Mode Types
100bt_scan_mode_types = {
101    "state_off": -1,
102    "none": 0,
103    "connectable": 1,
104    "connectable_discoverable": 3
105}
106
107# Bluetooth Adapter State Constants
108bt_adapter_states = {
109    "off": 10,
110    "turning_on": 11,
111    "on": 12,
112    "turning_off": 13,
113    "ble_turning_on": 14,
114    "ble_on": 15,
115    "ble_turning_off": 16
116}
117
118# Should be kept in sync with BluetoothProfile.java
119bt_profile_constants = {
120    "headset": 1,
121    "a2dp": 2,
122    "health": 3,
123    "input_device": 4,
124    "pan": 5,
125    "pbap_server": 6,
126    "gatt": 7,
127    "gatt_server": 8,
128    "map": 9,
129    "sap": 10,
130    "a2dp_sink": 11,
131    "avrcp_controller": 12,
132    "headset_client": 16,
133    "pbap_client": 17,
134    "map_mce": 18
135}
136
137# Bluetooth RFCOMM UUIDs as defined by the SIG
138bt_rfcomm_uuids = {
139    "default_uuid": "457807c0-4897-11df-9879-0800200c9a66",
140    "base_uuid": "00000000-0000-1000-8000-00805F9B34FB",
141    "sdp": "00000001-0000-1000-8000-00805F9B34FB",
142    "udp": "00000002-0000-1000-8000-00805F9B34FB",
143    "rfcomm": "00000003-0000-1000-8000-00805F9B34FB",
144    "tcp": "00000004-0000-1000-8000-00805F9B34FB",
145    "tcs_bin": "00000005-0000-1000-8000-00805F9B34FB",
146    "tcs_at": "00000006-0000-1000-8000-00805F9B34FB",
147    "att": "00000007-0000-1000-8000-00805F9B34FB",
148    "obex": "00000008-0000-1000-8000-00805F9B34FB",
149    "ip": "00000009-0000-1000-8000-00805F9B34FB",
150    "ftp": "0000000A-0000-1000-8000-00805F9B34FB",
151    "http": "0000000C-0000-1000-8000-00805F9B34FB",
152    "wsp": "0000000E-0000-1000-8000-00805F9B34FB",
153    "bnep": "0000000F-0000-1000-8000-00805F9B34FB",
154    "upnp": "00000010-0000-1000-8000-00805F9B34FB",
155    "hidp": "00000011-0000-1000-8000-00805F9B34FB",
156    "hardcopy_control_channel": "00000012-0000-1000-8000-00805F9B34FB",
157    "hardcopy_data_channel": "00000014-0000-1000-8000-00805F9B34FB",
158    "hardcopy_notification": "00000016-0000-1000-8000-00805F9B34FB",
159    "avctp": "00000017-0000-1000-8000-00805F9B34FB",
160    "avdtp": "00000019-0000-1000-8000-00805F9B34FB",
161    "cmtp": "0000001B-0000-1000-8000-00805F9B34FB",
162    "mcap_control_channel": "0000001E-0000-1000-8000-00805F9B34FB",
163    "mcap_data_channel": "0000001F-0000-1000-8000-00805F9B34FB",
164    "l2cap": "00000100-0000-1000-8000-00805F9B34FB"
165}
166
167# Should be kept in sync with BluetoothProfile#STATE_* constants.
168bt_profile_states = {
169    "disconnected": 0,
170    "connecting": 1,
171    "connected": 2,
172    "disconnecting": 3
173}
174
175# Access Levels from BluetoothDevice.
176bt_access_levels = {"access_allowed": 1, "access_denied": 2}
177
178# Priority levels as defined in BluetoothProfile.java.
179bt_priority_levels = {
180    "auto_connect": 1000,
181    "on": 100,
182    "off": 0,
183    "undefined": -1
184}
185
186# A2DP codec configuration constants as defined in
187# frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
188codec_types = {
189    'SBC': 0,
190    'AAC': 1,
191    'APTX': 2,
192    'APTX-HD': 3,
193    'LDAC': 4,
194    'MAX': 5,
195    'INVALID': 1000000
196}
197
198codec_priorities = {
199    'DISABLED': -1,
200    'DEFAULT': 0,
201    'HIGHEST': 1000000
202}
203
204sample_rates = {
205    'NONE': 0,
206    '44100': 0x1 << 0,
207    '48000': 0x1 << 1,
208    '88200': 0x1 << 2,
209    '96000': 0x1 << 3,
210    '176400': 0x1 << 4,
211    '192000': 0x1 << 5
212}
213
214bits_per_samples = {
215    'NONE': 0,
216    '16': 0x1 << 0,
217    '24': 0x1 << 1,
218    '32': 0x1 << 2
219}
220
221channel_modes = {
222    'NONE': 0,
223    'MONO': 0x1 << 0,
224    'STEREO': 0x1 << 1
225}
226
227# Bluetooth HID constants.
228hid_connection_timeout = 5
229
230# Bluetooth HID EventFacade constants.
231hid_on_set_report_event = "onSetReport"
232hid_on_get_report_event = "onGetReport"
233hid_on_set_protocol_event = "onSetProtocol"
234hid_on_intr_data_event = "onInterruptData"
235hid_on_virtual_cable_unplug_event = "onVirtualCableUnplug"
236hid_id_keyboard = 1
237hid_id_mouse = 2
238hid_default_event_timeout = 15
239hid_default_set_report_payload = "Haha"
240
241### Bluetooth Constants End ###
242
243### Bluetooth Low Energy Constants Begin ###
244
245# Bluetooth Low Energy scan callback types
246ble_scan_settings_callback_types = {
247    "all_matches": 1,
248    "first_match": 2,
249    "match_lost": 4,
250    "found_and_lost": 6
251}
252
253# Bluetooth Low Energy scan settings match mode
254ble_scan_settings_match_modes = {"aggresive": 1, "sticky": 2}
255
256# Bluetooth Low Energy scan settings match nums
257ble_scan_settings_match_nums = {"one": 1, "few": 2, "max": 3}
258
259# Bluetooth Low Energy scan settings result types
260ble_scan_settings_result_types = {"full": 0, "abbreviated": 1}
261
262# Bluetooth Low Energy scan settings mode
263ble_scan_settings_modes = {
264    "opportunistic": -1,
265    "low_power": 0,
266    "balanced": 1,
267    "low_latency": 2
268}
269
270# Bluetooth Low Energy scan settings report delay millis
271ble_scan_settings_report_delay_milli_seconds = {
272    "min": 0,
273    "max": 9223372036854775807
274}
275
276# Bluetooth Low Energy scan settings phy
277ble_scan_settings_phys = {"1m": 1, "coded": 3, "all_supported": 255}
278
279# Bluetooth Low Energy advertise settings types
280ble_advertise_settings_types = {"non_connectable": 0, "connectable": 1}
281
282# Bluetooth Low Energy advertise settings modes
283ble_advertise_settings_modes = {
284    "low_power": 0,
285    "balanced": 1,
286    "low_latency": 2
287}
288
289# Bluetooth Low Energy advertise settings tx power
290ble_advertise_settings_tx_powers = {
291    "ultra_low": 0,
292    "low": 1,
293    "medium": 2,
294    "high": 3
295}
296
297# Bluetooth Low Energy service uuids for specific devices
298ble_uuids = {
299    "p_service": "0000feef-0000-1000-8000-00805f9b34fb",
300    "hr_service": "0000180d-0000-1000-8000-00805f9b34fb"
301}
302
303# Bluetooth Low Energy advertising error codes
304ble_advertise_error_code = {
305    "data_too_large": 1,
306    "too_many_advertisers": 2,
307    "advertisement_already_started": 3,
308    "bluetooth_internal_failure": 4,
309    "feature_not_supported": 5
310}
311
312### Bluetooth Low Energy Constants End ###
313
314### Bluetooth GATT Constants Begin ###
315
316# Gatt Callback error messages
317gatt_cb_err = {
318    "char_write_req_err":
319    "Characteristic Write Request event not found. Expected {}",
320    "char_write_err":
321    "Characteristic Write event not found. Expected {}",
322    "desc_write_req_err":
323    "Descriptor Write Request event not found. Expected {}",
324    "desc_write_err":
325    "Descriptor Write event not found. Expected {}",
326    "char_read_err":
327    "Characteristic Read event not found. Expected {}",
328    "char_read_req_err":
329    "Characteristic Read Request not found. Expected {}",
330    "desc_read_err":
331    "Descriptor Read event not found. Expected {}",
332    "desc_read_req_err":
333    "Descriptor Read Request event not found. Expected {}",
334    "rd_remote_rssi_err":
335    "Read Remote RSSI event not found. Expected {}",
336    "gatt_serv_disc_err":
337    "GATT Services Discovered event not found. Expected {}",
338    "serv_added_err":
339    "Service Added event not found. Expected {}",
340    "mtu_changed_err":
341    "MTU Changed event not found. Expected {}",
342    "mtu_serv_changed_err":
343    "MTU Server Changed event not found. Expected {}",
344    "gatt_conn_changed_err":
345    "GATT Connection Changed event not found. Expected {}",
346    "char_change_err":
347    "GATT Characteristic Changed event not fond. Expected {}",
348    "phy_read_err":
349    "Phy Read event not fond. Expected {}",
350    "phy_update_err":
351    "Phy Update event not fond. Expected {}",
352    "exec_write_err":
353    "GATT Execute Write event not found. Expected {}"
354}
355
356# GATT callback strings as defined in GattClientFacade.java and
357# GattServerFacade.java implemented callbacks.
358gatt_cb_strings = {
359    "char_write_req": "GattServer{}onCharacteristicWriteRequest",
360    "exec_write": "GattServer{}onExecuteWrite",
361    "char_write": "GattConnect{}onCharacteristicWrite",
362    "desc_write_req": "GattServer{}onDescriptorWriteRequest",
363    "desc_write": "GattConnect{}onDescriptorWrite",
364    "char_read": "GattConnect{}onCharacteristicRead",
365    "char_read_req": "GattServer{}onCharacteristicReadRequest",
366    "desc_read": "GattConnect{}onDescriptorRead",
367    "desc_read_req": "GattServer{}onDescriptorReadRequest",
368    "rd_remote_rssi": "GattConnect{}onReadRemoteRssi",
369    "gatt_serv_disc": "GattConnect{}onServicesDiscovered",
370    "serv_added": "GattServer{}onServiceAdded",
371    "mtu_changed": "GattConnect{}onMtuChanged",
372    "mtu_serv_changed": "GattServer{}onMtuChanged",
373    "gatt_conn_change": "GattConnect{}onConnectionStateChange",
374    "char_change": "GattConnect{}onCharacteristicChanged",
375    "phy_read": "GattConnect{}onPhyRead",
376    "phy_update": "GattConnect{}onPhyUpdate",
377    "serv_phy_read": "GattServer{}onPhyRead",
378    "serv_phy_update": "GattServer{}onPhyUpdate",
379}
380
381# GATT event dictionary of expected callbacks and errors.
382gatt_event = {
383    "char_write_req": {
384        "evt": gatt_cb_strings["char_write_req"],
385        "err": gatt_cb_err["char_write_req_err"]
386    },
387    "exec_write": {
388        "evt": gatt_cb_strings["exec_write"],
389        "err": gatt_cb_err["exec_write_err"]
390    },
391    "char_write": {
392        "evt": gatt_cb_strings["char_write"],
393        "err": gatt_cb_err["char_write_err"]
394    },
395    "desc_write_req": {
396        "evt": gatt_cb_strings["desc_write_req"],
397        "err": gatt_cb_err["desc_write_req_err"]
398    },
399    "desc_write": {
400        "evt": gatt_cb_strings["desc_write"],
401        "err": gatt_cb_err["desc_write_err"]
402    },
403    "char_read": {
404        "evt": gatt_cb_strings["char_read"],
405        "err": gatt_cb_err["char_read_err"]
406    },
407    "char_read_req": {
408        "evt": gatt_cb_strings["char_read_req"],
409        "err": gatt_cb_err["char_read_req_err"]
410    },
411    "desc_read": {
412        "evt": gatt_cb_strings["desc_read"],
413        "err": gatt_cb_err["desc_read_err"]
414    },
415    "desc_read_req": {
416        "evt": gatt_cb_strings["desc_read_req"],
417        "err": gatt_cb_err["desc_read_req_err"]
418    },
419    "rd_remote_rssi": {
420        "evt": gatt_cb_strings["rd_remote_rssi"],
421        "err": gatt_cb_err["rd_remote_rssi_err"]
422    },
423    "gatt_serv_disc": {
424        "evt": gatt_cb_strings["gatt_serv_disc"],
425        "err": gatt_cb_err["gatt_serv_disc_err"]
426    },
427    "serv_added": {
428        "evt": gatt_cb_strings["serv_added"],
429        "err": gatt_cb_err["serv_added_err"]
430    },
431    "mtu_changed": {
432        "evt": gatt_cb_strings["mtu_changed"],
433        "err": gatt_cb_err["mtu_changed_err"]
434    },
435    "gatt_conn_change": {
436        "evt": gatt_cb_strings["gatt_conn_change"],
437        "err": gatt_cb_err["gatt_conn_changed_err"]
438    },
439    "char_change": {
440        "evt": gatt_cb_strings["char_change"],
441        "err": gatt_cb_err["char_change_err"]
442    },
443    "phy_read": {
444        "evt": gatt_cb_strings["phy_read"],
445        "err": gatt_cb_err["phy_read_err"]
446    },
447    "phy_update": {
448        "evt": gatt_cb_strings["phy_update"],
449        "err": gatt_cb_err["phy_update_err"]
450    },
451    "serv_phy_read": {
452        "evt": gatt_cb_strings["serv_phy_read"],
453        "err": gatt_cb_err["phy_read_err"]
454    },
455    "serv_phy_update": {
456        "evt": gatt_cb_strings["serv_phy_update"],
457        "err": gatt_cb_err["phy_update_err"]
458    }
459}
460
461# Matches constants of connection states defined in BluetoothGatt.java
462gatt_connection_state = {
463    "disconnected": 0,
464    "connecting": 1,
465    "connected": 2,
466    "disconnecting": 3,
467    "closed": 4
468}
469
470# Matches constants of Bluetooth GATT Characteristic values as defined
471# in BluetoothGattCharacteristic.java
472gatt_characteristic = {
473    "property_broadcast": 0x01,
474    "property_read": 0x02,
475    "property_write_no_response": 0x04,
476    "property_write": 0x08,
477    "property_notify": 0x10,
478    "property_indicate": 0x20,
479    "property_signed_write": 0x40,
480    "property_extended_props": 0x80,
481    "permission_read": 0x01,
482    "permission_read_encrypted": 0x02,
483    "permission_read_encrypted_mitm": 0x04,
484    "permission_write": 0x10,
485    "permission_write_encrypted": 0x20,
486    "permission_write_encrypted_mitm": 0x40,
487    "permission_write_signed": 0x80,
488    "permission_write_signed_mitm": 0x100,
489    "write_type_default": 0x02,
490    "write_type_no_response": 0x01,
491    "write_type_signed": 0x04,
492}
493
494# Matches constants of Bluetooth GATT Characteristic values as defined
495# in BluetoothGattDescriptor.java
496gatt_descriptor = {
497    "enable_notification_value": [0x01, 0x00],
498    "enable_indication_value": [0x02, 0x00],
499    "disable_notification_value": [0x00, 0x00],
500    "permission_read": 0x01,
501    "permission_read_encrypted": 0x02,
502    "permission_read_encrypted_mitm": 0x04,
503    "permission_write": 0x10,
504    "permission_write_encrypted": 0x20,
505    "permission_write_encrypted_mitm": 0x40,
506    "permission_write_signed": 0x80,
507    "permission_write_signed_mitm": 0x100
508}
509
510# https://www.bluetooth.com/specifications/gatt/descriptors
511gatt_char_desc_uuids = {
512    "char_ext_props": '00002900-0000-1000-8000-00805f9b34fb',
513    "char_user_desc": '00002901-0000-1000-8000-00805f9b34fb',
514    "client_char_cfg": '00002902-0000-1000-8000-00805f9b34fb',
515    "server_char_cfg": '00002903-0000-1000-8000-00805f9b34fb',
516    "char_fmt_uuid": '00002904-0000-1000-8000-00805f9b34fb',
517    "char_agreg_fmt": '00002905-0000-1000-8000-00805f9b34fb',
518    "char_valid_range": '00002906-0000-1000-8000-00805f9b34fb',
519    "external_report_reference": '00002907-0000-1000-8000-00805f9b34fb',
520    "report_reference": '00002908-0000-1000-8000-00805f9b34fb'
521}
522
523# https://www.bluetooth.com/specifications/gatt/characteristics
524gatt_char_types = {
525    "device_name": '00002a00-0000-1000-8000-00805f9b34fb',
526    "appearance": '00002a01-0000-1000-8000-00805f9b34fb',
527    "peripheral_priv_flag": '00002a02-0000-1000-8000-00805f9b34fb',
528    "reconnection_address": '00002a03-0000-1000-8000-00805f9b34fb',
529    "peripheral_pref_conn": '00002a04-0000-1000-8000-00805f9b34fb',
530    "service_changed": '00002a05-0000-1000-8000-00805f9b34fb',
531    "system_id": '00002a23-0000-1000-8000-00805f9b34fb',
532    "model_number_string": '00002a24-0000-1000-8000-00805f9b34fb',
533    "serial_number_string": '00002a25-0000-1000-8000-00805f9b34fb',
534    "firmware_revision_string": '00002a26-0000-1000-8000-00805f9b34fb',
535    "hardware_revision_string": '00002a27-0000-1000-8000-00805f9b34fb',
536    "software_revision_string": '00002a28-0000-1000-8000-00805f9b34fb',
537    "manufacturer_name_string": '00002a29-0000-1000-8000-00805f9b34fb',
538    "pnp_id": '00002a50-0000-1000-8000-00805f9b34fb',
539}
540
541# Matches constants of Bluetooth GATT Characteristic values as defined
542# in BluetoothGattCharacteristic.java
543gatt_characteristic_value_format = {
544    "string": 0x1,
545    "byte": 0x2,
546    "sint8": 0x21,
547    "uint8": 0x11,
548    "sint16": 0x22,
549    "unit16": 0x12,
550    "sint32": 0x24,
551    "uint32": 0x14
552}
553
554# Matches constants of Bluetooth Gatt Service types as defined in
555# BluetoothGattService.java
556gatt_service_types = {"primary": 0, "secondary": 1}
557
558# Matches constants of Bluetooth Gatt Connection Priority values as defined in
559# BluetoothGatt.java
560gatt_connection_priority = {"balanced": 0, "high": 1, "low_power": 2}
561
562# Min and max MTU values
563gatt_mtu_size = {"min": 23, "max": 217}
564
565# Gatt Characteristic attribute lengths
566gatt_characteristic_attr_length = {"attr_1": 1, "attr_2": 3, "attr_3": 15}
567
568# Matches constants of Bluetooth Gatt operations status as defined in
569# BluetoothGatt.java
570gatt_status = {"success": 0, "failure": 0x101}
571
572# Matches constants of Bluetooth transport values as defined in
573# BluetoothDevice.java
574gatt_transport = {"auto": 0x00, "bredr": 0x01, "le": 0x02}
575
576# Matches constants of Bluetooth physical channeling values as defined in
577# BluetoothDevice.java
578gatt_phy = {"1m": 1, "2m": 2, "le_coded": 3}
579
580# Matches constants of Bluetooth physical channeling bitmask values as defined
581# in BluetoothDevice.java
582gatt_phy_mask = {"1m_mask": 1, "2m_mask": 2, "coded_mask": 4}
583
584# Values as defiend in the Bluetooth GATT specification
585gatt_server_responses = {
586    "GATT_SUCCESS": 0x0,
587    "GATT_FAILURE": 0x1,
588    "GATT_READ_NOT_PERMITTED": 0x2,
589    "GATT_WRITE_NOT_PERMITTED": 0x3,
590    "GATT_INVALID_PDU": 0x4,
591    "GATT_INSUFFICIENT_AUTHENTICATION": 0x5,
592    "GATT_REQUEST_NOT_SUPPORTED": 0x6,
593    "GATT_INVALID_OFFSET": 0x7,
594    "GATT_INSUFFICIENT_AUTHORIZATION": 0x8,
595    "GATT_INVALID_ATTRIBUTE_LENGTH": 0xd,
596    "GATT_INSUFFICIENT_ENCRYPTION": 0xf,
597    "GATT_CONNECTION_CONGESTED": 0x8f,
598    "GATT_13_ERR": 0x13,
599    "GATT_12_ERR": 0x12,
600    "GATT_0C_ERR": 0x0C,
601    "GATT_16": 0x16
602}
603
604### Bluetooth GATT Constants End ###
605
606### Chameleon Constants Begin ###
607
608# Chameleon audio bits per sample.
609audio_bits_per_sample_16 = 16
610audio_bits_per_sample_24 = 24
611audio_bits_per_sample_32 = 32
612
613# Chameleon audio sample rates.
614audio_sample_rate_44100 = 44100
615audio_sample_rate_48000 = 48000
616audio_sample_rate_88200 = 88200
617audio_sample_rate_96000 = 96000
618
619# Chameleon audio channel modes.
620audio_channel_mode_mono = 1
621audio_channel_mode_stereo = 2
622audio_channel_mode_8 = 8
623
624# Chameleon time delays.
625delay_after_binding_seconds = 0.5
626delay_before_record_seconds = 0.5
627silence_wait_seconds = 5
628
629# Chameleon bus endpoints.
630fpga_linein_bus_endpoint = 'Chameleon FPGA line-in'
631headphone_bus_endpoint = 'Cros device headphone'
632
633### Chameleon Constants End ###
634
635### Begin logcat strings dict"""
636logcat_strings = {
637    "media_playback_vol_changed": "onRouteVolumeChanged",
638}
639
640### End logcat strings dict"""
641
642### Begin Service Discovery UUIDS ###
643### Values match the Bluetooth SIG defined values: """
644""" https://www.bluetooth.com/specifications/assigned-numbers/service-discovery """
645sig_uuid_constants = {
646    "BASE_UUID": "0000{}-0000-1000-8000-00805F9B34FB",
647    "SDP": "0001",
648    "UDP": "0002",
649    "RFCOMM": "0003",
650    "TCP": "0004",
651    "TCS-BIN": "0005",
652    "TCS-AT": "0006",
653    "ATT": "0007",
654    "OBEX": "0008",
655    "IP": "0009",
656    "FTP": "000A",
657    "HTTP": "000C",
658    "WSP": "000E",
659    "BNEP": "000F",
660    "UPNP": "0010",
661    "HIDP": "0011",
662    "HardcopyControlChannel": "0012",
663    "HardcopyDataChannel": "0014",
664    "HardcopyNotification": "0016",
665    "AVCTP": "0017",
666    "AVDTP": "0019",
667    "CMTP": "001B",
668    "MCAPControlChannel": "001E",
669    "MCAPDataChannel": "001F",
670    "L2CAP": "0100",
671    "ServiceDiscoveryServerServiceClassID": "1000",
672    "BrowseGroupDescriptorServiceClassID": "1001",
673    "SerialPort": "1101",
674    "LANAccessUsingPPP": "1102",
675    "DialupNetworking": "1103",
676    "IrMCSync": "1104",
677    "OBEXObjectPush": "1105",
678    "OBEXFileTransfer": "1106",
679    "IrMCSyncCommand": "1107",
680    "Headset": "1108",
681    "CordlessTelephony": "1109",
682    "AudioSource": "110A",
683    "AudioSink": "110B",
684    "A/V_RemoteControlTarget": "110C",
685    "AdvancedAudioDistribution": "110D",
686    "A/V_RemoteControl": "110E",
687    "A/V_RemoteControlController": "110F",
688    "Intercom": "1110",
689    "Fax": "1111",
690    "Headset - Audio Gateway (AG)": "1112",
691    "WAP": "1113",
692    "WAP_CLIENT": "1114",
693    "PANU": "1115",
694    "NAP": "1116",
695    "GN": "1117",
696    "DirectPrinting": "1118",
697    "ReferencePrinting": "1119",
698    "ImagingResponder": "111B",
699    "ImagingAutomaticArchive": "111C",
700    "ImagingReferencedObjects": "111D",
701    "Handsfree": "111E",
702    "HandsfreeAudioGateway": "111F",
703    "DirectPrintingReferenceObjectsService": "1120",
704    "ReflectedUI": "1121",
705    "BasicPrinting": "1122",
706    "PrintingStatus": "1123",
707    "HumanInterfaceDeviceService": "1124",
708    "HardcopyCableReplacement": "1125",
709    "HCR_Print": "1126",
710    "HCR_Scan": "1127",
711    "Common_ISDN_Access": "1128",
712    "SIM_Access": "112D",
713    "Phonebook Access - PCE": "112E",
714    "Phonebook Access - PSE": "112F",
715    "Phonebook Access": "1130",
716    "Headset - HS": "1131",
717    "Message Access Server": "1132",
718    "Message Notification Server": "1133",
719    "Message Access Profile": "1134",
720    "GNSS": "1135",
721    "GNSS_Server": "1136",
722    "PnPInformation": "1200",
723    "GenericNetworking": "1201",
724    "GenericFileTransfer": "1202",
725    "GenericAudio": "1203",
726    "GenericTelephony": "1204",
727    "UPNP_Service": "1205",
728    "UPNP_IP_Service": "1206",
729    "ESDP_UPNP_IP_PAN": "1300",
730    "ESDP_UPNP_IP_LAP": "1301",
731    "ESDP_UPNP_L2CAP": "1302",
732    "VideoSource": "1303",
733    "VideoSink": "1304",
734    "VideoDistribution": "1305",
735    "HDP": "1400"
736}
737
738### End Service Discovery UUIDS ###
739