• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023-2024 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/**
17 * @file
18 * @kit ConnectivityKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22import type constant from './@ohos.bluetooth.constant';
23
24/**
25 * Provides methods to operate or manage Bluetooth.
26 *
27 * @namespace connection
28 * @syscap SystemCapability.Communication.Bluetooth.Core
29 * @since 10
30 */
31/**
32 * Provides methods to operate or manage Bluetooth.
33 *
34 * @namespace connection
35 * @syscap SystemCapability.Communication.Bluetooth.Core
36 * @atomicservice
37 * @since 12
38 */
39/**
40 * Provides methods to operate or manage Bluetooth.
41 *
42 * @namespace connection
43 * @syscap SystemCapability.Communication.Bluetooth.Core
44 * @crossplatform
45 * @atomicservice
46 * @since 13
47 */
48declare namespace connection {
49  /**
50   * Indicate the profile connection state.
51   *
52   * @typedef { constant.ProfileConnectionState } ProfileConnectionState
53   * @syscap SystemCapability.Communication.Bluetooth.Core
54   * @since 10
55   */
56  /**
57   * Indicate the profile connection state.
58   *
59   * @typedef { constant.ProfileConnectionState } ProfileConnectionState
60   * @syscap SystemCapability.Communication.Bluetooth.Core
61   * @crossplatform
62   * @since 13
63   */
64  type ProfileConnectionState = constant.ProfileConnectionState;
65
66  /**
67   * Indicate the profile id.
68   *
69   * @typedef { constant.ProfileId } ProfileId
70   * @syscap SystemCapability.Communication.Bluetooth.Core
71   * @since 10
72   */
73  /**
74   * Indicate the profile id.
75   *
76   * @typedef { constant.ProfileId } ProfileId
77   * @syscap SystemCapability.Communication.Bluetooth.Core
78   * @crossplatform
79   * @since 13
80   */
81  type ProfileId = constant.ProfileId;
82
83  /**
84   * Indicate the profile uuid.
85   *
86   * @typedef { constant.ProfileUuids } ProfileUuids
87   * @syscap SystemCapability.Communication.Bluetooth.Core
88   * @systemapi
89   * @since 10
90   */
91  /**
92   * Indicate the profile uuid.
93   *
94   * @typedef { constant.ProfileUuids } ProfileUuids
95   * @syscap SystemCapability.Communication.Bluetooth.Core
96   * @since 12
97   */
98  /**
99   * Indicate the profile uuid.
100   *
101   * @typedef { constant.ProfileUuids } ProfileUuids
102   * @syscap SystemCapability.Communication.Bluetooth.Core
103   * @crossplatform
104   * @since 13
105   */
106  type ProfileUuids = constant.ProfileUuids;
107
108  /**
109   * Indicate the major class of a bluetooth device.
110   *
111   * @typedef { constant.MajorClass } MajorClass
112   * @syscap SystemCapability.Communication.Bluetooth.Core
113   * @since 10
114   */
115  /**
116   * Indicate the major class of a bluetooth device.
117   *
118   * @typedef { constant.MajorClass } MajorClass
119   * @syscap SystemCapability.Communication.Bluetooth.Core
120   * @crossplatform
121   * @since 13
122   */
123  type MajorClass = constant.MajorClass;
124
125  /**
126   * Indicate the major minor class of a bluetooth device.
127   *
128   * @typedef { constant.MajorMinorClass } MajorMinorClass
129   * @syscap SystemCapability.Communication.Bluetooth.Core
130   * @since 10
131   */
132  /**
133   * Indicate the major minor class of a bluetooth device.
134   *
135   * @typedef { constant.MajorMinorClass } MajorMinorClass
136   * @syscap SystemCapability.Communication.Bluetooth.Core
137   * @crossplatform
138   * @since 13
139   */
140  type MajorMinorClass = constant.MajorMinorClass;
141
142  /**
143   * Get the profile connection state of the current device.
144   *
145   * @permission ohos.permission.ACCESS_BLUETOOTH
146   * @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter.
147   *                                  With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}.
148   *                                  Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned.
149   *                                  Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned.
150   * @returns { ProfileConnectionState } Returns the connection state.
151   * @throws { BusinessError } 201 - Permission denied.
152   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types.
153   * @throws { BusinessError } 801 - Capability not supported.
154   * @throws { BusinessError } 2900001 - Service stopped.
155   * @throws { BusinessError } 2900003 - Bluetooth disabled.
156   * @throws { BusinessError } 2900004 - Profile not supported.
157   * @throws { BusinessError } 2900099 - Operation failed.
158   * @syscap SystemCapability.Communication.Bluetooth.Core
159   * @since 10
160   */
161  /**
162   * Get the profile connection state of the current device.
163   *
164   * @permission ohos.permission.ACCESS_BLUETOOTH
165   * @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter.
166   *                                  With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}.
167   *                                  Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned.
168   *                                  Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned.
169   * @returns { ProfileConnectionState } Returns the connection state.
170   * @throws { BusinessError } 201 - Permission denied.
171   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types.
172   * @throws { BusinessError } 801 - Capability not supported.
173   * @throws { BusinessError } 2900001 - Service stopped.
174   * @throws { BusinessError } 2900003 - Bluetooth disabled.
175   * @throws { BusinessError } 2900004 - Profile not supported.
176   * @throws { BusinessError } 2900099 - Operation failed.
177   * @syscap SystemCapability.Communication.Bluetooth.Core
178   * @crossplatform
179   * @since 13
180   */
181  function getProfileConnectionState(profileId?: ProfileId): ProfileConnectionState;
182
183  /**
184   * Starts pairing with a remote Bluetooth device.
185   *
186   * @permission ohos.permission.ACCESS_BLUETOOTH
187   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
188   * @param { AsyncCallback<void> } callback - the callback of pairDevice.
189   * @throws { BusinessError } 201 - Permission denied.
190   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
191   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
192   * @throws { BusinessError } 801 - Capability not supported.
193   * @throws { BusinessError } 2900001 - Service stopped.
194   * @throws { BusinessError } 2900003 - Bluetooth disabled.
195   * @throws { BusinessError } 2900099 - Operation failed.
196   * @syscap SystemCapability.Communication.Bluetooth.Core
197   * @since 10
198   */
199  /**
200   * Starts pairing with a remote Bluetooth device.
201   *
202   * @permission ohos.permission.ACCESS_BLUETOOTH
203   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
204   * @param { AsyncCallback<void> } callback - the callback of pairDevice.
205   * @throws { BusinessError } 201 - Permission denied.
206   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
207   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
208   * @throws { BusinessError } 801 - Capability not supported.
209   * @throws { BusinessError } 2900001 - Service stopped.
210   * @throws { BusinessError } 2900003 - Bluetooth disabled.
211   * @throws { BusinessError } 2900099 - Operation failed.
212   * @syscap SystemCapability.Communication.Bluetooth.Core
213   * @atomicservice
214   * @since 12
215   */
216  /**
217   * Starts pairing with a remote Bluetooth device.
218   *
219   * @permission ohos.permission.ACCESS_BLUETOOTH
220   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
221   * @param { AsyncCallback<void> } callback - the callback of pairDevice.
222   * @throws { BusinessError } 201 - Permission denied.
223   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
224   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
225   * @throws { BusinessError } 801 - Capability not supported.
226   * @throws { BusinessError } 2900001 - Service stopped.
227   * @throws { BusinessError } 2900003 - Bluetooth disabled.
228   * @throws { BusinessError } 2900099 - Operation failed.
229   * @syscap SystemCapability.Communication.Bluetooth.Core
230   * @crossplatform
231   * @atomicservice
232   * @since 13
233   */
234  function pairDevice(deviceId: string, callback: AsyncCallback<void>): void;
235
236  /**
237   * Starts pairing with a remote Bluetooth device.
238   *
239   * @permission ohos.permission.ACCESS_BLUETOOTH
240   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
241   * @returns { Promise<void> } Returns the promise object.
242   * @throws { BusinessError } 201 - Permission denied.
243   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
244   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
245   * @throws { BusinessError } 801 - Capability not supported.
246   * @throws { BusinessError } 2900001 - Service stopped.
247   * @throws { BusinessError } 2900003 - Bluetooth disabled.
248   * @throws { BusinessError } 2900099 - Operation failed.
249   * @syscap SystemCapability.Communication.Bluetooth.Core
250   * @since 10
251   */
252  /**
253   * Starts pairing with a remote Bluetooth device.
254   *
255   * @permission ohos.permission.ACCESS_BLUETOOTH
256   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
257   * @returns { Promise<void> } Returns the promise object.
258   * @throws { BusinessError } 201 - Permission denied.
259   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
260   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
261   * @throws { BusinessError } 801 - Capability not supported.
262   * @throws { BusinessError } 2900001 - Service stopped.
263   * @throws { BusinessError } 2900003 - Bluetooth disabled.
264   * @throws { BusinessError } 2900099 - Operation failed.
265   * @syscap SystemCapability.Communication.Bluetooth.Core
266   * @atomicservice
267   * @since 12
268   */
269  /**
270   * Starts pairing with a remote Bluetooth device.
271   *
272   * @permission ohos.permission.ACCESS_BLUETOOTH
273   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
274   * @returns { Promise<void> } Returns the promise object.
275   * @throws { BusinessError } 201 - Permission denied.
276   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
277   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
278   * @throws { BusinessError } 801 - Capability not supported.
279   * @throws { BusinessError } 2900001 - Service stopped.
280   * @throws { BusinessError } 2900003 - Bluetooth disabled.
281   * @throws { BusinessError } 2900099 - Operation failed.
282   * @syscap SystemCapability.Communication.Bluetooth.Core
283   * @crossplatform
284   * @atomicservice
285   * @since 13
286   */
287  function pairDevice(deviceId: string): Promise<void>;
288
289  /**
290   * Starts pairing with a credible remote Bluetooth device with transport.
291   * This interface does not trigger a dialog box and does not require user authorization.
292   * Only specific system application can use this function.
293   *
294   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
295   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
296   * @param { BluetoothTransport } transport - the transport of the remote device to pair.
297   * @param { AsyncCallback<void> } callback - the callback of pairCredibleDevice.
298   * @throws { BusinessError } 201 - Permission denied.
299   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
300   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
301   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
302   * @throws { BusinessError } 801 - Capability not supported.
303   * @throws { BusinessError } 2900001 - Service stopped.
304   * @throws { BusinessError } 2900003 - Bluetooth disabled.
305   * @throws { BusinessError } 2900099 - Operation failed.
306   * @syscap SystemCapability.Communication.Bluetooth.Core
307   * @systemapi
308   * @since 10
309   */
310  function pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback<void>): void;
311
312  /**
313   * Starts pairing with a credible remote Bluetooth device with transport.
314   * This interface does not trigger a dialog box and does not require user authorization.
315   * Only specific system application can use this function.
316   *
317   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
318   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
319   * @param { BluetoothTransport } transport - the transport of the remote device to pair.
320   * @returns { Promise<void> } Returns the promise object.
321   * @throws { BusinessError } 201 - Permission denied.
322   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
323   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
324   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
325   * @throws { BusinessError } 801 - Capability not supported.
326   * @throws { BusinessError } 2900001 - Service stopped.
327   * @throws { BusinessError } 2900003 - Bluetooth disabled.
328   * @throws { BusinessError } 2900099 - Operation failed.
329   * @syscap SystemCapability.Communication.Bluetooth.Core
330   * @systemapi
331   * @since 10
332   */
333  function pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise<void>;
334
335  /**
336   * Remove a paired remote device.
337   *
338   * @permission ohos.permission.ACCESS_BLUETOOTH
339   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
340   * @param { AsyncCallback<void> } callback - the callback of cancelPairedDevice.
341   * @throws { BusinessError } 201 - Permission denied.
342   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
343   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
344   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
345   * @throws { BusinessError } 801 - Capability not supported.
346   * @throws { BusinessError } 2900001 - Service stopped.
347   * @throws { BusinessError } 2900003 - Bluetooth disabled.
348   * @throws { BusinessError } 2900099 - Operation failed.
349   * @syscap SystemCapability.Communication.Bluetooth.Core
350   * @systemapi
351   * @since 10
352   */
353  function cancelPairedDevice(deviceId: string, callback: AsyncCallback<void>): void;
354
355  /**
356   * Remove a paired remote device.
357   *
358   * @permission ohos.permission.ACCESS_BLUETOOTH
359   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
360   * @returns { Promise<void> } Returns the promise object.
361   * @throws { BusinessError } 201 - Permission denied.
362   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
363   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
364   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
365   * @throws { BusinessError } 801 - Capability not supported.
366   * @throws { BusinessError } 2900001 - Service stopped.
367   * @throws { BusinessError } 2900003 - Bluetooth disabled.
368   * @throws { BusinessError } 2900099 - Operation failed.
369   * @syscap SystemCapability.Communication.Bluetooth.Core
370   * @systemapi
371   * @since 10
372   */
373  function cancelPairedDevice(deviceId: string): Promise<void>;
374
375  /**
376   * Remove a pairing remote device.
377   *
378   * @permission ohos.permission.ACCESS_BLUETOOTH
379   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
380   * @param { AsyncCallback<void> } callback - the callback of cancelPairingDevice.
381   * @throws { BusinessError } 201 - Permission denied.
382   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
383   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
384   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
385   * @throws { BusinessError } 801 - Capability not supported.
386   * @throws { BusinessError } 2900001 - Service stopped.
387   * @throws { BusinessError } 2900003 - Bluetooth disabled.
388   * @throws { BusinessError } 2900099 - Operation failed.
389   * @syscap SystemCapability.Communication.Bluetooth.Core
390   * @systemapi
391   * @since 10
392   */
393  function cancelPairingDevice(deviceId: string, callback: AsyncCallback<void>): void;
394
395  /**
396   * Remove a pairing remote device.
397   *
398   * @permission ohos.permission.ACCESS_BLUETOOTH
399   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
400   * @returns { Promise<void> } Returns the promise object.
401   * @throws { BusinessError } 201 - Permission denied.
402   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
403   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
404   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
405   * @throws { BusinessError } 801 - Capability not supported.
406   * @throws { BusinessError } 2900001 - Service stopped.
407   * @throws { BusinessError } 2900003 - Bluetooth disabled.
408   * @throws { BusinessError } 2900099 - Operation failed.
409   * @syscap SystemCapability.Communication.Bluetooth.Core
410   * @systemapi
411   * @since 10
412   */
413  function cancelPairingDevice(deviceId: string): Promise<void>;
414
415  /**
416   * Obtains the name of a peer Bluetooth device.
417   *
418   * @permission ohos.permission.ACCESS_BLUETOOTH
419   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
420   * @returns { string } Returns the device name in character string format.
421   * @throws { BusinessError } 201 - Permission denied.
422   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
423   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
424   * @throws { BusinessError } 801 - Capability not supported.
425   * @throws { BusinessError } 2900001 - Service stopped.
426   * @throws { BusinessError } 2900003 - Bluetooth disabled.
427   * @throws { BusinessError } 2900099 - Operation failed.
428   * @syscap SystemCapability.Communication.Bluetooth.Core
429   * @since 10
430   */
431  /**
432   * Obtains the name of a peer Bluetooth device.
433   *
434   * @permission ohos.permission.ACCESS_BLUETOOTH
435   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
436   * @returns { string } Returns the device name in character string format.
437   * @throws { BusinessError } 201 - Permission denied.
438   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
439   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
440   * @throws { BusinessError } 801 - Capability not supported.
441   * @throws { BusinessError } 2900001 - Service stopped.
442   * @throws { BusinessError } 2900003 - Bluetooth disabled.
443   * @throws { BusinessError } 2900099 - Operation failed.
444   * @syscap SystemCapability.Communication.Bluetooth.Core
445   * @atomicservice
446   * @since 12
447   */
448  /**
449   * Obtains the name of a peer Bluetooth device.
450   *
451   * @permission ohos.permission.ACCESS_BLUETOOTH
452   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
453   * @returns { string } Returns the device name in character string format.
454   * @throws { BusinessError } 201 - Permission denied.
455   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
456   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
457   * @throws { BusinessError } 801 - Capability not supported.
458   * @throws { BusinessError } 2900001 - Service stopped.
459   * @throws { BusinessError } 2900003 - Bluetooth disabled.
460   * @throws { BusinessError } 2900099 - Operation failed.
461   * @syscap SystemCapability.Communication.Bluetooth.Core
462   * @crossplatform
463   * @atomicservice
464   * @since 13
465   */
466  function getRemoteDeviceName(deviceId: string): string;
467
468  /**
469   * Obtains the name or alias of the Bluetooth peer device.
470   *
471   * @permission ohos.permission.ACCESS_BLUETOOTH
472   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
473   * @param { boolean } [alias] - Indicates whether to obtain the device alias. If the parameter is not provided, the device alias is obtained by default.
474   * @returns { string } Returns the device name in character string format.
475   * @throws { BusinessError } 201 - Permission denied.
476   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
477   * 2. Incorrect parameter types. 3. Parameter verification failed.
478   * @throws { BusinessError } 801 - Capability not supported.
479   * @throws { BusinessError } 2900001 - Service stopped.
480   * @throws { BusinessError } 2900003 - Bluetooth disabled.
481   * @throws { BusinessError } 2900099 - Failed to obtain the name or alias of the peer Bluetooth device.
482   * @syscap SystemCapability.Communication.Bluetooth.Core
483   * @atomicservice
484   * @since 16
485   */
486  function getRemoteDeviceName(deviceId: string, alias?: boolean): string;
487
488  /**
489   * Obtains the class of a peer Bluetooth device.
490   *
491   * @permission ohos.permission.ACCESS_BLUETOOTH
492   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
493   * @returns { DeviceClass } The class of the remote device.
494   * @throws { BusinessError } 201 - Permission denied.
495   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
496   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
497   * @throws { BusinessError } 801 - Capability not supported.
498   * @throws { BusinessError } 2900001 - Service stopped.
499   * @throws { BusinessError } 2900003 - Bluetooth disabled.
500   * @throws { BusinessError } 2900099 - Operation failed.
501   * @syscap SystemCapability.Communication.Bluetooth.Core
502   * @since 10
503   */
504  /**
505   * Obtains the class of a peer Bluetooth device.
506   *
507   * @permission ohos.permission.ACCESS_BLUETOOTH
508   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
509   * @returns { DeviceClass } The class of the remote device.
510   * @throws { BusinessError } 201 - Permission denied.
511   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
512   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
513   * @throws { BusinessError } 801 - Capability not supported.
514   * @throws { BusinessError } 2900001 - Service stopped.
515   * @throws { BusinessError } 2900003 - Bluetooth disabled.
516   * @throws { BusinessError } 2900099 - Operation failed.
517   * @syscap SystemCapability.Communication.Bluetooth.Core
518   * @crossplatform
519   * @since 13
520   */
521  /**
522   * Obtains the class of a peer Bluetooth device.
523   *
524   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
525   * @returns { DeviceClass } The class of the remote device.
526   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
527   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
528   * @throws { BusinessError } 801 - Capability not supported.
529   * @throws { BusinessError } 2900001 - Service stopped.
530   * @throws { BusinessError } 2900003 - Bluetooth disabled.
531   * @throws { BusinessError } 2900099 - Operation failed.
532   * @syscap SystemCapability.Communication.Bluetooth.Core
533   * @crossplatform
534   * @since 18
535   */
536  function getRemoteDeviceClass(deviceId: string): DeviceClass;
537
538  /**
539   * Obtains the Bluetooth local name of a device.
540   *
541   * @permission ohos.permission.ACCESS_BLUETOOTH
542   * @returns { string } Returns the name the device.
543   * @throws { BusinessError } 201 - Permission denied.
544   * @throws { BusinessError } 801 - Capability not supported.
545   * @throws { BusinessError } 2900001 - Service stopped.
546   * @throws { BusinessError } 2900099 - Operation failed.
547   * @syscap SystemCapability.Communication.Bluetooth.Core
548   * @since 10
549   */
550  /**
551   * Obtains the Bluetooth local name of a device.
552   *
553   * @permission ohos.permission.ACCESS_BLUETOOTH
554   * @returns { string } Returns the name the device.
555   * @throws { BusinessError } 201 - Permission denied.
556   * @throws { BusinessError } 801 - Capability not supported.
557   * @throws { BusinessError } 2900001 - Service stopped.
558   * @throws { BusinessError } 2900099 - Operation failed.
559   * @syscap SystemCapability.Communication.Bluetooth.Core
560   * @crossplatform
561   * @since 13
562   */
563  function getLocalName(): string;
564
565  /**
566   * Obtains the list of Bluetooth devices that have been paired with the current device.
567   *
568   * @permission ohos.permission.ACCESS_BLUETOOTH
569   * @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
570   * @throws { BusinessError } 201 - Permission denied.
571   * @throws { BusinessError } 801 - Capability not supported.
572   * @throws { BusinessError } 2900001 - Service stopped.
573   * @throws { BusinessError } 2900003 - Bluetooth disabled.
574   * @throws { BusinessError } 2900099 - Operation failed.
575   * @syscap SystemCapability.Communication.Bluetooth.Core
576   * @since 10
577   */
578  /**
579   * Obtains the list of Bluetooth devices that have been paired with the current device.
580   *
581   * @permission ohos.permission.ACCESS_BLUETOOTH
582   * @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
583   * @throws { BusinessError } 201 - Permission denied.
584   * @throws { BusinessError } 801 - Capability not supported.
585   * @throws { BusinessError } 2900001 - Service stopped.
586   * @throws { BusinessError } 2900003 - Bluetooth disabled.
587   * @throws { BusinessError } 2900099 - Operation failed.
588   * @syscap SystemCapability.Communication.Bluetooth.Core
589   * @atomicservice
590   * @since 12
591   */
592  /**
593   * Obtains the list of Bluetooth devices that have been paired with the current device.
594   *
595   * @permission ohos.permission.ACCESS_BLUETOOTH
596   * @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
597   * @throws { BusinessError } 201 - Permission denied.
598   * @throws { BusinessError } 801 - Capability not supported.
599   * @throws { BusinessError } 2900001 - Service stopped.
600   * @throws { BusinessError } 2900003 - Bluetooth disabled.
601   * @throws { BusinessError } 2900099 - Operation failed.
602   * @syscap SystemCapability.Communication.Bluetooth.Core
603   * @crossplatform
604   * @atomicservice
605   * @since 13
606   */
607  function getPairedDevices(): Array<string>;
608
609  /**
610   * Obtains the pair state of a specified device.
611   *
612   * @permission ohos.permission.ACCESS_BLUETOOTH
613   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
614   * @returns { BondState } Returns the pair state.
615   * @throws { BusinessError } 201 - Permission denied.
616   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
617   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
618   * @throws { BusinessError } 801 - Capability not supported.
619   * @throws { BusinessError } 2900001 - Service stopped.
620   * @throws { BusinessError } 2900003 - Bluetooth disabled.
621   * @throws { BusinessError } 2900099 - Operation failed.
622   * @syscap SystemCapability.Communication.Bluetooth.Core
623   * @since 11
624   */
625  /**
626   * Obtains the pair state of a specified device.
627   *
628   * @permission ohos.permission.ACCESS_BLUETOOTH
629   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
630   * @returns { BondState } Returns the pair state.
631   * @throws { BusinessError } 201 - Permission denied.
632   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
633   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
634   * @throws { BusinessError } 801 - Capability not supported.
635   * @throws { BusinessError } 2900001 - Service stopped.
636   * @throws { BusinessError } 2900003 - Bluetooth disabled.
637   * @throws { BusinessError } 2900099 - Operation failed.
638   * @syscap SystemCapability.Communication.Bluetooth.Core
639   * @atomicservice
640   * @since 12
641   */
642  /**
643   * Obtains the pair state of a specified device.
644   *
645   * @permission ohos.permission.ACCESS_BLUETOOTH
646   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
647   * @returns { BondState } Returns the pair state.
648   * @throws { BusinessError } 201 - Permission denied.
649   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
650   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
651   * @throws { BusinessError } 801 - Capability not supported.
652   * @throws { BusinessError } 2900001 - Service stopped.
653   * @throws { BusinessError } 2900003 - Bluetooth disabled.
654   * @throws { BusinessError } 2900099 - Operation failed.
655   * @syscap SystemCapability.Communication.Bluetooth.Core
656   * @crossplatform
657   * @atomicservice
658   * @since 13
659   */
660  function getPairState(deviceId: string): BondState;
661
662  /**
663   * Sets the confirmation of pairing with a certain device.
664   *
665   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
666   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
667   * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise.
668   * @throws { BusinessError } 201 - Permission denied.
669   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
670   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
671   * @throws { BusinessError } 801 - Capability not supported.
672   * @throws { BusinessError } 2900001 - Service stopped.
673   * @throws { BusinessError } 2900003 - Bluetooth disabled.
674   * @throws { BusinessError } 2900099 - Operation failed.
675   * @syscap SystemCapability.Communication.Bluetooth.Core
676   * @since 10
677   */
678  function setDevicePairingConfirmation(deviceId: string, accept: boolean): void;
679
680  /**
681   * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE.
682   *
683   * @permission ohos.permission.ACCESS_BLUETOOTH
684   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
685   * @param { string } code - The pin code entered by the user.
686   * @param { AsyncCallback<void> } callback - the callback of setDevicePinCode.
687   * @throws { BusinessError } 201 - Permission denied.
688   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
689   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
690   * @throws { BusinessError } 801 - Capability not supported.
691   * @throws { BusinessError } 2900001 - Service stopped.
692   * @throws { BusinessError } 2900003 - Bluetooth disabled.
693   * @throws { BusinessError } 2900099 - Operation failed.
694   * @syscap SystemCapability.Communication.Bluetooth.Core
695   * @since 10
696   */
697  function setDevicePinCode(deviceId: string, code: string, callback: AsyncCallback<void>): void;
698
699  /**
700   * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE.
701   *
702   * @permission ohos.permission.ACCESS_BLUETOOTH
703   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
704   * @param { string } code - The pin code entered by the user.
705   * @returns { Promise<void> } Returns the promise object.
706   * @throws { BusinessError } 201 - Permission denied.
707   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
708   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
709   * @throws { BusinessError } 801 - Capability not supported.
710   * @throws { BusinessError } 2900001 - Service stopped.
711   * @throws { BusinessError } 2900003 - Bluetooth disabled.
712   * @throws { BusinessError } 2900099 - Operation failed.
713   * @syscap SystemCapability.Communication.Bluetooth.Core
714   * @since 10
715   */
716  function setDevicePinCode(deviceId: string, code: string): Promise<void>;
717
718  /**
719   * Sets the Bluetooth friendly name of a device. It is used only by system applications for security.
720   * If a non-system application invokes the interface, exception 801 is thrown.
721   *
722   * @permission ohos.permission.ACCESS_BLUETOOTH
723   * @param { string } name - Indicates a valid Bluetooth name.
724   * @throws { BusinessError } 201 - Permission denied.
725   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
726   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
727   * @throws { BusinessError } 801 - Capability not supported.
728   * @throws { BusinessError } 2900001 - Service stopped.
729   * @throws { BusinessError } 2900003 - Bluetooth disabled.
730   * @throws { BusinessError } 2900099 - Operation failed.
731   * @syscap SystemCapability.Communication.Bluetooth.Core
732   * @since 10
733   * @deprecated since 12
734   */
735  function setLocalName(name: string): void;
736
737  /**
738   * Sets the Bluetooth scan mode for a device.
739   *
740   * @permission ohos.permission.ACCESS_BLUETOOTH
741   * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set.
742   * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable.
743   * @throws { BusinessError } 201 - Permission denied.
744   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
745   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
746   * @throws { BusinessError } 801 - Capability not supported.
747   * @throws { BusinessError } 2900001 - Service stopped.
748   * @throws { BusinessError } 2900003 - Bluetooth disabled.
749   * @throws { BusinessError } 2900099 - Operation failed.
750   * @syscap SystemCapability.Communication.Bluetooth.Core
751   * @since 10
752   */
753  function setBluetoothScanMode(mode: ScanMode, duration: number): void;
754
755  /**
756   * Obtains the Bluetooth scanning mode of a device.
757   *
758   * @permission ohos.permission.ACCESS_BLUETOOTH
759   * @returns { ScanMode } Returns the Bluetooth scanning mode.
760   * @throws { BusinessError } 201 - Permission denied.
761   * @throws { BusinessError } 801 - Capability not supported.
762   * @throws { BusinessError } 2900001 - Service stopped.
763   * @throws { BusinessError } 2900003 - Bluetooth disabled.
764   * @throws { BusinessError } 2900099 - Operation failed.
765   * @syscap SystemCapability.Communication.Bluetooth.Core
766   * @since 10
767   */
768  /**
769   * Obtains the Bluetooth scanning mode of a device.
770   *
771   * @permission ohos.permission.ACCESS_BLUETOOTH
772   * @returns { ScanMode } Returns the Bluetooth scanning mode.
773   * @throws { BusinessError } 201 - Permission denied.
774   * @throws { BusinessError } 801 - Capability not supported.
775   * @throws { BusinessError } 2900001 - Service stopped.
776   * @throws { BusinessError } 2900003 - Bluetooth disabled.
777   * @throws { BusinessError } 2900099 - Operation failed.
778   * @syscap SystemCapability.Communication.Bluetooth.Core
779   * @crossplatform
780   * @since 13
781   */
782  function getBluetoothScanMode(): ScanMode;
783
784  /**
785   * Starts scanning Bluetooth devices.
786   *
787   * @permission ohos.permission.ACCESS_BLUETOOTH
788   * @throws { BusinessError } 201 - Permission denied.
789   * @throws { BusinessError } 801 - Capability not supported.
790   * @throws { BusinessError } 2900001 - Service stopped.
791   * @throws { BusinessError } 2900003 - Bluetooth disabled.
792   * @throws { BusinessError } 2900099 - Operation failed.
793   * @syscap SystemCapability.Communication.Bluetooth.Core
794   * @since 10
795   */
796  /**
797   * Starts scanning Bluetooth devices.
798   *
799   * @permission ohos.permission.ACCESS_BLUETOOTH
800   * @throws { BusinessError } 201 - Permission denied.
801   * @throws { BusinessError } 801 - Capability not supported.
802   * @throws { BusinessError } 2900001 - Service stopped.
803   * @throws { BusinessError } 2900003 - Bluetooth disabled.
804   * @throws { BusinessError } 2900099 - Operation failed.
805   * @syscap SystemCapability.Communication.Bluetooth.Core
806   * @atomicservice
807   * @since 12
808   */
809  /**
810   * Starts scanning Bluetooth devices.
811   *
812   * @permission ohos.permission.ACCESS_BLUETOOTH
813   * @throws { BusinessError } 201 - Permission denied.
814   * @throws { BusinessError } 801 - Capability not supported.
815   * @throws { BusinessError } 2900001 - Service stopped.
816   * @throws { BusinessError } 2900003 - Bluetooth disabled.
817   * @throws { BusinessError } 2900099 - Operation failed.
818   * @syscap SystemCapability.Communication.Bluetooth.Core
819   * @crossplatform
820   * @atomicservice
821   * @since 13
822   */
823  function startBluetoothDiscovery(): void;
824
825  /**
826   * Stops Bluetooth device scanning.
827   *
828   * @permission ohos.permission.ACCESS_BLUETOOTH
829   * @throws { BusinessError } 201 - Permission denied.
830   * @throws { BusinessError } 801 - Capability not supported.
831   * @throws { BusinessError } 2900001 - Service stopped.
832   * @throws { BusinessError } 2900003 - Bluetooth disabled.
833   * @throws { BusinessError } 2900099 - Operation failed.
834   * @syscap SystemCapability.Communication.Bluetooth.Core
835   * @since 10
836   */
837  /**
838   * Stops Bluetooth device scanning.
839   *
840   * @permission ohos.permission.ACCESS_BLUETOOTH
841   * @throws { BusinessError } 201 - Permission denied.
842   * @throws { BusinessError } 801 - Capability not supported.
843   * @throws { BusinessError } 2900001 - Service stopped.
844   * @throws { BusinessError } 2900003 - Bluetooth disabled.
845   * @throws { BusinessError } 2900099 - Operation failed.
846   * @syscap SystemCapability.Communication.Bluetooth.Core
847   * @atomicservice
848   * @since 12
849   */
850  /**
851   * Stops Bluetooth device scanning.
852   *
853   * @permission ohos.permission.ACCESS_BLUETOOTH
854   * @throws { BusinessError } 201 - Permission denied.
855   * @throws { BusinessError } 801 - Capability not supported.
856   * @throws { BusinessError } 2900001 - Service stopped.
857   * @throws { BusinessError } 2900003 - Bluetooth disabled.
858   * @throws { BusinessError } 2900099 - Operation failed.
859   * @syscap SystemCapability.Communication.Bluetooth.Core
860   * @crossplatform
861   * @atomicservice
862   * @since 13
863   */
864  function stopBluetoothDiscovery(): void;
865
866  /**
867   * Check if bluetooth is discovering.
868   *
869   * @permission ohos.permission.ACCESS_BLUETOOTH
870   * @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise.
871   * @throws { BusinessError } 201 - Permission denied.
872   * @throws { BusinessError } 801 - Capability not supported.
873   * @throws { BusinessError } 2900001 - Service stopped.
874   * @throws { BusinessError } 2900003 - Bluetooth disabled.
875   * @throws { BusinessError } 2900099 - Operation failed.
876   * @syscap SystemCapability.Communication.Bluetooth.Core
877   * @since 11
878   */
879  /**
880   * Check if bluetooth is discovering.
881   *
882   * @permission ohos.permission.ACCESS_BLUETOOTH
883   * @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise.
884   * @throws { BusinessError } 201 - Permission denied.
885   * @throws { BusinessError } 801 - Capability not supported.
886   * @throws { BusinessError } 2900001 - Service stopped.
887   * @throws { BusinessError } 2900003 - Bluetooth disabled.
888   * @throws { BusinessError } 2900099 - Operation failed.
889   * @syscap SystemCapability.Communication.Bluetooth.Core
890   * @crossplatform
891   * @since 13
892   */
893  function isBluetoothDiscovering(): boolean;
894
895  /**
896   * Obtains the profile UUIDs supported by the local device.
897   *
898   * @permission ohos.permission.ACCESS_BLUETOOTH
899   * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getLocalProfileUuids.
900   * @throws { BusinessError } 201 - Permission denied.
901   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
902   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
903   * <br>2. Incorrect parameter types.
904   * @throws { BusinessError } 801 - Capability not supported.
905   * @throws { BusinessError } 2900001 - Service stopped.
906   * @throws { BusinessError } 2900003 - Bluetooth disabled.
907   * @throws { BusinessError } 2900099 - Operation failed.
908   * @syscap SystemCapability.Communication.Bluetooth.Core
909   * @systemapi
910   * @since 10
911   */
912  function getLocalProfileUuids(callback: AsyncCallback<Array<ProfileUuids>>): void;
913
914  /**
915   * Obtains the profile UUIDs supported by the local device.
916   *
917   * @permission ohos.permission.ACCESS_BLUETOOTH
918   * @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
919   * @throws { BusinessError } 201 - Permission denied.
920   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
921   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
922   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
923   * @throws { BusinessError } 801 - Capability not supported.
924   * @throws { BusinessError } 2900001 - Service stopped.
925   * @throws { BusinessError } 2900003 - Bluetooth disabled.
926   * @throws { BusinessError } 2900099 - Operation failed.
927   * @syscap SystemCapability.Communication.Bluetooth.Core
928   * @systemapi
929   * @since 10
930   */
931  function getLocalProfileUuids(): Promise<Array<ProfileUuids>>;
932
933  /**
934   * Obtains the profile UUIDs supported by the remote device.
935   *
936   * @permission ohos.permission.ACCESS_BLUETOOTH
937   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
938   * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
939   * @throws { BusinessError } 201 - Permission denied.
940   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
941   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
942   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
943   * @throws { BusinessError } 801 - Capability not supported.
944   * @throws { BusinessError } 2900001 - Service stopped.
945   * @throws { BusinessError } 2900003 - Bluetooth disabled.
946   * @throws { BusinessError } 2900099 - Operation failed.
947   * @syscap SystemCapability.Communication.Bluetooth.Core
948   * @systemapi
949   * @since 10
950   */
951  /**
952   * Obtains the profile UUIDs supported by the remote device.
953   *
954   * @permission ohos.permission.ACCESS_BLUETOOTH
955   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
956   * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
957   * @throws { BusinessError } 201 - Permission denied.
958   * @throws { BusinessError } 401 - Invalid parameter.
959   * @throws { BusinessError } 801 - Capability not supported.
960   * @throws { BusinessError } 2900001 - Service stopped.
961   * @throws { BusinessError } 2900003 - Bluetooth disabled.
962   * @throws { BusinessError } 2900099 - Operation failed.
963   * @syscap SystemCapability.Communication.Bluetooth.Core
964   * @since 12
965   */
966  /**
967   * Obtains the profile UUIDs supported by the remote device.
968   *
969   * @permission ohos.permission.ACCESS_BLUETOOTH
970   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
971   * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
972   * @throws { BusinessError } 201 - Permission denied.
973   * @throws { BusinessError } 401 - Invalid parameter.
974   * @throws { BusinessError } 801 - Capability not supported.
975   * @throws { BusinessError } 2900001 - Service stopped.
976   * @throws { BusinessError } 2900003 - Bluetooth disabled.
977   * @throws { BusinessError } 2900099 - Operation failed.
978   * @syscap SystemCapability.Communication.Bluetooth.Core
979   * @crossplatform
980   * @since 13
981   */
982  function getRemoteProfileUuids(deviceId: string, callback: AsyncCallback<Array<ProfileUuids>>): void;
983
984  /**
985   * Obtains the profile UUIDs supported by the remote device.
986   *
987   * @permission ohos.permission.ACCESS_BLUETOOTH
988   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
989   * @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
990   * @throws { BusinessError } 201 - Permission denied.
991   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
992   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
993   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
994   * @throws { BusinessError } 801 - Capability not supported.
995   * @throws { BusinessError } 2900001 - Service stopped.
996   * @throws { BusinessError } 2900003 - Bluetooth disabled.
997   * @throws { BusinessError } 2900099 - Operation failed.
998   * @syscap SystemCapability.Communication.Bluetooth.Core
999   * @systemapi
1000   * @since 10
1001   */
1002  /**
1003   * Obtains the profile UUIDs supported by the remote device.
1004   *
1005   * @permission ohos.permission.ACCESS_BLUETOOTH
1006   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1007   * @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
1008   * @throws { BusinessError } 201 - Permission denied.
1009   * @throws { BusinessError } 401 - Invalid parameter.
1010   * @throws { BusinessError } 801 - Capability not supported.
1011   * @throws { BusinessError } 2900001 - Service stopped.
1012   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1013   * @throws { BusinessError } 2900099 - Operation failed.
1014   * @syscap SystemCapability.Communication.Bluetooth.Core
1015   * @since 12
1016   */
1017  /**
1018   * Obtains the profile UUIDs supported by the remote device.
1019   *
1020   * @permission ohos.permission.ACCESS_BLUETOOTH
1021   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1022   * @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
1023   * @throws { BusinessError } 201 - Permission denied.
1024   * @throws { BusinessError } 401 - Invalid parameter.
1025   * @throws { BusinessError } 801 - Capability not supported.
1026   * @throws { BusinessError } 2900001 - Service stopped.
1027   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1028   * @throws { BusinessError } 2900099 - Operation failed.
1029   * @syscap SystemCapability.Communication.Bluetooth.Core
1030   * @crossplatform
1031   * @since 13
1032   */
1033  function getRemoteProfileUuids(deviceId: string): Promise<Array<ProfileUuids>>;
1034
1035  /**
1036   * Connects all allowed bluetooth profiles between the local and remote device.
1037   *
1038   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1039   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1040   * @param { AsyncCallback<void> } callback - the callback result.
1041   * @throws { BusinessError } 201 - Permission denied.
1042   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1043   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1044   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1045   * @throws { BusinessError } 801 - Capability not supported.
1046   * @throws { BusinessError } 2900001 - Service stopped.
1047   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1048   * @throws { BusinessError } 2900099 - Operation failed.
1049   * @syscap SystemCapability.Communication.Bluetooth.Core
1050   * @systemapi
1051   * @since 11
1052   */
1053  /**
1054   * Connects all allowed bluetooth profiles between the local and remote device.
1055   *
1056   * @permission ohos.permission.ACCESS_BLUETOOTH
1057   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1058   * @param { AsyncCallback<void> } callback - the callback result.
1059   * @throws { BusinessError } 201 - Permission denied.
1060   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
1061   * 2. Incorrect parameter types. 3. Parameter verification failed.
1062   * @throws { BusinessError } 801 - Capability not supported.
1063   * @throws { BusinessError } 2900001 - Service stopped.
1064   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1065   * @throws { BusinessError } 2900099 - Operation failed.
1066   * @syscap SystemCapability.Communication.Bluetooth.Core
1067   * @since 16
1068   */
1069  function connectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void;
1070
1071  /**
1072   * Connects all allowed bluetooth profiles between the local and remote device.
1073   *
1074   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1075   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1076   * @returns { Promise<void> } Returns the promise object.
1077   * @throws { BusinessError } 201 - Permission denied.
1078   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1079   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1080   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1081   * @throws { BusinessError } 801 - Capability not supported.
1082   * @throws { BusinessError } 2900001 - Service stopped.
1083   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1084   * @throws { BusinessError } 2900099 - Operation failed.
1085   * @syscap SystemCapability.Communication.Bluetooth.Core
1086   * @systemapi
1087   * @since 11
1088   */
1089  /**
1090   * Connects all allowed bluetooth profiles between the local and remote device.
1091   *
1092   * @permission ohos.permission.ACCESS_BLUETOOTH
1093   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1094   * @returns { Promise<void> } Returns the promise object.
1095   * @throws { BusinessError } 201 - Permission denied.
1096   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
1097   * 2. Incorrect parameter types. 3. Parameter verification failed.
1098   * @throws { BusinessError } 801 - Capability not supported.
1099   * @throws { BusinessError } 2900001 - Service stopped.
1100   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1101   * @throws { BusinessError } 2900099 - Operation failed.
1102   * @syscap SystemCapability.Communication.Bluetooth.Core
1103   * @since 16
1104   */
1105  function connectAllowedProfiles(deviceId: string): Promise<void>;
1106
1107  /**
1108   * Disconnects all allowed bluetooth profiles between the local and remote device.
1109   *
1110   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1111   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1112   * @param { AsyncCallback<void> } callback - the callback result.
1113   * @throws { BusinessError } 201 - Permission denied.
1114   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1115   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1116   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1117   * @throws { BusinessError } 801 - Capability not supported.
1118   * @throws { BusinessError } 2900001 - Service stopped.
1119   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1120   * @throws { BusinessError } 2900099 - Operation failed.
1121   * @syscap SystemCapability.Communication.Bluetooth.Core
1122   * @systemapi
1123   * @since 11
1124   */
1125  function disconnectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void;
1126
1127  /**
1128   * Get remote device battery information.
1129   *
1130   * @permission ohos.permission.ACCESS_BLUETOOTH
1131   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1132   * @returns { Promise<BatteryInfo> } Returns battery info.
1133   * @throws { BusinessError } 201 - Permission denied.
1134   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1135   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1136   * @throws { BusinessError } 2900001 - Service stopped.
1137   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1138   * @syscap SystemCapability.Communication.Bluetooth.Core
1139   * @since 12
1140   */
1141  function getRemoteDeviceBatteryInfo(deviceId: string): Promise<BatteryInfo>;
1142
1143  /**
1144   * Obtains the product ID of a remote device.
1145   *
1146   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1147   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1148   * @returns { string } Returns the remote device's product ID.
1149   * @throws { BusinessError } 201 - Permission denied.
1150   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1151   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1152   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1153   * @throws { BusinessError } 801 - Capability not supported.
1154   * @throws { BusinessError } 2900001 - Service stopped.
1155   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1156   * @throws { BusinessError } 2900099 - Operation failed.
1157   * @syscap SystemCapability.Communication.Bluetooth.Core
1158   * @systemapi
1159   * @since 11
1160   */
1161  /**
1162   * Obtains the product ID of a remote device.
1163   *
1164   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1165   * @returns { string } Returns the remote device's product ID.
1166   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1167   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1168   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1169   * @throws { BusinessError } 801 - Capability not supported.
1170   * @throws { BusinessError } 2900001 - Service stopped.
1171   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1172   * @throws { BusinessError } 2900099 - Operation failed.
1173   * @syscap SystemCapability.Communication.Bluetooth.Core
1174   * @systemapi
1175   * @since 16
1176   */
1177  function getRemoteProductId(deviceId: string): string;
1178
1179  /**
1180   * Disconnects all allowed bluetooth profiles between the local and remote device.
1181   *
1182   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1183   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1184   * @returns { Promise<void> } Returns the promise object.
1185   * @throws { BusinessError } 201 - Permission denied.
1186   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1187   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1188   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1189   * @throws { BusinessError } 801 - Capability not supported.
1190   * @throws { BusinessError } 2900001 - Service stopped.
1191   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1192   * @throws { BusinessError } 2900099 - Operation failed.
1193   * @syscap SystemCapability.Communication.Bluetooth.Core
1194   * @systemapi
1195   * @since 11
1196   */
1197  function disconnectAllowedProfiles(deviceId: string): Promise<void>;
1198
1199  /**
1200   * Modify remote device name.
1201   *
1202   * @permission ohos.permission.ACCESS_BLUETOOTH
1203   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1204   * @param { string } name - New device name. Max length is 64 bytes.
1205   * @returns { Promise<void> } Returns the promise object.
1206   * @throws { BusinessError } 201 - Permission denied.
1207   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1208   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1209   * @throws { BusinessError } 2900001 - Service stopped.
1210   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1211   * @syscap SystemCapability.Communication.Bluetooth.Core
1212   * @atomicservice
1213   * @since 12
1214   */
1215    function setRemoteDeviceName(deviceId: string, name: string): Promise<void>;
1216
1217  /**
1218   * Set remote device custom type.
1219   *
1220   * @permission ohos.permission.ACCESS_BLUETOOTH
1221   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1222   * @param { DeviceType } type - Indicates device type.
1223   * @returns { Promise<void> } Returns the promise object.
1224   * @throws { BusinessError } 201 - Permission denied.
1225   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1226   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1227   * @throws { BusinessError } 2900001 - Service stopped.
1228   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1229   * @syscap SystemCapability.Communication.Bluetooth.Core
1230   * @systemapi
1231   * @since 12
1232   */
1233  function setRemoteDeviceType(deviceId: string, type: DeviceType): Promise<void>;
1234
1235  /**
1236   * Get remote device custom type.
1237   *
1238   * @permission ohos.permission.ACCESS_BLUETOOTH
1239   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1240   * @returns { Promise<DeviceType> } Returns the device type.
1241   * @throws { BusinessError } 201 - Permission denied.
1242   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1243   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1244   * @throws { BusinessError } 2900001 - Service stopped.
1245   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1246   * @syscap SystemCapability.Communication.Bluetooth.Core
1247   * @systemapi
1248   * @since 12
1249   */
1250  /**
1251   * Get remote device custom type.
1252   *
1253   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1254   * @returns { Promise<DeviceType> } Returns the device type.
1255   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1256   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1257   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1258   * @throws { BusinessError } 2900001 - Service stopped.
1259   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1260   * @syscap SystemCapability.Communication.Bluetooth.Core
1261   * @systemapi
1262   * @since 18
1263   */
1264  function getRemoteDeviceType(deviceId: string): Promise<DeviceType>;
1265
1266  /**
1267   * Controls the actions of Bluetooth peripherals.
1268   *
1269   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1270   * @param { ControlDeviceActionParams } controlDeviceActionParams - Indicates the action for Bluetooth peripherals.
1271   * @returns { Promise<void> } Returns the promise object.
1272   * @throws { BusinessError } 201 - Permission denied.
1273   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1274   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1275   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1276   * @throws { BusinessError } 801 - Capability not supported.
1277   * @throws { BusinessError } 2900001 - Service stopped.
1278   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1279   * @throws { BusinessError } 2900099 - Operation failed.
1280   * @syscap SystemCapability.Communication.Bluetooth.Core
1281   * @systemapi
1282   * @since 15
1283   */
1284  function controlDeviceAction(controlDeviceActionParams: ControlDeviceActionParams): Promise<void>;
1285
1286  /**
1287   * Get latest connection time of device.
1288   *
1289   * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
1290   * @returns { Promise<number> } Returns latest connection time.
1291   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1292   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1293   * @throws { BusinessError } 801 - Capability not supported.
1294   * @throws { BusinessError } 2900001 - Service stopped.
1295   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1296   * @throws { BusinessError } 2900099 - Operation failed.
1297   * @syscap SystemCapability.Communication.Bluetooth.Core
1298   * @since 15
1299   */
1300  function getLastConnectionTime(deviceId: string): Promise<number>;
1301
1302  /**
1303   * update cloud devices.
1304   *
1305   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
1306   * @param { TrustedPairedDevices } trustedPairedDevices - Indicates the cloud devices.
1307   * @returns { Promise<void> } Returns the promise object.
1308   * @throws { BusinessError } 201 - Permission denied.
1309   * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
1310   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1311   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1312   * @throws { BusinessError } 801 - Capability not supported.
1313   * @throws { BusinessError } 2900001 - Service stopped.
1314   * @throws { BusinessError } 2900003 - Bluetooth disabled.
1315   * @throws { BusinessError } 2900099 - Operation failed.
1316   * @syscap SystemCapability.Communication.Bluetooth.Core
1317   * @systemapi
1318   * @since 15
1319   */
1320  function updateCloudBluetoothDevice(trustedPairedDevices: TrustedPairedDevices): Promise<void>;
1321
1322
1323  /**
1324   * Subscribe the event reported when a remote Bluetooth device is discovered.
1325   *
1326   * @permission ohos.permission.ACCESS_BLUETOOTH
1327   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1328   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1329   * @throws { BusinessError } 201 - Permission denied.
1330   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1331   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1332   * @throws { BusinessError } 801 - Capability not supported.
1333   * @throws { BusinessError } 2900099 - Operation failed.
1334   * @syscap SystemCapability.Communication.Bluetooth.Core
1335   * @since 10
1336   */
1337  /**
1338   * Subscribe the event reported when a remote Bluetooth device is discovered.
1339   *
1340   * @permission ohos.permission.ACCESS_BLUETOOTH
1341   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1342   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1343   * @throws { BusinessError } 201 - Permission denied.
1344   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1345   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1346   * @throws { BusinessError } 801 - Capability not supported.
1347   * @throws { BusinessError } 2900099 - Operation failed.
1348   * @syscap SystemCapability.Communication.Bluetooth.Core
1349   * @atomicservice
1350   * @since 12
1351   */
1352  /**
1353   * Subscribe the event reported when a remote Bluetooth device is discovered.
1354   *
1355   * @permission ohos.permission.ACCESS_BLUETOOTH
1356   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1357   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1358   * @throws { BusinessError } 201 - Permission denied.
1359   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1360   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1361   * @throws { BusinessError } 801 - Capability not supported.
1362   * @throws { BusinessError } 2900099 - Operation failed.
1363   * @syscap SystemCapability.Communication.Bluetooth.Core
1364   * @crossplatform
1365   * @atomicservice
1366   * @since 13
1367   */
1368  function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void;
1369
1370  /**
1371   * Unsubscribe the event reported when a remote Bluetooth device is discovered.
1372   *
1373   * @permission ohos.permission.ACCESS_BLUETOOTH
1374   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1375   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1376   * @throws { BusinessError } 201 - Permission denied.
1377   * @throws { BusinessError } 801 - Capability not supported.
1378   * @throws { BusinessError } 2900099 - Operation failed.
1379   * @syscap SystemCapability.Communication.Bluetooth.Core
1380   * @since 10
1381   */
1382  /**
1383   * Unsubscribe the event reported when a remote Bluetooth device is discovered.
1384   *
1385   * @permission ohos.permission.ACCESS_BLUETOOTH
1386   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1387   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1388   * @throws { BusinessError } 201 - Permission denied.
1389   * @throws { BusinessError } 801 - Capability not supported.
1390   * @throws { BusinessError } 2900099 - Operation failed.
1391   * @syscap SystemCapability.Communication.Bluetooth.Core
1392   * @atomicservice
1393   * @since 12
1394   */
1395  /**
1396   * Unsubscribe the event reported when a remote Bluetooth device is discovered.
1397   *
1398   * @permission ohos.permission.ACCESS_BLUETOOTH
1399   * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
1400   * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
1401   * @throws { BusinessError } 201 - Permission denied.
1402   * @throws { BusinessError } 801 - Capability not supported.
1403   * @throws { BusinessError } 2900099 - Operation failed.
1404   * @syscap SystemCapability.Communication.Bluetooth.Core
1405   * @crossplatform
1406   * @atomicservice
1407   * @since 13
1408   */
1409  function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void;
1410
1411  /**
1412   * Subscribe the event reported when a remote Bluetooth device is discovered.
1413   *
1414   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC
1415   * @param { 'discoveryResult' } type - Type of the discovering event to listen for.
1416   * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
1417   * @throws { BusinessError } 201 - Permission denied.
1418   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1419   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1420   * @throws { BusinessError } 801 - Capability not supported.
1421   * @throws { BusinessError } 2900099 - Operation failed.
1422   * @syscap SystemCapability.Communication.Bluetooth.Core
1423   * @systemapi
1424   * @since 12
1425   */
1426  /**
1427   * Subscribe the event reported when a remote Bluetooth device is discovered.
1428   *
1429   * @permission ohos.permission.ACCESS_BLUETOOTH
1430   * @param { 'discoveryResult' } type - Type of the discovering event to listen for.
1431   * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
1432   * @throws { BusinessError } 201 - Permission denied.
1433   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1434   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1435   * @throws { BusinessError } 801 - Capability not supported.
1436   * @throws { BusinessError } 2900099 - Operation failed.
1437   * @syscap SystemCapability.Communication.Bluetooth.Core
1438   * @since 18
1439   */
1440  function on(type: 'discoveryResult', callback: Callback<Array<DiscoveryResult>>): void;
1441
1442  /**
1443   * Unsubscribe the event reported when a remote Bluetooth device is discovered.
1444   *
1445   * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC
1446   * @param { 'discoveryResult' } type - Type of the discovering event to listen for.
1447   * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
1448   * @throws { BusinessError } 201 - Permission denied.
1449   * @throws { BusinessError } 801 - Capability not supported.
1450   * @throws { BusinessError } 2900099 - Operation failed.
1451   * @syscap SystemCapability.Communication.Bluetooth.Core
1452   * @systemapi
1453   * @since 12
1454   */
1455  /**
1456   * Unsubscribe the event reported when a remote Bluetooth device is discovered.
1457   *
1458   * @permission ohos.permission.ACCESS_BLUETOOTH
1459   * @param { 'discoveryResult' } type - Type of the discovering event to listen for.
1460   * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
1461   * @throws { BusinessError } 201 - Permission denied.
1462   * @throws { BusinessError } 801 - Capability not supported.
1463   * @throws { BusinessError } 2900099 - Operation failed.
1464   * @syscap SystemCapability.Communication.Bluetooth.Core
1465   * @since 18
1466   */
1467  function off(type: 'discoveryResult', callback?: Callback<Array<DiscoveryResult>>): void;
1468
1469  /**
1470   * Subscribe the event reported when a remote Bluetooth device is bonded.
1471   *
1472   * @permission ohos.permission.ACCESS_BLUETOOTH
1473   * @param { 'bondStateChange' } type - Type of the bond state event to listen for.
1474   * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
1475   * @throws { BusinessError } 201 - Permission denied.
1476   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1477   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1478   * @throws { BusinessError } 801 - Capability not supported.
1479   * @throws { BusinessError } 2900099 - Operation failed.
1480   * @syscap SystemCapability.Communication.Bluetooth.Core
1481   * @since 10
1482   */
1483  /**
1484   * Subscribe the event reported when a remote Bluetooth device is bonded.
1485   *
1486   * @permission ohos.permission.ACCESS_BLUETOOTH
1487   * @param { 'bondStateChange' } type - Type of the bond state event to listen for.
1488   * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
1489   * @throws { BusinessError } 201 - Permission denied.
1490   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1491   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1492   * @throws { BusinessError } 801 - Capability not supported.
1493   * @throws { BusinessError } 2900099 - Operation failed.
1494   * @syscap SystemCapability.Communication.Bluetooth.Core
1495   * @crossplatform
1496   * @since 13
1497   */
1498  function on(type: 'bondStateChange', callback: Callback<BondStateParam>): void;
1499
1500  /**
1501   * Unsubscribe the event reported when a remote Bluetooth device is bonded.
1502   *
1503   * @permission ohos.permission.ACCESS_BLUETOOTH
1504   * @param { 'bondStateChange' } type - Type of the bond state event to listen for.
1505   * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
1506   * @throws { BusinessError } 201 - Permission denied.
1507   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1508   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1509   * @throws { BusinessError } 801 - Capability not supported.
1510   * @throws { BusinessError } 2900099 - Operation failed.
1511   * @syscap SystemCapability.Communication.Bluetooth.Core
1512   * @since 10
1513   */
1514  /**
1515   * Unsubscribe the event reported when a remote Bluetooth device is bonded.
1516   *
1517   * @permission ohos.permission.ACCESS_BLUETOOTH
1518   * @param { 'bondStateChange' } type - Type of the bond state event to listen for.
1519   * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
1520   * @throws { BusinessError } 201 - Permission denied.
1521   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1522   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1523   * @throws { BusinessError } 801 - Capability not supported.
1524   * @throws { BusinessError } 2900099 - Operation failed.
1525   * @syscap SystemCapability.Communication.Bluetooth.Core
1526   * @crossplatform
1527   * @since 13
1528   */
1529  function off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void;
1530
1531  /**
1532   * Subscribe the event of a pairing request from a remote Bluetooth device.
1533   *
1534   * @permission ohos.permission.ACCESS_BLUETOOTH
1535   * @param { 'pinRequired' } type - Type of the pairing request event to listen for.
1536   * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event.
1537   * @throws { BusinessError } 201 - Permission denied.
1538   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1539   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1540   * @throws { BusinessError } 801 - Capability not supported.
1541   * @throws { BusinessError } 2900099 - Operation failed.
1542   * @syscap SystemCapability.Communication.Bluetooth.Core
1543   * @since 10
1544   */
1545  function on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void;
1546
1547  /**
1548   * Unsubscribe the event of a pairing request from a remote Bluetooth device.
1549   *
1550   * @permission ohos.permission.ACCESS_BLUETOOTH
1551   * @param { 'pinRequired' } type - Type of the pairing request event to listen for.
1552   * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event.
1553   * @throws { BusinessError } 201 - Permission denied.
1554   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
1555   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
1556   * @throws { BusinessError } 801 - Capability not supported.
1557   * @throws { BusinessError } 2900099 - Operation failed.
1558   * @syscap SystemCapability.Communication.Bluetooth.Core
1559   * @since 10
1560   */
1561  function off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void;
1562
1563  /**
1564   * Subscribe the event of battery state changed from a remote device.
1565   *
1566   * @permission ohos.permission.ACCESS_BLUETOOTH
1567   * @param { 'batteryChange' } type - Type of the battery event to listen for.
1568   * @param { Callback<BatteryInfo> } callback - Callback used to listen.
1569   * @throws { BusinessError } 201 - Permission denied.
1570   * @throws { BusinessError } 2900099 - Operation failed.
1571   * @syscap SystemCapability.Communication.Bluetooth.Core
1572   * @since 12
1573   */
1574  function on(type: 'batteryChange', callback: Callback<BatteryInfo>): void;
1575
1576  /**
1577   * Unsubscribe the event of battery state changed from a remote device.
1578   *
1579   * @permission ohos.permission.ACCESS_BLUETOOTH
1580   * @param { 'batteryChange' } type - Type of the battery event to listen for.
1581   * @param { Callback<BatteryInfo> } callback - Callback used to listen.
1582   * @throws { BusinessError } 201 - Permission denied.
1583   * @throws { BusinessError } 2900099 - Operation failed.
1584   * @syscap SystemCapability.Communication.Bluetooth.Core
1585   * @since 12
1586   */
1587  function off(type: 'batteryChange', callback?: Callback<BatteryInfo>): void;
1588
1589  /**
1590   * Describes the class of a bluetooth device.
1591   *
1592   * @typedef BondStateParam
1593   * @syscap SystemCapability.Communication.Bluetooth.Core
1594   * @since 10
1595   */
1596  /**
1597   * Describes the class of a bluetooth device.
1598   *
1599   * @typedef BondStateParam
1600   * @syscap SystemCapability.Communication.Bluetooth.Core
1601   * @crossplatform
1602   * @since 13
1603   */
1604  interface BondStateParam {
1605    /**
1606     * Address of a Bluetooth device.
1607     *
1608     * @type { string }
1609     * @syscap SystemCapability.Communication.Bluetooth.Core
1610     * @since 10
1611     */
1612    /**
1613     * Address of a Bluetooth device.
1614     *
1615     * @type { string }
1616     * @syscap SystemCapability.Communication.Bluetooth.Core
1617     * @crossplatform
1618     * @since 13
1619     */
1620    deviceId: string;
1621    /**
1622     * Profile connection state of the device.
1623     *
1624     * @type { BondState }
1625     * @syscap SystemCapability.Communication.Bluetooth.Core
1626     * @since 10
1627     */
1628    /**
1629     * Profile connection state of the device.
1630     *
1631     * @type { BondState }
1632     * @syscap SystemCapability.Communication.Bluetooth.Core
1633     * @crossplatform
1634     * @since 13
1635     */
1636    state: BondState;
1637    /**
1638     * Cause of unbond.
1639     *
1640     * @type { UnbondCause }
1641     * @syscap SystemCapability.Communication.Bluetooth.Core
1642     * @since 12
1643     */
1644    /**
1645     * Cause of unbond.
1646     *
1647     * @type { UnbondCause }
1648     * @syscap SystemCapability.Communication.Bluetooth.Core
1649     * @crossplatform
1650     * @since 13
1651     */
1652    cause: UnbondCause;
1653  }
1654
1655  /**
1656   * Describes the bond key param.
1657   *
1658   * @typedef PinRequiredParam
1659   * @syscap SystemCapability.Communication.Bluetooth.Core
1660   * @since 10
1661   */
1662  interface PinRequiredParam {
1663    /**
1664     * ID of the device to pair.
1665     *
1666     * @type { string }
1667     * @syscap SystemCapability.Communication.Bluetooth.Core
1668     * @since 10
1669     */
1670    deviceId: string;
1671    /**
1672     * Key for the device pairing.
1673     *
1674     * @type { string }
1675     * @syscap SystemCapability.Communication.Bluetooth.Core
1676     * @since 10
1677     */
1678    pinCode: string;
1679    /**
1680     * Indicates the pairing type to a peer device.
1681     *
1682     * @type { PinType }
1683     * @syscap SystemCapability.Communication.Bluetooth.Core
1684     * @systemapi
1685     * @since 10
1686     */
1687    pinType: PinType;
1688  }
1689
1690  /**
1691   * Describes the class of a bluetooth device.
1692   *
1693   * @typedef DeviceClass
1694   * @syscap SystemCapability.Communication.Bluetooth.Core
1695   * @since 10
1696   */
1697  /**
1698   * Describes the class of a bluetooth device.
1699   *
1700   * @typedef DeviceClass
1701   * @syscap SystemCapability.Communication.Bluetooth.Core
1702   * @crossplatform
1703   * @since 13
1704   */
1705  interface DeviceClass {
1706    /**
1707     * Major classes of Bluetooth devices.
1708     *
1709     * @type { MajorClass }
1710     * @syscap SystemCapability.Communication.Bluetooth.Core
1711     * @since 10
1712     */
1713    /**
1714     * Major classes of Bluetooth devices.
1715     *
1716     * @type { MajorClass }
1717     * @syscap SystemCapability.Communication.Bluetooth.Core
1718     * @crossplatform
1719     * @since 13
1720     */
1721    majorClass: MajorClass;
1722    /**
1723     * Major and minor classes of Bluetooth devices.
1724     *
1725     * @type { MajorMinorClass }
1726     * @syscap SystemCapability.Communication.Bluetooth.Core
1727     * @since 10
1728     */
1729    /**
1730     * Major and minor classes of Bluetooth devices.
1731     *
1732     * @type { MajorMinorClass }
1733     * @syscap SystemCapability.Communication.Bluetooth.Core
1734     * @crossplatform
1735     * @since 13
1736     */
1737    majorMinorClass: MajorMinorClass;
1738    /**
1739     * Class of the device.
1740     *
1741     * @type { number }
1742     * @syscap SystemCapability.Communication.Bluetooth.Core
1743     * @since 10
1744     */
1745    /**
1746     * Class of the device.
1747     *
1748     * @type { number }
1749     * @syscap SystemCapability.Communication.Bluetooth.Core
1750     * @crossplatform
1751     * @since 13
1752     */
1753    classOfDevice: number;
1754  }
1755
1756  /**
1757   * Enum for the transport of a remote device
1758   *
1759   * @enum { number }
1760   * @syscap SystemCapability.Communication.Bluetooth.Core
1761   * @since 10
1762   */
1763  enum BluetoothTransport {
1764    /**
1765     * The value of bluetooth transport BR/EDR.
1766     *
1767     * @syscap SystemCapability.Communication.Bluetooth.Core
1768     * @since 10
1769     */
1770    TRANSPORT_BR_EDR = 0,
1771    /**
1772     * The value of bluetooth transport LE.
1773     *
1774     * @syscap SystemCapability.Communication.Bluetooth.Core
1775     * @since 10
1776     */
1777    TRANSPORT_LE = 1
1778  }
1779
1780  /**
1781   * The enum of BR scan mode.
1782   *
1783   * @enum { number }
1784   * @syscap SystemCapability.Communication.Bluetooth.Core
1785   * @since 10
1786   */
1787  /**
1788   * The enum of BR scan mode.
1789   *
1790   * @enum { number }
1791   * @syscap SystemCapability.Communication.Bluetooth.Core
1792   * @crossplatform
1793   * @since 13
1794   */
1795  enum ScanMode {
1796    /**
1797     * Indicates the scan mode is none
1798     *
1799     * @syscap SystemCapability.Communication.Bluetooth.Core
1800     * @since 10
1801     */
1802    /**
1803     * Indicates the scan mode is none
1804     *
1805     * @syscap SystemCapability.Communication.Bluetooth.Core
1806     * @crossplatform
1807     * @since 13
1808     */
1809    SCAN_MODE_NONE = 0,
1810    /**
1811     * Indicates the scan mode is connectable
1812     *
1813     * @syscap SystemCapability.Communication.Bluetooth.Core
1814     * @since 10
1815     */
1816    /**
1817     * Indicates the scan mode is connectable
1818     *
1819     * @syscap SystemCapability.Communication.Bluetooth.Core
1820     * @crossplatform
1821     * @since 13
1822     */
1823    SCAN_MODE_CONNECTABLE = 1,
1824    /**
1825     * Indicates the scan mode is general discoverable
1826     *
1827     * @syscap SystemCapability.Communication.Bluetooth.Core
1828     * @since 10
1829     */
1830    SCAN_MODE_GENERAL_DISCOVERABLE = 2,
1831    /**
1832     * Indicates the scan mode is limited discoverable
1833     *
1834     * @syscap SystemCapability.Communication.Bluetooth.Core
1835     * @since 10
1836     */
1837    SCAN_MODE_LIMITED_DISCOVERABLE = 3,
1838    /**
1839     * Indicates the scan mode is connectable and general discoverable
1840     *
1841     * @syscap SystemCapability.Communication.Bluetooth.Core
1842     * @since 10
1843     */
1844    /**
1845     * Indicates the scan mode is connectable and general discoverable
1846     *
1847     * @syscap SystemCapability.Communication.Bluetooth.Core
1848     * @crossplatform
1849     * @since 13
1850     */
1851    SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4,
1852    /**
1853     * Indicates the scan mode is connectable and limited discoverable
1854     *
1855     * @syscap SystemCapability.Communication.Bluetooth.Core
1856     * @since 10
1857     */
1858    SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5
1859  }
1860
1861  /**
1862   * The enum of bond state.
1863   *
1864   * @enum { number }
1865   * @syscap SystemCapability.Communication.Bluetooth.Core
1866   * @since 10
1867   */
1868  /**
1869   * The enum of bond state.
1870   *
1871   * @enum { number }
1872   * @syscap SystemCapability.Communication.Bluetooth.Core
1873   * @atomicservice
1874   * @since 12
1875   */
1876  /**
1877   * The enum of bond state.
1878   *
1879   * @enum { number }
1880   * @syscap SystemCapability.Communication.Bluetooth.Core
1881   * @crossplatform
1882   * @atomicservice
1883   * @since 13
1884   */
1885  enum BondState {
1886    /**
1887     * Indicate the bond state is invalid
1888     *
1889     * @syscap SystemCapability.Communication.Bluetooth.Core
1890     * @since 10
1891     */
1892    /**
1893     * Indicate the bond state is invalid
1894     *
1895     * @syscap SystemCapability.Communication.Bluetooth.Core
1896     * @atomicservice
1897     * @since 12
1898     */
1899    /**
1900     * Indicate the bond state is invalid
1901     *
1902     * @syscap SystemCapability.Communication.Bluetooth.Core
1903     * @crossplatform
1904     * @atomicservice
1905     * @since 13
1906     */
1907    BOND_STATE_INVALID = 0,
1908    /**
1909     * Indicate the bond state is bonding
1910     *
1911     * @syscap SystemCapability.Communication.Bluetooth.Core
1912     * @since 10
1913     */
1914    /**
1915     * Indicate the bond state is bonding
1916     *
1917     * @syscap SystemCapability.Communication.Bluetooth.Core
1918     * @atomicservice
1919     * @since 12
1920     */
1921    /**
1922     * Indicate the bond state is bonding
1923     *
1924     * @syscap SystemCapability.Communication.Bluetooth.Core
1925     * @crossplatform
1926     * @atomicservice
1927     * @since 13
1928     */
1929    BOND_STATE_BONDING = 1,
1930    /**
1931     * Indicate the bond state is bonded
1932     *
1933     * @syscap SystemCapability.Communication.Bluetooth.Core
1934     * @since 10
1935     */
1936    /**
1937     * Indicate the bond state is bonded
1938     *
1939     * @syscap SystemCapability.Communication.Bluetooth.Core
1940     * @atomicservice
1941     * @since 12
1942     */
1943    /**
1944     * Indicate the bond state is bonded
1945     *
1946     * @syscap SystemCapability.Communication.Bluetooth.Core
1947     * @crossplatform
1948     * @atomicservice
1949     * @since 13
1950     */
1951    BOND_STATE_BONDED = 2
1952  }
1953
1954  /**
1955   * Enum for the type of pairing to a remote device
1956   *
1957   * @enum { number }
1958   * @syscap SystemCapability.Communication.Bluetooth.Core
1959   * @systemapi
1960   * @since 10
1961   */
1962  enum PinType {
1963    /**
1964     * The user needs to enter the pin code displayed on the peer device.
1965     *
1966     * @syscap SystemCapability.Communication.Bluetooth.Core
1967     * @systemapi
1968     * @since 10
1969     */
1970    PIN_TYPE_ENTER_PIN_CODE = 0,
1971    /**
1972     * The user needs to enter the passkey displayed on the peer device.
1973     *
1974     * @syscap SystemCapability.Communication.Bluetooth.Core
1975     * @systemapi
1976     * @since 10
1977     */
1978    PIN_TYPE_ENTER_PASSKEY = 1,
1979    /**
1980     * The user needs to confirm the passkey displayed on the local device.
1981     *
1982     * @syscap SystemCapability.Communication.Bluetooth.Core
1983     * @systemapi
1984     * @since 10
1985     */
1986    PIN_TYPE_CONFIRM_PASSKEY = 2,
1987    /**
1988     * The user needs to accept or deny the pairing request.
1989     *
1990     * @syscap SystemCapability.Communication.Bluetooth.Core
1991     * @systemapi
1992     * @since 10
1993     */
1994    PIN_TYPE_NO_PASSKEY_CONSENT = 3,
1995    /**
1996     * The user needs to enter the passkey displayed on the local device on the peer device.
1997     *
1998     * @syscap SystemCapability.Communication.Bluetooth.Core
1999     * @systemapi
2000     * @since 10
2001     */
2002    PIN_TYPE_NOTIFY_PASSKEY = 4,
2003    /**
2004     * The user needs to enter the pin code displayed on the peer device, used for bluetooth 2.0.
2005     *
2006     * @syscap SystemCapability.Communication.Bluetooth.Core
2007     * @systemapi
2008     * @since 10
2009     */
2010    PIN_TYPE_DISPLAY_PIN_CODE = 5,
2011    /**
2012     * The user needs to accept or deny the OOB pairing request.
2013     *
2014     * @syscap SystemCapability.Communication.Bluetooth.Core
2015     * @systemapi
2016     * @since 10
2017     */
2018    PIN_TYPE_OOB_CONSENT = 6,
2019    /**
2020     * The user needs to enter the 16-digit pin code displayed on the peer device.
2021     *
2022     * @syscap SystemCapability.Communication.Bluetooth.Core
2023     * @systemapi
2024     * @since 10
2025     */
2026    PIN_TYPE_PIN_16_DIGITS = 7
2027  }
2028
2029  /**
2030   * Describes the contents of the discovery results
2031   *
2032   * @typedef DiscoveryResult
2033   * @syscap SystemCapability.Communication.Bluetooth.Core
2034   * @systemapi
2035   * @since 12
2036   */
2037  /**
2038   * Describes the contents of the discovery results
2039   *
2040   * @typedef DiscoveryResult
2041   * @syscap SystemCapability.Communication.Bluetooth.Core
2042   * @since 18
2043   */
2044  interface DiscoveryResult {
2045    /**
2046     * Identify of the discovery device
2047     *
2048     * @type { string }
2049     * @syscap SystemCapability.Communication.Bluetooth.Core
2050     * @systemapi
2051     * @since 12
2052     */
2053    /**
2054     * Identify of the discovery device
2055     *
2056     * @type { string }
2057     * @syscap SystemCapability.Communication.Bluetooth.Core
2058     * @since 18
2059     */
2060    deviceId: string;
2061    /**
2062     * RSSI of the remote device
2063     *
2064     * @type { number }
2065     * @syscap SystemCapability.Communication.Bluetooth.Core
2066     * @systemapi
2067     * @since 12
2068     */
2069    /**
2070     * RSSI of the remote device
2071     *
2072     * @type { number }
2073     * @syscap SystemCapability.Communication.Bluetooth.Core
2074     * @since 18
2075     */
2076    rssi: number;
2077    /**
2078     * The local name of the device
2079     *
2080     * @type { string }
2081     * @syscap SystemCapability.Communication.Bluetooth.Core
2082     * @systemapi
2083     * @since 12
2084     */
2085    /**
2086     * The local name of the device
2087     *
2088     * @type { string }
2089     * @syscap SystemCapability.Communication.Bluetooth.Core
2090     * @since 18
2091     */
2092    deviceName: string;
2093    /**
2094     * The class of the device
2095     *
2096     * @type { DeviceClass }
2097     * @syscap SystemCapability.Communication.Bluetooth.Core
2098     * @systemapi
2099     * @since 12
2100     */
2101    /**
2102     * The class of the device
2103     *
2104     * @type { DeviceClass }
2105     * @syscap SystemCapability.Communication.Bluetooth.Core
2106     * @since 18
2107     */
2108    deviceClass: DeviceClass;
2109  }
2110
2111  /**
2112   * Describes the contents of the battery information.
2113   *
2114   * @typedef BatteryInfo
2115   * @syscap SystemCapability.Communication.Bluetooth.Core
2116   * @since 12
2117   */
2118  interface BatteryInfo {
2119    /**
2120     * Identify of the discovery device.
2121     *
2122     * @type { string }
2123     * @syscap SystemCapability.Communication.Bluetooth.Core
2124     * @systemapi
2125     * @since 12
2126     */
2127    deviceId: string;
2128    /**
2129     * Electricity value of the general device. {@code -1} means no power information.
2130     *
2131     * @type { number }
2132     * @syscap SystemCapability.Communication.Bluetooth.Core
2133     * @since 12
2134     */
2135    batteryLevel: number;
2136    /**
2137     * Electricity value of the left ear. {@code -1} means no power information.
2138     *
2139     * @type { number }
2140     * @syscap SystemCapability.Communication.Bluetooth.Core
2141     * @since 12
2142     */
2143    leftEarBatteryLevel: number;
2144    /**
2145     * The charge state of the left ear.
2146     *
2147     * @type { DeviceChargeState }
2148     * @syscap SystemCapability.Communication.Bluetooth.Core
2149     * @since 12
2150     */
2151    leftEarChargeState: DeviceChargeState;
2152    /**
2153     * Electricity value of the right ear. {@code -1} means no power information.
2154     *
2155     * @type { number }
2156     * @syscap SystemCapability.Communication.Bluetooth.Core
2157     * @since 12
2158     */
2159    rightEarBatteryLevel: number;
2160    /**
2161     * The charge state of the right ear.
2162     *
2163     * @type { DeviceChargeState }
2164     * @syscap SystemCapability.Communication.Bluetooth.Core
2165     * @since 12
2166     */
2167    rightEarChargeState: DeviceChargeState;
2168    /**
2169     * Electricity value of the box. {@code -1} means no power information.
2170     *
2171     * @type { number }
2172     * @syscap SystemCapability.Communication.Bluetooth.Core
2173     * @since 12
2174     */
2175    boxBatteryLevel: number;
2176    /**
2177     * The charge state of the box.
2178     *
2179     * @type { DeviceChargeState }
2180     * @syscap SystemCapability.Communication.Bluetooth.Core
2181     * @since 12
2182     */
2183    boxChargeState: DeviceChargeState;
2184  }
2185
2186  /**
2187   * Enum for the charge state.
2188   *
2189   * @enum { number }
2190   * @syscap SystemCapability.Communication.Bluetooth.Core
2191   * @since 12
2192   */
2193  enum DeviceChargeState {
2194    /**
2195     * Not support super charge, and not charged.
2196     *
2197     * @syscap SystemCapability.Communication.Bluetooth.Core
2198     * @since 12
2199     */
2200    DEVICE_NORMAL_CHARGE_NOT_CHARGED = 0,
2201    /**
2202     * Not support super charge, and in charging.
2203     *
2204     * @syscap SystemCapability.Communication.Bluetooth.Core
2205     * @since 12
2206     */
2207    DEVICE_NORMAL_CHARGE_IN_CHARGING = 1,
2208    /**
2209     * Support super charge, and not charged.
2210     *
2211     * @syscap SystemCapability.Communication.Bluetooth.Core
2212     * @since 12
2213     */
2214    DEVICE_SUPER_CHARGE_NOT_CHARGED = 2,
2215    /**
2216     * Support super charge, and in charging.
2217     *
2218     * @syscap SystemCapability.Communication.Bluetooth.Core
2219     * @since 12
2220     */
2221    DEVICE_SUPER_CHARGE_IN_CHARGING = 3
2222  }
2223
2224  /**
2225   * Enum for the custom type of remote device.
2226   *
2227   * @enum { number }
2228   * @syscap SystemCapability.Communication.Bluetooth.Core
2229   * @systemapi
2230   * @since 12
2231   */
2232  enum DeviceType {
2233    /**
2234     * Default type, the type is consistent with COD.
2235     *
2236     * @syscap SystemCapability.Communication.Bluetooth.Core
2237     * @systemapi
2238     * @since 12
2239     */
2240    DEVICE_TYPE_DEFAULT = 0,
2241    /**
2242     * Car bluetooth.
2243     *
2244     * @syscap SystemCapability.Communication.Bluetooth.Core
2245     * @systemapi
2246     * @since 12
2247     */
2248    DEVICE_TYPE_CAR = 1,
2249    /**
2250     * Headset bluetooth.
2251     *
2252     * @syscap SystemCapability.Communication.Bluetooth.Core
2253     * @systemapi
2254     * @since 12
2255     */
2256    DEVICE_TYPE_HEADSET = 2,
2257    /**
2258     * Hearing Aid.
2259     *
2260     * @syscap SystemCapability.Communication.Bluetooth.Core
2261     * @systemapi
2262     * @since 12
2263     */
2264    DEVICE_TYPE_HEARING = 3,
2265    /**
2266     * Glasses device.
2267     *
2268     * @syscap SystemCapability.Communication.Bluetooth.Core
2269     * @systemapi
2270     * @since 12
2271     */
2272    DEVICE_TYPE_GLASSES = 4,
2273    /**
2274     * Watch device.
2275     *
2276     * @syscap SystemCapability.Communication.Bluetooth.Core
2277     * @systemapi
2278     * @since 12
2279     */
2280    DEVICE_TYPE_WATCH = 5,
2281    /**
2282     * Speaker device.
2283     *
2284     * @syscap SystemCapability.Communication.Bluetooth.Core
2285     * @systemapi
2286     * @since 12
2287     */
2288    DEVICE_TYPE_SPEAKER = 6,
2289    /**
2290     * Others bluetooth.
2291     *
2292     * @syscap SystemCapability.Communication.Bluetooth.Core
2293     * @systemapi
2294     * @since 12
2295     */
2296    DEVICE_TYPE_OTHERS = 7
2297  }
2298
2299  /**
2300   * Enum for cause of unbond.
2301   *
2302   * @enum { number }
2303   * @syscap SystemCapability.Communication.Bluetooth.Core
2304   * @since 12
2305   */
2306  /**
2307   * Enum for cause of unbond.
2308   *
2309   * @enum { number }
2310   * @syscap SystemCapability.Communication.Bluetooth.Core
2311   * @crossplatform
2312   * @since 13
2313   */
2314  enum UnbondCause {
2315    /**
2316     * User proactively removed device.
2317     *
2318     * @syscap SystemCapability.Communication.Bluetooth.Core
2319     * @since 12
2320     */
2321    /**
2322     * User proactively removed device.
2323     *
2324     * @syscap SystemCapability.Communication.Bluetooth.Core
2325     * @crossplatform
2326     * @since 13
2327     */
2328    USER_REMOVED = 0,
2329    /**
2330     * Remote device shut down.
2331     *
2332     * @syscap SystemCapability.Communication.Bluetooth.Core
2333     * @since 12
2334     */
2335    REMOTE_DEVICE_DOWN = 1,
2336    /**
2337     * Wrong PIN code.
2338     *
2339     * @syscap SystemCapability.Communication.Bluetooth.Core
2340     * @since 12
2341     */
2342    AUTH_FAILURE = 2,
2343    /**
2344     * Remote device rejected.
2345     *
2346     * @syscap SystemCapability.Communication.Bluetooth.Core
2347     * @since 12
2348     */
2349    AUTH_REJECTED = 3,
2350    /**
2351     * Internal error.
2352     *
2353     * @syscap SystemCapability.Communication.Bluetooth.Core
2354     * @since 12
2355     */
2356    INTERNAL_ERROR = 4
2357  }
2358  /**
2359   * Describes information about controlling the Bluetooth peripheral.
2360   *
2361   * @typedef ControlDeviceActionParams
2362   * @syscap SystemCapability.Communication.Bluetooth.Core
2363   * @systemapi
2364   * @since 15
2365   */
2366  interface ControlDeviceActionParams {
2367    /**
2368     * Indicates the address of the peripheral.
2369     *
2370     * @type { string }
2371     * @syscap SystemCapability.Communication.Bluetooth.Core
2372     * @systemapi
2373     * @since 15
2374     */
2375    deviceId: string;
2376    /**
2377     * Indicates the control type.
2378     *
2379     * @type { ControlType }
2380     * @syscap SystemCapability.Communication.Bluetooth.Core
2381     * @systemapi
2382     * @since 15
2383     */
2384    type: ControlType;
2385    /**
2386     * Indicates the control value.
2387     *
2388     * @type { ControlTypeValue }
2389     * @syscap SystemCapability.Communication.Bluetooth.Core
2390     * @systemapi
2391     * @since 15
2392     */
2393    typeValue: ControlTypeValue;
2394    /**
2395     * Indicates the control object.
2396     *
2397     * @type { ControlObject }
2398     * @syscap SystemCapability.Communication.Bluetooth.Core
2399     * @systemapi
2400     * @since 15
2401     */
2402    controlObject: ControlObject;
2403  }
2404
2405  /**
2406   * Describes the control type.
2407   *
2408   * @enum { number }
2409   * @syscap SystemCapability.Communication.Bluetooth.Core
2410   * @systemapi
2411   * @since 15
2412   */
2413  enum ControlType {
2414    /**
2415     * Indicates the control command of play.
2416     *
2417     * @syscap SystemCapability.Communication.Bluetooth.Core
2418     * @systemapi
2419     * @since 15
2420     */
2421    PLAY = 0,
2422    /**
2423     * Indicates the control command of vibration.
2424     *
2425     * @syscap SystemCapability.Communication.Bluetooth.Core
2426     * @systemapi
2427     * @since 15
2428     */
2429    VIBRATE = 1,
2430    /**
2431     * Indicates the control command of flash.
2432     *
2433     * @syscap SystemCapability.Communication.Bluetooth.Core
2434     * @systemapi
2435     * @since 15
2436     */
2437    FLASH = 2,
2438    /**
2439     * Indicates the control command of lock.
2440     *
2441     * @syscap SystemCapability.Communication.Bluetooth.Core
2442     * @systemapi
2443     * @since 15
2444     */
2445    LOCK = 3,
2446    /**
2447     * Indicates the control command of erase.
2448     *
2449     * @syscap SystemCapability.Communication.Bluetooth.Core
2450     * @systemapi
2451     * @since 15
2452     */
2453    ERASE = 4,
2454  }
2455
2456  /**
2457   * Describes the control type value.
2458   *
2459   * @enum { number }
2460   * @syscap SystemCapability.Communication.Bluetooth.Core
2461   * @systemapi
2462   * @since 15
2463   */
2464  enum ControlTypeValue {
2465    /**
2466     * Indicates the action of disable.
2467     *
2468     * @syscap SystemCapability.Communication.Bluetooth.Core
2469     * @systemapi
2470     * @since 15
2471     */
2472    DISABLE = 0,
2473    /**
2474     * Indicates the action of enable.
2475     *
2476     * @syscap SystemCapability.Communication.Bluetooth.Core
2477     * @systemapi
2478     * @since 15
2479     */
2480    ENABLE = 1,
2481    /**
2482     * Indicates the action of query.
2483     *
2484     * @syscap SystemCapability.Communication.Bluetooth.Core
2485     * @systemapi
2486     * @since 15
2487     */
2488    QUERY = 2,
2489  }
2490
2491  /**
2492   * Describes the control object.
2493   *
2494   * @enum { number }
2495   * @syscap SystemCapability.Communication.Bluetooth.Core
2496   * @systemapi
2497   * @since 15
2498   */
2499  enum ControlObject {
2500    /**
2501     * Control object of left ear.
2502     *
2503     * @syscap SystemCapability.Communication.Bluetooth.Core
2504     * @systemapi
2505     * @since 15
2506     */
2507    LEFT_EAR = 0,
2508    /**
2509     * Control object of right ear.
2510     *
2511     * @syscap SystemCapability.Communication.Bluetooth.Core
2512     * @systemapi
2513     * @since 15
2514     */
2515    RIGHT_EAR = 1,
2516    /**
2517     * Control object of left and right ear.
2518     *
2519     * @syscap SystemCapability.Communication.Bluetooth.Core
2520     * @systemapi
2521     * @since 15
2522     */
2523    LEFT_RIGHT_EAR = 2,
2524  }
2525
2526  /**
2527   * Describes the cloud pair device.
2528   *
2529   * @typedef TrustedPairedDevices
2530   * @syscap SystemCapability.Communication.Bluetooth.Core
2531   * @systemapi
2532   * @since 15
2533   */
2534  interface TrustedPairedDevices {
2535    /**
2536     * The list of cloud pair devices.
2537     *
2538     * @type { Array<TrustedPairedDevice> }
2539     * @syscap SystemCapability.Communication.Bluetooth.Core
2540     * @systemapi
2541     * @since 15
2542     */
2543    trustedPairedDevices: Array<TrustedPairedDevice>;
2544  }
2545
2546  /**
2547   * Describes device of cloud pair.
2548   *
2549   * @typedef TrustedPairedDevice
2550   * @syscap SystemCapability.Communication.Bluetooth.Core
2551   * @systemapi
2552   * @since 15
2553   */
2554  interface TrustedPairedDevice {
2555    /**
2556     * Indicates the device identify.
2557     *
2558     * @type { string }
2559     * @syscap SystemCapability.Communication.Bluetooth.Core
2560     * @systemapi
2561     * @since 15
2562     */
2563    sn: string;
2564    /**
2565     * Indicates the device type of the peripheral.
2566     *
2567     * @type { string }
2568     * @syscap SystemCapability.Communication.Bluetooth.Core
2569     * @systemapi
2570     * @since 15
2571     */
2572    deviceType: string;
2573    /**
2574     * Indicates the modelId of the peripheral.
2575     *
2576     * @type { string }
2577     * @syscap SystemCapability.Communication.Bluetooth.Core
2578     * @systemapi
2579     * @since 15
2580     */
2581    modelId: string;
2582    /**
2583     * Indicates the manufactory of the peripheral.
2584     *
2585     * @type { string }
2586     * @syscap SystemCapability.Communication.Bluetooth.Core
2587     * @systemapi
2588     * @since 15
2589     */
2590    manufactory: string;
2591    /**
2592     * Indicates the productId of the peripheral.
2593     *
2594     * @type { string }
2595     * @syscap SystemCapability.Communication.Bluetooth.Core
2596     * @systemapi
2597     * @since 15
2598     */
2599    productId: string;
2600    /**
2601     * Indicates the HiLink version of the peripheral.
2602     *
2603     * @type { string }
2604     * @syscap SystemCapability.Communication.Bluetooth.Core
2605     * @systemapi
2606     * @since 15
2607     */
2608    hiLinkVersion: string;
2609    /**
2610     * Indicates the macAddress of the peripheral.
2611     *
2612     * @type { string }
2613     * @syscap SystemCapability.Communication.Bluetooth.Core
2614     * @systemapi
2615     * @since 15
2616     */
2617    macAddress: string;
2618    /**
2619     * Indicates the service type of the peripheral.
2620     *
2621     * @type { string }
2622     * @syscap SystemCapability.Communication.Bluetooth.Core
2623     * @systemapi
2624     * @since 15
2625     */
2626    serviceType: string;
2627    /**
2628     * Indicates the service id of the peripheral.
2629     *
2630     * @type { string }
2631     * @syscap SystemCapability.Communication.Bluetooth.Core
2632     * @systemapi
2633     * @since 15
2634     */
2635    serviceId: string;
2636    /**
2637     * The local name of the device
2638     *
2639     * @type { string }
2640     * @syscap SystemCapability.Communication.Bluetooth.Core
2641     * @systemapi
2642     * @since 15
2643     */
2644    deviceName: string;
2645    /**
2646     * Indicates the uuid of the peripheral.
2647     *
2648     * @type { string }
2649     * @syscap SystemCapability.Communication.Bluetooth.Core
2650     * @systemapi
2651     * @since 15
2652     */
2653    uuids: string;
2654    /**
2655     * Indicates the bluetoothClass of the peripheral.
2656     *
2657     * @type { number }
2658     * @syscap SystemCapability.Communication.Bluetooth.Core
2659     * @systemapi
2660     * @since 15
2661     */
2662    bluetoothClass: number;
2663    /**
2664     * Indicates the token of the peripheral.
2665     *
2666     * @type { ArrayBuffer }
2667     * @syscap SystemCapability.Communication.Bluetooth.Core
2668     * @systemapi
2669     * @since 15
2670     */
2671    token: ArrayBuffer;
2672    /**
2673     * Indicates the deviceNameTime of the peripheral.
2674     *
2675     * @type { number }
2676     * @syscap SystemCapability.Communication.Bluetooth.Core
2677     * @systemapi
2678     * @since 15
2679     */
2680    deviceNameTime: number;
2681    /**
2682     * Indicates the securityAdvInfo of the peripheral.
2683     *
2684     * @type { ArrayBuffer }
2685     * @syscap SystemCapability.Communication.Bluetooth.Core
2686     * @systemapi
2687     * @since 15
2688     */
2689    secureAdvertisingInfo: ArrayBuffer;
2690    /**
2691     * Indicates the pairState of the peripheral.
2692     *
2693     * @type { number }
2694     * @syscap SystemCapability.Communication.Bluetooth.Core
2695     * @systemapi
2696     * @since 15
2697     */
2698    pairState: number;
2699  }
2700}
2701export default connection;