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