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