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