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