harmony 鸿蒙Wifi

2025-06-12 浏览 (1)

Wifi

Overview

Provides APIs for obtaining the Wi-Fi switch state.

Since: 13

Summary

Files

NameDescription
oh_wifi.hDefines APIs for obtaining Wi-Fi switch state.
File to include: <ConnectivityKit/wifi/oh_wifi.h>

Types

NameDescription
typedef enum Wifi_ResultCode Wifi_ResultCodeDefines an enum for the error codes returned by Wi-Fi APIs.

Enums

NameDescription
Wifi_ResultCode {
WIFI_SUCCESS = 0,
WIFI_PERMISSION_DENIED = 201,
WIFI_INVALID_PARAM = 401,
WIFI_NOT_SUPPORTED = 801,
WIFI_OPERATION_FAILED = 2501000
}
Enumerates the error codes returned by Wi-Fi APIs.

Functions

NameDescription
Wifi_ResultCode OH_Wifi_IsWifiEnabled (bool *enabled)Checks whether Wi-Fi is enabled.

Type Description

Wifi_ResultCode

typedef enum Wifi_ResultCode Wifi_ResultCode

Description

Defines an enum for the error codes returned by Wi-Fi APIs.

Since: 13

Enum Description

Wifi_ResultCode

enum Wifi_ResultCode

Description

Enumerates the error codes returned by Wi-Fi APIs.

Since: 13

ValueDescription
WIFI_SUCCESSThe operation is successful.
WIFI_PERMISSION_DENIEDPermission verification has failed.
WIFI_INVALID_PARAMInvalid parameter.
Possible causes: 1. The input parameter is a null pointer. 2. The parameter value is out of the value range.
WIFI_NOT_SUPPORTEDThe API cannot be called because the device does not have the required capabilities.
WIFI_OPERATION_FAILEDOperation failed.
Possible cause: The internal execution of the service fails.

Function Description

OH_Wifi_IsWifiEnabled()

Wifi_ResultCode OH_Wifi_IsWifiEnabled (bool * enabled)

Description

Checks whether Wi-Fi is enabled.

Since: 13

Parameters

NameDescription
enabledPointer to the Wi-Fi state obtained.
The value true means Wi-Fi is enabled; the value false means the opposite.
A non-null pointer must be passed in. Otherwise, an error is returned.

Returns

Returns the operation result. For details, see Wifi_ResultCode.

WIFI_SUCCESS indicates that the operation is successful.

WIFI_INVALID_PARAM indicates that the input parameter is a null pointer.

WIFI_OPERATION_FAILED indicates an internal service error.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Connectivity Kit (Short-Range Communication Service)

harmony 鸿蒙Bluetooth

harmony 鸿蒙Bluetooth Error Codes

harmony 鸿蒙NFC Error Codes

harmony 鸿蒙SecureElement Error Codes

harmony 鸿蒙Wi-Fi Error Codes

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module) (System API)

harmony 鸿蒙@ohos.bluetooth.a2dp (Bluetooth A2DP Module)

harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module) (System API)

harmony 鸿蒙@ohos.bluetooth.access (Bluetooth Access Module)

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/l4QZJd