1e41f4b71Sopenharmony_ci# Bluetooth Subsystem ChangeLog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.bluetooth.1 API Migration to @ohos.bluetoothManager.d.ts
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci**@ohos.bluetooth.d.ts** does not allow for throwing error codes, which is required by API version 9 and system APIs. Therefore, all APIs of **@ohos.bluetooth.d.ts** are migrated to the newly added **@ohos.bluetoothManager.d.ts**, and error code description is also added.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciTo use Bluetooth APIs, import **@ohos.bluetoothManager**.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci  ```ts
10e41f4b71Sopenharmony_ci  import bluetoothManager from '@ohos.bluetoothManager';
11e41f4b71Sopenharmony_ci  ```
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Change Impacts**
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciSystem APIs and APIs in API version 9 are affected. Import **@ohos.bluetoothManager** to use APIs that can throw error codes.
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci  ```ts
19e41f4b71Sopenharmony_ci  import bluetoothManager from '@ohos.bluetoothManager';
20e41f4b71Sopenharmony_ci  ```
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci**Key API/Component Changes**
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Class                        | Original API                                                      | New API                                                      | Change Type                                                    |
25e41f4b71Sopenharmony_ci| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
26e41f4b71Sopenharmony_ci| bluetooth                    | function getState(): BluetoothState                          | function getState(): BluetoothState                          | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
27e41f4b71Sopenharmony_ci| bluetooth                    | method                                                       | function getBtConnectionState(): ProfileConnectionState;     | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
28e41f4b71Sopenharmony_ci| bluetooth                    | function pairDevice(deviceId: string): boolean               | function pairDevice(deviceId: string): void                  | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
29e41f4b71Sopenharmony_ci| bluetooth                    | function cancelPairedDevice(deviceId: string): boolean       | function cancelPairedDevice(deviceId: string): void          | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
30e41f4b71Sopenharmony_ci| bluetooth                    | function getRemoteDeviceName(deviceId: string): string       | function getRemoteDeviceName(deviceId: string): string       | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
31e41f4b71Sopenharmony_ci| bluetooth                    | function getRemoteDeviceClass(deviceId: string): DeviceClass | function getRemoteDeviceClass(deviceId: string): DeviceClass | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
32e41f4b71Sopenharmony_ci| bluetooth                    | function enableBluetooth(): boolean                          | function enableBluetooth(): void                             | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
33e41f4b71Sopenharmony_ci| bluetooth                    | function disableBluetooth(): boolean                         | function disableBluetooth(): void                            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
34e41f4b71Sopenharmony_ci| bluetooth                    | function getLocalName(): string                              | function getLocalName(): string                              | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
35e41f4b71Sopenharmony_ci| bluetooth                    | function getPairedDevices(): Array<string>;            | function getPairedDevices(): Array<string>;            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
36e41f4b71Sopenharmony_ci| bluetooth                    | function getProfileConnState(profileId: ProfileId): ProfileConnectionState | function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the API name to **getProfileConnectionState**.|
37e41f4b71Sopenharmony_ci| bluetooth                    | function setDevicePairingConfirmation(device: string, accept: boolean): boolean | function setDevicePairingConfirmation(device: string, accept: boolean): void | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
38e41f4b71Sopenharmony_ci| bluetooth                    | function setLocalName(name: string): boolean;                | function setLocalName(name: string): void;                   | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
39e41f4b71Sopenharmony_ci| bluetooth                    | function setBluetoothScanMode(mode: ScanMode, duration: number): boolean | function setBluetoothScanMode(mode: ScanMode, duration: number): void | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
40e41f4b71Sopenharmony_ci| bluetooth                    | function getBluetoothScanMode(): ScanMod                     | function getBluetoothScanMode(): ScanMode                    | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
41e41f4b71Sopenharmony_ci| bluetooth                    | function startBluetoothDiscovery(): boolean                  | function startBluetoothDiscovery(): void                     | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**, added the **ohos.permission.APPROXIMATELY_LOCATION** permission, and changed the return value to **void**.|
42e41f4b71Sopenharmony_ci| bluetooth                    | function stopBluetoothDiscovery(): boolean;                  | function stopBluetoothDiscovery(): void;                     | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
43e41f4b71Sopenharmony_ci| bluetooth                    | function on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void; | function on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
44e41f4b71Sopenharmony_ci| bluetooth                    | function off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void; | function off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
45e41f4b71Sopenharmony_ci| bluetooth                    | function on(type: "bondStateChange", callback: Callback<BondStateParam>): void; | function on(type: "bondStateChange", callback: Callbackk<BondStateParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
46e41f4b71Sopenharmony_ci| bluetooth                    | function off(type: "bondStateChange", callback?: Callback<BondStateParam>): void; | function off(type: "bondStateChange", callback?: Callback<BondStateParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
47e41f4b71Sopenharmony_ci| bluetooth                    | function on(type: "pinRequired", callback: Callback<PinRequiredParam>): void; | function on(type: "pinRequired", callback: Callback<PinRequiredParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
48e41f4b71Sopenharmony_ci| bluetooth                    | function off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void; | function off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
49e41f4b71Sopenharmony_ci| bluetooth                    | function on(type: "stateChange", callback: Callback<BluetoothState>): void; | function on(type: "stateChange", callback: Callback<BluetoothState>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
50e41f4b71Sopenharmony_ci| bluetooth                    | function off(type: "stateChange", callback?: Callback<BluetoothState>): void; | function off(type: "stateChange", callback?: Callback<BluetoothState>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
51e41f4b71Sopenharmony_ci| bluetooth                    | function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void; | function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
52e41f4b71Sopenharmony_ci| bluetooth                    | function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void; | function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
53e41f4b71Sopenharmony_ci| bluetooth                    | function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void; | function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
54e41f4b71Sopenharmony_ci| bluetooth                    | function sppCloseServerSocket(socket: number): void;         | function sppCloseServerSocket(socket: number): void;         | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
55e41f4b71Sopenharmony_ci| bluetooth                    | function sppCloseClientSocket(socket: number): void;         | function sppCloseClientSocket(socket: number): void;         | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
56e41f4b71Sopenharmony_ci| bluetooth                    | function sppWrite(clientSocket: number, data: ArrayBuffer): boolean; | function sppWrite(clientSocket: number, data: ArrayBuffer): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
57e41f4b71Sopenharmony_ci| bluetooth                    | function on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void; | function on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.           |
58e41f4b71Sopenharmony_ci| bluetooth                    | function off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void; | function off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
59e41f4b71Sopenharmony_ci| bluetooth                    | function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile;                                | function getProfileInstance(profileId: ProfileId): A2dpSourceProfile |
60e41f4b71Sopenharmony_ci| bluetooth                    | function getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile                                 | HidHostProfile                                               |
61e41f4b71Sopenharmony_ci| BaseProfile                  | getConnectionDevices(): Array<string>;                 | getConnectionDevices(): Array<string>;                 | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
62e41f4b71Sopenharmony_ci| BaseProfile                  | getDeviceState(device: string): ProfileConnectionState;      | getDeviceState(device: string): ProfileConnectionState;      | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
63e41f4b71Sopenharmony_ci| A2dpSourceProfile            | connect(device: string): boolean;                            | connect(device: string): void;                               | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
64e41f4b71Sopenharmony_ci| A2dpSourceProfile            | disconnect(device: string): boolean;                         | disconnect(device: string): void;                            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
65e41f4b71Sopenharmony_ci| A2dpSourceProfile            | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
66e41f4b71Sopenharmony_ci| A2dpSourceProfile            | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
67e41f4b71Sopenharmony_ci| A2dpSourceProfile            | getPlayingState(device: string): PlayingState;               | getPlayingState(device: string): PlayingState;               | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
68e41f4b71Sopenharmony_ci| HandsFreeAudioGatewayProfile | connect(device: string): boolean;                            | connect(device: string): void;                               | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
69e41f4b71Sopenharmony_ci| HandsFreeAudioGatewayProfile | disconnect(device: string): boolean;                         | disconnect(device: string): void;                            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
70e41f4b71Sopenharmony_ci| HandsFreeAudioGatewayProfile | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
71e41f4b71Sopenharmony_ci| HandsFreeAudioGatewayProfile | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
72e41f4b71Sopenharmony_ci| HidHostProfile               | connect(device: string): boolean;                            | connect(device: string): void;                               | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
73e41f4b71Sopenharmony_ci| HidHostProfile               | disconnect(device: string): boolean;                         | disconnect(device: string): void;                            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
74e41f4b71Sopenharmony_ci| HidHostProfile               | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
75e41f4b71Sopenharmony_ci| HidHostProfile               | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
76e41f4b71Sopenharmony_ci| PanProfile                   | disconnect(device: string): boolean;                         | disconnect(device: string): void;                            | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
77e41f4b71Sopenharmony_ci| PanProfile                   | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | on(type: "connectionStateChange", callback: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
78e41f4b71Sopenharmony_ci| PanProfile                   | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | off(type: "connectionStateChange", callback?: Callback<StateChangeParam>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
79e41f4b71Sopenharmony_ci| PanProfile                   | setTethering(enable: boolean): void;                         | setTethering(enable: boolean): void;                         | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
80e41f4b71Sopenharmony_ci| PanProfile                   | isTetheringOn(): boolean;                                    | isTetheringOn(): boolean;                                    | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
81e41f4b71Sopenharmony_ci| BLE                          | function createGattServer(): GattServer;                     | function createGattServer(): GattServer;                     | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
82e41f4b71Sopenharmony_ci| BLE                          | function createGattClientDevice(deviceId: string): GattClientDevice; | function createGattClientDevice(deviceId: string): GattClientDevice; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
83e41f4b71Sopenharmony_ci| BLE                          | function getConnectedBLEDevices(): Array<string>;      | function getConnectedBLEDevices(): Array<string>;      | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
84e41f4b71Sopenharmony_ci| BLE                          | function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void; | function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and added the **ohos.permission.APPROXIMATELY_LOCATION** permission.|
85e41f4b71Sopenharmony_ci| BLE                          | function stopBLEScan(): void;                                | function stopBLEScan(): void;                                | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
86e41f4b71Sopenharmony_ci| BLE                          | mefunction on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void;thod | function on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
87e41f4b71Sopenharmony_ci| BLE                          | function off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void; | function off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
88e41f4b71Sopenharmony_ci| GattServer                   | startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; | startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
89e41f4b71Sopenharmony_ci| GattServer                   | stopAdvertising(): void;                                     | stopAdvertising(): void;                                     | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.             |
90e41f4b71Sopenharmony_ci| GattServer                   | addService(service: GattService): boolean;                   | addService(service: GattService): void;                      | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
91e41f4b71Sopenharmony_ci| GattServer                   | removeService(serviceUuid: string): boolean;                 | removeService(serviceUuid: string): void;                    | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**.|
92e41f4b71Sopenharmony_ci| GattServer | close(): void; | close(): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**.
93e41f4b71Sopenharmony_ci| GattServer | notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean; | notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
94e41f4b71Sopenharmony_ci| GattServer | sendResponse(serverResponse: ServerResponse): boolean; | sendResponse(serverResponse: ServerResponse): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
95e41f4b71Sopenharmony_ci| GattServer | on(type: "characteristicRead", callback: Callback<CharacteristicReadReq>): void; | on(type: "characteristicRead", callback: Callback<CharacteristicReadRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
96e41f4b71Sopenharmony_ci| GattServer | off(type: "characteristicRead", callback?: Callback<CharacteristicReadReq>): void; | off(type: "characteristicRead", callback?: Callback<CharacteristicReadRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
97e41f4b71Sopenharmony_ci| GattServer | on(type: "characteristicWrite", callback: Callback<CharacteristicWriteReq>): void; | on(type: "characteristicWrite", callback: Callback<CharacteristicWriteRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
98e41f4b71Sopenharmony_ci| GattServer | off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteReq>): void; | off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
99e41f4b71Sopenharmony_ci| GattServer | on(type: "descriptorRead", callback: Callback<DescriptorReadReq>): void; | on(type: "descriptorRead", callback: Callback<DescriptorReadRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
100e41f4b71Sopenharmony_ci| GattServer | off(type: "descriptorRead", callback?: Callback<DescriptorReadReq>): void; | off(type: "descriptorRead", callback?: Callback<DescriptorReadRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
101e41f4b71Sopenharmony_ci| GattServer | on(type: "descriptorWrite", callback: Callback<DescriptorWriteReq>): void; | on(type: "descriptorWrite", callback: Callback<DescriptorWriteRequest>): void;| Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
102e41f4b71Sopenharmony_ci| GattServer | off(type: "descriptorWrite", callback?: Callback<DescriptorWriteReq>): void; | off(type: "descriptorWrite", callback?: Callback<DescriptorWriteRequest>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
103e41f4b71Sopenharmony_ci| GattServer | on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void; | on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void;| Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
104e41f4b71Sopenharmony_ci| GattServer | off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void; | off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
105e41f4b71Sopenharmony_ci| GattClientDevice | connect(): boolean; | connect(): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
106e41f4b71Sopenharmony_ci| GattClientDevice | disconnect(): boolean; | disconnect(): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
107e41f4b71Sopenharmony_ci| GattClientDevice | close(): boolean; | close(): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
108e41f4b71Sopenharmony_ci| GattClientDevice | getDeviceName(callback: AsyncCallback<string>): void; | getDeviceName(callback: AsyncCallback<string>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
109e41f4b71Sopenharmony_ci| GattClientDevice | getDeviceName(): Promise<string>; | getDeviceName(): Promise<string>; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
110e41f4b71Sopenharmony_ci| GattClientDevice | getServices(callback: AsyncCallback<Array<GattService>>): void; | getServices(callback: AsyncCallback<Array<GattService>>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
111e41f4b71Sopenharmony_ci| GattClientDevice | getServices(): Promise<Array<GattService>>; | getServices(): Promise<Array<GattService>>; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
112e41f4b71Sopenharmony_ci| GattClientDevice | readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void; | readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
113e41f4b71Sopenharmony_ci| GattClientDevice | readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>; | readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
114e41f4b71Sopenharmony_ci| GattClientDevice | readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void; | readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
115e41f4b71Sopenharmony_ci| GattClientDevice | readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>; | readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
116e41f4b71Sopenharmony_ci| GattClientDevice | writeCharacteristicValue(characteristic: BLECharacteristic): boolean; | writeCharacteristicValue(characteristic: BLECharacteristic): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
117e41f4b71Sopenharmony_ci| GattClientDevice | writeDescriptorValue(descriptor: BLEDescriptor): boolean; | writeDescriptorValue(descriptor: BLEDescriptor): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
118e41f4b71Sopenharmony_ci| GattClientDevice | getRssiValue(callback: AsyncCallback<number>): void; | getRssiValue(callback: AsyncCallback<number>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
119e41f4b71Sopenharmony_ci| GattClientDevice | getRssiValue(): Promise<number>; | getRssiValue(): Promise<number>; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
120e41f4b71Sopenharmony_ci| GattClientDevice | setBLEMtuSize(mtu: number): boolean; | setBLEMtuSize(mtu: number): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
121e41f4b71Sopenharmony_ci| GattClientDevice | setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean; | setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts** and changed the return value to **void**. |
122e41f4b71Sopenharmony_ci| GattClientDevice | on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void; | on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
123e41f4b71Sopenharmony_ci| GattClientDevice | off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void; | off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
124e41f4b71Sopenharmony_ci| GattClientDevice | on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void; | on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
125e41f4b71Sopenharmony_ci| GattClientDevice | off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void; | off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void; | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
126e41f4b71Sopenharmony_ci| bluetooth | GattService | GattService | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
127e41f4b71Sopenharmony_ci| bluetooth | BLECharacteristic | BLECharacteristic | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
128e41f4b71Sopenharmony_ci| bluetooth | BLEDescriptor | BLEDescriptor | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
129e41f4b71Sopenharmony_ci| bluetooth | NotifyCharacteristic | NotifyCharacteristic | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
130e41f4b71Sopenharmony_ci| bluetooth | CharacteristicReadReq | CharacteristicReadRequest | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
131e41f4b71Sopenharmony_ci| bluetooth | CharacteristicWriteReq | CharacteristicWriteRequest | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
132e41f4b71Sopenharmony_ci| bluetooth | DescriptorReadRe | DescriptorReadRequest | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
133e41f4b71Sopenharmony_ci| bluetooth | DescriptorWriteReq | DescriptorWriteRequest | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
134e41f4b71Sopenharmony_ci| bluetooth | ServerResponse | ServerResponse | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
135e41f4b71Sopenharmony_ci| bluetooth | BLEConnectChangedState | BLEConnectChangedState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
136e41f4b71Sopenharmony_ci| bluetooth | ScanResult | ScanResult | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
137e41f4b71Sopenharmony_ci| bluetooth | AdvertiseSetting | AdvertiseSetting | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
138e41f4b71Sopenharmony_ci| bluetooth | AdvertiseData | AdvertiseData | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
139e41f4b71Sopenharmony_ci| bluetooth | ManufactureData | ManufactureData | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
140e41f4b71Sopenharmony_ci| bluetooth | ServiceData | ServiceData | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
141e41f4b71Sopenharmony_ci| bluetooth | ScanFilter | ScanFilter | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
142e41f4b71Sopenharmony_ci| bluetooth | ScanOptions | ScanOptions | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
143e41f4b71Sopenharmony_ci| bluetooth | SppOption | SppOption | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
144e41f4b71Sopenharmony_ci| bluetooth | PinRequiredParam | PinRequiredParam | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
145e41f4b71Sopenharmony_ci| bluetooth | DeviceClass | DeviceClass | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
146e41f4b71Sopenharmony_ci| bluetooth | BondStateParam | BondStateParam | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
147e41f4b71Sopenharmony_ci| bluetooth | StateChangeParam | StateChangeParam | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
148e41f4b71Sopenharmony_ci| bluetooth | ScanDuty | ScanDuty | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
149e41f4b71Sopenharmony_ci| bluetooth | MatchMode | MatchMode | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
150e41f4b71Sopenharmony_ci| bluetooth | ProfileConnectionState | ProfileConnectionState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
151e41f4b71Sopenharmony_ci| bluetooth | BluetoothState | BluetoothState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
152e41f4b71Sopenharmony_ci| bluetooth | SppType | SppType | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
153e41f4b71Sopenharmony_ci| bluetooth | ScanMode | ScanMode | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
154e41f4b71Sopenharmony_ci| bluetooth | BondState | BondState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
155e41f4b71Sopenharmony_ci| bluetooth | MajorClass | MajorClass | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
156e41f4b71Sopenharmony_ci| bluetooth | MajorMinorClass | MajorMinorClass | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
157e41f4b71Sopenharmony_ci| bluetooth | PlayingState | PlayingState | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
158e41f4b71Sopenharmony_ci| bluetooth | ProfileId | ProfileId | Migrated this API in API version 9 to **@ohos.bluetoothManager.d.ts**. |
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**(Optional) Adaptation Guide**
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ciThe following uses **enableLocation** as an example to show how it is called in the new version:
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci  ```ts
167e41f4b71Sopenharmony_ci  import bluetoothManager from '@ohos.bluetoothManager';
168e41f4b71Sopenharmony_ci  try {
169e41f4b71Sopenharmony_ci      var state = bluetoothManager.getState();
170e41f4b71Sopenharmony_ci  } catch (err) {
171e41f4b71Sopenharmony_ci      console.error("errCode:" + err.code + ",errMessage:" + err.message);
172e41f4b71Sopenharmony_ci  }
173e41f4b71Sopenharmony_ci  ```
174