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