openharmony 鸿蒙 changelog-wifi

2023-02-03 浏览 (595)

Wi-Fi Subsystem ChangeLog

cl.wifi.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManager.d.ts

@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.

Import @ohos.wifiManager.d.ts, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.

import wifiManager from '@ohos.wifiManager';

Change Impacts

System 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.

import wifiManager from '@ohos.wifiManager';

Other APIs are not affected.

Key API/Component Changes

ClassTypeDeclarationChange Type
wifinamespacedeclare namespace wifiMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction enableWifi(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value type to void.
wifimethodfunction disableWifi(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value type to void.
wifimethodfunction scan(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value type to void.
wifimethodfunction getScanResults(): Promise<Array<WifiScanInfo>>Migrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed getScanInfos to getScanResults.
wifimethodfunction getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed getScanInfos to getScanResults.
wifimethodfunction getScanResultsSync():  Array<[WifiScanInfo]>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction addCandidateConfig(config: WifiDeviceConfig): Promise<number>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction removeCandidateConfig(networkId: number): Promise<void>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>Deleted this API in API version 9.
wifimethodfunction addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): voidDeleted this API in API version 9.
wifimethodfunction removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean>Deleted this API in API version 9.
wifimethodfunction removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean>): voidDeleted this API in API version 9.
wifimethodfunction getCandidateConfigs():  Array<[WifiDeviceConfig]>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction connectToCandidateConfig(networkId: number): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction connectToNetwork(networkId: number): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction connectToDevice(config: WifiDeviceConfig): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction disconnect(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction reassociate(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction reconnect(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction disableNetwork(netId: number): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction removeAllNetwork(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction removeDevice(id: number): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction enableHotspot(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction disableHotspot(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction setHotspotConfig(config: HotspotConfig): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction getP2pLocalDevice(): Promise<WifiP2pDevice>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>Migrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifimethodfunction createGroup(config: WifiP2PConfig): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction removeGroup(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction p2pConnect(config: WifiP2PConfig): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction p2pCancelConnect(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction startDiscoverDevices(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction stopDiscoverDevices(): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction deletePersistentGroup(netId: number): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifimethodfunction setDeviceName(devName: string): voidMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and changed the return value to void.
wifiinterfaceexport interface WifiEapConfigMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifienumexport enum EapMethodMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifienumexport enum Phase2MethodMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifiinterfaceexport interface WifiDeviceConfigMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and added the eapConfig parameter.
wifiinterfaceexport interface IpConfigMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and added the prefixLength parameter.
wifiinterfaceexport interface WifiInfoElemMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifienumexport enum WifiChannelWidthMigrated this API in API version 9 to @ohos.wifiManager.d.ts.
wifiinterfaceexport interface WifiScanInfoMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and added the following three parameters: centerFrequency0, centerFrequency1, and infoElems.
wifienumexport enum WifiSecurityTypeMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and added four encryption types.
wifiinterfaceexport interface WifiLinkedInfoMigrated this API in API version 9 to @ohos.wifiManager.d.ts, and added the MacType parameter.

(Optional) Adaptation Guide

The following uses getLinkedInfo as an example to show how it is called in the new version:

import wifiManager from '@ohos.wifiManager'

wifiManager.getLinkedInfo((err, data) => {
    if (err) {
        console.error("get linked info error");
        return;
    }
    console.info("get linked info: " + JSON.stringify(data));
});

wifiManager.getLinkedInfo().then(data => {
    console.info("get linked info: " + JSON.stringify(data));
}).catch(error => {
    console.info("get linked info error");
});

cl.wifiext.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManagerExt.d.ts

@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.

Import @ohos.wifiManagerExt.d.ts, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.

import wifiManagerExt from '@ohos.wifiManagerExt';

Change Impacts

System 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.

import wifiManagerExt from '@ohos.wifiManagerExt';

Other APIs are not affected.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Distributed Scheduler Subsystem ChangeLog

harmony 鸿蒙Ability Subsystem ChangeLog

harmony 鸿蒙Account Subsystem ChangeLog

harmony 鸿蒙Customization Subsystem ChangeLog

harmony 鸿蒙Location Subsystem ChangeLog

harmony 鸿蒙Multimedia Subsystem ChangeLog

harmony 鸿蒙Common Event and Notification Subsystem ChangeLog

harmony 鸿蒙User IAM Subsystem ChangeLog

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/277957e7ff934cf6ae26a47f2bb0e068