• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback, Callback } from './basic';
17
18/**
19 * Provides methods to operate or manage Bluetooth.
20 * @namespace bluetooth
21 * @syscap SystemCapability.Communication.Bluetooth.Core
22 * @since 7
23 * @deprecated since 9
24 * @useinstead ohos.bluetoothManager
25 */
26declare namespace bluetooth {
27    /**
28     * Obtains the Bluetooth status of a device.
29     *
30     * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF},
31     * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF},
32     * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON},
33     * or {@link BluetoothState#STATE_BLE_TURNING_OFF}.
34     * @since 7
35     * @permission ohos.permission.USE_BLUETOOTH
36     * @deprecated since 9
37     * @useinstead ohos.bluetoothManager/bluetoothManager.getState
38     */
39    function getState(): BluetoothState;
40
41    /**
42     * Get the local device connection state to any profile of any remote device.
43     *
44     * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED},
45     * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED},
46     * {@link ProfileConnectionState#STATE_DISCONNECTING}.
47     * @since 7
48     * @permission ohos.permission.USE_BLUETOOTH
49     * @deprecated since 9
50     * @useinstead ohos.bluetoothManager/bluetoothManager.getBtConnectionState
51     */
52    function getBtConnectionState(): ProfileConnectionState;
53
54    /**
55     * Starts pairing with a remote Bluetooth device.
56     *
57     * @param deviceId The address of the remote device to pair.
58     * @returns { boolean } Returns {@code true} if the pairing process is started; returns {@code false} otherwise.
59     * @since 7
60     * @permission ohos.permission.DISCOVER_BLUETOOTH
61     * @deprecated since 9
62     * @useinstead ohos.bluetoothManager/bluetoothManager.pairDevice
63     */
64    function pairDevice(deviceId: string): boolean;
65
66    /**
67     * Remove a paired remote device.
68     *
69     * @param deviceId The address of the remote device to be removed.
70     * @returns { boolean } Returns {@code true} if the cancel process is started; returns {@code false} otherwise.
71     * @since 8
72     * @permission ohos.permission.DISCOVER_BLUETOOTH
73     * @systemapi Hide this for inner system use
74     * @deprecated since 9
75     * @useinstead ohos.bluetoothManager/bluetoothManager.cancelPairedDevice
76     */
77    function cancelPairedDevice(deviceId: string): boolean;
78
79    /**
80     * Obtains the name of a peer Bluetooth device.
81     *
82     * @param deviceId The address of the remote device.
83     * @returns { string } Returns the device name in character string format.
84     * @since 8
85     * @permission ohos.permission.USE_BLUETOOTH
86     * @deprecated since 9
87     * @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceName
88     */
89    function getRemoteDeviceName(deviceId: string): string;
90
91    /**
92     * Obtains the class of a peer Bluetooth device.
93     *
94     * @param deviceId The address of the remote device.
95     * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}.
96     * @since 8
97     * @permission ohos.permission.USE_BLUETOOTH
98     * @deprecated since 9
99     * @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceClass
100     */
101    function getRemoteDeviceClass(deviceId: string): DeviceClass;
102
103    /**
104     * Enables Bluetooth on a device.
105     *
106     * @returns { boolean } Returns {@code true} if Bluetooth is being enabled; returns {@code false} if an error occurs.
107     * @since 8
108     * @permission ohos.permission.DISCOVER_BLUETOOTH
109     * @deprecated since 9
110     * @useinstead ohos.bluetoothManager/bluetoothManager.enableBluetooth
111     */
112    function enableBluetooth(): boolean;
113
114    /**
115     * Disables Bluetooth on a device.
116     *
117     * @returns { boolean } Returns {@code true} if Bluetooth is being disabled; returns {@code false} if an error occurs.
118     * @since 8
119     * @permission ohos.permission.DISCOVER_BLUETOOTH
120     * @deprecated since 9
121     * @useinstead ohos.bluetoothManager/bluetoothManager.disableBluetooth
122     */
123    function disableBluetooth(): boolean;
124
125    /**
126     * Obtains the Bluetooth local name of a device.
127     *
128     * @returns { string } Returns the name the device.
129     * @since 8
130     * @permission ohos.permission.USE_BLUETOOTH
131     * @deprecated since 9
132     * @useinstead ohos.bluetoothManager/bluetoothManager.getLocalName
133     */
134    function getLocalName(): string;
135
136    /**
137     * Obtains the list of Bluetooth devices that have been paired with the current device.
138     *
139     * @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
140     * @since 8
141     * @permission ohos.permission.USE_BLUETOOTH
142     * @deprecated since 9
143     * @useinstead ohos.bluetoothManager/bluetoothManager.getPairedDevices
144     */
145    function getPairedDevices(): Array<string>;
146
147    /**
148     * Obtains the connection state of profile.
149     *
150     * @param profileId The profile id.
151     * @returns { ProfileConnectionState } Returns the connection state.
152     * @since 8
153     * @permission ohos.permission.USE_BLUETOOTH
154     * @deprecated since 9
155     * @useinstead ohos.bluetoothManager/bluetoothManager.getProfileConnectionState
156     */
157    function getProfileConnState(profileId: ProfileId): ProfileConnectionState;
158
159    /**
160     * Sets the confirmation of pairing with a certain device.
161     *
162     * @param device The address of the remote device.
163     * @param accept Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise.
164     * @returns { boolean } Returns {@code true} if the pairing confirmation is set; returns {@code false} otherwise.
165     * @since 8
166     * @permission ohos.permission.MANAGE_BLUETOOTH
167     * @deprecated since 9
168     * @useinstead ohos.bluetoothManager/bluetoothManager.setDevicePairingConfirmation
169     */
170    function setDevicePairingConfirmation(device: string, accept: boolean): boolean;
171
172    /**
173     * Sets the Bluetooth friendly name of a device.
174     *
175     * @param name Indicates a valid Bluetooth name.
176     * @returns { boolean } Returns {@code true} if the Bluetooth name is set successfully; returns {@code false} otherwise.
177     * @since 8
178     * @permission ohos.permission.DISCOVER_BLUETOOTH
179     * @deprecated since 9
180     * @useinstead ohos.bluetoothManager/bluetoothManager.setLocalName
181     */
182    function setLocalName(name: string): boolean;
183
184    /**
185     * Sets the Bluetooth scan mode for a device.
186     *
187     * @param mode Indicates the Bluetooth scan mode to set, {@link ScanMode}.
188     * @param duration Indicates the duration in seconds, in which the host is discoverable.
189     * @returns { boolean } Returns {@code true} if the Bluetooth scan mode is set; returns {@code false} otherwise.
190     * @since 8
191     * @permission ohos.permission.USE_BLUETOOTH
192     * @deprecated since 9
193     * @useinstead ohos.bluetoothManager/bluetoothManager.setBluetoothScanMode
194     */
195    function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;
196
197    /**
198     * Obtains the Bluetooth scanning mode of a device.
199     *
200     * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}.
201     * @since 8
202     * @permission ohos.permission.USE_BLUETOOTH
203     * @deprecated since 9
204     * @useinstead ohos.bluetoothManager/bluetoothManager.getBluetoothScanMode
205     */
206    function getBluetoothScanMode(): ScanMode;
207
208    /**
209     * Starts scanning Bluetooth devices.
210     *
211     * @returns { boolean } Returns {@code true} if the scan is started successfully; returns {@code false} otherwise.
212     * @since 8
213     * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
214     * @deprecated since 9
215     * @useinstead ohos.bluetoothManager/bluetoothManager.startBluetoothDiscovery
216     */
217    function startBluetoothDiscovery(): boolean;
218
219    /**
220     * Stops Bluetooth device scanning.
221     *
222     * @returns { boolean } Returns {@code true} if scanning is stopped successfully; returns {@code false} otherwise.
223     * @since 8
224     * @permission ohos.permission.DISCOVER_BLUETOOTH
225     * @deprecated since 9
226     * @useinstead ohos.bluetoothManager/bluetoothManager.stopBluetoothDiscovery
227     */
228    function stopBluetoothDiscovery(): boolean;
229
230    /**
231     * Subscribe the event reported when a remote Bluetooth device is discovered.
232     *
233     * @param type Type of the discovering event to listen for.
234     * @param callback Callback used to listen for the discovering event.
235     * @since 8
236     * @permission ohos.permission.USE_BLUETOOTH
237     * @deprecated since 9
238     * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bluetoothDeviceFind
239     */
240    function on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void;
241
242    /**
243     * Unsubscribe the event reported when a remote Bluetooth device is discovered.
244     *
245     * @param type Type of the discovering event to listen for.
246     * @param callback Callback used to listen for the discovering event.
247     * @since 8
248     * @permission ohos.permission.USE_BLUETOOTH
249     * @deprecated since 9
250     * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bluetoothDeviceFind
251     */
252    function off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void;
253
254    /**
255     * Subscribe the event reported when a remote Bluetooth device is bonded.
256     *
257     * @param type Type of the bond state event to listen for.
258     * @param callback Callback used to listen for the bond state event, {@link BondStateParam}.
259     * @since 8
260     * @permission ohos.permission.USE_BLUETOOTH
261     * @deprecated since 9
262     * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bondStateChange
263     */
264    function on(type: "bondStateChange", callback: Callback<BondStateParam>): void;
265
266    /**
267     * Unsubscribe the event reported when a remote Bluetooth device is bonded.
268     *
269     * @param type Type of the bond state event to listen for.
270     * @param callback Callback used to listen for the bond state event.
271     * @since 8
272     * @permission ohos.permission.USE_BLUETOOTH
273     * @deprecated since 9
274     * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bondStateChange
275     */
276    function off(type: "bondStateChange", callback?: Callback<BondStateParam>): void;
277
278    /**
279     * Subscribe the event of a pairing request from a remote Bluetooth device.
280     *
281     * @param type Type of the pairing request event to listen for.
282     * @param callback Callback used to listen for the pairing request event.
283     * @since 8
284     * @permission ohos.permission.DISCOVER_BLUETOOTH
285     * @deprecated since 9
286     * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:pinRequired
287     */
288    function on(type: "pinRequired", callback: Callback<PinRequiredParam>): void;
289
290    /**
291     * Unsubscribe the event of a pairing request from a remote Bluetooth device.
292     *
293     * @param type Type of the pairing request event to listen for.
294     * @param callback Callback used to listen for the pairing request event.
295     * @since 8
296     * @permission ohos.permission.DISCOVER_BLUETOOTH
297     * @deprecated since 9
298     * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:pinRequired
299     */
300    function off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void;
301
302    /**
303     * Subscribe the event reported when the Bluetooth state changes.
304     *
305     * @param type Type of the Bluetooth state changes event to listen for.
306     * @param callback Callback used to listen for the Bluetooth state event.
307     * @since 8
308     * @permission ohos.permission.USE_BLUETOOTH
309     * @deprecated since 9
310     * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:stateChange
311     */
312    function on(type: "stateChange", callback: Callback<BluetoothState>): void;
313
314    /**
315     * Unsubscribe the event reported when the Bluetooth state changes.
316     *
317     * @param type Type of the Bluetooth state changes event to listen for.
318     * @param callback Callback used to listen for the Bluetooth state event.
319     * @since 8
320     * @permission ohos.permission.USE_BLUETOOTH
321     * @deprecated since 9
322     * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:stateChange
323     */
324    function off(type: "stateChange", callback?: Callback<BluetoothState>): void;
325
326    /**
327     * Creates a Bluetooth server listening socket.
328     *
329     * @param name Indicates the service name.
330     * @param option Indicates the listen parameters {@link SppOption}.
331     * @param callback Callback used to return a server socket ID.
332     * @since 8
333     * @permission ohos.permission.USE_BLUETOOTH
334     * @deprecated since 9
335     * @useinstead ohos.bluetoothManager/bluetoothManager.sppListen
336     */
337    function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void;
338
339    /**
340     * Waits for a remote device to connect.
341     *
342     * @param serverSocket Indicates the server socket ID, returned by {@link sppListen}.
343     * @param callback Callback used to return a client socket ID.
344     * @since 8
345     * @deprecated since 9
346     * @useinstead ohos.bluetoothManager/bluetoothManager.sppAccept
347     */
348    function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void;
349
350    /**
351     * Connects to a remote device over the socket.
352     *
353     * @param device The address of the remote device to connect.
354     * @param option Indicates the connect parameters {@link SppOption}.
355     * @param callback Callback used to return a client socket ID.
356     * @since 8
357     * @permission ohos.permission.USE_BLUETOOTH
358     * @deprecated since 9
359     * @useinstead ohos.bluetoothManager/bluetoothManager.sppConnect
360     */
361    function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void;
362
363    /**
364     * Disables an spp server socket and releases related resources.
365     *
366     * @param socket Indicates the server socket ID, returned by {@link sppListen}.
367     * @since 8
368     * @deprecated since 9
369     * @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseServerSocket
370     */
371    function sppCloseServerSocket(socket: number): void;
372
373    /**
374     * Disables an spp client socket and releases related resources.
375     *
376     * @param socket Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}.
377     * @since 8
378     * @deprecated since 9
379     * @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseClientSocket
380     */
381    function sppCloseClientSocket(socket: number): void;
382
383    /**
384     * Write data through the socket.
385     *
386     * @param clientSocket Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}.
387     * @param data Indicates the data to write.
388     * @returns { boolean } Returns {@code true} if the data is write successfully; returns {@code false} otherwise.
389     * @since 8
390     * @deprecated since 9
391     * @useinstead ohos.bluetoothManager/bluetoothManager.sppWrite
392     */
393    function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;
394
395    /**
396     * Subscribe the event reported when data is read from the socket.
397     *
398     * @param type Type of the spp read event to listen for.
399     * @param callback Callback used to listen for the spp read event.
400     * @since 8
401     * @deprecated since 9
402     * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:sppRead
403     */
404    function on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void;
405
406    /**
407     * Unsubscribe the event reported when data is read from the socket.
408     *
409     * @param type Type of the spp read event to listen for.
410     * @param callback Callback used to listen for the spp read event.
411     * @since 8
412     * @deprecated since 9
413     * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:sppRead
414     */
415    function off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void;
416
417    /**
418     * Obtains the instance of profile.
419     *
420     * @param profileId The profile id..
421     * @returns { A2dpSourceProfile | HandsFreeAudioGatewayProfile } Returns instance of profile.
422     * @since 8
423     * @deprecated since 9
424     * @useinstead ohos.bluetoothManager/bluetoothManager.getProfileInstance
425     */
426    function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile;
427
428    /**
429     * Base interface of profile.
430     *
431     * @deprecated since 9
432     * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile
433     */
434    interface BaseProfile {
435        /**
436         * Obtains the connected devices list of profile.
437         *
438         * @returns { Array<string> } Returns the address of connected devices list.
439         * @since 8
440         * @permission ohos.permission.USE_BLUETOOTH
441         * @deprecated since 9
442         * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getConnectionDevices
443         */
444        getConnectionDevices(): Array<string>;
445
446        /**
447         * Obtains the profile state of device.
448         *
449         * @param device The address of bluetooth device.
450         * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device.
451         * @since 8
452         * @permission ohos.permission.USE_BLUETOOTH
453         * @deprecated since 9
454         * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getDeviceState
455         */
456        getDeviceState(device: string): ProfileConnectionState;
457    }
458
459    /**
460     * Manager a2dp source profile.
461     *
462     * @deprecated since 9
463     * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile
464     */
465    interface A2dpSourceProfile extends BaseProfile {
466        /**
467         * Connect to device with a2dp.
468         *
469         * @param device The address of the remote device to connect.
470         * @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise.
471         * @since 8
472         * @permission ohos.permission.DISCOVER_BLUETOOTH
473         * @deprecated since 9
474         * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#connect
475         */
476        connect(device: string): boolean;
477
478        /**
479         * Disconnect to device with a2dp.
480         *
481         * @param device The address of the remote device to disconnect.
482         * @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise.
483         * @since 8
484         * @permission ohos.permission.DISCOVER_BLUETOOTH
485         * @deprecated since 9
486         * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#disconnect
487         */
488        disconnect(device: string): boolean;
489
490        /**
491         * Subscribe the event reported when the profile connection state changes .
492         *
493         * @param type Type of the profile connection state changes event to listen for .
494         * @param callback Callback used to listen for event.
495         * @since 8
496         * @deprecated since 9
497         * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.on#event:connectionStateChange
498         */
499        on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void;
500
501        /**
502         * Unsubscribe the event reported when the profile connection state changes .
503         *
504         * @param type Type of the profile connection state changes event to listen for .
505         * @param callback Callback used to listen for event.
506         * @since 8
507         * @deprecated since 9
508         * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.off#event:connectionStateChange
509         */
510        off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void;
511
512        /**
513         * Obtains the playing state of device.
514         *
515         * @param device The address of the remote device.
516         * @returns { PlayingState } Returns {@link PlayingState} of the remote device.
517         * @since 8
518         * @deprecated since 9
519         * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#getPlayingState
520         */
521        getPlayingState(device: string): PlayingState;
522    }
523
524    /**
525     * Manager handsfree AG profile.
526     *
527     * @deprecated since 9
528     * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile
529     */
530    interface HandsFreeAudioGatewayProfile extends BaseProfile {
531        /**
532         * Connect to device with hfp.
533         *
534         * @param device The address of the remote device to connect.
535         * @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise.
536         * @since 8
537         * @permission ohos.permission.DISCOVER_BLUETOOTH
538         * @deprecated since 9
539         * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#connect
540         */
541        connect(device: string): boolean;
542
543        /**
544         * Disconnect to device with hfp.
545         *
546         * @param device The address of the remote device to disconnect.
547         * @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise.
548         * @since 8
549         * @permission ohos.permission.DISCOVER_BLUETOOTH
550         * @deprecated since 9
551         * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#disconnect
552         */
553        disconnect(device: string): boolean;
554
555        /**
556         * Subscribe the event reported when the profile connection state changes .
557         *
558         * @param type Type of the profile connection state changes event to listen for .
559         * @param callback Callback used to listen for event.
560         * @since 8
561         * @deprecated since 9
562         * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.on#event:connectionStateChange
563         */
564        on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void;
565
566        /**
567         * Unsubscribe the event reported when the profile connection state changes .
568         *
569         * @param type Type of the profile connection state changes event to listen for .
570         * @param callback Callback used to listen for event.
571         * @since 8
572         * @deprecated since 9
573         * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.off#event:connectionStateChange
574         */
575        off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void;
576    }
577
578    namespace BLE {
579        /**
580         * create a JavaScript Gatt server instance.
581         *
582         * @returns { GattServer } Returns a JavaScript Gatt server instance {@code GattServer}.
583         * @since 7
584         * @deprecated since 9
585         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattServer
586         */
587        function createGattServer(): GattServer;
588
589        /**
590         * create a JavaScript Gatt client device instance.
591         *
592         * @param deviceId The address of the remote device.
593         * @returns { GattClientDevice } Returns a JavaScript Gatt client device instance {@code GattClientDevice}.
594         * @since 7
595         * @deprecated since 9
596         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattClientDevice
597         */
598        function createGattClientDevice(deviceId: string): GattClientDevice;
599
600        /**
601         * Obtains the list of devices in the connected status.
602         *
603         * @returns { Array<string> } Returns the list of device address.
604         * @since 7
605         * @permission ohos.permission.USE_BLUETOOTH
606         * @deprecated since 9
607         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.getConnectedBLEDevices
608         */
609        function getConnectedBLEDevices(): Array<string>;
610
611        /**
612         * Starts scanning for specified BLE devices with filters.
613         *
614         * @param filters Indicates the list of filters used to filter out specified devices.
615         * If you do not want to use filter, set this parameter to {@code null}.
616         * @param options Indicates the parameters for scanning and if the user does not assign a value, the default value will be used.
617         * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER}
618         * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}.
619         * @since 7
620         * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION
621         * @deprecated since 9
622         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.startBLEScan
623         */
624        function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void;
625
626        /**
627         * Stops BLE scanning.
628         *
629         * @since 7
630         * @permission ohos.permission.DISCOVER_BLUETOOTH
631         * @deprecated since 9
632         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.stopBLEScan
633         */
634        function stopBLEScan(): void;
635
636        /**
637         * Subscribe BLE scan result.
638         *
639         * @param type Type of the scan result event to listen for.
640         * @param callback Callback used to listen for the scan result event.
641         * @since 7
642         * @permission ohos.permission.USE_BLUETOOTH
643         * @deprecated since 9
644         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.on#event:BLEDeviceFind
645         */
646        function on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void;
647
648        /**
649         * Unsubscribe BLE scan result.
650         *
651         * @param type Type of the scan result event to listen for.
652         * @param callback Callback used to listen for the scan result event.
653         * @since 7
654         * @permission ohos.permission.USE_BLUETOOTH
655         * @deprecated since 9
656         * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.off#event:BLEDeviceFind
657         */
658        function off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void;
659    }
660
661    /**
662     * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance.
663     *
664     * @deprecated since 9
665     * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer
666     */
667    interface GattServer {
668        /**
669         * Starts BLE advertising.
670         *
671         * @param setting Indicates the settings for BLE advertising.
672         * If you need to use the default value, set this parameter to {@code null}.
673         * @param advData Indicates the advertising data.
674         * @param advResponse Indicates the scan response associated with the advertising data.
675         * @since 7
676         * @permission ohos.permission.DISCOVER_BLUETOOTH
677         * @deprecated since 9
678         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#startAdvertising
679         */
680        startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;
681
682        /**
683         * Stops BLE advertising.
684         *
685         * @since 7
686         * @permission ohos.permission.DISCOVER_BLUETOOTH
687         * @deprecated since 9
688         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#stopAdvertising
689         */
690        stopAdvertising(): void;
691
692        /**
693         * Adds a specified service to be hosted.
694         *
695         * <p>The added service and its characteristics are provided by the local device.
696         *
697         * @param service Indicates the service to add.
698         * @returns { boolean } Returns {@code true} if the service is added; returns {@code false} otherwise.
699         * @since 7
700         * @permission ohos.permission.USE_BLUETOOTH
701         * @deprecated since 9
702         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#addService
703         */
704        addService(service: GattService): boolean;
705
706        /**
707         * Removes a specified service from the list of GATT services provided by this device.
708         *
709         * @param serviceUuid Indicates the UUID of the service to remove.
710         * @returns { boolean } Returns {@code true} if the service is removed; returns {@code false} otherwise.
711         * @since 7
712         * @permission ohos.permission.USE_BLUETOOTH
713         * @deprecated since 9
714         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#removeService
715         */
716        removeService(serviceUuid: string): boolean;
717
718        /**
719         * Closes this {@code GattServer} object and unregisters its callbacks.
720         *
721         * @since 7
722         * @permission ohos.permission.USE_BLUETOOTH
723         * @deprecated since 9
724         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#close
725         */
726        close(): void;
727
728        /**
729         * Sends a notification of a change in a specified local characteristic.
730         *
731         * <p>This method should be called for every BLE peripheral device that has requested notifications.
732         *
733         * @param deviceId Indicates the address of the BLE peripheral device to receive the notification.
734         * @param notifyCharacteristic Indicates the local characteristic that has changed.
735         * @returns { boolean } Returns {@code true} if the notification is sent successfully; returns {@code false} otherwise.
736         * @since 7
737         * @permission ohos.permission.USE_BLUETOOTH
738         * @deprecated since 9
739         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#notifyCharacteristicChanged
740         */
741        notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;
742
743        /**
744         * Sends a response to a specified read or write request to a given BLE peripheral device.
745         *
746         * @param serverResponse Indicates the response parameters {@link ServerResponse}.
747         * @returns { boolean } Returns {@code true} if the response is sent successfully; returns {@code false} otherwise.
748         * @since 7
749         * @permission ohos.permission.USE_BLUETOOTH
750         * @deprecated since 9
751         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#sendResponse
752         */
753        sendResponse(serverResponse: ServerResponse): boolean;
754
755        /**
756         * Subscribe characteristic read event.
757         *
758         * @param type Type of the characteristic read event to listen for.
759         * @param callback Callback used to listen for the characteristic read event.
760         * @since 7
761         * @permission ohos.permission.USE_BLUETOOTH
762         * @deprecated since 9
763         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#on#event:characteristicRead
764         */
765        on(type: "characteristicRead", callback: Callback<CharacteristicReadReq>): void;
766
767        /**
768         * Unsubscribe characteristic read event.
769         *
770         * @param type Type of the characteristic read event to listen for.
771         * @param callback Callback used to listen for the characteristic read event.
772         * @since 7
773         * @permission ohos.permission.USE_BLUETOOTH
774         * @deprecated since 9
775         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#off#event:characteristicRead
776         */
777        off(type: "characteristicRead", callback?: Callback<CharacteristicReadReq>): void;
778
779        /**
780         * Subscribe characteristic write event.
781         *
782         * @param type Type of the characteristic write event to listen for.
783         * @param callback Callback used to listen for the characteristic write event.
784         * @since 7
785         * @permission ohos.permission.USE_BLUETOOTH
786         * @deprecated since 9
787         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#on#event:characteristicWrite
788         */
789        on(type: "characteristicWrite", callback: Callback<CharacteristicWriteReq>): void;
790
791        /**
792         * Unsubscribe characteristic write event.
793         *
794         * @param type Type of the characteristic write event to listen for.
795         * @param callback Callback used to listen for the characteristic write event.
796         * @since 7
797         * @permission ohos.permission.USE_BLUETOOTH
798         * @deprecated since 9
799         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#off#event:characteristicWrite
800         */
801        off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteReq>): void;
802
803        /**
804         * Subscribe descriptor read event.
805         *
806         * @param type Type of the descriptor read event to listen for.
807         * @param callback Callback used to listen for the descriptor read event.
808         * @since 7
809         * @permission ohos.permission.USE_BLUETOOTH
810         * @deprecated since 9
811         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#on#event:descriptorRead
812         */
813        on(type: "descriptorRead", callback: Callback<DescriptorReadReq>): void;
814
815        /**
816         * Unsubscribe descriptor read event.
817         *
818         * @param type Type of the descriptor read event to listen for.
819         * @param callback Callback used to listen for the descriptor read event.
820         * @since 7
821         * @permission ohos.permission.USE_BLUETOOTH
822         * @deprecated since 9
823         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#off#event:descriptorRead
824         */
825        off(type: "descriptorRead", callback?: Callback<DescriptorReadReq>): void;
826
827        /**
828         * Subscribe descriptor write event.
829         *
830         * @param type Type of the descriptor write event to listen for.
831         * @param callback Callback used to listen for the descriptor write event.
832         * @since 7
833         * @permission ohos.permission.USE_BLUETOOTH
834         * @permission ohos.permission.USE_BLUETOOTH
835         * @deprecated since 9
836         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#on#event:descriptorWrite
837         */
838        on(type: "descriptorWrite", callback: Callback<DescriptorWriteReq>): void;
839
840        /**
841         * Unsubscribe descriptor write event.
842         *
843         * @param type Type of the descriptor write event to listen for.
844         * @param callback Callback used to listen for the descriptor write event.
845         * @since 7
846         * @permission ohos.permission.USE_BLUETOOTH
847         * @deprecated since 9
848         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#off#event:descriptorWrite
849         */
850        off(type: "descriptorWrite", callback?: Callback<DescriptorWriteReq>): void;
851
852        /**
853         * Subscribe server connection state changed event.
854         *
855         * @param type Type of the connection state changed event to listen for.
856         * @param callback Callback used to listen for the connection state changed event.
857         * @since 7
858         * @permission ohos.permission.USE_BLUETOOTH
859         * @deprecated since 9
860         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#on#event:connectStateChange
861         */
862        on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void;
863
864        /**
865         * Unsubscribe server connection state changed event.
866         *
867         * @param type Type of the connection state changed event to listen for.
868         * @param callback Callback used to listen for the connection state changed event.
869         * @since 7
870         * @permission ohos.permission.USE_BLUETOOTH
871         * @deprecated since 9
872         * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#off#event:connectStateChange
873         */
874        off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void;
875    }
876
877    /**
878     * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance.
879     *
880     * @deprecated since 9
881     * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice
882     */
883    interface GattClientDevice {
884
885        /**
886         * Connects to a BLE peripheral device.
887         *
888         * <p>The 'BLEConnectionStateChange' event is subscribed to return the connection state.
889         *
890         * @returns { boolean } Returns {@code true} if the connection process starts; returns {@code false} otherwise.
891         * @since 7
892         * @permission ohos.permission.USE_BLUETOOTH
893         * @deprecated since 9
894         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#connect
895         */
896        connect(): boolean;
897
898        /**
899         * Disconnects from or stops an ongoing connection to a BLE peripheral device.
900         *
901         * @returns { boolean } Returns {@code true} if the disconnection process starts; returns {@code false} otherwise.
902         * @since 7
903         * @permission ohos.permission.USE_BLUETOOTH
904         * @deprecated since 9
905         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#disconnect
906         */
907        disconnect(): boolean;
908
909        /**
910         * Disables a BLE peripheral device.
911         *
912         * <p> This method unregisters the device and clears the registered callbacks and handles.
913         *
914         * @returns { boolean } Returns {@code true} if the the device is disabled; returns {@code false} otherwise.
915         * @since 7
916         * @permission ohos.permission.USE_BLUETOOTH
917         * @deprecated since 9
918         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#close
919         */
920        close(): boolean;
921
922        /**
923         * Obtains the name of BLE peripheral device.
924         *
925         * @returns { Promise<string> } Returns a string representation of the name if obtained;
926         * returns {@code null} if the name fails to be obtained or the name does not exist.
927         * @since 7
928         * @permission ohos.permission.USE_BLUETOOTH
929         * @deprecated since 9
930         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getDeviceName
931         */
932        getDeviceName(callback: AsyncCallback<string>): void;
933        getDeviceName(): Promise<string>;
934
935        /**
936         * Starts discovering services.
937         *
938         * @returns { Promise<Array<GattService>> } Returns the list of services {@link GattService} of the BLE peripheral device.
939         * @since 7
940         * @permission ohos.permission.USE_BLUETOOTH
941         * @deprecated since 9
942         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getServices
943         */
944        getServices(callback: AsyncCallback<Array<GattService>>): void;
945        getServices(): Promise<Array<GattService>>;
946
947        /**
948         * Reads the characteristic of a BLE peripheral device.
949         *
950         * @param characteristic Indicates the characteristic to read.
951         * @since 7
952         * @permission ohos.permission.USE_BLUETOOTH
953         * @deprecated since 9
954         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readCharacteristicValue
955         */
956        readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void;
957        readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>;
958
959        /**
960         * Reads the descriptor of a BLE peripheral device.
961         *
962         * @param descriptor Indicates the descriptor to read.
963         * @since 7
964         * @permission ohos.permission.USE_BLUETOOTH
965         * @deprecated since 9
966         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readDescriptorValue
967         */
968        readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void;
969        readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>;
970
971        /**
972         * Writes the characteristic of a BLE peripheral device.
973         *
974         * @param characteristic Indicates the characteristic to write.
975         * @returns { boolean } Returns {@code true} if the characteristic is written successfully; returns {@code false} otherwise.
976         * @since 7
977         * @permission ohos.permission.USE_BLUETOOTH
978         * @deprecated since 9
979         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeCharacteristicValue
980         */
981        writeCharacteristicValue(characteristic: BLECharacteristic): boolean;
982
983        /**
984         * Writes the descriptor of a BLE peripheral device.
985         *
986         * @param descriptor Indicates the descriptor to write.
987         * @returns { boolean } Returns {@code true} if the descriptor is written successfully; returns {@code false} otherwise.
988         * @since 7
989         * @permission ohos.permission.USE_BLUETOOTH
990         * @deprecated since 9
991         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeDescriptorValue
992         */
993        writeDescriptorValue(descriptor: BLEDescriptor): boolean;
994
995        /**
996         * Get the RSSI value of this BLE peripheral device.
997         *
998         * @returns { Promise<number> } Returns the RSSI value.
999         * @since 7
1000         * @permission ohos.permission.USE_BLUETOOTH
1001         * @deprecated since 9
1002         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getRssiValue
1003         */
1004        getRssiValue(callback: AsyncCallback<number>): void;
1005        getRssiValue(): Promise<number>;
1006
1007        /**
1008         * Set the mtu size of a BLE peripheral device.
1009         *
1010         * @param mtu The maximum transmission unit.
1011         * @returns { boolean } Returns {@code true} if the set mtu is successfully; returns {@code false} otherwise.
1012         * @since 7
1013         * @permission ohos.permission.USE_BLUETOOTH
1014         * @deprecated since 9
1015         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setBLEMtuSize
1016         */
1017        setBLEMtuSize(mtu: number): boolean;
1018
1019        /**
1020         * Enables or disables notification of a characteristic when value changed.
1021         *
1022         * @param enable Specifies whether to enable notification of the characteristic. The value {@code true} indicates
1023         * that notification is enabled, and the value {@code false} indicates that notification is disabled.
1024         * @returns { boolean } Returns {@code true} if notification of the characteristic is enabled or disabled;
1025         * returns {@code false} otherwise.
1026         * @since 7
1027         * @permission ohos.permission.USE_BLUETOOTH
1028         * @deprecated since 9
1029         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setNotifyCharacteristicChanged
1030         */
1031        setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;
1032
1033        /**
1034         * Subscribe characteristic value changed event.
1035         *
1036         * @param type Type of the characteristic value changed event to listen for.
1037         * @param callback Callback used to listen for the characteristic value changed event.
1038         * @since 7
1039         * @permission ohos.permission.USE_BLUETOOTH
1040         * @deprecated since 9
1041         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#on#event:BLECharacteristicChange
1042         */
1043        on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void;
1044
1045        /**
1046         * Unsubscribe characteristic value changed event.
1047         *
1048         * @param type Type of the characteristic value changed event to listen for.
1049         * @param callback Callback used to listen for the characteristic value changed event.
1050         * @since 7
1051         * @permission ohos.permission.USE_BLUETOOTH
1052         * @deprecated since 9
1053         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#off#event:BLECharacteristicChange
1054         */
1055        off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void;
1056
1057        /**
1058         * Subscribe client connection state changed event.
1059         *
1060         * @param type Type of the connection state changed event to listen for.
1061         * @param callback Callback used to listen for the connection state changed event.
1062         * @since 7
1063         * @permission ohos.permission.USE_BLUETOOTH
1064         * @deprecated since 9
1065         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#on#event:BLEConnectionStateChange
1066         */
1067        on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void;
1068
1069        /**
1070         * Unsubscribe client connection state changed event.
1071         *
1072         * @param type Type of the connection state changed event to listen for.
1073         * @param callback Callback used to listen for the connection state changed event.
1074         * @since 7
1075         * @permission ohos.permission.USE_BLUETOOTH
1076         * @deprecated since 9
1077         * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#off#event:BLEConnectionStateChange
1078         */
1079        off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void;
1080    }
1081
1082    /**
1083     * Describes the Gatt service.
1084     *
1085     * @since 7
1086     * @deprecated since 9
1087     * @useinstead ohos.bluetoothManager/bluetoothManager.GattService
1088     */
1089    interface GattService {
1090        /** The UUID of a GattService instance */
1091        serviceUuid: string;
1092        /** Indicates whether the GattService instance is primary or secondary. */
1093        isPrimary: boolean;
1094        /** The {@link BLECharacteristic} list belongs to this GattService instance */
1095        characteristics: Array<BLECharacteristic>;
1096        /** The list of GATT services contained in the service */
1097        includeServices?: Array<GattService>;
1098    }
1099
1100    /**
1101     * Describes the Gatt characteristic.
1102     *
1103     * @since 7
1104     * @deprecated since 9
1105     * @useinstead ohos.bluetoothManager/bluetoothManager.BLECharacteristic
1106     */
1107    interface BLECharacteristic {
1108        /** The UUID of the {@link GattService} instance to which the characteristic belongs */
1109        serviceUuid: string;
1110        /** The UUID of a BLECharacteristic instance */
1111        characteristicUuid: string;
1112        /** The value of a BLECharacteristic instance */
1113        characteristicValue: ArrayBuffer;
1114        /** The list of {@link BLEDescriptor} contained in the characteristic */
1115        descriptors: Array<BLEDescriptor>;
1116    }
1117
1118    /**
1119     * Describes the Gatt descriptor.
1120     *
1121     * @since 7
1122     * @deprecated since 9
1123     * @useinstead ohos.bluetoothManager/bluetoothManager.BLEDescriptor
1124     */
1125    interface BLEDescriptor {
1126        /** The UUID of the {@link GattService} instance to which the descriptor belongs */
1127        serviceUuid: string;
1128        /** The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs */
1129        characteristicUuid: string;
1130        /** The UUID of the BLEDescriptor instance */
1131        descriptorUuid: string;
1132        /** The value of the BLEDescriptor instance */
1133        descriptorValue: ArrayBuffer;
1134    }
1135
1136    /**
1137     * Describes the value of the indication or notification sent by the Gatt server.
1138     *
1139     * @since 7
1140     * @deprecated since 9
1141     * @useinstead ohos.bluetoothManager/bluetoothManager.NotifyCharacteristic
1142     */
1143    interface NotifyCharacteristic {
1144        /** The UUID of the {@link GattService} instance to which the characteristic belongs */
1145        serviceUuid: string;
1146        /** The UUID of a NotifyCharacteristic instance */
1147        characteristicUuid: string;
1148        /** The value of a NotifyCharacteristic instance */
1149        characteristicValue: ArrayBuffer;
1150        /**
1151         * Specifies whether to request confirmation from the BLE peripheral device (indication) or
1152         * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter.
1153         */
1154        confirm: boolean;
1155    }
1156
1157    /**
1158     * Describes the parameters of the Gatt client's characteristic read request.
1159     *
1160     * @since 7
1161     * @deprecated since 9
1162     * @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicReadRequest
1163     */
1164    interface CharacteristicReadReq {
1165        /** Indicates the address of the client that initiates the read request */
1166        deviceId: string;
1167        /** The Id of the read request */
1168        transId: number;
1169        /** Indicates the byte offset of the start position for reading characteristic value */
1170        offset: number;
1171        /** The UUID of a CharacteristicReadReq instance */
1172        characteristicUuid: string;
1173        /** The UUID of the service to which the characteristic belongs */
1174        serviceUuid: string;
1175    }
1176
1177    /**
1178     * Describes the parameters of the of the Gatt client's characteristic write request.
1179     *
1180     * @since 7
1181     * @deprecated since 9
1182     * @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicWriteRequest
1183     */
1184    interface CharacteristicWriteReq {
1185        /** Indicates the address of the client that initiates the write request */
1186        deviceId: string;
1187        /** The Id of the write request */
1188        transId: number;
1189        /** Indicates the byte offset of the start position for writing characteristic value */
1190        offset: number;
1191        /** Whether this request should be pending for later operation */
1192        isPrep: boolean;
1193        /** Whether the remote client need a response */
1194        needRsp: boolean;
1195        /** Indicates the value to be written */
1196        value: ArrayBuffer;
1197        /** The UUID of a CharacteristicWriteReq instance */
1198        characteristicUuid: string;
1199        /** The UUID of the service to which the characteristic belongs */
1200        serviceUuid: string;
1201    }
1202
1203    /**
1204     * Describes the parameters of the Gatt client's descriptor read request.
1205     *
1206     * @since 7
1207     * @deprecated since 9
1208     * @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorReadRequest
1209     */
1210    interface DescriptorReadReq {
1211        /** Indicates the address of the client that initiates the read request */
1212        deviceId: string;
1213        /** The Id of the read request */
1214        transId: number;
1215        /** Indicates the byte offset of the start position for reading characteristic value */
1216        offset: number;
1217        /** The UUID of a DescriptorReadReq instance */
1218        descriptorUuid: string;
1219        /** The UUID of the characteristic to which the descriptor belongs */
1220        characteristicUuid: string;
1221        /** The UUID of the service to which the descriptor belongs */
1222        serviceUuid: string;
1223    }
1224
1225    /**
1226     * Describes the parameters of the Gatt client's characteristic write request.
1227     *
1228     * @since 7
1229     * @deprecated since 9
1230     * @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorWriteRequest
1231     */
1232    interface DescriptorWriteReq {
1233        /** Indicates the address of the client that initiates the write request */
1234        deviceId: string;
1235        /** The Id of the write request */
1236        transId: number;
1237        /** Indicates the byte offset of the start position for writing characteristic value */
1238        offset: number;
1239        /** Whether this request should be pending for later operation */
1240        isPrep: boolean;
1241        /** Whether the remote client need a response */
1242        needRsp: boolean;
1243        /** Indicates the value to be written */
1244        value: ArrayBuffer;
1245        /** The UUID of a DescriptorWriteReq instance */
1246        descriptorUuid: string;
1247        /** The UUID of the characteristic to which the descriptor belongs */
1248        characteristicUuid: string;
1249        /** The UUID of the service to which the descriptor belongs */
1250        serviceUuid: string;
1251    }
1252
1253    /**
1254     * Describes the parameters of a response send by the server to a specified read or write request.
1255     *
1256     * @since 7
1257     * @deprecated since 9
1258     * @useinstead ohos.bluetoothManager/bluetoothManager.ServerResponse
1259     */
1260    interface ServerResponse {
1261        /** Indicates the address of the client to which to send the response */
1262        deviceId: string;
1263        /** The Id of the write request */
1264        transId: number;
1265        /** Indicates the status of the read or write request, set this parameter to '0' in normal cases */
1266        status: number;
1267        /** Indicates the byte offset of the start position for reading or writing operation */
1268        offset: number;
1269        /** Indicates the value to be sent */
1270        value: ArrayBuffer;
1271    }
1272
1273    /**
1274     * Describes the Gatt profile connection state.
1275     *
1276     * @since 7
1277     * @deprecated since 9
1278     * @useinstead ohos.bluetoothManager/bluetoothManager.BLEConnectChangedState
1279     */
1280    interface BLEConnectChangedState {
1281        /** Indicates the peer device address */
1282        deviceId: string;
1283        /** Connection state of the Gatt profile */
1284        state: ProfileConnectionState;
1285    }
1286
1287    /**
1288     * Describes the contents of the scan results.
1289     *
1290     * @since 7
1291     * @deprecated since 9
1292     * @useinstead ohos.bluetoothManager/bluetoothManager.ScanResult
1293     */
1294    interface ScanResult {
1295        /** Address of the scanned device */
1296        deviceId: string;
1297        /** RSSI of the remote device */
1298        rssi: number;
1299        /** The raw data of broadcast packet */
1300        data: ArrayBuffer;
1301    }
1302
1303    /**
1304     * Describes the settings for BLE advertising.
1305     *
1306     * @since 7
1307     * @deprecated since 9
1308     * @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseSetting
1309     */
1310    interface AdvertiseSetting {
1311        /**
1312         * Minimum slot value for the advertising interval, which is {@code 32} (20 ms)
1313         * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s)
1314         * Default slot value for the advertising interval, which is {@code 1600} (1s)
1315         */
1316        interval?: number;
1317        /**
1318         * Minimum transmission power level for advertising, which is {@code -127}
1319         * Maximum transmission power level for advertising, which is {@code 1}
1320         * Default transmission power level for advertising, which is {@code -7}
1321         */
1322        txPower?: number;
1323        /** Indicates whether the BLE is connectable, default is {@code true} */
1324        connectable?: boolean;
1325    }
1326
1327    /**
1328     * Describes the advertising data.
1329     *
1330     * @since 7
1331     * @deprecated since 9
1332     * @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseData
1333     */
1334    interface AdvertiseData {
1335        /** The specified service UUID list to this advertisement */
1336        serviceUuids: Array<string>;
1337        /** The specified manufacturer data list to this advertisement */
1338        manufactureData: Array<ManufactureData>;
1339        /** The specified service data list to this advertisement */
1340        serviceData: Array<ServiceData>;
1341    }
1342
1343    /**
1344     * Describes the manufacturer data.
1345     *
1346     * @since 7
1347     * @deprecated since 9
1348     * @useinstead ohos.bluetoothManager/bluetoothManager.ManufactureData
1349     */
1350    interface ManufactureData {
1351        /** Indicates the manufacturer ID assigned by Bluetooth SIG */
1352        manufactureId: number;
1353        /** Indicates the manufacturer data to add */
1354        manufactureValue: ArrayBuffer;
1355    }
1356
1357    /**
1358     * Describes the service data.
1359     *
1360     * @since 7
1361     * @deprecated since 9
1362     * @useinstead ohos.bluetoothManager/bluetoothManager.ServiceData
1363     */
1364    interface ServiceData {
1365        /** Indicates the UUID of the service data to add */
1366        serviceUuid: string;
1367        /** Indicates the service data to add */
1368        serviceValue: ArrayBuffer;
1369    }
1370
1371    /**
1372     * Describes the criteria for filtering scanning results can be set.
1373     *
1374     * @deprecated since 9
1375     * @useinstead ohos.bluetoothManager/bluetoothManager.ScanFilter
1376     */
1377    interface ScanFilter {
1378        /**
1379         * The address of a BLE peripheral device
1380         * @since 7
1381         */
1382        deviceId?: string;
1383
1384        /**
1385         * The name of a BLE peripheral device
1386         * @since 7
1387         */
1388        name?: string;
1389
1390        /**
1391         * The service UUID of a BLE peripheral device
1392         * @since 7
1393         */
1394        serviceUuid?: string;
1395    }
1396
1397    /**
1398     * Describes the parameters for scan.
1399     *
1400     * @since 7
1401     * @deprecated since 9
1402     * @useinstead ohos.bluetoothManager/bluetoothManager.ScanOptions
1403     */
1404    interface ScanOptions {
1405        /** Time of delay for reporting the scan result */
1406        interval?: number;
1407        /** Bluetooth LE scan mode */
1408        dutyMode?: ScanDuty;
1409        /** Match mode for Bluetooth LE scan filters hardware match */
1410        matchMode?: MatchMode;
1411    }
1412
1413    /**
1414     * Describes the spp parameters.
1415     *
1416     * @since 8
1417     * @deprecated since 9
1418     * @useinstead ohos.bluetoothManager/bluetoothManager.SppOption
1419     */
1420    interface SppOption {
1421        /** Indicates the UUID in the SDP record. */
1422        uuid: string;
1423        /** Indicates secure channel or not */
1424        secure: boolean;
1425        /** Spp link type {@link SppType}*/
1426        type: SppType;
1427    }
1428
1429    /**
1430     * Describes the bond key param.
1431     *
1432     * @since 8
1433     * @deprecated since 9
1434     * @useinstead ohos.bluetoothManager/bluetoothManager.PinRequiredParam
1435     */
1436    interface PinRequiredParam {
1437        deviceId: string;
1438        pinCode: string;
1439    }
1440
1441    /**
1442     * Describes the class of a bluetooth device.
1443     *
1444     * @since 8
1445     * @deprecated since 9
1446     * @useinstead ohos.bluetoothManager/bluetoothManager.DeviceClass
1447     */
1448    interface DeviceClass {
1449        majorClass: MajorClass;
1450        majorMinorClass: MajorMinorClass;
1451        classOfDevice: number;
1452    }
1453
1454    /**
1455     * Describes the class of a bluetooth device.
1456     *
1457     * @since 8
1458     * @deprecated since 9
1459     * @useinstead ohos.bluetoothManager/bluetoothManager.BondStateParam
1460     */
1461    interface BondStateParam {
1462        deviceId: string;
1463        state: BondState;
1464    }
1465
1466    /**
1467     * The enum of scan duty.
1468     *
1469     * @deprecated since 9
1470     * @useinstead ohos.bluetoothManager/bluetoothManager.ScanDuty
1471     */
1472    enum ScanDuty {
1473        /** low power mode */
1474        SCAN_MODE_LOW_POWER = 0,
1475        /** balanced power mode */
1476        SCAN_MODE_BALANCED = 1,
1477        /** Scan using highest duty cycle */
1478        SCAN_MODE_LOW_LATENCY = 2
1479    }
1480
1481    /**
1482     * The enum of BLE match mode.
1483     *
1484     * @deprecated since 9
1485     * @useinstead ohos.bluetoothManager/bluetoothManager.MatchMode
1486     */
1487    enum MatchMode {
1488        /** aggressive mode */
1489        MATCH_MODE_AGGRESSIVE = 1,
1490        /** sticky mode */
1491        MATCH_MODE_STICKY = 2
1492    }
1493
1494    /**
1495     * The enum of profile connection state.
1496     *
1497     * @deprecated since 9
1498     * @useinstead ohos.bluetoothManager/bluetoothManager.ProfileConnectionState
1499     */
1500    enum ProfileConnectionState {
1501        /** the current profile is disconnected */
1502        STATE_DISCONNECTED = 0,
1503        /** the current profile is being connected */
1504        STATE_CONNECTING = 1,
1505        /** the current profile is connected */
1506        STATE_CONNECTED = 2,
1507        /** the current profile is being disconnected */
1508        STATE_DISCONNECTING = 3
1509    }
1510
1511    /**
1512     * The enum of bluetooth state.
1513     *
1514     * @deprecated since 9
1515     * @useinstead ohos.bluetoothManager/bluetoothManager.BluetoothState
1516     */
1517    enum BluetoothState {
1518        /** Indicates the local Bluetooth is off */
1519        STATE_OFF = 0,
1520        /** Indicates the local Bluetooth is turning on */
1521        STATE_TURNING_ON = 1,
1522        /** Indicates the local Bluetooth is on, and ready for use */
1523        STATE_ON = 2,
1524        /** Indicates the local Bluetooth is turning off */
1525        STATE_TURNING_OFF = 3,
1526        /** Indicates the local Bluetooth is turning LE mode on */
1527        STATE_BLE_TURNING_ON = 4,
1528        /** Indicates the local Bluetooth is in LE only mode */
1529        STATE_BLE_ON = 5,
1530        /** Indicates the local Bluetooth is turning off LE only mode */
1531        STATE_BLE_TURNING_OFF = 6
1532    }
1533
1534    /**
1535     * The enum of SPP type.
1536     *
1537     * @since 8
1538     * @deprecated since 9
1539     * @useinstead ohos.bluetoothManager/bluetoothManager.SppType
1540     */
1541    enum SppType {
1542        /** RFCOMM */
1543        SPP_RFCOMM
1544    }
1545
1546    /**
1547     * The enum of BR scan mode.
1548     *
1549     * @since 8
1550     * @deprecated since 9
1551     * @useinstead ohos.bluetoothManager/bluetoothManager.ScanMode
1552     */
1553    enum ScanMode {
1554        /** Indicates the scan mode is none */
1555        SCAN_MODE_NONE = 0,
1556        /** Indicates the scan mode is connectable */
1557        SCAN_MODE_CONNECTABLE = 1,
1558        /** Indicates the scan mode is general discoverable */
1559        SCAN_MODE_GENERAL_DISCOVERABLE = 2,
1560        /** Indicates the scan mode is limited discoverable */
1561        SCAN_MODE_LIMITED_DISCOVERABLE = 3,
1562        /** Indicates the scan mode is connectable and general discoverable */
1563        SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4,
1564        /** Indicates the scan mode is connectable and limited discoverable */
1565        SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5
1566    }
1567
1568    /**
1569     * The enum of bond state.
1570     *
1571     * @since 8
1572     * @deprecated since 9
1573     * @useinstead ohos.bluetoothManager/bluetoothManager.BondState
1574     */
1575    enum BondState {
1576        /** Indicate the bond state is invalid */
1577        BOND_STATE_INVALID = 0,
1578        /** Indicate the bond state is bonding */
1579        BOND_STATE_BONDING = 1,
1580        /** Indicate the bond state is bonded*/
1581        BOND_STATE_BONDED = 2
1582    }
1583
1584    /**
1585     * The enum of major class of a bluetooth device.
1586     *
1587     * @since 8
1588     * @deprecated since 9
1589     * @useinstead ohos.bluetoothManager/bluetoothManager.MajorClass
1590     */
1591    enum MajorClass {
1592        MAJOR_MISC = 0x0000,
1593        MAJOR_COMPUTER = 0x0100,
1594        MAJOR_PHONE = 0x0200,
1595        MAJOR_NETWORKING = 0x0300,
1596        MAJOR_AUDIO_VIDEO = 0x0400,
1597        MAJOR_PERIPHERAL = 0x0500,
1598        MAJOR_IMAGING = 0x0600,
1599        MAJOR_WEARABLE = 0x0700,
1600        MAJOR_TOY = 0x0800,
1601        MAJOR_HEALTH = 0x0900,
1602        MAJOR_UNCATEGORIZED = 0x1F00
1603    }
1604
1605    /**
1606     * The enum of major minor class of a bluetooth device.
1607     *
1608     * @since 8
1609     * @deprecated since 9
1610     * @useinstead ohos.bluetoothManager/bluetoothManager.MajorMinorClass
1611     */
1612    enum MajorMinorClass {
1613        // The Minor Device Class field
1614        // Computer Major Class
1615        COMPUTER_UNCATEGORIZED = 0x0100,
1616        COMPUTER_DESKTOP = 0x0104,
1617        COMPUTER_SERVER = 0x0108,
1618        COMPUTER_LAPTOP = 0x010C,
1619        COMPUTER_HANDHELD_PC_PDA = 0x0110,
1620        COMPUTER_PALM_SIZE_PC_PDA = 0x0114,
1621        COMPUTER_WEARABLE = 0x0118,
1622        COMPUTER_TABLET = 0x011C,
1623
1624        // Phone Major Class
1625        PHONE_UNCATEGORIZED = 0x0200,
1626        PHONE_CELLULAR = 0x0204,
1627        PHONE_CORDLESS = 0x0208,
1628        PHONE_SMART = 0x020C,
1629        PHONE_MODEM_OR_GATEWAY = 0x0210,
1630        PHONE_ISDN = 0x0214,
1631
1632        // LAN/Network Access Point Major Class
1633        NETWORK_FULLY_AVAILABLE = 0x0300,
1634        NETWORK_1_TO_17_UTILIZED = 0x0320,
1635        NETWORK_17_TO_33_UTILIZED = 0x0340,
1636        NETWORK_33_TO_50_UTILIZED = 0x0360,
1637        NETWORK_60_TO_67_UTILIZED = 0x0380,
1638        NETWORK_67_TO_83_UTILIZED = 0x03A0,
1639        NETWORK_83_TO_99_UTILIZED = 0x03C0,
1640        NETWORK_NO_SERVICE = 0x03E0,
1641
1642        // Audio/Video Major Class
1643        AUDIO_VIDEO_UNCATEGORIZED = 0x0400,
1644        AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404,
1645        AUDIO_VIDEO_HANDSFREE = 0x0408,
1646        AUDIO_VIDEO_MICROPHONE = 0x0410,
1647        AUDIO_VIDEO_LOUDSPEAKER = 0x0414,
1648        AUDIO_VIDEO_HEADPHONES = 0x0418,
1649        AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C,
1650        AUDIO_VIDEO_CAR_AUDIO = 0x0420,
1651        AUDIO_VIDEO_SET_TOP_BOX = 0x0424,
1652        AUDIO_VIDEO_HIFI_AUDIO = 0x0428,
1653        AUDIO_VIDEO_VCR = 0x042C,
1654        AUDIO_VIDEO_VIDEO_CAMERA = 0x0430,
1655        AUDIO_VIDEO_CAMCORDER = 0x0434,
1656        AUDIO_VIDEO_VIDEO_MONITOR = 0x0438,
1657        AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C,
1658        AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440,
1659        AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448,
1660
1661        // Peripheral Major Class
1662        PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500,
1663        PERIPHERAL_KEYBOARD = 0x0540,
1664        PERIPHERAL_POINTING_DEVICE = 0x0580,
1665        PERIPHERAL_KEYBOARD_POINTING = 0x05C0,
1666        PERIPHERAL_UNCATEGORIZED = 0x0500,
1667        PERIPHERAL_JOYSTICK = 0x0504,
1668        PERIPHERAL_GAMEPAD = 0x0508,
1669        PERIPHERAL_REMOTE_CONTROL = 0x05C0,
1670        PERIPHERAL_SENSING_DEVICE = 0x0510,
1671        PERIPHERAL_DIGITIZER_TABLET = 0x0514,
1672        PERIPHERAL_CARD_READER = 0x0518,
1673        PERIPHERAL_DIGITAL_PEN = 0x051C,
1674        PERIPHERAL_SCANNER_RFID = 0x0520,
1675        PERIPHERAL_GESTURAL_INPUT = 0x0522,
1676
1677        // Imaging Major Class
1678        IMAGING_UNCATEGORIZED = 0x0600,
1679        IMAGING_DISPLAY = 0x0610,
1680        IMAGING_CAMERA = 0x0620,
1681        IMAGING_SCANNER = 0x0640,
1682        IMAGING_PRINTER = 0x0680,
1683
1684        // Wearable Major Class
1685        WEARABLE_UNCATEGORIZED = 0x0700,
1686        WEARABLE_WRIST_WATCH = 0x0704,
1687        WEARABLE_PAGER = 0x0708,
1688        WEARABLE_JACKET = 0x070C,
1689        WEARABLE_HELMET = 0x0710,
1690        WEARABLE_GLASSES = 0x0714,
1691
1692        // Minor Device Class field - Toy Major Class
1693        TOY_UNCATEGORIZED = 0x0800,
1694        TOY_ROBOT = 0x0804,
1695        TOY_VEHICLE = 0x0808,
1696        TOY_DOLL_ACTION_FIGURE = 0x080C,
1697        TOY_CONTROLLER = 0x0810,
1698        TOY_GAME = 0x0814,
1699
1700        // Minor Device Class field - Health
1701        HEALTH_UNCATEGORIZED = 0x0900,
1702        HEALTH_BLOOD_PRESSURE = 0x0904,
1703        HEALTH_THERMOMETER = 0x0908,
1704        HEALTH_WEIGHING = 0x090C,
1705        HEALTH_GLUCOSE = 0x0910,
1706        HEALTH_PULSE_OXIMETER = 0x0914,
1707        HEALTH_PULSE_RATE = 0x0918,
1708        HEALTH_DATA_DISPLAY = 0x091C,
1709        HEALTH_STEP_COUNTER = 0x0920,
1710        HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924,
1711        HEALTH_PEAK_FLOW_MOITOR = 0x0928,
1712        HEALTH_MEDICATION_MONITOR = 0x092C,
1713        HEALTH_KNEE_PROSTHESIS = 0x0930,
1714        HEALTH_ANKLE_PROSTHESIS = 0x0934,
1715        HEALTH_GENERIC_HEALTH_MANAGER = 0x0938,
1716        HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C,
1717    }
1718
1719    /**
1720     * Profile state change parameters.
1721     *
1722     * @since 8
1723     * @deprecated since 9
1724     * @useinstead ohos.bluetoothManager/bluetoothManager.StateChangeParam
1725     */
1726    interface StateChangeParam {
1727        /** The address of device */
1728        deviceId: string;
1729
1730        /** Profile state value */
1731        state: ProfileConnectionState;
1732    }
1733
1734    /**
1735     * The enum of a2dp playing state.
1736     *
1737     * @since 8
1738     * @deprecated since 9
1739     * @useinstead ohos.bluetoothManager/bluetoothManager.PlayingState
1740     */
1741    enum PlayingState {
1742        STATE_NOT_PLAYING,
1743        STATE_PLAYING,
1744    }
1745
1746    /**
1747     * The enum of profile id.
1748     *
1749     * @deprecated since 9
1750     * @useinstead ohos.bluetoothManager/bluetoothManager.ProfileId
1751     */
1752    enum ProfileId {
1753        /**
1754         * @since 8
1755         */
1756        PROFILE_A2DP_SOURCE = 1,
1757
1758        /**
1759         * @since 8
1760         */
1761        PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4,
1762    }
1763}
1764
1765export default bluetooth;
1766