1# Lint as: python3 2"""Constants used for bluetooth test.""" 3 4import enum 5 6### Generic Constants Begin ### 7BT_DEFAULT_TIMEOUT_SECONDS = 15 8DEFAULT_RFCOMM_TIMEOUT_MS = 10000 9CALL_STATE_IDLE = 0 10CALL_STATE_RINGING = 1 11CALL_STATE_OFFHOOK = 2 12CALL_STATE_TIMEOUT_SEC = 30 13NAP_CONNECTION_TIMEOUT_SECS = 20 14 15# Call log types. 16INCOMING_CALL_LOG_TYPE = '1' 17OUTGOING_CALL_LOG_TYPE = '2' 18MISSED_CALL_LOG_TYPE = '3' 19 20# Passthrough Commands sent to the RPC Server. 21CMD_MEDIA_PLAY = 'play' 22CMD_MEDIA_PAUSE = 'pause' 23CMD_MEDIA_SKIP_NEXT = 'skipNext' 24CMD_MEDIA_SKIP_PREV = 'skipPrev' 25 26# Events dispatched from the RPC Server. 27EVENT_PLAY_RECEIVED = 'playReceived' 28EVENT_PAUSE_RECEIVED = 'pauseReceived' 29EVENT_SKIP_NEXT_RECEIVED = 'skipNextReceived' 30EVENT_SKIP_PREV_RECEIVED = 'skipPrevReceived' 31 32# A playback state indicating the media session is currently paused. 33STATE_PAUSED = 2 34STATE_PLAYING = 3 35 36# File path 37RAMDUMP_PATH = 'data/vendor/ssrdump' 38 39# UiAutoHelper package name. 40UIAUTO_HELPER_PACKAGE_NAME = 'com.google.android.uiautohelper' 41 42# Test Runner for Android instrumentation test. 43ANDROIDX_TEST_RUNNER = 'androidx.test.runner.AndroidJUnitRunner' 44 45# Wifi hotspot setting 46WIFI_HOTSPOT_2_4G = {'SSID': 'pqmBT', 'password': 'password', 'apBand': 0} 47 48# Strings representing boolean of device properties. 49TRUE = 'true' 50FALSE = 'false' 51 52# String representing a property of AAC VBR support for Android device. 53AAC_VBR_SUPPORTED_PROPERTY = 'persist.bluetooth.a2dp_aac.vbr_supported' 54 55# Dict containing charging control config for devices. 56CHARGING_CONTROL_CONFIG_DICT = { 57 # Internal codename 58} 59 60 61class AvrcpEvent(enum.Enum): 62 """Enumeration of AVRCP event types.""" 63 PLAY = 'State:NOT_PLAYING->PLAYING' 64 PAUSE = 'State:PLAYING->NOT_PLAYING' 65 TRACK_PREVIOUS = 'sendMediaKeyEvent: keyEvent=76' 66 TRACK_NEXT = 'sendMediaKeyEvent: keyEvent=75' 67 68 69# Bluetooth RFCOMM UUIDs as defined by the SIG 70BT_RFCOMM_UUIDS = { 71 'default_uuid': '457807c0-4897-11df-9879-0800200c9a66', 72 'base_uuid': '00000000-0000-1000-8000-00805F9B34FB', 73 'sdp': '00000001-0000-1000-8000-00805F9B34FB', 74 'udp': '00000002-0000-1000-8000-00805F9B34FB', 75 'rfcomm': '00000003-0000-1000-8000-00805F9B34FB', 76 'tcp': '00000004-0000-1000-8000-00805F9B34FB', 77 'tcs_bin': '00000005-0000-1000-8000-00805F9B34FB', 78 'tcs_at': '00000006-0000-1000-8000-00805F9B34FB', 79 'att': '00000007-0000-1000-8000-00805F9B34FB', 80 'obex': '00000008-0000-1000-8000-00805F9B34FB', 81 'ip': '00000009-0000-1000-8000-00805F9B34FB', 82 'ftp': '0000000A-0000-1000-8000-00805F9B34FB', 83 'http': '0000000C-0000-1000-8000-00805F9B34FB', 84 'wsp': '0000000E-0000-1000-8000-00805F9B34FB', 85 'bnep': '0000000F-0000-1000-8000-00805F9B34FB', 86 'upnp': '00000010-0000-1000-8000-00805F9B34FB', 87 'hidp': '00000011-0000-1000-8000-00805F9B34FB', 88 'hardcopy_control_channel': '00000012-0000-1000-8000-00805F9B34FB', 89 'hardcopy_data_channel': '00000014-0000-1000-8000-00805F9B34FB', 90 'hardcopy_notification': '00000016-0000-1000-8000-00805F9B34FB', 91 'avctp': '00000017-0000-1000-8000-00805F9B34FB', 92 'avdtp': '00000019-0000-1000-8000-00805F9B34FB', 93 'cmtp': '0000001B-0000-1000-8000-00805F9B34FB', 94 'mcap_control_channel': '0000001E-0000-1000-8000-00805F9B34FB', 95 'mcap_data_channel': '0000001F-0000-1000-8000-00805F9B34FB', 96 'l2cap': '00000100-0000-1000-8000-00805F9B34FB' 97} 98 99 100class BluetoothAccessLevel(enum.IntEnum): 101 """Enum class for bluetooth profile access levels.""" 102 ACCESS_ALLOWED = 1 103 ACCESS_DENIED = 2 104 105 106class BluetoothProfile(enum.IntEnum): 107 """Enum class for bluetooth profile types. 108 109 Should be kept in sync with 110 //frameworks/base/core/java/android/bluetooth/BluetoothProfile.java 111 """ 112 HEADSET = 1 113 A2DP = 2 114 HEALTH = 3 115 HID_HOST = 4 116 PAN = 5 117 PBAP = 6 118 GATT = 7 119 GATT_SERVER = 8 120 MAP = 9 121 SAP = 10 122 A2DP_SINK = 11 123 AVRCP_CONTROLLER = 12 124 AVRCP = 13 125 HEADSET_CLIENT = 16 126 PBAP_CLIENT = 17 127 MAP_MCE = 18 128 HID_DEVICE = 19 129 OPP = 20 130 HEARING_AID = 21 131 132 133class BluetoothConnectionPolicy(enum.IntEnum): 134 """Enum class for bluetooth bluetooth connection policy. 135 136 bluetooth connection policy as defined in 137 //frameworks/base/core/java/android/bluetooth/BluetoothProfile.java 138 """ 139 CONNECTION_POLICY_UNKNOWN = -1 140 CONNECTION_POLICY_FORBIDDEN = 0 141 CONNECTION_POLICY_ALLOWED = 100 142 143 144class BluetoothConnectionStatus(enum.IntEnum): 145 """Enum class for bluetooth connection status. 146 147 Bluetooth connection status as defined in 148 //frameworks/base/core/java/android/bluetooth/BluetoothProfile.java 149 """ 150 STATE_DISCONNECTED = 0 151 STATE_CONNECTING = 1 152 STATE_CONNECTED = 2 153 STATE_DISCONNECTING = 3 154 155 156class BluetoothPriorityLevel(enum.IntEnum): 157 """Enum class for bluetooth priority level. 158 159 Priority levels as defined in 160 //frameworks/base/core/java/android/bluetooth/BluetoothProfile.java 161 """ 162 PRIORITY_AUTO_CONNECT = 1000 163 PRIORITY_ON = 100 164 PRIORITY_OFF = 0 165 PRIORITY_UNDEFINED = -1 166 167 168class LogType(enum.Enum): 169 """Enumeration of device log type.""" 170 DEFAULT_VALUE = 'GENERIC' 171 BLUETOOTH_DEVICE_SIMULATOR = 'BDS' 172 ICLEVER_HB01 = 'GENERIC' 173 174 175class CallState(enum.IntEnum): 176 """Enum class for phone call state.""" 177 IDLE = 0 178 RINGING = 1 179 OFFHOOK = 2 180 181 182class CallLogType(enum.IntEnum): 183 """Enum class for phone call log type.""" 184 INCOMING_CALL = 1 185 OUTGOING_CALL = 2 186 MISSED_CALL = 3 187 188 189class BluetoothA2dpCodec(enum.IntEnum): 190 """Enum class for Bluetooth A2DP codec type.""" 191 SBC = 0 192 AAC = 1 193 APTX = 2 194 APTX_HD = 3 195 LDAC = 4 196