1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @addtogroup Wifi
18 * @{
19 *
20 * @brief Provide functions for querying the status of wifi switch.
21 * @since 13
22 */
23/**
24 * @file oh_wifi.h
25 * @kit ConnectivityKit
26 * @brief Define interfaces for querying wifi switch status.
27 * @library libwifi.so
28 * @syscap SystemCapability.Communication.WiFi.STA
29 * @since 13
30 */
31
32#ifndef OH_WIFI_H
33#define OH_WIFI_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 * @brief Enumerates the wifi result codes.
41 *
42 * @since 13
43 */
44typedef enum Wifi_ResultCode {
45    /**
46     * @error The operation is successful.
47     */
48    WIFI_SUCCESS = 0,
49    /**
50     * @error Permission verification failed. The application does not have the
51     * permission required to call the API.
52     */
53    WIFI_PERMISSION_DENIED = 201,
54    /**
55     * @error Parameter error. Possible reasons: 1. The input parameter is a null pointer;\n
56     * 2. Parameter values exceed the defined range.\n
57     */
58    WIFI_INVALID_PARAM = 401,
59    /**
60     * @error Capability not supported. Failed to call function due to limited device capabilities.
61     */
62    WIFI_NOT_SUPPORTED = 801,
63    /**
64     * @error Operation failed.
65     * Possible reasons: Internal execution failed.
66     */
67    WIFI_OPERATION_FAILED = 2501000
68} Wifi_ResultCode;
69
70/**
71 * @brief Check whether the wifi switch is enabled.
72 *
73 * @param enabled - It is a boolean pointer used to receive wifi switch status values.\n
74 * Equal to true indicates that the wifi switch is turned on, false indicates that\n
75 * the wifi switch is turned off.\n
76 * The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned.\n
77 * @return wifi functions result code.\n
78 *     For a detailed definition, please refer to {@link Wifi_ResultCode}.\n
79 *     {@link WIFI_SUCCESS} Successfully obtained the wifi switch status.\n
80 *     {@link WIFI_INVALID_PARAM} The input parameter enabled is a null pointer.\n
81 *     {@link WIFI_OPERATION_FAILED} Internal execution failed.\n
82 * @since 13
83 */
84Wifi_ResultCode OH_Wifi_IsWifiEnabled(bool *enabled);
85
86#ifdef __cplusplus
87}
88#endif
89/** @} */
90#endif // OH_WIFI_H