1# Wi-Fi Subsystem ChangeLog
2
3
4## cl.wifi.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManager.d.ts
5**@ohos.wifi.d.ts** does not allow for throwing error codes, which is required by API version 9 and the system APIs. Therefore, all system APIs and APIs in API version 9 of **@ohos.wifi.d.ts** are migrated to the newly added **@ohos.wifiManager.d.ts**, and error code description is also added.
6
7Import **@ohos.wifiManager.d.ts**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
8
9import wifiManager from '@ohos.wifiManager';
10
11
12**Change Impacts**
13
14System APIs and APIs in API version 9 are affected. Import **@ohos.wifiManager** to make sure that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
15
16import wifiManager from '@ohos.wifiManager';
17
18Other APIs are not affected.
19
20
21**Key API/Component Changes**
22
23| Class| Type | Declaration                                                    | Change Type                                                    |
24| ---- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
25| wifi | namespace | declare namespace wifi                                       | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
26| wifi | method    | function enableWifi(): void                                  | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void.  |
27| wifi | method    | function disableWifi(): void                                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void.  |
28| wifi | method    | function scan(): void                                        | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void.  |
29| wifi | method    | function getScanResults(): Promise<Array<WifiScanInfo>> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed **getScanInfos** to **getScanResults**.|
30| wifi | method    | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed **getScanInfos** to **getScanResults**.|
31| wifi | method    | function getScanResultsSync():  Array<[WifiScanInfo]> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
32| wifi | method    | function addCandidateConfig(config: WifiDeviceConfig): Promise<number> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
33| wifi | method    | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
34| wifi | method    | function removeCandidateConfig(networkId: number): Promise<void> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
35| wifi | method    | function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
36| wifi | method    | function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | Deleted this API in API version 9.                                    |
37| wifi | method    | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | Deleted this API in API version 9.                                    |
38| wifi | method    | function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | Deleted this API in API version 9.                                    |
39| wifi | method    | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | Deleted this API in API version 9.                                    |
40| wifi | method    | function getCandidateConfigs():  Array<[WifiDeviceConfig]> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
41| wifi | method    | function connectToCandidateConfig(networkId: number): void   | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
42| wifi | method    | function connectToNetwork(networkId: number): void           | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
43| wifi | method    | function connectToDevice(config: WifiDeviceConfig): void     | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
44| wifi | method    | function disconnect(): void                                  | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
45| wifi | method    | function reassociate(): void                                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
46| wifi | method    | function reconnect(): void                                   | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
47| wifi | method    | function disableNetwork(netId: number): void                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
48| wifi | method    | function removeAllNetwork(): void                            | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
49| wifi | method    | function removeDevice(id: number): void                      | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
50| wifi | method    | function enableHotspot(): void                               | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
51| wifi | method    | function disableHotspot(): void                              | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
52| wifi | method    | function setHotspotConfig(config: HotspotConfig): void       | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
53| wifi | method    | function getP2pLocalDevice(): Promise<WifiP2pDevice>   | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
54| wifi | method    | function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
55| wifi | method    | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
56| wifi | method    | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
57| wifi | method    | function createGroup(config: WifiP2PConfig): void            | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
58| wifi | method    | function removeGroup(): void                                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
59| wifi | method    | function p2pConnect(config: WifiP2PConfig): void             | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
60| wifi | method    | function p2pCancelConnect(): void                            | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
61| wifi | method    | function startDiscoverDevices(): void                        | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
62| wifi | method    | function stopDiscoverDevices(): void                         | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
63| wifi | method    | function deletePersistentGroup(netId: number): void          | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
64| wifi | method    | function setDeviceName(devName: string): void                | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
65| wifi | interface | export interface WifiEapConfig                               | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
66| wifi | enum      | export enum EapMethod                                        | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
67| wifi | enum      | export enum Phase2Method                                     | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
68| wifi | interface | export interface WifiDeviceConfig                            | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **eapConfig** parameter.|
69| wifi | interface | export interface IpConfig                                    | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **prefixLength** parameter.|
70| wifi | interface | export interface WifiInfoElem                                | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
71| wifi | enum      | export enum WifiChannelWidth                                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**.                  |
72| wifi | interface | export interface WifiScanInfo                                | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the following three parameters: **centerFrequency0**, **centerFrequency1**, and **infoElems**.|
73| wifi | enum      | export enum WifiSecurityType                                 | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added four encryption types. |
74| wifi | interface | export interface WifiLinkedInfo                              | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **MacType** parameter. |
75
76
77**(Optional) Adaptation Guide**
78
79The following uses **getLinkedInfo** as an example to show how it is called in the new version:
80
81```
82import wifiManager from '@ohos.wifiManager'
83
84wifiManager.getLinkedInfo((err, data) => {
85    if (err) {
86        console.error("get linked info error");
87        return;
88    }
89    console.info("get linked info: " + JSON.stringify(data));
90});
91
92wifiManager.getLinkedInfo().then(data => {
93    console.info("get linked info: " + JSON.stringify(data));
94}).catch(error => {
95    console.info("get linked info error");
96});
97
98```
99
100## cl.wifiext.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManagerExt.d.ts
101
102**@ohos.wifiext.d.ts** does not allow for throwing error codes, which is required by API version 9 and the system API. Therefore, all system APIs and APIs in API version 9 of **@ohos.wifiext.d.ts** are migrated to the newly added **@ohos.wifiManagerExt.d.ts**, and error code description is also added.
103
104Import **@ohos.wifiManagerExt.d.ts**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
105
106import wifiManagerExt from '@ohos.wifiManagerExt';
107
108
109**Change Impacts**
110
111System APIs and APIs in API version 9 are affected. Import **@ohos.wifiManagerExt**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used together with the Wi-Fi manager.
112
113import wifiManagerExt from '@ohos.wifiManagerExt';
114
115Other APIs are not affected.
116