1# Wifi 2 3 4## Overview 5 6Provides APIs for obtaining the Wi-Fi switch state. 7 8**Since**: 13 9 10 11## Summary 12 13 14### Files 15 16| Name| Description| 17| -------- | -------- | 18| [oh_wifi.h](oh__wifi_8h.md) | Defines APIs for obtaining Wi-Fi switch state.<br>**File to include**: \<ConnectivityKit\/wifi\/oh_wifi.h\> | 19 20 21### Types 22 23| Name| Description| 24| -------- | -------- | 25| typedef enum [Wifi_ResultCode](#wifi_resultcode) [Wifi_ResultCode](#wifi_resultcode) | Defines an enum for the error codes returned by Wi-Fi APIs.| 26 27 28### Enums 29 30| Name| Description| 31| -------- | -------- | 32| [Wifi_ResultCode](#wifi_resultcode) {<br>WIFI_SUCCESS = 0,<br>WIFI_PERMISSION_DENIED = 201,<br>WIFI_INVALID_PARAM = 401,<br>WIFI_NOT_SUPPORTED = 801,<br>WIFI_OPERATION_FAILED = 2501000<br>} | Enumerates the error codes returned by Wi-Fi APIs.| 33 34 35### Functions 36 37| Name| Description| 38| -------- | -------- | 39| [Wifi_ResultCode](#wifi_resultcode) [OH_Wifi_IsWifiEnabled](#oh_wifi_iswifienabled) (bool \*enabled) | Checks whether Wi-Fi is enabled.| 40 41 42## Type Description 43 44 45### Wifi_ResultCode 46 47``` 48typedef enum Wifi_ResultCode Wifi_ResultCode 49``` 50 51**Description** 52 53Defines an enum for the error codes returned by Wi-Fi APIs. 54 55**Since**: 13 56 57 58## Enum Description 59 60 61### Wifi_ResultCode 62 63``` 64enum Wifi_ResultCode 65``` 66 67**Description** 68 69Enumerates the error codes returned by Wi-Fi APIs. 70 71**Since**: 13 72 73| Value| Description| 74| -------- | -------- | 75| WIFI_SUCCESS | The operation is successful.| 76| WIFI_PERMISSION_DENIED | Permission verification has failed.| 77| WIFI_INVALID_PARAM | Invalid parameter.<br>Possible causes: 1. The input parameter is a null pointer. 2. The parameter value is out of the value range.| 78| WIFI_NOT_SUPPORTED | The API cannot be called because the device does not have the required capabilities.| 79| WIFI_OPERATION_FAILED | Operation failed.<br>Possible cause: The internal execution of the service fails.| 80 81 82## Function Description 83 84 85### OH_Wifi_IsWifiEnabled() 86 87``` 88Wifi_ResultCode OH_Wifi_IsWifiEnabled (bool * enabled) 89``` 90 91**Description** 92 93Checks whether Wi-Fi is enabled. 94 95**Since**: 13 96 97**Parameters** 98 99| Name| Description| 100| -------- | -------- | 101| enabled | Pointer to the Wi-Fi state obtained.<br>The value **true** means Wi-Fi is enabled; the value **false** means the opposite.<br>A non-null pointer must be passed in. Otherwise, an error is returned.| 102 103**Returns** 104 105Returns the operation result. For details, see [Wifi_ResultCode](#wifi_resultcode). 106 107**WIFI_SUCCESS** indicates that the operation is successful. 108 109**WIFI_INVALID_PARAM** indicates that the input parameter is a null pointer. 110 111**WIFI_OPERATION_FAILED** indicates an internal service error. 112