function randomUUID(entropyCache?: boolean): string 改为 function generateRandomUUID(entropyCache?: boolean): string 函数名由原来的randomUUID改为generateRandomUUID。
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 方法/属性/枚举/常量 | 变更类型 |
| :---------- | ------------------- | ------- |
| @ohos.util | function randomUUID(entropyCache?: boolean): string | 删除 |
| @ohos.util | function generateRandomUUID(entropyCache?: boolean): string| 变更 |
**适配指导**
应用中使用generateRandomUUID可参考下列代码
示例:
```ts
importutilfrom'@ohos.util'
letuuid=util.generateRandomUUID(true);
console.log("RFC 4122 Version 4 UUID:"+uuid);
// 输出:
// RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045
```
## cl.util.2.randomBinaryUUID接口名变更
util子系统randomBinaryUUID函数名存在变更:
function randomBinaryUUID(entropyCache?: boolean): Uint8Array 改为 function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array 函数名由原来的randomBinaryUUID改为generateRandomBinaryUUID。
开发者需要根据以下说明对应用进行适配。
**变更影响**
影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。
**关键的接口/组件变更**
| 模块名 | 方法/属性/枚举/常量 | 变更类型 |
| :---------- | ------------------- | ------- |
| @ohos.util | function randomBinaryUUID(entropyCache?: boolean): Uint8Array; | 删除 |
| @ohos.util | function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array| 变更 |
| bluetooth | function getState(): BluetoothState | function getState(): BluetoothState | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | method | function getBtConnectionState(): ProfileConnectionState; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function pairDevice(deviceId: string): boolean | function pairDevice(deviceId: string): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function cancelPairedDevice(deviceId: string): boolean | function cancelPairedDevice(deviceId: string): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function getRemoteDeviceName(deviceId: string): string | function getRemoteDeviceName(deviceId: string): string| API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function getRemoteDeviceClass(deviceId: string): DeviceClass | function getRemoteDeviceClass(deviceId: string): DeviceClass | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function enableBluetooth(): boolean | function enableBluetooth(): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function disableBluetooth(): boolean | function disableBluetooth(): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function getLocalName(): string | function getLocalName(): string | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function getPairedDevices(): Array<string>; | function getPairedDevices(): Array<string>; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function getProfileConnState(profileId: ProfileId): ProfileConnectionState | function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口名修改为getProfileConnectionState |
| bluetooth | function setDevicePairingConfirmation(device: string, accept: boolean): boolean | function setDevicePairingConfirmation(device: string, accept: boolean): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function setLocalName(name: string): boolean; | function setLocalName(name: string): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function setBluetoothScanMode(mode: ScanMode, duration: number): boolean | function setBluetoothScanMode(mode: ScanMode, duration: number): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function getBluetoothScanMode(): ScanMod | function getBluetoothScanMode(): ScanMode | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function startBluetoothDiscovery(): boolean | function startBluetoothDiscovery(): void | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,新加权限ohos.permission.APPROXIMATELY_LOCATION,接口返回值改为void |
| bluetooth | function stopBluetoothDiscovery(): boolean; | function stopBluetoothDiscovery(): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void; | function on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void; | function off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function on(type: "bondStateChange", callback: Callback<BondStateParam>): void; | function on(type: "bondStateChange", callback: Callbackk<BondStateParam>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function off(type: "bondStateChange", callback?: Callback<BondStateParam>): void; | function off(type: "bondStateChange", callback?: Callback<BondStateParam>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function on(type: "pinRequired", callback: Callback<PinRequiredParam>): void; | function on(type: "pinRequired", callback: Callback<PinRequiredParam>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void; | function off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function on(type: "stateChange", callback: Callback<BluetoothState>): void; | function on(type: "stateChange", callback: Callback<BluetoothState>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function off(type: "stateChange", callback?: Callback<BluetoothState>): void; | function off(type: "stateChange", callback?: Callback<BluetoothState>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void; | function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void; | function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void; | function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppCloseServerSocket(socket: number): void; | function sppCloseServerSocket(socket: number): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppCloseClientSocket(socket: number): void; | function sppCloseClientSocket(socket: number): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function sppWrite(clientSocket: number, data: ArrayBuffer): boolean; | function sppWrite(clientSocket: number, data: ArrayBuffer): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口返回值改为void |
| bluetooth | function on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void; | function on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts。 |
| bluetooth | function off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void; | function off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| bluetooth | function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile; | function getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口名修改为getProfileInstance |
| bluetooth | function getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile; | function getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,接口名修改为getProfileInstance |
| BLE | function createGattServer(): GattServer; | function createGattServer(): GattServer; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| BLE | function createGattClientDevice(deviceId: string): GattClientDevice; | function createGattClientDevice(deviceId: string): GattClientDevice; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| BLE | function getConnectedBLEDevices(): Array<string>; | function getConnectedBLEDevices(): Array<string>; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| BLE | function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void; | function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts,新加权限ohos.permission.APPROXIMATELY_LOCATION |
| BLE | function stopBLEScan(): void; | function stopBLEScan(): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| BLE | mefunction on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void;thod | function on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
| BLE | function off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void; | function off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void; | API9接口变更,迁移到@ohos.bluetoothManager.d.ts |
|wifiManager| method | function scan(): void; | 权限变更为ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getScanResults(): Promise<Array<WifiScanInfo>>; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getScanResultsSync(): Array<WifiScanInfo>; | 权限变更为ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION)) |
|wifiManager| method | function getCandidateConfigs(): Array<WifiDeviceConfig>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getDeviceConfigs(): Array<WifiDeviceConfig>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.GET_WIFI_CONFIG |
|wifiManager| method | function getStations(): Array<StationInfo>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT |
|wifiManager| method | function getCurrentGroup(): Promise<WifiP2pGroupInfo>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pPeerDevices(): Promise<WifiP2pDevice[]>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function p2pConnect(config: WifiP2PConfig): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function startDiscoverDevices(): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function on(type: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function off(type: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): void; | 权限变更为ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function on(type: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): void; | 权限变更为ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |
|wifiManager| method | function off(type: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): void; | 权限变更为ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION |