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