harmony 鸿蒙@ohos.wifiext (WLAN Extension)

2022-08-09 浏览 (924)

@ohos.wifiext (WLAN Extension)

This wifiext module provides WLAN extension interfaces for non-universal products.

NOTE

The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. The APIs described in this document are used only for non-universal products, such as routers.

Modules to Import

import wifiext from '@ohos.wifiext';

wifiext.enableHotspot

enableHotspot(): boolean;

Enables the WLAN hotspot.

Required permissions: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT

System capability: SystemCapability.Communication.WiFi.AP.Extension

Return value

TypeDescription
booleanReturns true if the operation is successful; returns false otherwise.

wifiext.disableHotspot

disableHotspot(): boolean;

Disables the WLAN hotspot.

Required permissions: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT

System capability: SystemCapability.Communication.WiFi.AP.Extension

Return value

TypeDescription
booleanReturns true if the operation is successful; returns false otherwise.

wifiext.getSupportedPowerModel

getSupportedPowerModel(): Promise<Array<PowerModel>>

Obtains the supported power models. This API uses a promise to return the result.

Required permissions: ohos.permission.GET_WIFI_INFO

System capability: SystemCapability.Communication.WiFi.AP.Extension

Return value

TypeDescription
Promise<Array<PowerModel>>Promise used to return the power models obtained.

PowerModel

Enumerates the power models.

System capability: SystemCapability.Communication.WiFi.AP.Extension

NameValueDescription
SLEEPING0Sleeping
GENERAL1General
THROUGH_WALL2Through_wall

wifiext.getSupportedPowerModel

getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void

Obtains the supported power models. This API uses an asynchronous callback to return the result.

Required permissions: ohos.permission.GET_WIFI_INFO

System capability: SystemCapability.Communication.WiFi.AP.Extension

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<Array<PowerModel>>YesCallback invoked to return the result. If the operation is successful, err is 0 and data is the power models obtained. If err is not 0, an error has occurred.

wifiext.getPowerModel

getPowerModel(): Promise<PowerModel>

Obtains the power model. This API uses a promise to return the result.

Required permissions: ohos.permission.GET_WIFI_INFO

System capability: SystemCapability.Communication.WiFi.AP.Extension

Return value

TypeDescription
Promise<PowerModel>Promise used to return the power model obtained.

wifiext.getPowerModel

getPowerModel(callback: AsyncCallback<PowerModel>): void

Obtains the power model. This API uses an asynchronous callback to return the result.

Required permissions: ohos.permission.GET_WIFI_INFO

System capability: SystemCapability.Communication.WiFi.AP.Extension

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<PowerModel>YesCallback invoked to return the result. If the operation is successful, err is 0 and data is the power model obtained. If err is not 0, an error has occurred.

wifiext.setPowerModel

setPowerModel(model: PowerModel) : boolean;

Sets the power model.

Required permissions: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT

System capability: SystemCapability.Communication.WiFi.AP.Extension

Parameters

NameTypeMandatoryDescription
modelPowerModelYesPower model to set.

Return value

TypeDescription
booleanReturns true if the operation is successful; returns false otherwise.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

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