• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: service_wifi_api.h 的头文件
15  */
16 
17 #ifndef __SERVICE_WIFI_API_H__
18 #define __SERVICE_WIFI_API_H__
19 
20 #include "wifi_device_config.h"
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27 
28 /**
29 * @ingroup wifi_service_api
30 *
31 * Type of WiFi device. \n
32 * CNcomment:WiFi设备的类型. CNend
33 */
34 typedef enum {
35     WIFI_TYPE_STA,           /**< STAION. CNcomment:STAION.CNend */
36     WIFI_TYPE_HOTSPOT,       /**< HOTSPOT. CNcomment:HOTSPOT.CNend */
37     WIFI_TYPE_P2P,           /**< P2P. CNcomment:P2P.CNend */
38     WIFI_TYPE_BUTT
39 } wifi_device_type_enum;
40 
41 /**
42 * @ingroup wifi_service_api
43 *
44 * Connection mode of WPS. \n
45 * CNcomment:WPS的连接方式.CNend
46 */
47 typedef enum wifi_wps_method {
48     WIFI_WPS_PBC,            /**< Connection mode of WPS PBC. CNcomment:WPS PBC连接方式.CNend */
49     WIFI_WPS_PIN,            /**< Connection mode of WPS PIN. CNcomment:WPS PIN连接方式.CNend */
50     WIFI_WPS_BUTT,
51 } wifi_wps_method;
52 
53 /**
54 * @ingroup wifi_service_api
55 *
56 * Config of wps. \n
57 * CNcomment:wps的配置.CNend
58 */
59 typedef struct wifi_wps_config {
60     wifi_wps_method  wps_method;                   /**< Connection mode of WPS.CNcomment:WPS的连接方式.CNend */
61     unsigned char  bssid[WIFI_MAC_LEN];         /**< Basic service set ID (BSSID).CNcomment:BSSID.CNend */
62     char   wps_pin[WIFI_WPS_PIN_MAX_LEN_NUM];    /**< Pin Code of WPS.CNcomment:WPS的Pin码.CNend */
63 } wifi_wps_config;
64 
65 /**
66 * @ingroup wifi_service_api
67 *
68 * Type of wow pattern. \n
69 * CNcomment:wow pattern类型.CNend
70 */
71 typedef enum {
72     WOW_PATTERN_ADD,    /**< Add Pattern. CNcomment:添加模式.CNend */
73     WOW_PATTERN_DEL,    /**< DEL Pattern. CNcomment:删除模式.CNend */
74     WOW_PATTERN_CLR,    /**< CLR Pattern. CNcomment:清除模式.CNend */
75     WOW_PATTERN_BUTT,
76 } wow_pattern_type;
77 
78 /**
79 * @ingroup wifi_service_api
80 *
81 * Enumeration of return codes.\n
82 * CNcomment:返回码的枚举. CNend
83 */
84 typedef enum {
85     WIFI_SUCCESS = 0, /**< No errors. CNcomment:没有错误.CNend */
86     ERROR_WIFI_INVALID_ARGS = -1, /**< Invalid parameters.CNcomment:无效参数.CNend */
87     ERROR_WIFI_CHIP_INVALID = -2, /**< Invalid chip.CNcomment:无效芯片.CNend */
88     ERROR_WIFI_IFACE_INVALID = -3, /**< Invalid WiFi interface.CNcomment:无效的WiFi接口.CNend */
89     ERROR_WIFI_RTT_CONTROLLER_INVALID = -4, /**< Invalid RTT controller.CNcomment:无效的RTT控制器.CNend */
90     ERROR_WIFI_NOT_SUPPORTED = -5, /**< WiFi not supported by the current version or device.
91                                         CNcomment:当前版本或设备不支持WiFi.CNend */
92     ERROR_WIFI_NOT_AVAILABLE = -6, /**< WiFi unavailable.CNcomment:WiFi不可用.CNend */
93     ERROR_WIFI_NOT_STARTED = -7, /**< Wi-Fi not initialized or starte.CNcomment:WiFi未初始化或者开启.CNend */
94     ERROR_WIFI_BUSY = -8, /**< System busy.CNcomment:系统忙.CNend */
95     ERROR_WIFI_INVALID_PASSWORD = -9, /**< WiFi invalid password.CNcomment:WiFi密码无效.CNend */
96     ERROR_WIFI_UNKNOWN = -128 /**< Unknown error.CNcomment:未知的错误.CNend */
97 } wifi_return_code;
98 
99 /**
100 * @ingroup  soc_wifi_basic
101 * @brief  Set protocol mode of sta.CNcomment:设置station接口的protocol模式.CNend
102 *
103 * @par Description:
104 *           Set protocol mode of sta, set before calling uapi_wifi_sta_start().\n
105 *           CNcomment:配置station接口的protocol模式, 在sta start之前调用.CNend
106 *
107 * @attention  Default mode 802.11BGN CNcomment:默认模式 802.11BGN.CNend
108 * @param  mode            [IN]     Type #protocol_mode_enum, protocol mode.
109 *
110 * @retval #EXT_WIFI_OK        Execute successfully.
111 * @retval #EXT_WIFI_FAIL      Execute failed.
112 * @par Dependency:
113 *            @li soc_wifi_api.h: WiFi API
114 * @see  NULL
115 * @since
116 */
117 int uapi_wifi_sta_set_protocol_mode(protocol_mode_enum mode);
118 
119 /**
120 * @ingroup  soc_wifi_basic
121 * @brief  Get protocol mode of.CNcomment:获取station接口的protocol模式.CNend
122 *
123 * @par Description:
124 *           Get protocol mode of station.CNcomment:获取station接口的protocol模式.CNend
125 *
126 * @attention  NULL
127 * @param      NULL
128 *
129 * @retval #protocol_mode_enum protocol mode.If fail, return EXT_WIFI_PHY_MODE_BUTT.
130 * @par Dependency:
131 *            @li soc_wifi_api.h: WiFi API
132 * @see  NULL
133 * @since
134 */
135 protocol_mode_enum uapi_wifi_sta_get_protocol_mode(void);
136 
137 /**
138 * @ingroup  soc_wifi_basic
139 * @brief  Set protocol mode of softap.CNcomment:设置softap接口的protocol模式.CNend
140 *
141 * @par Description:
142 *           Set protocol mode of softap.CNcomment:设置softap接口的protocol模式.CNend\n
143 *           Initiallize config, set before softap start.CNcomment:初始配置,在softap start之前调用.CNend
144 *
145 * @attention  Default mode(802.11BGN) CNcomment:默认模式(802.11BGN).CNend
146 * @param  mode            [IN]     Type  #protocol_mode_enum protocol mode.
147 *
148 * @retval #EXT_WIFI_OK        Execute successfully.
149 * @retval #EXT_WIFI_FAIL      Execute failed.
150 * @par Dependency:
151 *            @li soc_wifi_api.h: WiFi API
152 * @see  NULL
153 * @since
154 */
155 int uapi_wifi_softap_set_protocol_mode(protocol_mode_enum mode);
156 
157 /**
158 * @ingroup  soc_wifi_basic
159 * @brief  Get protocol mode of softap.CNcomment:获取softap接口的protocol模式.CNend
160 *
161 * @par Description:
162 *           Get protocol mode of softap.CNcomment:获取softap接口的protocol模式.CNend
163 *
164 * @attention  NULL
165 * @param      NULL
166 *
167 * @retval #protocol_mode_enum protocol mode. If fail, return WIFI_MODE_UNDEFINE.
168 * @par Dependency:
169 *            @li soc_wifi_api.h: WiFi API
170 * @see  NULL
171 * @since
172 */
173 protocol_mode_enum uapi_wifi_softap_get_protocol_mode(void);
174 
175 /**
176 * @ingroup  soc_wifi_basic
177 * @brief  Config pmf settings of sta.CNcomment:配置station的pmf.CNend
178 *
179 * @par Description:
180 *           Config pmf settings of sta, set before sta start.CNcomment:配置station的pmf, 在sta start之前调用.CNend
181 *
182 * @attention  Default pmf enum value 1. CNcomment:默认pmf枚举值1.CNend
183 * @param  pmf           [IN]     Type #wifi_pmf_option_enum, pmf enum value.CNcoment:pmf枚举值.CNend
184 *
185 * @retval #EXT_WIFI_OK        Execute successfully.
186 * @retval #EXT_WIFI_FAIL      Execute failed.
187 * @par Dependency:
188 *            @li soc_wifi_api.h: WiFi API
189 * @see  NULL
190 * @since
191 */
192 int uapi_wifi_set_pmf(wifi_pmf_option_enum pmf);
193 
194 wifi_pmf_option_enum uapi_wifi_get_pmf(void);
195 
196 /**
197 * @ingroup  soc_wifi_basic
198 * @brief  Get wifi device config.CNcomment:获取wifi device的配置.CNend
199 *
200 * @par Description:
201 *           Get wifi device config.CNcomment:获取wifi device的配置.CNend
202 *
203 * @attention  NULL
204 * @param  iftype           [IN]     Type #ext_wifi_iftype, iftype enum value.CNcoment:iftype枚举值.CNend
205 *
206 * @retval #struct ext_wifi_dev *     Execute successfully.
207 * @retval #NULL                     Execute failed.
208 * @par Dependency:
209 *            @li soc_wifi_api.h: WiFi API
210 * @see  NULL
211 * @since
212 */
213 struct ext_wifi_dev *wifi_dev_get(ext_wifi_iftype iftype);
214 
215 #ifdef __cplusplus
216 #if __cplusplus
217     }
218 #endif
219 #endif
220 
221 #endif /* end of service_wifi_api.h */
222