js-apis-wifiext.md 4.3 KB
Newer Older
A
annie_wangli 已提交
1
# WLAN
A
Annie_wang 已提交
2
This **wifiext** module provides WLAN extension interfaces for non-universal products.
A
annie_wangli 已提交
3

A
Annie_wang 已提交
4
> **NOTE**<br>
A
annie_wangli 已提交
5
> 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.
A
annie_wangli 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
The APIs described in this document are used only for non-universal products, such as routers.


## Modules to Import

```js
import wifiext from '@ohos.wifiext';
```

## wifiext.enableHotspot

enableHotspot(): boolean;

Enables the WLAN hotspot.

A
Annie_wang 已提交
21
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
22

A
Annie_wang 已提交
23
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
24

A
Annie_wang 已提交
25
**Return value**
A
Annie_wang 已提交
26

A
annie_wangli 已提交
27 28 29 30 31 32 33 34 35 36 37
  | **Type**| **Description**|
  | -------- | -------- |
  | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|


## wifiext.disableHotspot

disableHotspot(): boolean;

Disables the WLAN hotspot.

A
Annie_wang 已提交
38
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
39

A
Annie_wang 已提交
40
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
41

A
Annie_wang 已提交
42
**Return value**
A
Annie_wang 已提交
43

A
annie_wangli 已提交
44 45 46 47 48 49 50 51 52
  | **Type**| **Description**|
  | -------- | -------- |
  | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|


## wifiext.getSupportedPowerModel

getSupportedPowerModel(): Promise&lt;Array&lt;PowerModel&gt;&gt;

A
Annie_wang 已提交
53
Obtains the supported power models. This API uses a promise to return the result.
A
annie_wangli 已提交
54

A
Annie_wang 已提交
55
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
56

A
Annie_wang 已提交
57
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
58

A
Annie_wang 已提交
59
**Return value**
A
Annie_wang 已提交
60

A
annie_wangli 已提交
61 62
  | Type| Description|
  | -------- | -------- |
A
Annie_wang 已提交
63
  | Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.|
A
annie_wangli 已提交
64 65 66 67


## PowerModel

A
Annie_wang 已提交
68
Enumerates the power models.
A
annie_wangli 已提交
69

A
Annie_wang 已提交
70 71
**System capability**: SystemCapability.Communication.WiFi.AP.Extension

A
annie_wangli 已提交
72 73 74 75 76 77 78 79 80 81 82
| Name| Default Value| Description|
| -------- | -------- | -------- |
| SLEEPING | 0 | Sleeping|
| GENERAL | 1 | General|
| THROUGH_WALL | 2 | Through_wall|


## wifiext.getSupportedPowerModel

getSupportedPowerModel(callback: AsyncCallback&lt;Array&lt;PowerModel&gt;&gt;): void

A
Annie_wang 已提交
83
Obtains the supported power models. This API uses an asynchronous callback to return the result.
A
annie_wangli 已提交
84

A
Annie_wang 已提交
85
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
86

A
Annie_wang 已提交
87
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
88

A
Annie_wang 已提交
89
**Parameters**
A
Annie_wang 已提交
90

A
annie_wangli 已提交
91 92
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
93
  | callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback 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.|
A
annie_wangli 已提交
94 95 96 97 98 99


## wifiext.getPowerModel

getPowerModel(): Promise&lt;PowerModel&gt;

A
Annie_wang 已提交
100
Obtains the power model. This API uses a promise to return the result.
A
annie_wangli 已提交
101

A
Annie_wang 已提交
102
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
103

A
Annie_wang 已提交
104
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
105

A
Annie_wang 已提交
106
**Return value**
A
Annie_wang 已提交
107

A
annie_wangli 已提交
108 109
  | Type| Description|
  | -------- | -------- |
A
Annie_wang 已提交
110
  | Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power model obtained.|
A
annie_wangli 已提交
111 112 113 114 115 116


## wifiext.getPowerModel

getPowerModel(callback: AsyncCallback&lt;PowerModel&gt;): void

A
Annie_wang 已提交
117
Obtains the power model. This API uses an asynchronous callback to return the result.
A
annie_wangli 已提交
118

A
Annie_wang 已提交
119
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
120

A
Annie_wang 已提交
121
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
122

A
Annie_wang 已提交
123
**Parameters**
A
Annie_wang 已提交
124

A
annie_wangli 已提交
125 126
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
127
  | callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback 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.|
A
annie_wangli 已提交
128 129 130 131 132 133 134 135


## wifiext.setPowerModel

setPowerModel(model: PowerModel) : boolean;

 Sets the power model.

A
Annie_wang 已提交
136
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
137

A
Annie_wang 已提交
138
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
A
annie_wangli 已提交
139

A
Annie_wang 已提交
140
**Parameters**
A
Annie_wang 已提交
141

A
annie_wangli 已提交
142 143
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
144
  | model | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Power model to set.|
A
annie_wangli 已提交
145

A
Annie_wang 已提交
146
**Return value**
A
Annie_wang 已提交
147

A
annie_wangli 已提交
148 149 150
  | **Type**| **Description**|
  | -------- | -------- |
  | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|