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