• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 基础通信WIFI子系统ChangeLog
2
3
4## cl.wifi.1 系统API和API9接口迁移到新增的@ohos.wifiManager.d.ts
5@ohos.wifi.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifi.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManager.d.ts当中,并添加错误码描述。
6
7后续需要import @ohos.wifiManager.d.ts才能够使用wifi的系统API以及API9接口:
8
9import wifiManager from '@ohos.wifiManager';
10
11
12**变更影响**
13
14仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManager才能使用wifi的系统API和API9接口
15
16import wifiManager from '@ohos.wifiManager';
17
18对于其他接口无影响
19
20
21**关键的接口/组件变更**
22
23| 类名 | 接口类型 | 接口声明 | 变更类型 |
24| -- | -- | -- | -- |
25| wifi | namespace | declare namespace wifi | API9接口变更,迁移到@ohos.wifiManager.d.ts |
26| wifi | method | function enableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void |
27| wifi | method | function disableWifi(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void |
28| wifi | method | function scan(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值改为void |
29| wifi | method | function getScanResults(): Promise<Array<WifiScanInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults |
30| wifi | method | function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,由getScanInfos修改为getScanResults |
31| wifi | method | function getScanResultsSync():  Array<[WifiScanInfo]> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
32| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise<number> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
33| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts |
34| wifi | method | function removeCandidateConfig(networkId: number): Promise<void> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
35| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts |
36| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 |
37| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 |
38| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> | API9接口变更,该接口删除 |
39| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): void | API9接口变更,该接口删除 |
40| wifi | method | function getCandidateConfigs():  Array<[WifiDeviceConfig]> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
41| wifi | method | function connectToCandidateConfig(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts |
42| wifi | method | function connectToNetwork(networkId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
43| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
44| wifi | method | function disconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
45| wifi | method | function reassociate(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
46| wifi | method | function reconnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
47| wifi | method | function disableNetwork(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
48| wifi | method | function removeAllNetwork(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
49| wifi | method | function removeDevice(id: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
50| wifi | method | function enableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
51| wifi | method | function disableHotspot(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
52| wifi | method | function setHotspotConfig(config: HotspotConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
53| wifi | method | function getP2pLocalDevice(): Promise<WifiP2pDevice> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
54| wifi | method | function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts |
55| wifi | method | function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | API9接口变更,迁移到@ohos.wifiManager.d.ts |
56| wifi | method | function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void | API9接口变更,迁移到@ohos.wifiManager.d.ts |
57| wifi | method | function createGroup(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
58| wifi | method | function removeGroup(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
59| wifi | method | function p2pConnect(config: WifiP2PConfig): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
60| wifi | method | function p2pCancelConnect(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
61| wifi | method | function startDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
62| wifi | method | function stopDiscoverDevices(): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
63| wifi | method | function deletePersistentGroup(netId: number): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
64| wifi | method | function setDeviceName(devName: string): void | API9接口变更,迁移到@ohos.wifiManager.d.ts,返回值修改为void |
65| wifi | interface | export interface WifiEapConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts |
66| wifi | enum | export enum EapMethod | API9接口变更,迁移到@ohos.wifiManager.d.ts |
67| wifi | enum | export enum Phase2Method | API9接口变更,迁移到@ohos.wifiManager.d.ts |
68| wifi | interface | export interface WifiDeviceConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加eapConfig参数 |
69| wifi | interface | export interface IpConfig | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加prefixLength参数 |
70| wifi | interface | export interface WifiInfoElem | API9接口变更,迁移到@ohos.wifiManager.d.ts |
71| wifi | enum | export enum WifiChannelWidth | API9接口变更,迁移到@ohos.wifiManager.d.ts |
72| wifi | interface | export interface WifiScanInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加centerFrequency0、centerFrequency1、infoElems三个参数 |
73| wifi | enum | export enum WifiSecurityType | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加4种加密类型 |
74| wifi | interface | export interface WifiLinkedInfo | API9接口变更,迁移到@ohos.wifiManager.d.ts,增加MacType参数 |
75
76
77**适配指导(可选,不涉及则可以删除)**
78
79以getLinkedInfo为例,在新版本中需要使用如下方式进行调用:
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 系统API和API9接口迁移到新增的@ohos.wifiManagerExt.d.ts
101
102@ohos.wifiext.d.ts接口不支持抛出错误码,而API9以及SystemAPI都需要支持错误码抛出,为支持该功能,将@ohos.wifiext.d.ts中的所有SystemAPI以及API9接口迁移到新增的@ohos.wifiManagerExt.d.ts当中,并添加错误码描述
103
104后续需要import @ohos.wifiManagerExt.d.ts才能够使用wifi的系统API以及API9接口:
105
106import wifiManagerExt from '@ohos.wifiManagerExt';
107
108
109**变更影响**
110
111仅对系统API以及API9所有接口的使用有影响,需要import @ohos.wifiManagerExt才能使用wifi的系统API和API9接口,与wifiManager配套使用
112
113import wifiManagerExt from '@ohos.wifiManagerExt';
114
115对于其他接口无影响
116