]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/T-HEAD_CB2201_CDK/csi/csi_driver/include/drv_wifi_wps.h
Introduce a port for T-HEAD CK802. A simple demo for T-HEAD CB2201 is also included.
[freertos] / FreeRTOS / Demo / T-HEAD_CB2201_CDK / csi / csi_driver / include / drv_wifi_wps.h
1 /**
2  * Copyright (C) 2016 CSI Project. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __CSI_WIFI_WPS_H__
18 #define __CSI_WIFI_WPS_H__
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /** \defgroup WiFi_APIs WiFi Related APIs
25   * @brief WiFi APIs
26   */
27
28 /** @addtogroup WiFi_APIs
29   * @{
30   */
31
32 /** \defgroup WPS_APIs  WPS APIs
33   * @brief WPS APIs
34   *
35   * WPS can only be used when station is enabled.
36   *
37   */
38
39 /** @addtogroup WPS_APIs
40   * @{
41   */
42
43 #define CSI_ERR_WIFI_REGISTRAR   (CSI_DRV_ERRNO_WIFI_BASE + 51)  /*!< WPS registrar is not supported */
44 #define CSI_ERR_WIFI_WPS_TYPE    (CSI_DRV_ERRNO_WIFI_BASE + 52)  /*!< WPS type error */
45 #define CSI_ERR_WIFI_WPS_SM      (CSI_DRV_ERRNO_WIFI_BASE + 53)  /*!< WPS state machine is not initialized */
46
47 typedef enum wps_type {
48     WPS_TYPE_DISABLE = 0,
49     WPS_TYPE_PBC,
50     WPS_TYPE_PIN,
51     WPS_TYPE_MAX,
52 } wps_type_t;
53
54 /**
55   * @brief     Enable Wi-Fi WPS function.
56   *
57   * @attention WPS can only be used when station is enabled.
58   *
59   * @param     wps_type : WPS type, so far only WPS_TYPE_PBC and WPS_TYPE_PIN is supported
60   *
61   * @return    
62   *          - CSI_OK : succeed
63   *          - CSI_ERR_WIFI_WPS_TYPE : wps type is invalid
64   *          - CSI_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
65   *          - CSI_ERR_WIFI_FAIL : wps initialization fails
66   */
67 int32_t csi_wifi_wps_enable(wps_type_t wps_type);
68
69 /**
70   * @brief  Disable Wi-Fi WPS function and release resource it taken.
71   *
72   * @return    
73   *          - CSI_OK : succeed
74   *          - CSI_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
75   */
76 int32_t csi_wifi_wps_disable(void);
77
78 /**
79   * @brief     WPS starts to work.
80   *
81   * @attention WPS can only be used when station is enabled.
82   *
83   * @param     timeout_ms : maximum blocking time before API return.
84   *          - 0 : non-blocking
85   *          - 1~120000 : blocking time
86   *
87   * @return    
88   *          - CSI_OK : succeed
89   *          - CSI_ERR_WIFI_WPS_TYPE : wps type is invalid
90   *          - CSI_ERR_WIFI_WPS_MODE : wifi is not in station mode or sniffer mode is on
91   *          - CSI_ERR_WIFI_WPS_SM : wps state machine is not initialized
92   *          - CSI_ERR_WIFI_FAIL : wps initialization fails
93   */
94 int32_t csi_wifi_wps_start(int timeout_ms);
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif /* __CSI_WIFI_H__ */
101