• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 //
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 #ifndef _ESP_WIFI_DEFAULT_H
16 #define _ESP_WIFI_DEFAULT_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /**
23  * @brief Attaches wifi station interface to supplied netif
24  *
25  * @param esp_netif instance to attach the wifi station to
26  *
27  * @return
28  *  - ESP_OK on success
29  *  - ESP_FAIL if attach failed
30  */
31 esp_err_t esp_netif_attach_wifi_station(esp_netif_t *esp_netif);
32 
33 /**
34  * @brief Attaches wifi soft AP interface to supplied netif
35  *
36  * @param esp_netif instance to attach the wifi AP to
37  *
38  * @return
39  *  - ESP_OK on success
40  *  - ESP_FAIL if attach failed
41  */
42 esp_err_t esp_netif_attach_wifi_ap(esp_netif_t *esp_netif);
43 
44 /**
45  * @brief Sets default wifi event handlers for STA interface
46  *
47  * @return
48  *  - ESP_OK on success, error returned from esp_event_handler_register if failed
49  */
50 esp_err_t esp_wifi_set_default_wifi_sta_handlers(void);
51 
52 /**
53  * @brief Sets default wifi event handlers for STA interface
54  *
55  * @return
56  *  - ESP_OK on success, error returned from esp_event_handler_register if failed
57  */
58 esp_err_t esp_wifi_set_default_wifi_ap_handlers(void);
59 
60 /**
61  * @brief Clears default wifi event handlers for supplied network interface
62  *
63  * @param esp_netif instance of corresponding if object
64  *
65  * @return
66  *  - ESP_OK on success, error returned from esp_event_handler_register if failed
67  */
68 esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif);
69 
70 /**
71  * @brief Creates default WIFI AP. In case of any init error this API aborts.
72  *
73  * @return pointer to esp-netif instance
74  */
75 esp_netif_t* esp_netif_create_default_wifi_ap(void);
76 
77 /**
78  * @brief Creates default WIFI STA. In case of any init error this API aborts.
79  *
80  * @return pointer to esp-netif instance
81  */
82 esp_netif_t* esp_netif_create_default_wifi_sta(void);
83 
84 /**
85  * @brief Creates esp_netif WiFi object based on the custom configuration.
86  *
87  * @attention This API DOES NOT register default handlers!
88  *
89  * @param[in] wifi_if type of wifi interface
90  * @param[in] esp_netif_config inherent esp-netif configuration pointer
91  *
92  * @return pointer to esp-netif instance
93  */
94 esp_netif_t* esp_netif_create_wifi(wifi_interface_t wifi_if, esp_netif_inherent_config_t *esp_netif_config);
95 
96 /**
97  * @brief Creates default STA and AP network interfaces for esp-mesh.
98  *
99  * Both netifs are almost identical to the default station and softAP, but with
100  * DHCP client and server disabled. Please note that the DHCP client is typically
101  * enabled only if the device is promoted to a root node.
102  *
103  * Returns created interfaces which could be ignored setting parameters to NULL
104  * if an application code does not need to save the interface instances
105  * for further processing.
106  *
107  * @param[out] p_netif_sta pointer where the resultant STA interface is saved (if non NULL)
108  * @param[out] p_netif_ap pointer where the resultant AP interface is saved (if non NULL)
109  *
110  * @return ESP_OK on success
111  */
112 esp_err_t esp_netif_create_default_wifi_mesh_netifs(esp_netif_t **p_netif_sta, esp_netif_t **p_netif_ap);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif //_ESP_WIFI_DEFAULT_H
119