• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oh_wifi.h
2
3## Overview
4
5Defines APIs for obtaining Wi-Fi switch state.
6
7**File to include**: <ConnectivityKit/wifi/oh_wifi.h>
8
9**Library**: libwifi_ndk.so
10
11**System capability**: SystemCapability.Communication.WiFi.STA
12
13**Since**: 13
14
15**Related module**: [Wifi](capi-wifi.md)
16
17## Summary
18
19### Enums
20
21| Name| typedef Keyword| Description|
22| -- | -- | -- |
23| [Wifi_ResultCode](#wifi_resultcode) | Wifi_ResultCode | Enumerates the error codes returned by Wi-Fi APIs.|
24
25### Functions
26
27| Name| Description|
28| -- | -- |
29| [Wifi_ResultCode OH_Wifi_IsWifiEnabled(bool *enabled)](#oh_wifi_iswifienabled) | Checks whether Wi-Fi is enabled.|
30
31## Enum Description
32
33### Wifi_ResultCode
34
35```
36enum Wifi_ResultCode
37```
38
39**Description**
40
41Enumerates the error codes returned by Wi-Fi APIs.
42
43**Since**: 13
44
45| Enum Item| Description|
46| -- | -- |
47| WIFI_SUCCESS = 0 | Operation success.|
48| WIFI_PERMISSION_DENIED = 201 | Permission verification fails.|
49| WIFI_INVALID_PARAM = 401 | Invalid parameter.<br> Possible causes: 1. The input parameter is a null pointer. 2. The parameter value is out of the value range.|
50| WIFI_NOT_SUPPORTED = 801 | Unsupported function.|
51| WIFI_OPERATION_FAILED = 2501000 | Operation failed.<br> Possible cause: The internal execution of the service fails.|
52
53
54## Function Description
55
56### OH_Wifi_IsWifiEnabled()
57
58```
59Wifi_ResultCode OH_Wifi_IsWifiEnabled(bool *enabled)
60```
61
62**Description**
63
64Checks whether Wi-Fi is enabled.
65
66**Since**: 13
67
68
69**Parameters**
70
71| Name| Description|
72| -- | -- |
73| bool *enabled | Pointer to the boolean value indicating the Wi-Fi state.<br> The value **true** indicates that Wi-Fi is enabled, and the value **false** indicates the opposite.<br> A null pointer is prohibited. If a null pointer is passed in, an error is returned.|
74
75**Returns**
76
77| Type| Description|
78| -- | -- |
79| [Wifi_ResultCode](capi-oh-wifi-h.md#wifi_resultcode) | Operation result, which is specified by [Wifi_ResultCode](capi-oh-wifi-h.md#wifi_resultcode). The value can be:<br>     [WIFI_SUCCESS](capi-oh-wifi-h.md#wifi_resultcode): The Wi-Fi switch status is obtained successfully.<br>     [WIFI_INVALID_PARAM](capi-oh-wifi-h.md#wifi_resultcode): The input parameter is a null pointer.<br>     [WIFI_OPERATION_FAILED](capi-oh-wifi-h.md#wifi_resultcode): An internal error occurs during service execution.|
80