1/* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18package android.bluetooth; 19 20option java_outer_classname = "BluetoothProtoEnums"; 21option java_multiple_files = true; 22 23// Bluetooth connection states. 24enum ConnectionStateEnum { 25 CONNECTION_STATE_DISCONNECTED = 0; 26 CONNECTION_STATE_CONNECTING = 1; 27 CONNECTION_STATE_CONNECTED = 2; 28 CONNECTION_STATE_DISCONNECTING = 3; 29} 30 31// Bluetooth Adapter Enable and Disable Reasons 32enum EnableDisableReasonEnum { 33 ENABLE_DISABLE_REASON_UNSPECIFIED = 0; 34 ENABLE_DISABLE_REASON_APPLICATION_REQUEST = 1; 35 ENABLE_DISABLE_REASON_AIRPLANE_MODE = 2; 36 ENABLE_DISABLE_REASON_DISALLOWED = 3; 37 ENABLE_DISABLE_REASON_RESTARTED = 4; 38 ENABLE_DISABLE_REASON_START_ERROR = 5; 39 ENABLE_DISABLE_REASON_SYSTEM_BOOT = 6; 40 ENABLE_DISABLE_REASON_CRASH = 7; 41 ENABLE_DISABLE_REASON_USER_SWITCH = 8; 42 ENABLE_DISABLE_REASON_RESTORE_USER_SETTING = 9; 43 ENABLE_DISABLE_REASON_FACTORY_RESET = 10; 44 ENABLE_DISABLE_REASON_INIT_FLAGS_CHANGED = 11; 45} 46 47enum DirectionEnum { 48 DIRECTION_UNKNOWN = 0; 49 DIRECTION_OUTGOING = 1; 50 DIRECTION_INCOMING = 2; 51} 52 53// First item is the default value, other values follow Bluetooth spec definition 54enum LinkTypeEnum { 55 // Link type is at most 1 byte (0xFF), thus 0xFFF must not be a valid value 56 LINK_TYPE_UNKNOWN = 0xFFF; 57 LINK_TYPE_SCO = 0x00; 58 LINK_TYPE_ACL = 0x01; 59 LINK_TYPE_ESCO = 0x02; 60} 61 62enum DeviceInfoSrcEnum { 63 DEVICE_INFO_SRC_UNKNOWN = 0; 64 // Within Android Bluetooth stack 65 DEVICE_INFO_INTERNAL = 1; 66 // Outside Android Bluetooth stack 67 DEVICE_INFO_EXTERNAL = 2; 68} 69 70enum DeviceTypeEnum { 71 DEVICE_TYPE_UNKNOWN = 0; 72 DEVICE_TYPE_CLASSIC = 1; 73 DEVICE_TYPE_LE = 2; 74 DEVICE_TYPE_DUAL = 3; 75} 76 77// Defined in frameworks/base/core/java/android/bluetooth/BluetoothDevice.java 78enum TransportTypeEnum { 79 TRANSPORT_TYPE_AUTO = 0; 80 TRANSPORT_TYPE_BREDR = 1; 81 TRANSPORT_TYPE_LE = 2; 82} 83 84// Bond state enum 85// Defined in frameworks/base/core/java/android/bluetooth/BluetoothDevice.java 86enum BondStateEnum { 87 BOND_STATE_UNKNOWN = 0; 88 BOND_STATE_NONE = 10; 89 BOND_STATE_BONDING = 11; 90 BOND_STATE_BONDED = 12; 91} 92 93// Sub states within the bonding general state 94enum BondSubStateEnum { 95 BOND_SUB_STATE_UNKNOWN = 0; 96 BOND_SUB_STATE_LOCAL_OOB_DATA_PROVIDED = 1; 97 BOND_SUB_STATE_LOCAL_PIN_REQUESTED = 2; 98 BOND_SUB_STATE_LOCAL_PIN_REPLIED = 3; 99 BOND_SUB_STATE_LOCAL_SSP_REQUESTED = 4; 100 BOND_SUB_STATE_LOCAL_SSP_REPLIED = 5; 101 BOND_SUB_STATE_LOCAL_BOND_STATE_INTENT_SENT = 6; 102 BOND_SUB_STATE_LOCAL_START_PAIRING = 7; 103 BOND_SUB_STATE_LOCAL_START_PAIRING_OOB = 8; 104} 105 106enum UnbondReasonEnum { 107 UNBOND_REASON_UNKNOWN = 0; 108 UNBOND_REASON_AUTH_FAILED = 1; 109 UNBOND_REASON_AUTH_REJECTED = 2; 110 UNBOND_REASON_AUTH_CANCELED = 3; 111 UNBOND_REASON_REMOTE_DEVICE_DOWN = 4; 112 UNBOND_REASON_DISCOVERY_IN_PROGRESS = 5; 113 UNBOND_REASON_AUTH_TIMEOUT = 6; 114 UNBOND_REASON_REPEATED_ATTEMPTS = 7; 115 UNBOND_REASON_REMOTE_AUTH_CANCELED = 8; 116 UNBOND_REASON_REMOVED = 9; 117} 118 119enum SocketTypeEnum { 120 SOCKET_TYPE_UNKNOWN = 0; 121 SOCKET_TYPE_RFCOMM = 1; 122 SOCKET_TYPE_SCO = 2; 123 SOCKET_TYPE_L2CAP_BREDR = 3; 124 SOCKET_TYPE_L2CAP_LE = 4; 125} 126 127enum SocketConnectionstateEnum { 128 SOCKET_CONNECTION_STATE_UNKNOWN = 0; 129 // Socket acts as a server waiting for connection 130 SOCKET_CONNECTION_STATE_LISTENING = 1; 131 // Socket acts as a client trying to connect 132 SOCKET_CONNECTION_STATE_CONNECTING = 2; 133 // Socket is connected 134 SOCKET_CONNECTION_STATE_CONNECTED = 3; 135 // Socket tries to disconnect from remote 136 SOCKET_CONNECTION_STATE_DISCONNECTING = 4; 137 // This socket is closed 138 SOCKET_CONNECTION_STATE_DISCONNECTED = 5; 139} 140 141enum SocketRoleEnum { 142 SOCKET_ROLE_UNKNOWN = 0; 143 SOCKET_ROLE_LISTEN = 1; 144 SOCKET_ROLE_CONNECTION = 2; 145} 146 147enum L2capCocConnectionResult { 148 RESULT_L2CAP_CONN_UNKNOWN = 0; 149 RESULT_L2CAP_CONN_SUCCESS = 1; 150 RESULT_L2CAP_CONN_TIMEOUT = 2; 151 RESULT_L2CAP_CONN_PENDING = 3; 152 RESULT_L2CAP_CONN_NO_PSM = 4; 153 RESULT_L2CAP_CONN_SECURITY_BLOCK = 5; 154 RESULT_L2CAP_CONN_NO_RESOURCES = 6; 155 RESULT_L2CAP_CONN_NO_LINK = 7; 156 RESULT_L2CAP_CONN_CANCEL = 8; 157} 158 159enum CodePathCounterKeyEnum { 160 KEY_UNKNOWN = 0; 161 // Reserver smaller counters for very important bt features 162 163 // [100,000 - 120,000) profile connection related 164 165 // [100,000 - 100,100) L2CAP 166 L2CAP_SUCCESS = 100000; 167 L2CAP_CONNECT_CONFIRM_NEG= 100001; 168 L2CAP_NO_COMPATIBLE_CHANNEL_AT_CSM_CLOSED = 100002; 169 L2CAP_SECURITY_NEG_AT_CSM_CLOSED= 100003; 170 L2CAP_TIMEOUT_AT_CSM_CLOSED = 100004; 171 L2CAP_CREDIT_BASED_CONNECT_RSP_NEG = 100005; 172 L2CAP_CONNECT_RSP_NEG = 100006; 173 L2CAP_INFO_NO_COMPATIBLE_CHANNEL_AT_RSP = 100007; 174 L2CAP_CONFIG_REQ_FAILURE = 100008; 175 L2CAP_CONFIG_RSP_NEG = 100009; 176 L2CAP_NO_COMPATIBLE_CHANNEL_AT_W4_SEC = 100010; 177 L2CAP_SECURITY_NEG_AT_W4_SEC= 100011; 178 L2CAP_TIMEOUT_AT_CONNECT_RSP = 100012; 179 L2CAP_CONN_OTHER_ERROR_AT_CONNECT_RSP = 100013; 180 181 // [100,100 - 100,200) SDP 182 SDP_SUCCESS = 100100; 183 SDP_FAILURE = 100101; 184 185 // [101,000 - 102,000) HFP 186 187 // [101,000 - 101,100) RFCOMM 188 RFCOMM_CONNECTION_SUCCESS_IND = 101000; 189 RFCOMM_CONNECTION_SUCCESS_CNF = 101001; 190 RFCOMM_PORT_START_CNF_FAILED = 101002; 191 RFCOMM_PORT_START_CLOSE = 101003; 192 RFCOMM_PORT_START_FAILED = 101004; 193 RFCOMM_PORT_NEG_FAILED = 101005; 194 RFCOMM_PORT_CLOSED = 101006; 195 RFCOMM_PORT_PEER_CONNECTION_FAILED = 101007; 196 RFCOMM_PORT_PEER_TIMEOUT = 101008; 197 198 // [101,100 - 101,200) HFP (btif) 199 200 // [102,000 - 103,000) A2DP 201 A2DP_CONNECTION_SUCCESS = 102000; 202 A2DP_CONNECTION_ACL_DISCONNECTED = 102001; 203 A2DP_CONNECTION_REJECT_EVT = 102002; 204 A2DP_CONNECTION_FAILURE = 102003; 205 A2DP_CONNECTION_UNKNOWN_EVENT = 102004; 206 A2DP_ALREADY_CONNECTING = 102005; 207 A2DP_OFFLOAD_START_REQ_FAILURE = 102006; 208 A2DP_CONNECTION_CLOSE = 102007; 209 A2DP_CONNECTION_DISCONNECTED = 102008; 210 A2DP_CONNECTION_TIMEOUT = 102009; 211 212} 213 214enum AddressTypeEnum { 215 ADDRESS_TYPE_PUBLIC = 0; 216 ADDRESS_TYPE_RANDOM = 1; 217 ADDRESS_TYPE_UNKNOWN = 0xFFFF; 218} 219 220