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