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 enum import Enum 18from enum import IntEnum 19 20 21class BluetoothScanModeType(IntEnum): 22 STATE_OFF = -1 23 SCAN_MODE_NONE = 0 24 SCAN_MODE_CONNECTABLE = 1 25 SCAN_MODE_CONNECTABLE_DISCOVERABLE = 3 26 27 28class BluetoothAdapterState(IntEnum): 29 STATE_OFF = 10 30 STATE_TURNING_ON = 11 31 STATE_ON = 12 32 STATE_TURNING_OFF = 13 33 STATE_BLE_TURNING_ON = 14 34 STATE_BLE_ON = 15 35 STATE_BLE_TURNING_OFF = 16 36 37 38class BluetoothProfile(IntEnum): 39 # Should be kept in sync with BluetoothProfile.java 40 HEADSET = 1 41 A2DP = 2 42 HEALTH = 3 43 INPUT_DEVICE = 4 44 PAN = 5 45 PBAP_SERVER = 6 46 GATT = 7 47 GATT_SERVER = 8 48 MAP = 9 49 SAP = 10 50 A2DP_SINK = 11 51 AVRCP_CONTROLLER = 12 52 HEADSET_CLIENT = 16 53 PBAP_CLIENT = 17 54 MAP_MCE = 18 55 56 57class RfcommUuid(Enum): 58 DEFAULT_UUID = "457807c0-4897-11df-9879-0800200c9a66" 59 BASE_UUID = "00000000-0000-1000-8000-00805F9B34FB" 60 SDP = "00000001-0000-1000-8000-00805F9B34FB" 61 UDP = "00000002-0000-1000-8000-00805F9B34FB" 62 RFCOMM = "00000003-0000-1000-8000-00805F9B34FB" 63 TCP = "00000004-0000-1000-8000-00805F9B34FB" 64 TCS_BIN = "00000005-0000-1000-8000-00805F9B34FB" 65 TCS_AT = "00000006-0000-1000-8000-00805F9B34FB" 66 ATT = "00000007-0000-1000-8000-00805F9B34FB" 67 OBEX = "00000008-0000-1000-8000-00805F9B34FB" 68 IP = "00000009-0000-1000-8000-00805F9B34FB" 69 FTP = "0000000A-0000-1000-8000-00805F9B34FB" 70 HTTP = "0000000C-0000-1000-8000-00805F9B34FB" 71 WSP = "0000000E-0000-1000-8000-00805F9B34FB" 72 BNEP = "0000000F-0000-1000-8000-00805F9B34FB" 73 UPNP = "00000010-0000-1000-8000-00805F9B34FB" 74 HIDP = "00000011-0000-1000-8000-00805F9B34FB" 75 HARDCOPY_CONTROL_CHANNEL = "00000012-0000-1000-8000-00805F9B34FB" 76 HARDCOPY_DATA_CHANNEL = "00000014-0000-1000-8000-00805F9B34FB" 77 HARDCOPY_NOTIFICATION = "00000016-0000-1000-8000-00805F9B34FB" 78 AVCTP = "00000017-0000-1000-8000-00805F9B34FB" 79 AVDTP = "00000019-0000-1000-8000-00805F9B34FB" 80 CMTP = "0000001B-0000-1000-8000-00805F9B34FB" 81 MCAP_CONTROL_CHANNEL = "0000001E-0000-1000-8000-00805F9B34FB" 82 MCAP_DATA_CHANNEL = "0000001F-0000-1000-8000-00805F9B34FB" 83 L2CAP = "00000100-0000-1000-8000-00805F9B34FB" 84 85 86class BluetoothProfileState(Enum): 87 # Should be kept in sync with BluetoothProfile#STATE_* constants. 88 STATE_DISCONNECTED = 0 89 STATE_CONNECTING = 1 90 STATE_CONNECTED = 2 91 STATE_DISCONNECTING = 3 92 93 94class BluetoothAccessLevel(Enum): 95 # Access Levels from BluetoothDevice. 96 ACCESS_ALLOWED = 1 97 ACCESS_DENIED = 2 98 99 100class BluetoothPriorityLevel(Enum): 101 # Priority levels as defined in BluetoothProfile.java. 102 PRIORITY_AUTO_CONNECT = 1000 103 PRIORITY_ON = 100 104 PRIORITY_OFF = 0 105 PRIORITY_UNDEFINED = -1 106 107class BluetoothA2dpCodecType(Enum): 108 SBC = 0 109 AAC = 1 110 APTX = 2 111 APTX_HD = 3 112 LDAC = 4 113 MAX = 5 114