1/*
2 * Copyright (c) 2021 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 WLAN
18 * @{
19 *
20 * @brief Provides cross-OS migration, component adaptation, and modular assembly and compilation.
21 *
22 * Based on the unified APIs provided by the WLAN module, developers of the Hardware Driver Interface
23 * (HDI) are capable of creating, disabling, scanning for, and connecting to WLAN hotspots, managing WLAN chips,
24 * network devices, and power, and applying for, releasing, and moving network data buffers.
25 *
26 * @since 1.0
27 * @version 1.0
28 */
29
30/**
31 * @file wifi_hal_ap_feature.h
32 *
33 * @brief Declares WLAN access point (AP) features.
34 *
35 * @since 1.0
36 * @version 1.0
37 */
38
39#ifndef WIFI_HAL_AP_FEATURE_H
40#define WIFI_HAL_AP_FEATURE_H
41
42#include "wifi_hal_base_feature.h"
43
44#ifdef __cplusplus
45#if __cplusplus
46extern "C" {
47#endif
48#endif
49
50/**
51 * @brief Describes an STA connected to an AP.
52 *
53 * @since 1.0
54 * @version 1.0
55 */
56struct StaInfo {
57    unsigned char mac[WIFI_MAC_ADDR_LENGTH];  /**< MAC address of the STA */
58};
59
60/**
61 * @brief Inherits the basic features of {@link IWiFiBaseFeature} and additionally provides the features of
62 * obtaining information about all the STAs connected to an AP and setting the country/region code.
63 *
64 * @since 1.0
65 * @version 1.0
66 */
67struct IWiFiAp {
68    struct IWiFiBaseFeature baseFeature;  /**< Basic features of {@link IWiFiBaseFeature} */
69
70    /**
71     * @brief Obtains information (MAC addresses only in the current version) about all the connected STAs.
72     *
73     * @param apFeature Indicates the pointer to the AP feature, as described in {@link IWiFiAp}.
74     * @param staInfo Indicates the pointer to the information about the STAs connected to the AP.
75     * @param count Indicates the number of elements in the staInfo structure array.
76     * @param num Indicates the pointer to the number of connected STAs.
77     *
78     * @return Returns <b>0</b> if the information is obtained; returns a negative value otherwise.
79     *
80     * @since 1.0
81     * @version 1.0
82     */
83    int32_t (*getAssociatedStas)(const struct IWiFiAp *apFeature, struct StaInfo *staInfo,
84        uint32_t count, uint32_t *num);
85
86    /**
87     * @brief Sets the country/region code.
88     *
89     * @param apFeature Indicates the pointer to the AP feature, as described in {@link IWiFiAp}.
90     * @param code Indicates the pointer to the country/region code to set.
91     * @param len Indicates the length of the country/region code.
92     *
93     * @return Returns <b>0</b> if the country/region code is set; returns a negative value otherwise.
94     *
95     * @since 1.0
96     * @version 1.0
97     */
98    int32_t (*setCountryCode)(const struct IWiFiAp *apFeature, const char *code, uint32_t len);
99
100    /**
101     * @brief Obtain ap current bandwidth.
102     *
103     * @param ifName Indicates the NIC name.
104     * @param bandwidth ap current bandwidth, 1(20M), 2(40M), 4(80M), 8(160M).
105     *
106     * @return Returns <b>0</b> if the operation is successful.
107     * @return Returns a negative value if the operation fails.
108     *
109     * @since 4.1
110     * @version 1.2
111     */
112    int32_t (*getApBandwidth)(const char *ifName, uint8_t *bandwidth);
113};
114
115/**
116 * @brief Initializes a specified AP feature. This function is called during AP {@link FeatureType} creation.
117 *
118 * @param fe Indicates the double pointer to the AP feature.
119 *
120 * @return Returns <b>0</b> if the operation is successful; returns a negative value representing {@link HDF_STATUS}
121 * if the operation fails.
122 *
123 * @since 1.0
124 * @version 1.0
125 */
126int32_t InitApFeature(struct IWiFiAp **fe);
127
128#ifdef __cplusplus
129#if __cplusplus
130}
131#endif
132#endif
133
134#endif
135/** @} */
136