1# @ohos.wifiext (WLAN Extension)
2
3This **wifiext** module provides WLAN extension interfaces for non-universal products.
4
5> **NOTE**
6>
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.
8- The APIs described in this document are used only for non-universal products, such as routers.
9> - The APIs provided by this module are no longer mainained since API version 9. You are advised to use [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md).
10
11## Modules to Import
12
13```js
14import wifiext from '@ohos.wifiext';
15```
16
17## wifiext.enableHotspot
18
19enableHotspot(): boolean;
20
21Enables the WLAN hotspot.
22
23**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
24
25**System capability**: SystemCapability.Communication.WiFi.AP.Extension
26
27**Return value**
28
29| **Type**| **Description**|
30| -------- | -------- |
31| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
32
33
34## wifiext.disableHotspot
35
36disableHotspot(): boolean;
37
38Disables the WLAN hotspot.
39
40**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
41
42**System capability**: SystemCapability.Communication.WiFi.AP.Extension
43
44**Return value**
45
46| **Type**| **Description**|
47| -------- | -------- |
48| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
49
50
51## wifiext.getSupportedPowerModel
52
53getSupportedPowerModel(): Promise<Array<PowerModel>>
54
55Obtains the supported power models. This API uses a promise to return the result.
56
57**Required permissions**: ohos.permission.GET_WIFI_INFO
58
59**System capability**: SystemCapability.Communication.WiFi.AP.Extension
60
61**Return value**
62
63| Type| Description|
64| -------- | -------- |
65| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
66
67
68## PowerModel
69
70Enumerates the power models.
71
72**System capability**: SystemCapability.Communication.WiFi.AP.Extension
73
74| Name| Value| Description|
75| -------- | -------- | -------- |
76| SLEEPING | 0 | Sleeping|
77| GENERAL | 1 | General|
78| THROUGH_WALL | 2 | Through_wall|
79
80
81## wifiext.getSupportedPowerModel
82
83getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void
84
85Obtains the supported power models. This API uses an asynchronous callback to return the result.
86
87**Required permissions**: ohos.permission.GET_WIFI_INFO
88
89**System capability**: SystemCapability.Communication.WiFi.AP.Extension
90
91**Parameters**
92
93| Name| Type| Mandatory| Description|
94| -------- | -------- | -------- | -------- |
95| callback | AsyncCallback<Array<[PowerModel](#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.|
96
97
98## wifiext.getPowerModel
99
100getPowerModel(): Promise<PowerModel>
101
102Obtains the power model. This API uses a promise to return the result.
103
104**Required permissions**: ohos.permission.GET_WIFI_INFO
105
106**System capability**: SystemCapability.Communication.WiFi.AP.Extension
107
108**Return value**
109
110| Type| Description|
111| -------- | -------- |
112| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
113
114
115## wifiext.getPowerModel
116
117getPowerModel(callback: AsyncCallback<PowerModel>): void
118
119Obtains the power model. This API uses an asynchronous callback to return the result.
120
121**Required permissions**: ohos.permission.GET_WIFI_INFO
122
123**System capability**: SystemCapability.Communication.WiFi.AP.Extension
124
125**Parameters**
126
127| Name| Type| Mandatory| Description|
128| -------- | -------- | -------- | -------- |
129| callback | AsyncCallback<[PowerModel](#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**.|
130
131
132## wifiext.setPowerModel
133
134setPowerModel(model: PowerModel) : boolean;
135
136 Sets the power model.
137
138**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
139
140**System capability**: SystemCapability.Communication.WiFi.AP.Extension
141
142**Parameters**
143
144| Name| Type| Mandatory| Description|
145| -------- | -------- | -------- | -------- |
146| model | [PowerModel](#powermodel) | Yes| Power model to set.|
147
148**Return value**
149
150| **Type**| **Description**|
151| -------- | -------- |
152| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
153