-
Notifications
You must be signed in to change notification settings - Fork 7.2k
/
esp_wifi_default.h
152 lines (135 loc) · 4.8 KB
/
esp_wifi_default.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _ESP_WIFI_DEFAULT_H
#define _ESP_WIFI_DEFAULT_H
#include "esp_netif.h"
#include "esp_wifi_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Attaches wifi station interface to supplied netif
*
* @param esp_netif instance to attach the wifi station to
*
* @return
* - ESP_OK on success
* - ESP_FAIL if attach failed
*/
esp_err_t esp_netif_attach_wifi_station(esp_netif_t *esp_netif);
/**
* @brief Attaches wifi soft AP interface to supplied netif
*
* @param esp_netif instance to attach the wifi AP to
*
* @return
* - ESP_OK on success
* - ESP_FAIL if attach failed
*/
esp_err_t esp_netif_attach_wifi_ap(esp_netif_t *esp_netif);
/**
* @brief Sets default wifi event handlers for STA interface
*
* @return
* - ESP_OK on success, error returned from esp_event_handler_register if failed
*/
esp_err_t esp_wifi_set_default_wifi_sta_handlers(void);
/**
* @brief Sets default wifi event handlers for AP interface
*
* @return
* - ESP_OK on success, error returned from esp_event_handler_register if failed
*/
esp_err_t esp_wifi_set_default_wifi_ap_handlers(void);
/**
* @brief Sets default wifi event handlers for NAN interface
*
* @return
* - ESP_OK on success, error returned from esp_event_handler_register if failed
*/
esp_err_t esp_wifi_set_default_wifi_nan_handlers(void);
/**
* @brief Clears default wifi event handlers for supplied network interface
*
* @param esp_netif instance of corresponding if object
*
* @return
* - ESP_OK on success, error returned from esp_event_handler_register if failed
*/
esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif);
/**
* @brief Creates default WIFI AP. In case of any init error this API aborts.
*
* @note The API creates esp_netif object with default WiFi access point config,
* attaches the netif to wifi and registers wifi handlers to the default event loop.
* This API uses assert() to check for potential errors, so it could abort the program.
* (Note that the default event loop needs to be created prior to calling this API)
*
* @return pointer to esp-netif instance
*/
esp_netif_t* esp_netif_create_default_wifi_ap(void);
/**
* @brief Creates default WIFI STA. In case of any init error this API aborts.
*
* @note The API creates esp_netif object with default WiFi station config,
* attaches the netif to wifi and registers wifi handlers to the default event loop.
* This API uses assert() to check for potential errors, so it could abort the program.
* (Note that the default event loop needs to be created prior to calling this API)
*
* @return pointer to esp-netif instance
*/
esp_netif_t* esp_netif_create_default_wifi_sta(void);
/**
* @brief Creates default WIFI NAN. In case of any init error this API aborts.
*
* @note The API creates esp_netif object with default WiFi station config,
* attaches the netif to wifi and registers wifi handlers to the default event loop.
* (Note that the default event loop needs to be created prior to calling this API)
*
* @return pointer to esp-netif instance
*/
esp_netif_t* esp_netif_create_default_wifi_nan(void);
/**
* @brief Destroys default WIFI netif created with esp_netif_create_default_wifi_...() API.
*
* @param[in] esp_netif object to detach from WiFi and destroy
*
* @note This API unregisters wifi handlers and detaches the created object from the wifi.
* (this function is a no-operation if esp_netif is NULL)
*/
void esp_netif_destroy_default_wifi(void *esp_netif);
/**
* @brief Creates esp_netif WiFi object based on the custom configuration.
*
* @attention This API DOES NOT register default handlers!
*
* @param[in] wifi_if type of wifi interface
* @param[in] esp_netif_config inherent esp-netif configuration pointer
*
* @return pointer to esp-netif instance
*/
esp_netif_t* esp_netif_create_wifi(wifi_interface_t wifi_if, const esp_netif_inherent_config_t *esp_netif_config);
/**
* @brief Creates default STA and AP network interfaces for esp-mesh.
*
* Both netifs are almost identical to the default station and softAP, but with
* DHCP client and server disabled. Please note that the DHCP client is typically
* enabled only if the device is promoted to a root node.
*
* Returns created interfaces which could be ignored setting parameters to NULL
* if an application code does not need to save the interface instances
* for further processing.
*
* @param[out] p_netif_sta pointer where the resultant STA interface is saved (if non NULL)
* @param[out] p_netif_ap pointer where the resultant AP interface is saved (if non NULL)
*
* @return ESP_OK on success
*/
esp_err_t esp_netif_create_default_wifi_mesh_netifs(esp_netif_t **p_netif_sta, esp_netif_t **p_netif_ap);
#ifdef __cplusplus
}
#endif
#endif //_ESP_WIFI_DEFAULT_H