harmony 鸿蒙@ohos.wifiext (WLAN Extension)
@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.
- The APIs provided by this module are no longer mainained since API version 9. You are advised to use @ohos.wifiManagerExt (WLAN Extension).
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
Type | Description |
---|---|
boolean | Returns 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
Type | Description |
---|---|
boolean | Returns 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
Type | Description |
---|---|
Promise<Array<PowerModel>> | Promise used to return the power models obtained. |
PowerModel
Enumerates the power models.
System capability: SystemCapability.Communication.WiFi.AP.Extension
Name | Value | Description |
---|---|---|
SLEEPING | 0 | Sleeping |
GENERAL | 1 | General |
THROUGH_WALL | 2 | Through_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
Name | Type | Mandatory | Description |
---|---|---|---|
callback | AsyncCallback<Array<PowerModel>> | Yes | Callback used 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
Type | Description |
---|---|
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
Name | Type | Mandatory | Description |
---|---|---|---|
callback | AsyncCallback<PowerModel> | Yes | Callback used to return the result. If the operation is successful, err is 0 and data is the power model obtained. If the operation fails, err is not 0. |
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
Name | Type | Mandatory | Description |
---|---|---|---|
model | PowerModel | Yes | Power model to set. |
Return value
Type | Description |
---|---|
boolean | Returns true if the operation is successful; returns false otherwise. |
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Connectivity Kit (Short-Range Communication Service)
harmony 鸿蒙Bluetooth Error Codes
harmony 鸿蒙SecureElement Error Codes
harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module) (System API)
harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module)
harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module) (System API)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦