1e41f4b71Sopenharmony_ci# Wi-Fi Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci# cl.wifi.1 Change of the Name of the API for Obtaining Wi-Fi Scan Result 4e41f4b71Sopenharmony_ciThe name of the API for obtaining Wi-Fi scan result is changed in API version 10 Beta1 and then changed to the names used in API version 9 release. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci**Change Impact** 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ciThe JS API name needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**Key API/Component Changes** 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci- Involved API: 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci getScanInfoList(): Array<WifiScanInfo>; 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci- Before change: 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci```js 19e41f4b71Sopenharmony_cigetScanInfoList(): Array<WifiScanInfo>; 20e41f4b71Sopenharmony_ci``` 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci- After change: 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci```js 25e41f4b71Sopenharmony_cigetScanResults(): Array<WifiScanInfo>; 26e41f4b71Sopenharmony_cigetScanResultsSync(): Array<WifiScanInfo>; 27e41f4b71Sopenharmony_ci``` 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**Adaptation Guide** 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ciExample: 32e41f4b71Sopenharmony_ci- Call **getScanResults**. 33e41f4b71Sopenharmony_ci```js 34e41f4b71Sopenharmony_cifunction getScanResultsPromise() { 35e41f4b71Sopenharmony_ci let methodName = `${tag} getScanResultsPromise` 36e41f4b71Sopenharmony_ci wifiManager.getScanResults((err, data) => { 37e41f4b71Sopenharmony_ci if (err) { 38e41f4b71Sopenharmony_ci showToastE(`${methodName} failed ${JSON.stringify(err)}`) 39e41f4b71Sopenharmony_ci return 40e41f4b71Sopenharmony_ci } 41e41f4b71Sopenharmony_ci if (data == null || data.length == 0) { 42e41f4b71Sopenharmony_ci showToast(`${methodName} end data is null`) 43e41f4b71Sopenharmony_ci return; 44e41f4b71Sopenharmony_ci } 45e41f4b71Sopenharmony_ci }) 46e41f4b71Sopenharmony_ci} 47e41f4b71Sopenharmony_ci``` 48e41f4b71Sopenharmony_ci- Call **getScanResultsSync**. 49e41f4b71Sopenharmony_ci```js 50e41f4b71Sopenharmony_cifunction getScanResultsSync(): Array<wifiManager.WifiScanInfo> { 51e41f4b71Sopenharmony_ci let methodName = `${tag} getScanResultsSync` 52e41f4b71Sopenharmony_ci try { 53e41f4b71Sopenharmony_ci return wifiManager.getScanResultsSync(); 54e41f4b71Sopenharmony_ci } catch (error) { 55e41f4b71Sopenharmony_ci showToastE(`${methodName} failed ${JSON.stringify(error)}`) 56e41f4b71Sopenharmony_ci } 57e41f4b71Sopenharmony_ci return Array(); 58e41f4b71Sopenharmony_ci} 59e41f4b71Sopenharmony_ci``` 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci# cl.wifi.2 Change of Wi-Fi P2P APIs 62e41f4b71Sopenharmony_ciThe names of P2P APIs are changed in API version 10 Beta1 and then changed to the names used in API version 9 release. 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci**Change Impact** 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ciThe JS API name needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci**Key API/Component Changes** 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci- Added APIs 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci| API| Description| 73e41f4b71Sopenharmony_ci|------|---------| 74e41f4b71Sopenharmony_ci| **function** updateNetwork(config: WifiDeviceConfig): number; | Updates the added hotspot configuration information. | 75e41f4b71Sopenharmony_ci| **function** disableNetwork(netId: number): **void**; | Disables the added hotspot configuration. | 76e41f4b71Sopenharmony_ci| **function** removeAllNetwork(): **void**; | Deletes all hotspot configurations. | 77e41f4b71Sopenharmony_ci| **function** removeDevice(id: number): **void**; | Deletes configuration of a single hotspot. | 78e41f4b71Sopenharmony_ci| **function** getStations(): Array<StationInfo>; | Obtains information about devices connected to this hotspot. | 79e41f4b71Sopenharmony_ci| **function** createGroup(config: WifiP2PConfig): **void**; | Creates a P2P group. | 80e41f4b71Sopenharmony_ci| **function** removeGroup(): **void**; | Removes a P2P group. | 81e41f4b71Sopenharmony_ci| **function** startDiscoverDevices(): **void**; | Starts P2P scan. | 82e41f4b71Sopenharmony_ci| **function** stopDiscoverDevices(): **void**; | Stops P2P scan. | 83e41f4b71Sopenharmony_ci| **function** deletePersistentGroup(netId: number): **void**; | Deletes the persistent P2P group with a specified network ID. | 84e41f4b71Sopenharmony_ci| **function** setDeviceName(devName: string): **void**; | Sets the P2P device name. | 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci- Deprecated APIs 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci| API |Description | 89e41f4b71Sopenharmony_ci| ------------- |-------------------------------------------------------- | 90e41f4b71Sopenharmony_ci| **function** updateDeviceConfig(config: WifiDeviceConfig): number; | Updates the added hotspot configuration information. | 91e41f4b71Sopenharmony_ci| **function** disableDeviceConfig(networkId: number): **void**; | Disables the added hotspot configuration. | 92e41f4b71Sopenharmony_ci| **function** removeAllDeviceConfigs(): **void**; | Deletes all hotspot configurations. | 93e41f4b71Sopenharmony_ci| **function** removeDeviceConfig(networkId: number): **void**; | Deletes configuration of a single hotspot. | 94e41f4b71Sopenharmony_ci| **function** getHotspotStations(): Array<StationInfo>; | Obtains information about devices connected to this hotspot. | 95e41f4b71Sopenharmony_ci| **function** createP2pGroup(config: WifiP2PConfig): **void**; | Creates a P2P group. | 96e41f4b71Sopenharmony_ci| **function** removeP2pGroup(): **void**; | Removes a P2P group. | 97e41f4b71Sopenharmony_ci| **function** startDiscoverP2pDevices(): **void**; | Starts P2P scan. | 98e41f4b71Sopenharmony_ci| **function** stopDiscoverP2pDevices(): **void**; | Stops P2P scan. | 99e41f4b71Sopenharmony_ci| **function** deletePersistentP2pGroup(netId: number): **void**; | Deletes the persistent P2P group with a specified network ID. | 100e41f4b71Sopenharmony_ci| **function** setP2pDeviceName(devName: string): **void**; | Sets the P2P device name. | 101