1 /* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef BT_DEF_H 17 #define BT_DEF_H 18 19 #include <string> 20 #include <vector> 21 22 namespace OHOS { 23 namespace bluetooth { 24 // Defined here are various status codes 25 /********************************************* 26 * 27 * Interface Return Value Macro Define 28 * 29 *********************************************/ 30 constexpr int RET_NO_ERROR = 0; 31 constexpr int RET_NO_SUPPORT = -1; 32 constexpr int RET_BAD_PARAM = -2; 33 constexpr int RET_BAD_STATUS = -3; 34 constexpr int RET_NO_SPACE = -4; 35 36 /********************************************* 37 * 38 * Bluetooth UUID Macro Define 39 * 40 *********************************************/ 41 const std::string BLUETOOTH_UUID_BASE_UUID = "00000000-0000-1000-8000-00805F9B34FB"; 42 const std::string BLUETOOTH_UUID_A2DP_SINK = "0000110B-0000-1000-8000-00805F9B34FB"; 43 const std::string BLUETOOTH_UUID_A2DP_SRC = "0000110A-0000-1000-8000-00805F9B34FB"; 44 const std::string BLUETOOTH_UUID_GATT = "00001801-0000-1000-8000-00805F9B34FB"; 45 const std::string BLUETOOTH_UUID_AVRCP_CT = "0000110E-0000-1000-8000-00805F9B34FB"; 46 const std::string BLUETOOTH_UUID_AVRCP_TG = "0000110C-0000-1000-8000-00805F9B34FB"; 47 const std::string BLUETOOTH_UUID_HFP_AG = "0000111F-0000-1000-8000-00805F9B34FB"; 48 const std::string BLUETOOTH_UUID_HFP_HF = "0000111E-0000-1000-8000-00805F9B34FB"; 49 const std::string BLUETOOTH_UUID_PBAP_PCE = "0000112E-0000-1000-8000-00805F9B34FB"; 50 const std::string BLUETOOTH_UUID_PBAP_PSE = "0000112F-0000-1000-8000-00805F9B34FB"; 51 const std::string BLUETOOTH_UUID_SPP = "00001101-0000-1000-8000-00805F9B34FB"; 52 const std::string BLUETOOTH_UUID_PNP = "00001200-0000-1000-8000-00805F9B34FB"; 53 const std::string BLUETOOTH_UUID_HID_HOST = "00001124-0000-1000-8000-00805F9B34FB"; 54 const std::string BLUETOOTH_UUID_PAN = "00001116-0000-1000-8000-00805F9B34FB"; 55 const std::string BLUETOOTH_UUID_OPP = "00001105-0000-1000-8000-00805F9B34FB"; 56 const std::string BLUETOOTH_UUID_HSP_AG = "00001112-0000-1000-8000-00805F9B34FB"; 57 const std::string BLUETOOTH_UUID_HSP_HS = "00001108-0000-1000-8000-00805F9B34FB"; 58 const std::string BLUETOOTH_UUID_HOGP = "00001812-0000-1000-8000-00805F9B34FB"; 59 const std::string ADV_AUDIO_DIST = "0000110D-0000-1000-8000-00805F9B34FB"; 60 61 /********************************************* 62 * 63 * Adapter Macro Define 64 * 65 *********************************************/ 66 /** 67 * @brief bt transport define 68 * use to GetRemoteDevice(),GetPairedDevices()... 69 */ 70 enum BTTransport { 71 ADAPTER_BREDR = 0, 72 ADAPTER_BLE, 73 }; 74 /** 75 * @brief bt adapter/profile state define 76 * use to GetBtConnectionState(),GetBtProfileConnState(),... 77 */ 78 enum BTStateID { 79 STATE_TURNING_ON, 80 STATE_TURN_ON, 81 STATE_TURNING_OFF, 82 STATE_TURN_OFF, 83 }; 84 /** 85 * @brief connect state define 86 * use to ConnectionState()... 87 */ 88 enum class BTConnectState : int { 89 CONNECTING, 90 CONNECTED, 91 DISCONNECTING, 92 DISCONNECTED, 93 }; 94 /** 95 * @brief access permission define 96 * use to 97 * Get/SetPhonebookPermission(),Get/SetMessagePermission() 98 */ 99 enum class BTPermissionType : int { 100 ACCESS_UNKNOWN, 101 ACCESS_ALLOWED, 102 ACCESS_FORBIDDEN, 103 }; 104 /** 105 * @brief connection strategy define 106 * use to 107 * SetConnectionStrategy(),GetConnectionStrategy() 108 */ 109 enum class BTStrategyType : int { 110 CONNECTION_UNKNOWN, 111 CONNECTION_ALLOWED, 112 CONNECTION_FORBIDDEN, 113 }; 114 /** 115 * @brief profile id define 116 * use to 117 * GetBtProfileConnState(),GetProfileList() 118 */ 119 const uint32_t PROFILE_ID_GATT_CLIENT = 0x00000001; 120 const uint32_t PROFILE_ID_GATT_SERVER = 0x00000002; 121 const uint32_t PROFILE_ID_A2DP_SRC = 0x00000004; 122 const uint32_t PROFILE_ID_A2DP_SINK = 0x00000008; 123 const uint32_t PROFILE_ID_AVRCP_CT = 0x00000010; 124 const uint32_t PROFILE_ID_AVRCP_TG = 0x00000020; 125 const uint32_t PROFILE_ID_HFP_AG = 0x00000040; 126 const uint32_t PROFILE_ID_HFP_HF = 0x00000080; 127 const uint32_t PROFILE_ID_MAP_MCE = 0x00000100; 128 const uint32_t PROFILE_ID_MAP_MSE = 0x00000200; 129 const uint32_t PROFILE_ID_PBAP_PCE = 0x00000400; 130 const uint32_t PROFILE_ID_PBAP_PSE = 0x00000800; 131 const uint32_t PROFILE_ID_SPP = 0x00001000; 132 const uint32_t PROFILE_ID_DI = 0x00002000; 133 const uint32_t PROFILE_ID_HID_HOST = 0x00004000; 134 const uint32_t PROFILE_ID_PAN = 0x00008000; 135 const uint32_t PROFILE_ID_OPP = 0x00010000; 136 137 /** 138 * @brief default value 139 * use to 140 * initialize mac address, name or other values. 141 */ 142 const std::string INVALID_MAC_ADDRESS = "00:00:00:00:00:00"; 143 const std::string INVALID_NAME = ""; 144 const int INVALID_VALUE = 0; 145 const int INVALID_TYPE = -1; 146 const int ADDRESS_LENGTH = 17; 147 const int ADDRESS_COLON_INDEX = 2; 148 const int ADDRESS_SEPARATOR_UNIT = 3; 149 150 /** 151 * @brief discovery state 152 * use to 153 * GetBtScanMode(), SetBtScanMode() 154 */ 155 const int DISCOVERY_STARTED = 0x01; 156 const int DISCOVERYING = 0x02; 157 const int DISCOVERY_STOPED = 0x03; 158 159 /** 160 * @brief pairing result 161 * use to 162 * OnPairStatusChanged() 163 */ 164 const int PAIR_NONE = 0x01; 165 const int PAIR_PAIRING = 0x02; 166 const int PAIR_PAIRED = 0x03; 167 168 /** 169 * @brief discoverable mode and connect mode 170 * use to 171 * GetBtScanMode(), SetBtScanMode() 172 */ 173 const int SCAN_MODE_NONE = 0x00; 174 const int SCAN_MODE_CONNECTABLE = 0x01; 175 const int SCAN_MODE_GENERAL_DISCOVERABLE = 0x02; 176 const int SCAN_MODE_LIMITED_DISCOVERABLE = 0x03; 177 const int SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 0x04; 178 const int SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 0x05; 179 180 /** 181 * @brief bondable mode define 182 * use to 183 * GetBondableMode(), SetBondableMode() 184 */ 185 const int BONDABLE_MODE_OFF = 0x00; 186 const int BONDABLE_MODE_ON = 0x01; 187 188 /** 189 * @brief remote device's transport type 190 * use to 191 * GetTransportType() 192 */ 193 const int BT_TRANSPORT_BREDR = 0; 194 const int BT_TRANSPORT_BLE = 1; 195 196 /** 197 * @brief remote device type 198 * use to 199 * GetDeviceType 200 */ 201 const int DEVICE_TYPE_UNKNOWN = -1; 202 const int DEVICE_TYPE_BREDR = 0; 203 const int DEVICE_TYPE_LE = 1; 204 const int DEVICE_TYPE_DUAL_MONO = 2; 205 /********************************************* 206 * 207 * GATT Macro Define 208 * 209 *********************************************/ 210 211 constexpr uint8_t GATT_TRANSPORT_TYPE_AUTO = 0x0; 212 constexpr uint8_t GATT_TRANSPORT_TYPE_LE = 0x1; 213 constexpr uint8_t GATT_TRANSPORT_TYPE_CLASSIC = 0x2; 214 constexpr uint8_t GATT_ROLE_MASTER = 0x00; 215 constexpr uint8_t GATT_ROLE_SLAVE = 0x01; 216 constexpr uint8_t GATT_ROLE_INVALID = 0xFF; 217 218 /** 219 * @brief user confirm type during paring process. 220 * use to 221 * OnPairConfirmed() 222 */ 223 enum PinType { 224 PIN_TYPE_ENTER_PIN_CODE = 0, // enter the pin code displayed on the peer device 225 PIN_TYPE_ENTER_PASSKEY = 1, // enter the passkey displayed on the peer device 226 PIN_TYPE_CONFIRM_PASSKEY = 2, // confirm the passkey displayed on the local device 227 PIN_TYPE_NO_PASSKEY_CONSENT = 3, // accept or deny the pairing request 228 PIN_TYPE_NOTIFY_PASSKEY = 4, // enter the passkey displayed on the local device on the peer device 229 PIN_TYPE_DISPLAY_PIN_CODE = 5, // enter the pin code displayed on the peer device, used for bluetooth 2.0 230 PIN_TYPE_OOB_CONSENT = 6, // accept or deny the OOB pairing request, not suppport now 231 PIN_TYPE_PIN_16_DIGITS = 7, // enter the 16-digit pin code displayed on the peer device 232 }; 233 234 /** A GATT Attribute Permission. 235 * Define GATT Attribute permissions. 236 */ 237 enum class GattPermission : uint16_t { 238 READABLE = 1 << 0, /**< readable */ 239 READ_ENCRYPTED = 1 << 1, 240 READ_ENCRYPTED_MITM = 1 << 2, 241 WRITEABLE = 1 << 4, 242 WRITE_ENCRYPTED = 1 << 5, 243 WRITE_ENCRYPTED_MITM = 1 << 6, 244 WRITE_SIGNED = 1 << 7, 245 WRITE_SIGNED_MITM = 1 << 8, 246 PERMISSON_MAX = 1 << 9, 247 }; 248 249 enum class GattConnectionPriority : int { BALANCED, HIGH, LOW_POWER }; 250 251 enum GattStatus { 252 INVALID_REMOTE_DEVICE = -29, 253 INCLUDE_SERVICE_NOT_FOUND, 254 REFERENCED_BY_OTHER_SERVICE, 255 INVALID_CHARACTERISTIC, 256 INVALID_CHARACTERISTIC_DATA, 257 INVALID_CHARACTERISTIC_DESCRIPTOR, 258 INVALID_CHARACTERISTIC_DESCRIPTOR_DATA, 259 NOT_ENOUGH_HANDLES, 260 HANDLE_NOT_FOUND, 261 INVALID_PARAMETER, 262 INTERNAL_ERROR, 263 REQUEST_NOT_SUPPORT, 264 REMOTE_DEVICE_BUSY, 265 MAX_CONNECTIONS, 266 MAX_APPLICATIONS, 267 DEVICE_ALREADY_BIND, 268 INVALID_HANDLE, 269 INVALID_OFFSET, 270 READ_NOT_PERMITTED, 271 WRITE_NOT_PERMITTED, 272 INSUFFICIENT_ENCRYPTION, 273 INSUFFICIENT_AUTHENTICATION, 274 INSUFFICIENT_AUTHORIZATION, 275 INSUFFICIENT_ENCRYPTION_KEY_SIZE, 276 PREPARE_QUEUE_FULL, 277 ATTRIBUTE_NOT_LONG, 278 INVALID_ATTRIBUTE_VALUE_LENGTH, 279 WRITE_REQUEST_REJECTED, 280 GATT_FAILURE, 281 GATT_SUCCESS 282 }; 283 284 /********************************************* 285 * 286 * BLE Macro Define 287 * 288 *********************************************/ 289 // Minimum value for advertising interval. 290 const int BLE_ADV_MIN_INTERVAL = 0x0020; 291 // Maximum value for advertising interval. 292 const int BLE_ADV_MAX_INTERVAL = 0x4000; 293 // Default value for advertising interval. 294 const int BLE_ADV_DEFAULT_INTERVAL = 0x03E8; 295 296 // Special advertising set handle used for the legacy advertising set. 297 const uint8_t BLE_LEGACY_ADVERTISING_HANDLE = 0x00; 298 // Special advertising set handle used as return or parameter to signify an invalid handle. 299 const uint8_t BLE_INVALID_ADVERTISING_HANDLE = 0xFF; 300 301 // Report delay millis default value 302 const int BLE_REPORT_DELAY_MILLIS = 5000; 303 304 // Definitions for UUID length constants. 305 const int BLE_UUID_LEN_16 = 2; 306 const int BLE_UUID_LEN_32 = 4; 307 const int BLE_UUID_LEN_128 = 16; 308 const int DEVICE_NAME_MAX_LEN = 26; 309 310 // BLE acl connect status 311 const int BLE_CONNECTION_STATE_DISCONNECTED = 0x00; 312 const int BLE_CONNECTION_STATE_CONNECTED = 0x01; 313 const int BLE_CONNECTION_STATE_ENCRYPTED_BREDR = 0x02; 314 const int BLE_CONNECTION_STATE_ENCRYPTED_LE = 0x04; 315 316 const int BLE_PAIR_NONE = 0x01; 317 const int BLE_PAIR_PAIRING = 0x02; 318 const int BLE_PAIR_PAIRED = 0x03; 319 const int BLE_PAIR_CANCELING = 0x04; 320 321 const int BLE_ADV_DEFAULT_OP_CODE = 0x00; 322 const int BLE_ADV_STOP_COMPLETE_OP_CODE = 0x01; 323 const int BLE_ADV_START_FAILED_OP_CODE = 0x02; 324 325 const uint8_t BLE_ADV_DATA_BYTE_FIELD_LEN = 3; 326 const uint8_t BLE_ADV_DATA_FIELD_TYPE_AND_LEN = 2; 327 const uint8_t BLE_ONE_BYTE_LEN = 8; 328 329 const int8_t BLE_ADV_TX_POWER_ULTRA_LOW_VALUE = -21; 330 const int8_t BLE_ADV_TX_POWER_LOW_VALUE = -15; 331 const int8_t BLE_ADV_TX_POWER_MEDIUM_VALUE = -7; 332 const int8_t BLE_ADV_TX_POWER_HIGH_VALUE = 1; 333 334 // Intended Advertising PHY 335 const uint8_t BLE_ADVERTISEMENT_PHY_NONE = 0x00; 336 const uint8_t BLE_ADVERTISEMENT_PHY_1M = 0x01; 337 const uint8_t BLE_ADVERTISEMENT_PHY_2M = 0x02; 338 const uint8_t BLE_ADVERTISEMENT_PHY_CODED = 0x03; 339 340 const uint8_t BLE_LEGACY_SCAN_RESPONSE = 3; 341 const uint8_t BLE_LEGACY_ADV_SCAN_IND = 1; 342 const uint8_t BLE_LEGACY_ADV_IND_WITH_EX_ADV = 0x13; 343 const uint8_t BLE_LEGACY_ADV_NONCONN_IND_WITH_EX_ADV = 0x10; 344 const uint8_t BLE_ADV_EVT_LEGACY_BIT = 4; 345 346 // Incomplete, more data to come 347 const uint8_t BLE_EX_SCAN_DATE_STATUS_INCOMPLETE_MORE = 0x20; 348 // Incomplete, data truncated, no more to come 349 const uint8_t BLE_EX_SCAN_DATE_STATUS_INCOMPLETE_NO_MORE = 0x40; 350 351 // Scan mode 352 typedef enum { 353 SCAN_MODE_LOW_POWER = 0x00, 354 SCAN_MODE_BALANCED = 0x01, 355 SCAN_MODE_LOW_LATENCY = 0x02, 356 SCAN_MODE_OP_P2_60_3000 = 0x03, 357 SCAN_MODE_OP_P10_60_600 = 0x04, 358 SCAN_MODE_OP_P25_60_240 = 0x05, 359 SCAN_MODE_OP_P100_1000_1000 = 0x06, 360 SCAN_MODE_OP_P50_100_200 = 0x07, 361 } SCAN_MODE; 362 /// Regular scan params 363 constexpr uint16_t BLE_SCAN_MODE_LOW_POWER_WINDOW_MS = 512; 364 constexpr uint16_t BLE_SCAN_MODE_LOW_POWER_INTERVAL_MS = 5120; 365 constexpr uint16_t BLE_SCAN_MODE_BALANCED_WINDOW_MS = 1024; 366 constexpr uint16_t BLE_SCAN_MODE_BALANCED_INTERVAL_MS = 4096; 367 constexpr uint16_t BLE_SCAN_MODE_LOW_LATENCY_WINDOW_MS = 4096; 368 constexpr uint16_t BLE_SCAN_MODE_LOW_LATENCY_INTERVAL_MS = 4096; 369 constexpr uint16_t BLE_SCAN_MODE_OP_P2_60_3000_WINDOW_MS = 60; 370 constexpr uint16_t BLE_SCAN_MODE_OP_P2_60_3000_INTERVAL_MS = 3000; 371 constexpr uint16_t BLE_SCAN_MODE_OP_P10_60_600_WINDOW_MS = 60; 372 constexpr uint16_t BLE_SCAN_MODE_OP_P10_60_600_INTERVAL_MS = 600; 373 constexpr uint16_t BLE_SCAN_MODE_OP_P25_60_240_WINDOW_MS = 60; 374 constexpr uint16_t BLE_SCAN_MODE_OP_P25_60_240_INTERVAL_MS = 240; 375 constexpr uint16_t BLE_SCAN_MODE_OP_P100_1000_1000_WINDOW_MS = 1000; 376 constexpr uint16_t BLE_SCAN_MODE_OP_P100_1000_1000_INTERVAL_MS = 1000; 377 constexpr uint16_t BLE_SCAN_MODE_OP_P50_100_200_WINDOW_MS = 100; 378 constexpr uint16_t BLE_SCAN_MODE_OP_P50_100_200_INTERVAL_MS = 200; 379 constexpr float BLE_SCAN_UNIT_TIME = 0.625; 380 void ConvertBleScanMode(int scanMode, uint16_t &outScanWindow, uint16_t &outScanInterval); 381 382 // low power device 383 constexpr int32_t BLE_LPDEVICE_SCAN_SETTING_VALID_BIT = 0x01; 384 constexpr int32_t BLE_LPDEVICE_SCAN_FILTER_VALID_BIT = 0x02; 385 constexpr int32_t BLE_LPDEVICE_ADV_SETTING_VALID_BIT = 0x04; 386 constexpr int32_t BLE_LPDEVICE_ADVDATA_VALID_BIT = 0x08; 387 constexpr int32_t BLE_LPDEVICE_RESPDATA_VALID_BIT = 0x10; 388 constexpr int32_t BLE_LPDEVICE_ADV_DEVICEINFO_VALID_BIT = 0x20; 389 390 constexpr int8_t BLE_LPDEVICE_MSG_DEV_INFO = 0x00; 391 constexpr int8_t BLE_LPDEVICE_MSG_SOFT_FILTER = 0x01; 392 constexpr int8_t BLE_LPDEVICE_MSG_ADV_PARAM = 0x02; 393 constexpr int8_t BLE_LPDEVICE_MSG_ADV_DATA = 0x03; 394 constexpr int8_t BLE_LPDEVICE_MSG_ADV_RSP_DATA = 0x04; 395 constexpr int8_t BLE_LPDEVICE_MSG_UUID_DATA = 0x0a; 396 constexpr int8_t BLE_LPDEVICE_MSG_ADV_HANDLE = 0x0b; 397 constexpr int8_t BLE_LPDEVICE_MSG_SCAN_STATUS = 0x0c; 398 constexpr int8_t BLE_LPDEVICE_MSG_SCAN_PARAM = 0x0d; 399 400 constexpr uint8_t BLE_LPDEVICE_MSG_TYPE_NOTICE_UP_DATA = 0x02; 401 402 constexpr int8_t BLE_LPDEVICE_DISABLE_SCAN_IN_LPDEVICE = 0; 403 constexpr int8_t BLE_LPDEVICE_ENABLE_SCAN_IN_LPDEVICE = 1; 404 405 constexpr int8_t BLE_LPDEVICE_DEVICE_TYPE_ALL = 2; 406 407 constexpr uint32_t BLE_LPDEVICE_RECOVERY_DOING = 1; 408 constexpr uint32_t BLE_LPDEVICE_RECOVERY_DONE = 2; 409 410 constexpr int32_t BLE_LPDEVICE_HANDLE_RESOURCE_NOT_APPLY = -100; 411 412 constexpr uint8_t BLE_DATA_LEN_1 = 1; 413 constexpr uint8_t BLE_DATA_LEN_2 = 2; 414 constexpr uint8_t BLE_DATA_LEN_3 = 3; 415 constexpr uint8_t BLE_DATA_LEN_4 = 4; 416 417 constexpr uint8_t BLE_DEVICE_ADDR_LEN = 6; 418 constexpr uint8_t BLE_ADV_DEVICE_ID_LEN = 8; 419 constexpr uint8_t BLE_UUID_LEN = 16; 420 constexpr uint8_t BLE_UUID_HALF_LEN = 8; 421 422 constexpr int32_t BLE_SCAN_MAX_NUM = 1000; 423 424 // Phy type 425 using PHY_TYPE = enum { PHY_LE_1M = 1, PHY_LE_2M = 2, PHY_LE_CODED = 3, PHY_LE_ALL_SUPPORTED = 255 }; 426 427 // BLE advertiser TX power level. 428 using BLE_ADV_TX_POWER_LEVEL = enum { 429 BLE_ADV_TX_POWER_ULTRA_LOW = 0x00, 430 BLE_ADV_TX_POWER_LOW = 0x01, 431 BLE_ADV_TX_POWER_MEDIUM = 0x02, 432 BLE_ADV_TX_POWER_HIGH = 0x03 433 }; 434 435 // BLE advertiser flag 436 const uint8_t BLE_ADV_FLAG_NON_LIMIT_DISC = 0x00; 437 const uint8_t BLE_ADV_FLAG_LIMIT_DISC = 0x01 << 0; 438 const uint8_t BLE_ADV_FLAG_GEN_DISC = 0x01 << 1; 439 const uint8_t BLE_ADV_FLAG_BREDR_NOT_SPT = 0x01 << 2; 440 const uint8_t BLE_ADV_FLAG_DMT_CONTROLLER_SPT = 0x01 << 3; 441 const uint8_t BLE_ADV_FLAG_DMT_HOST_SPT = 0x01 << 4; 442 443 // Bluetooth device type 444 using BLE_BT_DEV_TYPE = enum { 445 BLE_BT_DEVICE_TYPE_UNKNOWN = -1, 446 BLE_BT_DEVICE_TYPE_BREDR = 0, 447 BLE_BT_DEVICE_TYPE_BLE = 1, 448 BLE_BT_DEVICE_TYPE_DUMO = 2, 449 }; 450 451 // BLE device address type 452 using BLE_ADDR_TYPE = enum { 453 BLE_ADDR_TYPE_PUBLIC = 0x00, 454 BLE_ADDR_TYPE_RANDOM = 0x01, 455 BLE_ADDR_TYPE_NON_RPA = 0x02, 456 BLE_ADDR_TYPE_RPA = 0x03, 457 BLE_ADDR_TYPE_UNKNOWN = 0xFE, 458 BLE_ADDR_TYPE_ANONYMOUS = 0xFF, 459 }; 460 461 using BLE_IO_CAP = enum { 462 BLE_IO_CAP_OUT = 0x00, // DisplayOnly 463 BLE_IO_CAP_IO = 0x01, // DisplayYesNo 464 BLE_IO_CAP_IN = 0x02, // KeyboardOnly 465 BLE_IO_CAP_NONE = 0x03, // NoInputNoOutput 466 BLE_IO_CAP_KBDISP = 0x04 // Keyboard display 467 }; 468 469 // Adv status 470 using BleAdvState = enum { 471 BLE_ADV_STATE_IDLE, 472 BLE_ADV_STATE_ADVERTISING, 473 }; 474 475 // The type of advertising data(not adv_type) 476 using BLE_ADV_DATA_TYPE = enum { 477 BLE_AD_TYPE_FLAG = 0x01, 478 BLE_AD_TYPE_16SRV_PART = 0x02, 479 BLE_AD_TYPE_16SRV_CMPL = 0x03, 480 BLE_AD_TYPE_32SRV_PART = 0x04, 481 BLE_AD_TYPE_32SRV_CMPL = 0x05, 482 BLE_AD_TYPE_128SRV_PART = 0x06, 483 BLE_AD_TYPE_128SRV_CMPL = 0x07, 484 BLE_AD_TYPE_NAME_SHORT = 0x08, 485 BLE_AD_TYPE_NAME_CMPL = 0x09, 486 BLE_AD_TYPE_TX_PWR = 0x0A, 487 BLE_AD_TYPE_DEV_CLASS = 0x0D, 488 BLE_AD_TYPE_SM_TK = 0x10, 489 BLE_AD_TYPE_SM_OOB_FLAG = 0x11, 490 BLE_AD_TYPE_INT_RANGE = 0x12, 491 BLE_AD_TYPE_SOL_SRV_UUID = 0x14, 492 BLE_AD_TYPE_128SOL_SRV_UUID = 0x15, 493 BLE_AD_TYPE_SERVICE_DATA = 0x16, 494 BLE_AD_TYPE_PUBLIC_TARGET = 0x17, 495 BLE_AD_TYPE_RANDOM_TARGET = 0x18, 496 BLE_AD_TYPE_APPEARANCE = 0x19, 497 BLE_AD_TYPE_ADV_INT = 0x1A, 498 BLE_AD_TYPE_LE_DEV_ADDR = 0x1b, 499 BLE_AD_TYPE_LE_ROLE = 0x1c, 500 BLE_AD_TYPE_SPAIR_C256 = 0x1d, 501 BLE_AD_TYPE_SPAIR_R256 = 0x1e, 502 BLE_AD_TYPE_32SOL_SRV_UUID = 0x1f, 503 BLE_AD_TYPE_32SERVICE_DATA = 0x20, 504 BLE_AD_TYPE_128SERVICE_DATA = 0x21, 505 BLE_AD_TYPE_LE_SECURE_CONFIRM = 0x22, 506 BLE_AD_TYPE_LE_SECURE_RANDOM = 0x23, 507 BLE_AD_TYPE_URI = 0x24, 508 BLE_AD_TYPE_INDOOR_POSITION = 0x25, 509 BLE_AD_TYPE_TRANS_DISC_DATA = 0x26, 510 BLE_AD_TYPE_LE_SUPPORT_FEATURE = 0x27, 511 BLE_AD_TYPE_CHAN_MAP_UPDATE = 0x28, 512 BLE_AD_MANUFACTURER_SPECIFIC_TYPE = 0xFF, 513 }; 514 515 /********************************************* 516 * 517 * Map Define 518 * 519 *********************************************/ 520 // Map Message Type 521 enum class MapMessageType : int { 522 EMAIL = 0, 523 SMS_GSM = 1, 524 SMS_CDMA = 2, 525 MMS = 3, 526 IM = 4, 527 INVALID = 5 528 }; // IM only support in bmessage ver1.1 529 530 // Map Message Status 531 enum class MapMessageStatus : int { READ, UNREAD, INVALID }; // default UNREAD 532 533 // Map BoolType , YES or NO 534 enum class MapBoolType : int { YES, NO, INVALID }; // default NO 535 536 // Map Message ReceptionStatus 537 enum class MapMsgReceptionStatus : int { COMPLETE, FRACTIONED, NOTIFICATION, INVALID }; 538 539 // Map MsgDeliveryStatus 540 enum class MapMsgDeliveryStatus : int { DELIVERED, SENT, UNKNOWN, INVALID }; 541 542 // Map MsgDirection 543 enum class MapMsgDirection : int { INCOMING, OUTGOING, OUTGOINGDRAFT, OUTGOINGPENDING, INVALID }; 544 545 // Map FractionDeliverType 546 enum class MapFractionDeliverType : int { MORE, LAST, INVALID }; 547 548 // Map FractionRequest Type 549 enum class MapFractionRequestType : uint8_t { FIRST = 0x00, NEXT = 0x01, INVALID = 0x02 }; 550 551 // Map OnOff Type 552 enum class MapOnOffType : uint8_t { OFF = 0, ON = 1, INVALID = 3 }; 553 554 // Map Charset Type 555 enum class MapCharsetType : uint8_t { NATIVE = 0x00, UTF_8 = 0x01, INVALID = 0x02 }; 556 557 // Attachment Type 558 enum class MapAttachmentType : uint8_t { NO = 0x00, HAVE = 0x01, INVALID = 0x02 }; 559 560 // Map StatusIndicator Type 561 enum class MapStatusIndicatorType : uint8_t { 562 READ_STATUS = 0x00, 563 DELETED_STATUS = 0x01, 564 SET_EXTENDED_DATA = 0x02, 565 INVALID = 0x03 566 }; 567 568 // Map StatusValue Type 569 enum class MapStatusValueType : uint8_t { NO = 0x00, YES = 0x01 }; 570 571 // Map ModifyText Type 572 enum class MapModifyTextType : uint8_t { REPLACE = 0x00, PREPEND = 0x01, INVALID = 0x02 }; 573 574 // Map Action Type 575 enum class MapActionType : int { 576 GET_UNREAD_MESSAGES, 577 GET_SUPPORTED_FEATURES, 578 SEND_MESSAGE, 579 SET_NOTIFICATION_FILTER, 580 GET_MESSAGES_LISTING, 581 GET_MESSAGE, 582 UPDATE_INBOX, 583 GET_CONVERSATION_LISTING, 584 SET_MESSAGE_STATUS, 585 SET_OWNER_STATUS, 586 GET_OWNER_STATUS, 587 GET_MAS_INSTANCE_INFO 588 }; 589 590 // Map ExecuteStatus Type 591 enum class MapExecuteStatus : int { 592 SUCCEED = 0, 593 CONTINUE = 1, 594 BAD_PARAM = (-1), 595 BAD_STATUS = (-2), 596 NOT_SUPPORT = (-3) 597 }; 598 599 // Supported Message Types 600 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_EMAIL 0x01 601 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_SMS_GSM 0x02 602 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_SMS_CDMA 0x04 603 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_MMS 0x08 604 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_IM 0x10 605 #define MAP_MCE_SUPPORTED_MESSAGE_TYPE_ALL 0x01F 606 607 // Api: MapClient::GetMessagesListing Application Parameters Mask defines 608 // FilterMessageType Mask, 1 is "filter out this type", 0 is "no filtering, get this type" 609 #define MAP_FILTER_MESSAGE_MASK_SMS_GSM 0b00000001 610 #define MAP_FILTER_MESSAGE_MASK_SMS_CDMA 0b00000010 611 #define MAP_FILTER_MESSAGE_MASK_EMAIL 0b00000100 612 #define MAP_FILTER_MESSAGE_MASK_MMS 0b00001000 613 #define MAP_FILTER_MESSAGE_MASK_IM 0b00010000 614 #define MAP_FILTER_MESSAGE_MASK_NO_FILTERING 0b00000000 615 // FilterReadStatus, 0b00000001 is get unread messages only, 616 // 0b00000010 is get read messages only 617 #define MAP_FILTER_READ_STATUS_MASK_UNREAD 0b00000001 618 #define MAP_FILTER_READ_STATUS_MASK_READ 0b00000010 619 #define MAP_FILTER_READ_STATUS_MASK_NO_FILTERING 0b00000000 620 // FilterPriority, 0b00000001 is get high priority messages only, 621 // 0b00000010 is get non-high priority messages only 622 #define MAP_FILTER_PRIORITY_MASK_HIGH 0b00000001 623 #define MAP_FILTER_PRIORITY_MASK_NO_HIGH 0b00000010 624 #define MAP_FILTER_PRIORITY_MASK_NO_FILTERING 0b00000000 625 // ParameterMask , Bits 0-20 has been used , Bits 21–31 Reserved for Future Use 626 #define MAP_GETMESSAGELIST_PARAMETER_MASK_REQUIRED 0b000000000000000000000000 627 #define MAP_GETMESSAGELIST_PARAMETER_MASK_PRESENT_ALL 0b000111111111111111111111 628 #define MAP_GETMESSAGELIST_PARAMETER_MASK_SUBJECT 0b000000000000000000000001 629 #define MAP_GETMESSAGELIST_PARAMETER_MASK_DATETIME 0b000000000000000000000010 630 #define MAP_GETMESSAGELIST_PARAMETER_MASK_SENDER_NAME 0b000000000000000000000100 631 #define MAP_GETMESSAGELIST_PARAMETER_MASK_SENDER_ADDRESSING 0b000000000000000000001000 632 #define MAP_GETMESSAGELIST_PARAMETER_MASK_RECIPIENT_NAME 0b000000000000000000010000 633 #define MAP_GETMESSAGELIST_PARAMETER_MASK_RECIPIENT_ADDRESSING 0b000000000000000000100000 634 #define MAP_GETMESSAGELIST_PARAMETER_MASK_TYPE 0b000000000000000001000000 635 #define MAP_GETMESSAGELIST_PARAMETER_MASK_SIZE 0b000000000000000010000000 636 #define MAP_GETMESSAGELIST_PARAMETER_MASK_RECEPTION_STATUS 0b000000000000000100000000 637 #define MAP_GETMESSAGELIST_PARAMETER_MASK_TEXT 0b000000000000001000000000 638 #define MAP_GETMESSAGELIST_PARAMETER_MASK_ATTACHMENT_SIZE 0b000000000000010000000000 639 #define MAP_GETMESSAGELIST_PARAMETER_MASK_PRIORITY 0b000000000000100000000000 640 #define MAP_GETMESSAGELIST_PARAMETER_MASK_READ 0b000000000001000000000000 641 #define MAP_GETMESSAGELIST_PARAMETER_MASK_SENT 0b000000000010000000000000 642 #define MAP_GETMESSAGELIST_PARAMETER_MASK_PROTECTED 0b000000000100000000000000 643 #define MAP_GETMESSAGELIST_PARAMETER_MASK_REPLYTO_ADDRESSING 0b000000001000000000000000 644 #define MAP_GETMESSAGELIST_PARAMETER_MASK_DELIVERY_STATUS 0b000000010000000000000000 645 #define MAP_GETMESSAGELIST_PARAMETER_MASK_CONVERSATION_ID 0b000000100000000000000000 646 #define MAP_GETMESSAGELIST_PARAMETER_MASK_CONVERSATION_NAME 0b000001000000000000000000 647 #define MAP_GETMESSAGELIST_PARAMETER_MASK_DIRECTION 0b000010000000000000000000 648 #define MAP_GETMESSAGELIST_PARAMETER_MASK_ATTACHMENT_MIME 0b000100000000000000000000 649 650 // Api: MapClient::GetConversationListing Application Parameters Mask defines 651 // ConvParameterMask , Bits 0-14 has been used, Bits 15–31 Reserved for Future Use 652 // Bit i is 1 indicates that the parameter related to Bit i shall be present in the requested Conversation-Listing. 653 // The reserved bits shall be set to 0 by the MCE and discarded by the MSE. 654 // If Bit 5 has the value 0, the Conversation-Listing in the response shall not contain any participant element 655 // and therefore the Bits 6–14 do not have any impact. 656 // If Bit 5 has the value 1, then at least one of the Bits 6–14 shall also have the value 1. 657 // If any of the Bits 6–14 has the value 1, Bit 5 shall have the value 1. 658 #define MAP_GETCONV_PARAMETER_MASK_ALL_ON 0b000000000111111111111111 659 #define MAP_GETCONV_PARAMETER_MASK_CONVERSATION_NAME 0b000000000000000000000001 660 #define MAP_GETCONV_PARAMETER_MASK_CONVERSATION_LAST_ACTIVITY 0b000000000000000000000010 661 #define MAP_GETCONV_PARAMETER_MASK_CONVERSATION_READ_STATUS 0b000000000000000000000100 662 #define MAP_GETCONV_PARAMETER_MASK_CONVERSATION_VERSION_COUNTER 0b000000000000000000001000 663 #define MAP_GETCONV_PARAMETER_MASK_CONVERSATION_SUMMARY 0b000000000000000000010000 664 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANTS 0b000000000000000000100000 665 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_UCI 0b000000000000000001000000 666 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_DISPLAY_NAME 0b000000000000000010000000 667 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_CHAT_STATE 0b000000000000000100000000 668 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_LAST_ACTIVITY 0b000000000000001000000000 669 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_X_BT_UID 0b000000000000010000000000 670 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_NAME 0b000000000000100000000000 671 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRESENCE_AVAILABILITY 0b000000000001000000000000 672 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRESENCE_TEXT 0b000000000010000000000000 673 #define MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRIORITY 0b000000000100000000000000 674 675 // Api: MapClient::SetNotificationFilter input param mask defines 676 // Bit i is 0 indicates that the MSE shall not send the notification related to bit i for the current MAS. 677 // NotificationFilterMask ,Bits 0-14 has been used, Bits 15–31 Reserved for Future Use 678 #define MAP_NOTIFICATION_FILTER_MASK_ALL_OFF 0b000000000000000000000000 679 #define MAP_NOTIFICATION_FILTER_MASK_ALL_ON 0b000000000111111111111111 680 #define MAP_NOTIFICATION_FILTER_MASK_NEW_MESSAGE 0b000000000000000000000001 681 #define MAP_NOTIFICATION_FILTER_MASK_MESSAGE_DELETED 0b000000000000000000000010 682 #define MAP_NOTIFICATION_FILTER_MASK_MESSAGE_SHIFT 0b000000000000000000000100 683 #define MAP_NOTIFICATION_FILTER_MASK_SENDING_SUCCESS 0b000000000000000000001000 684 #define MAP_NOTIFICATION_FILTER_MASK_SENDING_FAILURE 0b000000000000000000010000 685 #define MAP_NOTIFICATION_FILTER_MASK_DELIVERY_SUCCESS 0b000000000000000000100000 686 #define MAP_NOTIFICATION_FILTER_MASK_DELIVERY_FAILURE 0b000000000000000001000000 687 #define MAP_NOTIFICATION_FILTER_MASK_MEMORY_FULL 0b000000000000000010000000 688 #define MAP_NOTIFICATION_FILTER_MASK_MEMORY_AVAILABLE 0b000000000000000100000000 689 #define MAP_NOTIFICATION_FILTER_MASK_READ_STATUS_CHANGED 0b000000000000001000000000 690 #define MAP_NOTIFICATION_FILTER_MASK_CONVERSATION_CHANGED 0b000000000000010000000000 691 #define MAP_NOTIFICATION_FILTER_MASK_PARTICIPANT_PRESENCE_CHANGED 0b000000000000100000000000 692 #define MAP_NOTIFICATION_FILTER_MASK_PARTICIPANT_CHAT_STATE_CHANGED 0b000000000001000000000000 693 #define MAP_NOTIFICATION_FILTER_MASK_MESSAGE_EXTENDED_DATA_CHANGED 0b000000000010000000000000 694 #define MAP_NOTIFICATION_FILTER_MASK_MESSAGE_REMOVED 0b000000000100000000000000 695 696 // Api: MapClient::GetSupportedFeatures action complete param mask defines 697 // Map Supported features mask 698 #define MAP_SUPPORTED_FEATURES_NOTIFICATION_REGISTRATION 0x00000001 699 #define MAP_SUPPORTED_FEATURES_NOTIFICATION_FEATURE 0x00000002 700 #define MAP_SUPPORTED_FEATURES_BROWSING 0x00000004 701 #define MAP_SUPPORTED_FEATURES_UPLOADING 0x00000008 702 #define MAP_SUPPORTED_FEATURES_DELETE_FEATURE 0x00000010 703 #define MAP_SUPPORTED_FEATURES_INSTANCE_INFO_FEATURE 0x00000020 704 #define MAP_SUPPORTED_FEATURES_EVENT_REPORT_1_1 0x00000040 705 #define MAP_SUPPORTED_FEATURES_EVENT_REPORT_1_2 0x00000080 706 #define MAP_SUPPORTED_FEATURES_MESSAGE_FORMAT_1_1 0x00000100 707 #define MAP_SUPPORTED_FEATURES_MESSAGELIST_FORMAT_1_1 0x00000200 708 #define MAP_SUPPORTED_FEATURES_PERSISTENT_MESSAGE_HANDLE 0x00000400 709 #define MAP_SUPPORTED_FEATURES_DATABASE_IDENTIFIER 0x00000800 710 #define MAP_SUPPORTED_FEATURES_FOLDOR_VERSION_COUNTER 0x00001000 711 #define MAP_SUPPORTED_FEATURES_CONVERSATION_VERSION_COUNTER 0x00002000 712 #define MAP_SUPPORTED_FEATURES_PARTICIPANT_PRESENCE_CHANGE_NOTIFICATION 0x00004000 713 #define MAP_SUPPORTED_FEATURES_PARTICIPANT_CHAT_STATE_CHANGE_NOTIFICATION 0x00008000 714 #define MAP_SUPPORTED_FEATURES_PBAP_CONTACT_CROSS_REFERENCE 0x00010000 715 #define MAP_SUPPORTED_FEATURES_NOTIFICATION_FILTER 0x00020000 716 #define MAP_SUPPORTED_FEATURES_UTC_OFFSET_TIMESTAMP_FORMAT 0x00040000 717 #define MAP_SUPPORTED_FEATURES_MAPSUPPORTED_FEATURES 0x00080000 718 #define MAP_SUPPORTED_FEATURES_CONVERSATION_LISTING 0x00100000 719 #define MAP_SUPPORTED_FEATURES_OWNER_STATUS 0x00200000 720 #define MAP_SUPPORTED_FEATURES_MESSAGE_FORWARDING 0x00400000 721 722 /********************************************* 723 * 724 * AVRCP Macro Define 725 * 726 *********************************************/ 727 728 // The default label. The valid range is 0x00 ~ 0x0F. 729 #define AVRC_DEFAULT_LABEL (0x00) 730 // The invalid label. 731 #define AVRC_INVALID_LABEL (0x10) 732 733 /** 734 * @brief This enumeration declares the types of the methods. 735 * 736 * @since 6 737 */ 738 enum AvrcCtActionType : uint8_t { 739 AVRC_ACTION_TYPE_INVALID = 0x00, 740 AVRC_ACTION_TYPE_PRESS_BUTTON, 741 AVRC_ACTION_TYPE_RELEASE_BUTTON, 742 AVRC_ACTION_TYPE_SET_ADDRESSED_PLAYER, 743 AVRC_ACTION_TYPE_SET_BROWSED_PLAYER, 744 AVRC_ACTION_TYPE_GET_CAPABILITIES, 745 AVRC_ACTION_TYPE_GET_PLAYER_APP_SETTING_ATTRIBUTES, 746 AVRC_ACTION_TYPE_GET_PLAYER_APP_SETTING_VALUES, 747 AVRC_ACTION_TYPE_GET_PLAYER_APP_SETTING_CURRENT_VALUE, 748 AVRC_ACTION_TYPE_SET_PLAYER_APP_SETTING_CURRENT_VALUE, 749 AVRC_ACTION_TYPE_GET_PLAYER_APP_SETTING_ATTRIBUTE_TEXT, 750 AVRC_ACTION_TYPE_GET_PLAYER_APP_SETTING_VALUE_TEXT, 751 AVRC_ACTION_TYPE_GET_ELEMENT_ATTRIBUTES, 752 AVRC_ACTION_TYPE_GET_PLAY_STATUS, 753 AVRC_ACTION_TYPE_PLAY_ITEM, 754 AVRC_ACTION_TYPE_ADD_TO_NOW_PLAYING, 755 AVRC_ACTION_TYPE_CHANGE_PATH, 756 AVRC_ACTION_TYPE_GET_FOLDER_ITEMS, 757 AVRC_ACTION_TYPE_GET_ITEM_ATTRIBUTES, 758 AVRC_ACTION_TYPE_GET_TOTAL_NUMBER_OF_ITEMS, 759 AVRC_ACTION_TYPE_SET_ABSOLUTE_VOLUME, 760 AVRC_ACTION_TYPE_NOTIFY_PLAYBACK_STATUS_CHANGED, 761 AVRC_ACTION_TYPE_NOTIFY_TRACK_CHANGED, 762 AVRC_ACTION_TYPE_NOTIFY_TRACK_REACHED_END, 763 AVRC_ACTION_TYPE_NOTIFY_TRACK_REACHED_START, 764 AVRC_ACTION_TYPE_NOTIFY_PLAYBACK_POS_CHANGED, 765 AVRC_ACTION_TYPE_NOTIFY_PLAYER_APPLICATION_SETTING_CHANGED, 766 AVRC_ACTION_TYPE_NOTIFY_NOW_PLAYING_CONTENT_CHANGED, 767 AVRC_ACTION_TYPE_NOTIFY_AVAILABLE_PLAYERS_CHANGED, 768 AVRC_ACTION_TYPE_NOTIFY_ADDRESSED_PLAYER_CHANGED, 769 AVRC_ACTION_TYPE_NOTIFY_UIDS_CHANGED, 770 AVRC_ACTION_TYPE_NOTIFY_VOLUME_CHANGED, 771 AVRC_ACTION_TYPE_GET_MEDIA_PLAYER_LIST, 772 }; 773 774 /** 775 * @brief This enumeration declares the values of the supported button. 776 * @see AV/C Panel Subunit Specification 1.23 Section 9.4 PASS THROUGH control command Table 9.21 - Operation id List 777 * 778 * @since 6 779 */ 780 enum AvrcKeyOperation : uint8_t { 781 AVRC_KEY_OPERATION_VOLUME_UP = 0x41, // Volume up. 782 AVRC_KEY_OPERATION_VOLUME_DOWN = 0x42, // Volume down. 783 AVRC_KEY_OPERATION_MUTE = 0x43, // Mute. 784 AVRC_KEY_OPERATION_PLAY = 0x44, // Play. 785 AVRC_KEY_OPERATION_STOP = 0x45, // Stop. 786 AVRC_KEY_OPERATION_PAUSE = 0x46, // Pause. 787 AVRC_KEY_OPERATION_REWIND = 0x48, // Rewind. 788 AVRC_KEY_OPERATION_FAST_FORWARD = 0x49, // Fast forward. 789 AVRC_KEY_OPERATION_FORWARD = 0x4B, // Forward. 790 AVRC_KEY_OPERATION_BACKWARD = 0x4C, // Backward. 791 AVRC_KEY_OPERATION_INVALID = 0x7F, 792 }; 793 794 /** 795 * @brief This enumeration declares the values of the key state. 796 * 797 * @since 6 798 */ 799 enum AvrcTgKeyState : uint8_t { 800 AVRC_KEY_STATE_PRESS = 0x00, // The key is pushed. 801 AVRC_KEY_STATE_RELEASE = 0x01, // The key is released. 802 AVRC_KEY_STATE_INVALID, // Invalid key state. 803 }; 804 805 /** 806 * @brief This enumeration declares the values of the player application setting attributes. 807 * @see Audio/Video Remote Control 1.6.2 Section 27 Appendix F: list of defined player application settings and values. 808 * 809 * @since 6 810 */ 811 enum AvrcPlayerAttribute : uint8_t { 812 AVRC_PLAYER_ATTRIBUTE_ILLEGAL = 0x00, // Illegal , Should not be used. 813 AVRC_PLAYER_ATTRIBUTE_EQUALIZER = 0x01, // Equalizer ON / OFF status. 814 AVRC_PLAYER_ATTRIBUTE_REPEAT = 0x02, // Repeat Mode status. 815 AVRC_PLAYER_ATTRIBUTE_SHUFFLE = 0x03, // Shuffle ON/OFF status. 816 AVRC_PLAYER_ATTRIBUTE_SCAN = 0x04, // Scan ON/OFF status. 817 AVRC_PLAYER_ATTRIBUTE_RESERVED_MIN = 0x05, // Reserved for future use. 0x05 - 0x7F 818 AVRC_PLAYER_ATTRIBUTE_RESERVED_MAX = 0x7F, // Reserved for future use. 0x05 - 0x7F 819 AVRC_PLAYER_ATTRIBUTE_EXTENSION = 0x80, // Provided for TG driven static media player menu extension. 820 // Range: 0x80 - 0xFF 821 }; 822 823 /** 824 * @brief This enumeration declares the values of the Equalizer ON/OFF status. 825 * @see Audio/Video Remote Control 1.6.2 Section 27 Appendix F: list of defined player application settings and values. 826 * 827 * @since 6 828 */ 829 enum AvrcEqualizer : uint8_t { 830 AVRC_EQUALIZER_OFF = 0x01, 831 AVRC_EQUALIZER_ON, 832 AVRC_EQUALIZER_INVALID, 833 }; 834 835 /** 836 * @brief This enumeration declares the values of the Repeat Mode status. 837 * @see Audio/Video Remote Control 1.6.2 Section 27 Appendix F: list of defined player application settings and values. 838 * 839 * @since 6 840 */ 841 enum AvrcRepeat : uint8_t { 842 AVRC_REPEAT_OFF = 0x01, 843 AVRC_REPEAT_SINGLE_TRACK, 844 AVRC_REPEAT_ALL_TRACK, 845 AVRC_REPEAT_GROUP, 846 AVRC_REPEAT_INVALID, 847 }; 848 849 /** 850 * @brief This enumeration declares the values of the Shuffle ON/OFF status. 851 * @see Audio/Video Remote Control 1.6.2 Section 27 Appendix F: list of defined player application settings and values. 852 * 853 * @since 6 854 */ 855 enum AvrcShuffle : uint8_t { 856 AVRC_SHUFFLE_OFF = 0x01, 857 AVRC_SHUFFLE_ALL_TRACKS, 858 AVRC_SHUFFLE_GROUP, 859 AVRC_SHUFFLE_INVALID, 860 }; 861 862 /** 863 * @brief This enumeration declares the values of the Scan ON/OFF status. 864 * @see Audio/Video Remote Control 1.6.2 Section 27 Appendix F: list of defined player application settings and values. 865 * 866 * @since 6 867 */ 868 enum AvrcScan : uint8_t { 869 AVRC_SCAN_OFF = 0x01, 870 AVRC_SCAN_ALL_TRACKS, 871 AVRC_SCAN_GROUP, 872 AVRC_SCAN_INVALID, 873 }; 874 875 /** 876 * @brief This enumeration declares the values of the play status. 877 * 878 * @since 6 879 */ 880 enum AvrcPlayStatus : uint32_t { 881 AVRC_PLAY_STATUS_STOPPED = 0x00, // Stopped. 882 AVRC_PLAY_STATUS_PLAYING, // Playing. 883 AVRC_PLAY_STATUS_PAUSED, // Paused. 884 AVRC_PLAY_STATUS_FWD_SEEK, // Fwd seek. 885 AVRC_PLAY_STATUS_REV_SEEK, // Rev seek. 886 AVRC_PLAY_STATUS_RESERVED_MIN = 0x05, // Reserved for future use. 887 AVRC_PLAY_STATUS_RESERVED_MAX = 0xFE, // Reserved for future use. 888 AVRC_PLAY_STATUS_ERROR = 0xFF, // Error. 889 AVRC_PLAY_STATUS_INVALID_SONG_LENGTH = 0xFFFFFFFF, // If TG does not support, then TG shall return 0xFFFFFFFF. 890 AVRC_PLAY_STATUS_INVALID_SONG_POSITION = 0xFFFFFFFF, // If TG does not support, then TG shall return 0xFFFFFFFF. 891 }; 892 893 /** 894 * @brief This enumeration declares the values of folder direction. 895 * 896 * @since 6 897 */ 898 enum AvrcFolderDirection : uint8_t { 899 AVRC_FOLDER_DIRECTION_UP = 0x00, // Folder up. 900 AVRC_FOLDER_DIRECTION_DOWN = 0x01, // Folder down. 901 AVRC_FOLDER_DIRECTION_INVALID = 0x02, // Reserved. 902 }; 903 904 /** 905 * @brief This enumeration declares the values of the scope in which the UID of the media element item or folder item. 906 * @see Audio/Video Remote Control 1.6.2 Section 6.10.1 Scope. 907 * 908 * @since 6 909 */ 910 enum AvrcMediaScope : uint8_t { 911 AVRC_MEDIA_SCOPE_PLAYER_LIST = 0x00, // Contains all available media players. 912 AVRC_MEDIA_SCOPE_VIRTUAL_FILE_SYSTEM, // Contains the media content of the browsed player. 913 AVRC_MEDIA_SCOPE_SEARCH, // The results of a search operation on the browsed player. 914 AVRC_MEDIA_SCOPE_NOW_PLAYING, // The Now Playing list (or queue) of the addressed player. 915 AVRC_MEDIA_SCOPE_INVALID, 916 }; 917 918 /** 919 * @brief This enumeration declares the values of the browsable items. 920 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2 Browsable items. 921 * 922 * @since 6 923 */ 924 enum AvrcMediaType : uint8_t { 925 AVRC_MEDIA_TYPE_MEDIA_PLAYER_ITEM = 0x01, 926 AVRC_MEDIA_TYPE_FOLDER_ITEM, 927 AVRC_MEDIA_TYPE_MEDIA_ELEMENT_ITEM, 928 AVRC_MEDIA_TYPE_INVALID, 929 }; 930 931 /** 932 * @brief This enumeration declares the values of the attribute count. 933 * @see Audio/Video Remote Control 1.6.2 Section 6.10.4.2 GetFolderItems - Attribute Count. 934 * 935 * @since 6 936 */ 937 enum AvrcAttributeCount { 938 AVRC_ATTRIBUTE_COUNT_ALL = 0x00, 939 AVRC_ATTRIBUTE_COUNT_NO = 0xFF, 940 }; 941 942 /** 943 * @brief This enumeration declares the values of the media attribute. These values are used to uniquely identify media 944 * information. 945 * @see Audio/Video Remote Control 1.6.2 Section 26 Appendix E: list of media attributes. 946 * 947 * @since 6 948 */ 949 enum AvrcMediaAttribute : uint8_t { 950 // Not used. 951 AVRC_MEDIA_ATTRIBUTE_NOT_USED = 0x00, 952 // Text field representing the title, song name or content description coded per specified character set. 953 AVRC_MEDIA_ATTRIBUTE_TITLE, 954 // Text field representing artist(s), performer(s) or group coded per specified character set. 955 AVRC_MEDIA_ATTRIBUTE_ARTIST_NAME, 956 // Text field representing the title of the recording(source) from which the audio in the file is taken. 957 AVRC_MEDIA_ATTRIBUTE_ALBUM_NAME, 958 // Numeric ASCII string containing the order number of the audio - file on its original recording.O 0x5 Total 959 // Number of Tracks. 960 AVRC_MEDIA_ATTRIBUTE_TRACK_NUMBER, 961 // Numeric ASCII string containing the total number of tracks or elements on the original recording. 962 AVRC_MEDIA_ATTRIBUTE_TOTAL_NUMBER_OF_TRACKS, 963 // Text field representing the category of the composition characterized by a particular style. 964 AVRC_MEDIA_ATTRIBUTE_GENRE, 965 // Numeric ASCII string containing the length of the audio file in milliseconds.(E.g .02 : 30 = 150000) 966 AVRC_MEDIA_ATTRIBUTE_PLAYING_TIME, 967 // BIP Image Handle. 968 AVRC_MEDIA_ATTRIBUTE_DEFAULT_COVER_ART, 969 // Reserved for future use. 970 AVRC_MEDIA_ATTRIBUTE_RESERVED, 971 }; 972 973 /** 974 * @brief This enumeration declares the values of the major player type. 975 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2.1 Media player item - Major Player Type 976 * 977 * @since 6 978 */ 979 enum AvrcMediaMajorPlayerType : uint8_t { 980 AVRC_MEDIA_MAJOR_PLAYER_TYPE_AUDIO = 0x01, // Audio. 981 AVRC_MEDIA_MAJOR_PLAYER_TYPE_VIDEO = 0x02, // Video. 982 AVRC_MEDIA_MAJOR_PLAYER_TYPE_BROADCASTING_AUDIO = 0x04, // Broadcasting Audio. 983 AVRC_MEDIA_MAJOR_PLAYER_TYPE_BROADCASTING_VIDEO = 0x08, // Broadcasting Video. 984 AVRC_MEDIA_MAJOR_PLAYER_TYPE_RESERVED = 0x10 // Reserved for future use. 985 }; 986 987 /** 988 * @brief This enumeration declares the values of the major player type. 989 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2.1 Media player item - Player Sub Type 990 * 991 * @since 6 992 */ 993 enum AvrcMediaPlayerSubType : uint32_t { 994 AVRC_MEDIA_PLAYER_SUB_TYPE_AUDIO_BOOK = 0x00000001, // Audio Book. 995 AVRC_MEDIA_PLAYER_SUB_TYPE_PODCAST = 0x00000002, // Pod cast. 996 AVRC_MEDIA_PLAYER_SUB_TYPE_RESERVED = 0x00000004 // Reserved for future use. 997 }; 998 999 /** 1000 * @brief This enumeration declares the values of character set. 1001 * 1002 * @since 6 1003 */ 1004 enum AvrcMediaCharacterSet : uint16_t { 1005 AVRC_MEDIA_CHARACTER_SET_UTF8 = 0x006A, // The value of UTF-8 as defined in IANA character set document. 1006 }; 1007 1008 /** 1009 * @brief This enumeration declares the values of the folder type. 1010 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2.2 Folder item - Folder Type 1011 * 1012 * @since 6 1013 */ 1014 enum AvrcMediaFolderType : uint8_t { 1015 AVRC_MEDIA_FOLDER_TYPE_MIXED = 0x00, // Mixed. 1016 AVRC_MEDIA_FOLDER_TYPE_TITLES, // Titles. 1017 AVRC_MEDIA_FOLDER_TYPE_ALBUMS, // Albums. 1018 AVRC_MEDIA_FOLDER_TYPE_ARTISTS, // Artists. 1019 AVRC_MEDIA_FOLDER_TYPE_GENRES, // Genres. 1020 AVRC_MEDIA_FOLDER_TYPE_PLAY_LISTS, // Play lists. 1021 AVRC_MEDIA_FOLDER_TYPE_YEARS, // Years. 1022 AVRC_MEDIA_FOLDER_TYPE_RESERVED, // Reserved for future use. 1023 }; 1024 1025 /** 1026 * @brief This enumeration declares the values of the is playable. 1027 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2.2 Folder item - Is Playable 1028 * 1029 * @since 6 1030 */ 1031 enum AvrcMediaFolderPlayable : uint8_t { 1032 // The folder cannot be played. This means that the folder UID shall not be passed to either the PlayItem or 1033 // AddToNowPlaying commands. 1034 AVRC_MEDIA_FOLDER_PLAYABLE_NO = 0x00, 1035 // The folder can be played. The folder UID may be passed to the PlayItem and AddToNowPlaying(if supported) 1036 // commands. The media player behavior on playing a folder should be same as on the local user interface. 1037 AVRC_MEDIA_FOLDER_PLAYABLE_YES, 1038 AVRC_MEDIA_FOLDER_PLAYABLE_RESERVED, // Reserved for future use. 1039 }; 1040 1041 /** 1042 * @brief This enumeration declares the values of the media type. 1043 * @see Audio/Video Remote Control 1.6.2 Section 6.10.2.3 Media element item - Media Type 1044 * 1045 * @since 6 1046 */ 1047 enum AvrcMediaElementType : uint8_t { 1048 AVRC_MEDIA_ELEMENT_TYPE_AUDIO = 0x00, // Audio. 1049 AVRC_MEDIA_ELEMENT_TYPE_VIDEO, // Video. 1050 AVRC_MEDIA_ELEMENT_TYPE_RESERVED, // Reserved for future use. 1051 }; 1052 1053 /** 1054 * @brief This enumeration declares the values of the media type. 1055 * 1056 * @details An Absolute Volume is represented in one octet. The top bit (bit 7) is reserved for future addition (RFA). 1057 * The volume is specified as a percentage of the maximum. The value 0x0 corresponds to 0%. The value 0x7F corresponds 1058 * to 100%. Scaling should be applied to achieve values between these two. The existence of this scale does not impose 1059 * any restriction on the granularity of the volume control scale on the TG. 1060 * @see Audio/Video Remote Control 1.6.2 Section 6.13.1 Absolute Volume 1061 * 1062 * @since 6 1063 */ 1064 enum AvrcAbsoluteVolume : uint8_t { 1065 AVRC_ABSOLUTE_VOLUME_PERCENTAGE_0 = 0x00, // 0% 1066 AVRC_ABSOLUTE_VOLUME_PERCENTAGE_100 = 0x7F, // 100% 1067 AVRC_ABSOLUTE_VOLUME_INVALID = 0x80, 1068 }; 1069 1070 /** 1071 * @brief This enumeration declares the values of the "EVENT ID". 1072 * @see Audio/Video Remote Control 1.6.2 Section 28 Appendix H: list of defined notification events. 1073 * 1074 * @since 6 1075 */ 1076 enum AvrcEventId : uint8_t { 1077 AVRC_EVENT_ID_PLAYBACK_STATUS_CHANGED = 0x01, // Change in playback status of the current track. 1078 AVRC_EVENT_ID_TRACK_CHANGED, // Change of current track. 1079 AVRC_EVENT_ID_TRACK_REACHED_END, // Reached end of a track. 1080 AVRC_EVENT_ID_TRACK_REACHED_START, // Reached start of a track. 1081 // Change in playback position. Returned after the specified playback notification change notification interval. 1082 AVRC_EVENT_ID_PLAYBACK_POS_CHANGED, 1083 AVRC_EVENT_ID_BATT_STATUS_CHANGED, // Change in battery status. 1084 AVRC_EVENT_ID_SYSTEM_STATUS_CHANGED, // Change in system status. 1085 AVRC_EVENT_ID_PLAYER_APPLICATION_SETTING_CHANGED, // Change in player application setting. 1086 AVRC_EVENT_ID_NOW_PLAYING_CONTENT_CHANGED, // The content of the Now Playing list has changed. 1087 AVRC_EVENT_ID_AVAILABLE_PLAYERS_CHANGED, // The available players have changed 1088 AVRC_EVENT_ID_ADDRESSED_PLAYER_CHANGED, // The Addressed Player has been changed. 1089 AVRC_EVENT_ID_UIDS_CHANGED, // The UIDs have changed. 1090 AVRC_EVENT_ID_VOLUME_CHANGED, // The volume has been changed locally on the TG. 1091 AVRC_EVENT_ID_RESERVED = 0x0E, 1092 }; 1093 1094 /** 1095 * @bUnique identifier to identify an element on TG 1096 * 1097 * @since 6 1098 */ 1099 enum AvrcElementIdentifier : uint64_t { 1100 AVRC_ELEMENT_ATTRIBUTES_IDENTIFIER_PLAYING = 1101 0x0000000000000000, // attribute information for the element which is current track in the TG device. 1102 AVRC_ELEMENT_ATTRIBUTES_IDENTIFIER_RESERVED = 1103 0x0000000000000001, // All other values other than 0x0 are currently reserved. 1104 }; 1105 1106 /** 1107 * @brief This enumeration declares the allowed values for GetCapabilities Command. 1108 * 1109 * @since 6 1110 */ 1111 enum AvrcCapabilityId : uint8_t { 1112 AVRC_CAPABILITY_COMPANYID = 0x02, // The list of CompanyID supported by TG. 1113 AVRC_CAPABILITY_EVENTID = 0x03, // EventIDs defined in this specification to be supported by TG. 1114 }; 1115 1116 /** 1117 * @brief This enumeration declares the values of playback interval in seconds. 1118 * 1119 * @since 6 1120 */ 1121 enum AvrcPlaybackInterval : uint8_t { 1122 AVRC_PLAYBACK_INTERVAL_1_SEC = 0x01, 1123 AVRC_PLAYBACK_INTERVAL_5_SEC = 0x05, 1124 AVRC_PLAYBACK_INTERVAL_10_SEC = 0x0A, 1125 AVRC_PLAYBACK_INTERVAL_15_SEC = 0x0F, 1126 AVRC_PLAYBACK_INTERVAL_20_SEC = 0x14, 1127 AVRC_PLAYBACK_INTERVAL_25_SEC = 0x19, 1128 AVRC_PLAYBACK_INTERVAL_30_SEC = 0x1E, 1129 }; 1130 1131 /** 1132 * @brief This enumeration declares the error / status code of the vendor dependent command frame and the browsing 1133 * command frame. 1134 * 1135 * @since 6 1136 */ 1137 enum AvrcEsCode : uint8_t { 1138 AVRC_ES_CODE_INVALID = 0xFF, // Reserved. 1139 // Invalid command, sent if TG received a PDU that it did not understand. 1140 AVRC_ES_CODE_INVALID_COMMAND = 0x00, 1141 // Invalid parameter, sent if the TG received a PDU with a parameter ID that it did not understand. This error code 1142 // applies to the following identifiers : 1143 // PDU ID. 1144 // Capability ID. 1145 // Event ID. 1146 // Player Application Setting Attribute ID. 1147 // Player Application Setting Value ID. 1148 // Element Attribute ID. 1149 AVRC_ES_CODE_INVALID_PARAMETER = 0x01, 1150 // Parameter content error.Sent if the parameter ID is understood, but content is wrong or corrupted. 1151 AVRC_ES_CODE_PARAMETER_CONTENT_ERROR = 0x02, 1152 // Internal Error - sent if there are error conditions not covered by a more specific error code. 1153 AVRC_ES_CODE_INTERNAL_ERROR = 0x03, 1154 // Operation completed without error.This is the status that should be returned if the operation was successful. 1155 AVRC_ES_CODE_NO_ERROR = 0x04, 1156 // UID Changed - The UIDs on the device have changed. 1157 AVRC_ES_CODE_UID_CHANGED = 0x05, 1158 // Reserved. 1159 AVRC_ES_CODE_RESERVED = 0x06, 1160 // Invalid Direction - The Direction parameter is invalid. 1161 AVRC_ES_CODE_INVALID_DIRECTION = 0x07, 1162 // Not a Directory - The UID provided does not refer to a folder item. 1163 AVRC_ES_CODE_NOT_A_DIRECTORY = 0x08, 1164 // Does Not Exist - The UID provided does not refer to any currently valid item. 1165 AVRC_ES_CODE_DOES_NOT_EXIST = 0x09, 1166 // Invalid Scope - The scope parameter is invalid. 1167 AVRC_ES_CODE_INVALID_SCOPE = 0x0A, 1168 // Range Out of Bounds - The start of range provided is not valid. 1169 AVRC_ES_CODE_RANGE_OUT_OF_BOUNDS = 0x0B, 1170 // Folder Item is not playable - The UID provided refers to a folder item which cannot be handled by this media 1171 // player. 1172 AVRC_ES_CODE_FOLDER_ITEM_IS_NOT_PLAYABLE = 0x0C, 1173 // Media in Use - The media is not able to be used for this operation at this time. 1174 AVRC_ES_CODE_MEDIA_IN_USE = 0x0D, 1175 // Now Playing List Full - No more items can be added to the Now Playing List. 1176 AVRC_ES_CODE_NOW_PLAYING_LIST_FULL = 0x0E, 1177 // Search Not Supported - The Browsed Media Player does not support search. 1178 AVRC_ES_CODE_SEARCH_NOT_SUPPORTED = 0x0F, 1179 // Search in Progress - A search operation is already in progress. 1180 AVRC_ES_CODE_SEARCH_IN_PROGRESS = 0x10, 1181 // Invalid Player Id - The specified Player Id does not refer to a valid player. 1182 AVRC_ES_CODE_INVALID_PLAYER_ID = 0x11, 1183 // Player Not Browsable - The Player Id supplied refers to a Media Player which does not support browsing. 1184 AVRC_ES_CODE_PLAYER_NOT_BROWSABLE = 0x12, 1185 // Player Not Addressed.The Player Id supplied refers to a player which is not currently addressed, and the command 1186 // is not able to be performed if the player is not set as addressed. 1187 AVRC_ES_CODE_PLAYER_NOT_ADDRESSED = 0x13, 1188 // No valid Search Results - The Search result list does not contain valid entries, e.g.after being invalidated due 1189 // to change of browsed player. 1190 AVRC_ES_CODE_NO_VALID_SEARCH_RESULTS = 0x14, 1191 // No available players. 1192 AVRC_ES_CODE_NO_AVAILABLE_PLAYERS = 0x15, 1193 // Addressed Player Changed. 1194 AVRC_ES_CODE_ADDRESSED_PLAYER_CHANGED = 0x16, 1195 1196 // User custom error code. 1197 AVRC_ES_CODE_NOTIFICATION_CHANGED = 0xFF, 1198 }; 1199 1200 /********************************************* 1201 * 1202 * HFP Definitions 1203 * 1204 *********************************************/ 1205 /** 1206 * @brief sco connect state define 1207 * use to notify sco connection observers. 1208 */ 1209 enum class HfpScoConnectState : int { SCO_DISCONNECTED = 3, SCO_CONNECTING, SCO_DISCONNECTING, SCO_CONNECTED }; 1210 1211 /********************************************* 1212 * 1213 * A2DP Definitions 1214 * 1215 *********************************************/ 1216 1217 /** 1218 * @brief a2dp optional codec support state define 1219 * 1220 * @since 6 1221 */ 1222 enum A2DP_OPTIONAL_SUPPORT_STATE { 1223 A2DP_OPTIONAL_NOT_SUPPORT, 1224 A2DP_OPTIONAL_SUPPORT, 1225 A2DP_OPTIONAL_SUPPORT_UNKNOWN, 1226 }; 1227 1228 /** 1229 * @brief a2dp optional codec enable state define 1230 * 1231 * @since 6 1232 */ 1233 enum A2DP_OPTIONAL_ENABLE_STATE { A2DP_OPTIONAL_DISABLE, A2DP_OPTIONAL_ENABLE, A2DP_OPTIONAL_ENABLE_UNKNOWN }; 1234 1235 /** 1236 * @brief a2dp playing state define 1237 * 1238 * @since 6 1239 */ 1240 enum A2DP_PLAYING_STATE { A2DP_NOT_PLAYING, A2DP_IS_PLAYING }; 1241 1242 /** 1243 * @brief A2dp codec type enum. 1244 * 1245 * @since 6 1246 1247 */ 1248 enum A2dpUserCodecType : uint8_t { 1249 A2DP_CODEC_TYPE_SBC_USER = 0, 1250 A2DP_CODEC_TYPE_MPEG1_USER = 0x01, 1251 A2DP_CODEC_TYPE_AAC_USER = 0x01 << 1, 1252 A2DP_CODEC_TYPE_ATRAC_USER = 0x01 << 2, 1253 A2DP_CODEC_TYPE_NONA2DP_USER = 0xFF 1254 }; 1255 1256 /** 1257 * @brief A2dp codec priority enum. 1258 * 1259 * @since 6 1260 */ 1261 enum A2dpUserCodecPriority : uint32_t { 1262 A2DP_CODEC_PRIORITY_DISABLED_USER = 0, 1263 A2DP_CODEC_PRIORITY_DEFAULT_USER, 1264 A2DP_CODEC_PRIORITY_HIGHEST_USER = 1000 * 1000, 1265 }; 1266 1267 /** 1268 * @brief A2dp codec sample rate enum. 1269 * 1270 * @since 6 1271 */ 1272 enum A2dpUserCodecSampleRate : uint32_t { 1273 A2DP_SAMPLE_RATE_NONE_USER = 0x0, 1274 A2DP_SBC_SAMPLE_RATE_48000_USER = 0x1 << 4, /* octet0 b4 */ 1275 A2DP_SBC_SAMPLE_RATE_44100_USER = 0x1 << 5, /* octet0 b5 */ 1276 A2DP_SBC_SAMPLE_RATE_32000_USER = 0x1 << 6, /* octet0 b6 */ 1277 A2DP_SBC_SAMPLE_RATE_16000_USER = 0x1 << 7, /* octet0 b7 */ 1278 A2DP_SBC_SAMPLE_RATE_MSK_USER = 0xF0, 1279 A2DP_AAC_SAMPLE_RATE_OCTET1_44100_USER = 0x01, 1280 A2DP_AAC_SAMPLE_RATE_OCTET1_32000_USER = 0x01 << 1, 1281 A2DP_AAC_SAMPLE_RATE_OCTET1_24000_USER = 0x01 << 2, 1282 A2DP_AAC_SAMPLE_RATE_OCTET1_22050_USER = 0x01 << 3, 1283 A2DP_AAC_SAMPLE_RATE_OCTET1_16000_USER = 0x01 << 4, 1284 A2DP_AAC_SAMPLE_RATE_OCTET1_12000_USER = 0x01 << 5, 1285 A2DP_AAC_SAMPLE_RATE_OCTET1_11025_USER = 0x01 << 6, 1286 A2DP_AAC_SAMPLE_RATE_OCTET1_8000_USER = 0x01 << 7, 1287 A2DP_AAC_SAMPLE_RATE_OCTET1_MSK_USER = 0xFF, 1288 A2DP_AAC_SAMPLE_RATE_OCTET2_96000_USER = 0x01 << 12, 1289 A2DP_AAC_SAMPLE_RATE_OCTET2_88200_USER = 0x01 << 13, 1290 A2DP_AAC_SAMPLE_RATE_OCTET2_64000_USER = 0x01 << 14, 1291 A2DP_AAC_SAMPLE_RATE_OCTET2_48000_USER = 0x01 << 15, 1292 A2DP_AAC_SAMPLE_RATE_OCTET2_MSK_USER = 0xF0, 1293 }; 1294 1295 /** 1296 * @brief A2dp codec channel mode enum. 1297 * 1298 * @since 6 1299 */ 1300 enum A2dpUserCodecChannelMode : uint8_t { 1301 A2DP_CHANNEL_MODE_NONE_USER = 0x0, 1302 A2DP_SBC_CHANNEL_MODE_JOINT_STEREO_USER = 0x1, /* octet0 b0 */ 1303 A2DP_SBC_CHANNEL_MODE_STEREO_USER = 0x1 << 1, /* octet0 b1 */ 1304 A2DP_SBC_CHANNEL_MODE_DUAL_USER = 0x1 << 2, /* octet0 b2 */ 1305 A2DP_SBC_CHANNEL_MODE_MONO_USER = 0x1 << 3, /* octet0 b3 */ 1306 A2DP_SBC_CHANNEL_MODE_MSK_USER = 0x0F, 1307 A2DP_AAC_CHANNEL_MODE_OCTET2_DOUBLE_USER = 0x01 << 2, /* octet2 b2 */ 1308 A2DP_AAC_CHANNEL_MODE_OCTET2_SINGLE_USER = 0x01 << 3, /* octet2 b3 */ 1309 A2DP_AAC_CHANNEL_MODE_OCTET2_MSK_USER = 0x0C, 1310 }; 1311 1312 /** 1313 * @brief A2dp codec bits per sample enum. 1314 * 1315 * @since 6 1316 */ 1317 enum A2dpUserCodecBitsPerSample : uint8_t { 1318 A2DP_SAMPLE_BITS_NONE_USER = 0x0, 1319 A2DP_SAMPLE_BITS_16_USER = 0x1 << 0, 1320 A2DP_SAMPLE_BITS_24_USER = 0x1 << 1, 1321 A2DP_SAMPLE_BITS_32_USER = 0x1 << 2, 1322 A2DP_SAMPLE_BITS_MSK_USER = 0x06, 1323 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT0_USER = 0x01, /* octet3 b0 */ 1324 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT1_USER = 0x01 << 1, /* octet3 b1 */ 1325 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT2_USER = 0x01 << 2, /* octet3 b2 */ 1326 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT3_USER = 0x01 << 3, /* octet3 b3 */ 1327 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT4_USER = 0x01 << 4, /* octet3 b4 */ 1328 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT5_USER = 0x01 << 5, /* octet3 b5 */ 1329 A2DP_AAC_SAMPLE_BITS_OCTET3_BIT6_USER = 0x01 << 6, /* octet3 b6 */ 1330 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT0_USER = 0x01, /* octet4 b0 */ 1331 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT1_USER = 0x01 << 1, /* octet4 b1 */ 1332 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT2_USER = 0x01 << 2, /* octet4 b2 */ 1333 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT3_USER = 0x01 << 3, /* octet4 b3 */ 1334 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT4_USER = 0x01 << 4, /* octet4 b4 */ 1335 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT5_USER = 0x01 << 5, /* octet4 b5 */ 1336 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT6_USER = 0x01 << 6, /* octet4 b6 */ 1337 A2DP_AAC_SAMPLE_BITS_OCTET4_BIT7_USER = 0x01 << 7, /* octet4 b6 */ 1338 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT0_USER = 0x01, /* octet5 b0 */ 1339 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT1_USER = 0x01 << 1, /* octet5 b1 */ 1340 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT2_USER = 0x01 << 2, /* octet5 b2 */ 1341 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT3_USER = 0x01 << 3, /* octet5 b3 */ 1342 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT4_USER = 0x01 << 4, /* octet5 b4 */ 1343 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT5_USER = 0x01 << 5, /* octet5 b5 */ 1344 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT6_USER = 0x01 << 6, /* octet5 b6 */ 1345 A2DP_AAC_SAMPLE_BITS_OCTET5_BIT7_USER = 0x01 << 7, /* octet5 b6 */ 1346 }; 1347 1348 /** 1349 * @brief Pbap action Type. 1350 * 1351 * @since 6 1352 */ 1353 enum PbapActionType : uint16_t { 1354 PBAP_ACTION_PULLPHONEBOOKSIZE, // pull phonebooksize 1355 PBAP_ACTION_PULLPHONEBOOK, // pull phonebook 1356 PBAP_ACTION_SETPHONEBOOK, // set phonebook 1357 PBAP_ACTION_PULLVCARDLISTINGSIZE, // pull vcard listing size 1358 PBAP_ACTION_PULLVCARDLISTING, // pull vcard listing 1359 PBAP_ACTION_PULLVCARDENTRY, // pull vcard entry 1360 PBAP_ACTION_ABORT, // abort downloading 1361 }; 1362 1363 // PBAP_PHONEBOOK_NAME 1364 #define PBAP_PHONEBOOK_PB u"/telecom/pb.vcf" 1365 #define PBAP_PHONEBOOK_ICH u"/telecom/ich.vcf" 1366 #define PBAP_PHONEBOOK_OCH u"/telecom/och.vcf" 1367 #define PBAP_PHONEBOOK_MCH u"/telecom/mch.vcf" 1368 #define PBAP_PHONEBOOK_CCH u"/telecom/cch.vcf" 1369 #define PBAP_PHONEBOOK_SPD u"/telecom/spd.vcf" 1370 #define PBAP_PHONEBOOK_FAV u"/telecom/fav.vcf" 1371 #define PBAP_PHONEBOOK_PB1 u"/SIM1/telecom/pb.vcf" 1372 #define PBAP_PHONEBOOK_ICH1 u"/SIM1/telecom/ich.vcf" 1373 #define PBAP_PHONEBOOK_OCH1 u"/SIM1/telecom/och.vcf" 1374 #define PBAP_PHONEBOOK_MCH1 u"/SIM1/telecom/mch.vcf" 1375 #define PBAP_PHONEBOOK_CCH1 u"/SIM1/telecom/cch.vcf" 1376 1377 enum PbapOrderType : uint8_t { 1378 PBAP_ORDER_INDEXED = 0x00, // indexed order 1379 PBAP_ORDER_ALPHANUMERIC = 0x01, // alphabetical order 1380 PBAP_ORDER_PHONETIC = 0x02, // phonetic order 1381 }; 1382 1383 enum PbapFormatType : uint8_t { 1384 PBAP_FORMAT_VCARD2_1 = 0x00, // vCard Version 1385 PBAP_FORMAT_VCARD3_0 = 0x01, // vCard Version 1386 }; 1387 1388 // 5.1.4.1 PropertySelector {PropertyMask (64-bit value)} 1389 #define PBAP_PROPERTY_VERSION (1ULL << 0) // vCard Version 1390 #define PBAP_PROPERTY_FN (1ULL << 1) // Formatted Name 1391 #define PBAP_PROPERTY_N (1ULL << 2) // Structured Presentation of Name 1392 #define PBAP_PROPERTY_PHOTO (1ULL << 3) // Associated Image or Photo 1393 #define PBAP_PROPERTY_BDAY (1ULL << 4) // Birthday 1394 #define PBAP_PROPERTY_ADR (1ULL << 5) // Delivery Address 1395 #define PBAP_PROPERTY_LABEL (1ULL << 6) // Delivery 1396 #define PBAP_PROPERTY_TEL (1ULL << 7) // Telephone Number 1397 #define PBAP_PROPERTY_EMAIL (1ULL << 8) // Electronic Mail Address 1398 #define PBAP_PROPERTY_MAILER (1ULL << 9) // Electronic Mail 1399 #define PBAP_PROPERTY_TZ (1ULL << 10) // Time Zone 1400 #define PBAP_PROPERTY_GEO (1ULL << 11) // Geographic Position 1401 #define PBAP_PROPERTY_TITLE (1ULL << 12) // Job 1402 #define PBAP_PROPERTY_ROLE (1ULL << 13) // Role within the Organization 1403 #define PBAP_PROPERTY_LOGO (1ULL << 14) // Organization Logo 1404 #define PBAP_PROPERTY_AGENT (1ULL << 15) // vCard of Person Representing 1405 #define PBAP_PROPERTY_ORG (1ULL << 16) // Name of Organization 1406 #define PBAP_PROPERTY_NOTE (1ULL << 17) // Comments 1407 #define PBAP_PROPERTY_REV (1ULL << 18) // Revision 1408 #define PBAP_PROPERTY_SOUND (1ULL << 19) // Pronunciation of Name 1409 #define PBAP_PROPERTY_URL (1ULL << 20) // Uniform Resource Locator 1410 #define PBAP_PROPERTY_UID (1ULL << 21) // Unique ID 1411 #define PBAP_PROPERTY_KEY (1ULL << 22) // Public Encryption Key 1412 #define PBAP_PROPERTY_NICKNAME (1ULL << 23) // Nickname 1413 #define PBAP_PROPERTY_CATEGORIES (1ULL << 24) // Categories 1414 #define PBAP_PROPERTY_PROID (1ULL << 25) // Product ID 1415 #define PBAP_PROPERTY_CLASS (1ULL << 26) // Class information 1416 #define PBAP_PROPERTY_SORT_STRING (1ULL << 27) // String used for sorting operations 1417 #define PBAP_PROPERTY_X_IRMC_CALL_DATETIME (1ULL << 28) // Time stamp 1418 #define PBAP_PROPERTY_X_BT_SPEEDDIALKEY (1ULL << 29) // Speed-dial shortcut 1419 #define PBAP_PROPERTY_X_BT_UCI (1ULL << 30) // Uniform Caller Identifier 1420 #define PBAP_PROPERTY_X_BT_UID (1ULL << 31) // Bluetooth Contact Unique Identifier 1421 #define PBAP_PROPERTY_PROPRIENTARY_FILTER (1ULL << 39) // Bluetooth Proprientary 1422 1423 enum PbapSelectorOperatorType : uint8_t { 1424 PBAP_SELECTOR_OPERATOR_OR = 0x00, // SelectorOperator Or 1425 PBAP_SELECTOR_OPERATOR_AND = 0x01, // SelectorOperator And 1426 }; 1427 1428 enum PbapSearchPropertyType : uint8_t { 1429 PBAP_SEARCH_PROPERTY_NAME = 0x00, // name 1430 PBAP_SEARCH_PROPERTY_NUMBER = 0x01, // number 1431 PBAP_SEARCH_PROPERTY_SOUND = 0x02, // sound 1432 }; 1433 1434 const uint8_t PBAP_FLAG_GO_TO_ROOT = 0x02; // go back to root 1435 const uint8_t PBAP_FLAG_GO_DOWN = 0x02; // go down 1436 const uint8_t PBAP_FLAG_GO_UP = 0x03; // go up 1437 1438 enum PbapResponseCode : uint8_t { 1439 PBAP_CONTINUE = 0x90, // 100 Continue 1440 PBAP_SUCCESS = 0xA0, // 200 OK, Success 1441 PBAP_CREATED = 0xA1, // 201 Created 1442 PBAP_PBAP_ACCEPTED = 0xA2, // 202 Accepted 1443 PBAP_NON_AUTH = 0xA3, // 203 Non-Authoritative Information 1444 PBAP_NO_CONTENT = 0xA4, // 204 No Content 1445 PBAP_RESET_CONTENT = 0xA5, // 205 Reset Content 1446 PBAP_PARTIAL_CONTENT = 0xA6, // 206 Partial Content 1447 PBAP_MULTIPLE_CHOICES = 0xB0, // 300 Multiple Choices 1448 PBAP_MOVED_PERMANENTLY = 0xB1, // 301 Moved Permanently 1449 PBAP_MOVED_TEMPORARILY = 0xB2, // 302 Moved temporarily 1450 PBAP_SEE_OTHER = 0xB3, // 303 See Other 1451 PBAP_NOT_MODIFIED = 0xB4, // 304 Not modified 1452 PBAP_USE_PROXY = 0xB5, // 305 Use Proxy 1453 PBAP_BAD_REQUEST = 0xC0, // 400 Bad Request - server couldn’t understand request 1454 PBAP_UNAUTHORIZED = 0xC1, // 401 Unauthorized 1455 PBAP_PAYMENT_REQUIRED = 0xC2, // 402 Payment required 1456 PBAP_FORBIDDEN = 0xC3, // 403 Forbidden - operation is understood but refused 1457 PBAP_NOT_FOUND = 0xC4, // 404 Not Found 1458 PBAP_METHOD_NOT_ALLOWED = 0xC5, // 405 Method not allowed 1459 PBAP_NOT_ACCEPTABLE = 0xC6, // 406 Not Acceptable 1460 PBAP_PROXY_AUTH_REQUIRED = 0xC7, // 407 Proxy Authentication required 1461 PBAP_REQUEST_TIME_OUT = 0xC8, // 408 Request Time Out 1462 PBAP_CONFLICT = 0xC9, // 409 Conflict 1463 PBAP_GONE = 0xCA, // 410 Gone 1464 PBAP_LENGTH_REQUIRED = 0xCB, // 411 Length Required 1465 PBAP_PRECONDITION_FAILED = 0xCC, // 412 Precondition failed 1466 PBAP_REQUESTED_ENTITY_TOO_LARGE = 0xCD, // 413 Requested entity too large 1467 PBAP_REQUEST_URL_TOO_LARGE = 0xCE, // 414 Request URL too large 1468 PBAP_UNSUPPORTED_MEDIA_TYPE = 0xCF, // 415 Unsupported media type 1469 PBAP_INTERNAL_SERVER_ERROR = 0xD0, // 500 Internal Server Error 1470 PBAP_NOT_IMPLEMENTED = 0xD1, // 501 Not Implemented 1471 PBAP_BAD_GATEWAY = 0xD2, // 502 Bad Gateway 1472 PBAP_SERVICE_UNAVAILABLE = 0xD3, // 503 Service Unavailable 1473 PBAP_GATEWAY_TIMEOUT = 0xD4, // 504 Gateway Timeout 1474 PBAP_HTTP_VERSION_NOT_SUPPORTED = 0xD5, // 505 HTTP version not supported 1475 PBAP_DATABASE_FULL = 0xE0, // Database Full 1476 PBAP_DATABASE_LOCKED = 0xE1 // Database Locked 1477 }; 1478 1479 #ifdef BLUETOOTH_EXPORT 1480 #define BLUETOOTH_API __attribute__((visibility("default"))) 1481 #else 1482 #define BLUETOOTH_API 1483 #endif 1484 } // namespace bluetooth 1485 } // namespace OHOS 1486 #endif // BT_DEF_H 1487