js-apis-wifiext.md 4.3 KB
Newer Older
A
Annie_wang 已提交
1 2
# @ohos.wifiext

A
Annie_wang 已提交
3
This **wifiext** module provides WLAN extension interfaces for non-universal products.
A
annie_wangli 已提交
4

A
Annie_wang 已提交
5 6
> **NOTE**
>
A
annie_wangli 已提交
7
> 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 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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 已提交
23
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
24

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

A
Annie_wang 已提交
27
**Return value**
A
Annie_wang 已提交
28

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


## wifiext.disableHotspot

disableHotspot(): boolean;

Disables the WLAN hotspot.

A
Annie_wang 已提交
40
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
41

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

A
Annie_wang 已提交
44
**Return value**
A
Annie_wang 已提交
45

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


## wifiext.getSupportedPowerModel

getSupportedPowerModel(): Promise<Array<PowerModel>>

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

A
Annie_wang 已提交
57
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
58

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

A
Annie_wang 已提交
61
**Return value**
A
Annie_wang 已提交
62

A
annie_wangli 已提交
63 64
  | Type| Description|
  | -------- | -------- |
A
Annie_wang 已提交
65
  | Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
A
annie_wangli 已提交
66 67 68 69


## PowerModel

A
Annie_wang 已提交
70
Enumerates the power models.
A
annie_wangli 已提交
71

A
Annie_wang 已提交
72 73
**System capability**: SystemCapability.Communication.WiFi.AP.Extension

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


## wifiext.getSupportedPowerModel

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

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

A
Annie_wang 已提交
87
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
88

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

A
Annie_wang 已提交
91
**Parameters**
A
Annie_wang 已提交
92

A
annie_wangli 已提交
93 94
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
95
  | callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | 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 已提交
96 97 98 99 100 101


## wifiext.getPowerModel

getPowerModel(): Promise<PowerModel>

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

A
Annie_wang 已提交
104
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
105

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

A
Annie_wang 已提交
108
**Return value**
A
Annie_wang 已提交
109

A
annie_wangli 已提交
110 111
  | Type| Description|
  | -------- | -------- |
A
Annie_wang 已提交
112
  | Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
A
annie_wangli 已提交
113 114 115 116 117 118


## wifiext.getPowerModel

getPowerModel(callback: AsyncCallback<PowerModel>): void

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

A
Annie_wang 已提交
121
**Required permissions**: ohos.permission.GET_WIFI_INFO
A
annie_wangli 已提交
122

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

A
Annie_wang 已提交
125
**Parameters**
A
Annie_wang 已提交
126

A
annie_wangli 已提交
127 128
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
129
  | callback | AsyncCallback<[PowerModel](#powermodel)> | 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 已提交
130 131 132 133 134 135 136 137


## wifiext.setPowerModel

setPowerModel(model: PowerModel) : boolean;

 Sets the power model.

A
Annie_wang 已提交
138
**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
A
annie_wangli 已提交
139

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

A
Annie_wang 已提交
142
**Parameters**
A
Annie_wang 已提交
143

A
annie_wangli 已提交
144 145
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
A
Annie_wang 已提交
146
  | model | [PowerModel](#powermodel) | Yes| Power model to set.|
A
annie_wangli 已提交
147

A
Annie_wang 已提交
148
**Return value**
A
Annie_wang 已提交
149

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