• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Communication Subsystem - WiFi Changelog
2
3
4## cl.wifi.1 Moving System APIs and APIs of Version 9 to @ohos.wifiManager.d.ts
5Moved all system APIs and APIs of version 9 from **@ohos.wifi.d.ts** to the newly added **@ohos.wifiManager.d.ts**, and added error code descriptions. The **@ohos.wifi.d.ts** APIs do not support error code handling.
6
7To use these APIs, import the **@ohos.wifiManager.d.ts** module as follows:
8
9import wifiManager from '@ohos.wifiManager';
10
11
12**Change Impact**
13
14System APIs and APIs of version 9 are affected. To use these APIs, import **@ohos.wifiManager** as follows:
15
16import wifiManager from '@ohos.wifiManager';
17
18Other APIs are not affected.
19
20
21**Key API/Component Changes**
22
23| Class| API Type| Declaration| Change Type|
24| -- | -- | -- | -- |
25| wifi | namespace | declare namespace wifi | Moved to **@ohos.wifiManager.d.ts**|
26| wifi | method | function enableWifi(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
27| wifi | method | function disableWifi(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
28| wifi | method | function scan(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
29| wifi | method | function getScanResults(): Promise<Array<WifiScanInfo>> | Changed from **getScanInfos** to **getScanResults** and moved to **@ohos.wifiManager.d.ts**|
30| wifi | method | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void | Changed from **getScanInfos** to **getScanResults** and moved to **@ohos.wifiManager.d.ts**|
31| wifi | method | function getScanResultsSync():  Array<[WifiScanInfo]> | Moved to **@ohos.wifiManager.d.ts**|
32| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise<number> | Moved to **@ohos.wifiManager.d.ts**|
33| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void | Moved to **@ohos.wifiManager.d.ts**|
34| wifi | method | function removeCandidateConfig(networkId: number): Promise<void> | Moved to **@ohos.wifiManager.d.ts**|
35| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void | Moved 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|
38| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | Deleted|
39| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | Deleted|
40| wifi | method | function getCandidateConfigs():  Array<[WifiDeviceConfig]> | Moved to **@ohos.wifiManager.d.ts**|
41| wifi | method | function connectToCandidateConfig(networkId: number): void | Moved to **@ohos.wifiManager.d.ts**|
42| wifi | method | function connectToNetwork(networkId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
43| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
44| wifi | method | function disconnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
45| wifi | method | function reassociate(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
46| wifi | method | function reconnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
47| wifi | method | function disableNetwork(netId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
48| wifi | method | function removeAllNetwork(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
49| wifi | method | function removeDevice(id: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
50| wifi | method | function enableHotspot(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
51| wifi | method | function disableHotspot(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
52| wifi | method | function setHotspotConfig(config: HotspotConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
53| wifi | method | function getP2pLocalDevice(): Promise<WifiP2pDevice> | Moved to **@ohos.wifiManager.d.ts**|
54| wifi | method | function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | Moved to **@ohos.wifiManager.d.ts**|
55| wifi | method | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | Moved to **@ohos.wifiManager.d.ts**|
56| wifi | method | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void | Moved to **@ohos.wifiManager.d.ts**|
57| wifi | method | function createGroup(config: WifiP2PConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
58| wifi | method | function removeGroup(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
59| wifi | method | function p2pConnect(config: WifiP2PConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
60| wifi | method | function p2pCancelConnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
61| wifi | method | function startDiscoverDevices(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
62| wifi | method | function stopDiscoverDevices(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
63| wifi | method | function deletePersistentGroup(netId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
64| wifi | method | function setDeviceName(devName: string): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
65| wifi | interface | export interface WifiEapConfig | Moved to **@ohos.wifiManager.d.ts**|
66| wifi | enum | export enum EapMethod | Moved to **@ohos.wifiManager.d.ts**|
67| wifi | enum | export enum Phase2Method | Moved to **@ohos.wifiManager.d.ts**|
68| wifi | interface | export interface WifiDeviceConfig | Added with the **eapConfig** parameter and moved to **@ohos.wifiManager.d.ts**|
69| wifi | interface | export interface IpConfig | Added with the **prefixLength** parameter and moved to **@ohos.wifiManager.d.ts**|
70| wifi | interface | export interface WifiInfoElem | Moved to **@ohos.wifiManager.d.ts**|
71| wifi | enum | export enum WifiChannelWidth | Moved to **@ohos.wifiManager.d.ts**|
72| wifi | interface | export interface WifiScanInfo | Added with the **centerFrequency0**, **centerFrequency1**, and **infoElems** parameters and moved to **@ohos.wifiManager.d.ts**|
73| wifi | enum | export enum WifiSecurityType | Added with four encryption types and moved to **@ohos.wifiManager.d.ts**|
74| wifi | interface | export interface WifiLinkedInfo | Added with the **MacType** parameter and moved to **@ohos.wifiManager.d.ts**|
75
76
77**(Optional) Adaptation Guide**
78
79The following uses **getLinkedInfo** as an example:
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 Change of System APIs and APIs of Version 9
101
102Moved all system APIs and APIs of version 9 from **@ohos.wifiext.d.ts** to the newly added **@ohos.wifiManagerExt.d.ts**, and added error code descriptions.
103
104To use these APIs, import the **@ohos.wifiManagerExt.d.ts** module as follows:
105
106import wifiManagerExt from '@ohos.wifiManagerExt';
107
108
109**Change Impact**
110
111System APIs and APIs of version 9 are affected. Import **@ohos.wifiManagerExt** and use it together with **wifiManager**.
112
113import wifiManagerExt from '@ohos.wifiManagerExt';
114
115Other APIs are not affected.
116