• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.wifiManagerExt (WLAN Extension)
2This **wifiext** module provides WLAN extension interfaces for non-universal products.
3
4> **NOTE**
5>
6> - 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.
7> - The APIs described in this document are used only for non-universal products, such as routers.
8
9
10## Modules to Import
11
12```js
13import wifiManagerExt from '@ohos.wifiManagerExt';
14```
15
16## wifiext.enableHotspot<sup>9+</sup>
17
18enableHotspot(): void;
19
20Enables the WLAN hotspot.
21
22**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
23
24**System capability**: SystemCapability.Communication.WiFi.AP.Extension
25
26**Error codes**
27
28For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
29
30| **ID**| **Error Message**|
31  | -------- | -------- |
32| 2701000  | Operation failed.|
33
34## wifiext.disableHotspot<sup>9+</sup>
35
36disableHotspot(): void;
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**Error codes**
45
46For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
47
48| **ID**| **Error Message**|
49  | -------- | -------- |
50| 2701000  | Operation failed.|
51
52## wifiext.getSupportedPowerMode<sup>9+</sup>
53
54getSupportedPowerMode(): Promise&lt;Array&lt;PowerMode&gt;&gt;
55
56Obtains the supported power modes. This API uses a promise to return the result.
57
58**Required permissions**: ohos.permission.GET_WIFI_INFO
59
60**System capability**: SystemCapability.Communication.WiFi.AP.Extension
61
62**Return value**
63
64  | Type| Description|
65  | -------- | -------- |
66  | Promise&lt;Array&lt;[PowerMode](#powermode)&gt;&gt; | Promise used to return the power modes obtained.|
67
68**Error codes**
69
70For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
71
72| **ID**| **Error Message**|
73  | -------- | -------- |
74| 2701000  | Operation failed.|
75
76## PowerMode<sup>9+</sup>
77
78Enumerates the power modes.
79
80**System capability**: SystemCapability.Communication.WiFi.AP.Extension
81
82| Name| Value| Description|
83| -------- | -------- | -------- |
84| SLEEPING | 0 | Sleeping|
85| GENERAL | 1 | General|
86| THROUGH_WALL | 2 | Through_wall|
87
88
89## wifiext.getSupportedPowerMode<sup>9+</sup>
90
91getSupportedPowerMode(callback: AsyncCallback&lt;Array&lt;PowerMode&gt;&gt;): void
92
93Obtains the supported power modes. This API uses an asynchronous callback to return the result.
94
95**Required permissions**: ohos.permission.GET_WIFI_INFO
96
97**System capability**: SystemCapability.Communication.WiFi.AP.Extension
98
99**Parameters**
100
101  | Name| Type| Mandatory| Description|
102  | -------- | -------- | -------- | -------- |
103  | callback | AsyncCallback&lt;Array&lt;[PowerMode](#powermode)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.|
104
105**Error codes**
106
107For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
108
109| **ID**| **Error Message**|
110  | -------- | -------- |
111| 2701000  | Operation failed.|
112
113## wifiext.getPowerMode<sup>9+</sup>
114
115getPowerMode(): Promise&lt;PowerMode&gt;
116
117Obtains the power mode. This API uses a promise to return the result.
118
119**Required permissions**: ohos.permission.GET_WIFI_INFO
120
121**System capability**: SystemCapability.Communication.WiFi.AP.Extension
122
123**Return value**
124
125  | Type| Description|
126  | -------- | -------- |
127  | Promise&lt;[PowerMode](#powermode)&gt; | Promise used to return the power modes obtained.|
128
129**Error codes**
130
131For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
132
133| **ID**| **Error Message**|
134  | -------- | -------- |
135| 2701000  | Operation failed.|
136
137## wifiext.getPowerMode<sup>9+</sup>
138
139getPowerMode(callback: AsyncCallback&lt;PowerMode&gt;): void
140
141Obtains the power mode. This API uses an asynchronous callback to return the result.
142
143**Required permissions**: ohos.permission.GET_WIFI_INFO
144
145**System capability**: SystemCapability.Communication.WiFi.AP.Extension
146
147**Parameters**
148
149  | Name| Type| Mandatory| Description|
150  | -------- | -------- | -------- | -------- |
151  | callback | AsyncCallback&lt;[PowerMode](#powermode)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.|
152
153**Error codes**
154
155For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
156
157| **ID**| **Error Message**|
158  | -------- | -------- |
159| 2701000  | Operation failed.|
160
161## wifiext.setPowerMode<sup>9+</sup>
162
163setPowerMode(mode: PowerMode) : void;
164
165 Sets the power mode.
166
167**Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
168
169**System capability**: SystemCapability.Communication.WiFi.AP.Extension
170
171**Parameters**
172
173  | Name| Type| Mandatory| Description|
174  | -------- | -------- | -------- | -------- |
175  | model | [PowerMode](#powermode) | Yes| Power mode to set.|
176
177**Error codes**
178
179For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md).
180
181| **ID**| **Error Message**|
182  | -------- | -------- |
183| 2701000  | Operation failed.|
184