Merge wifi commit '87977b92f3e12cfca74cf2e4dea87dc8d60b26fc' into feature/wifi-stage-two

This commit is contained in:
Angus Gratton
2016-09-05 10:42:17 +10:00
14 changed files with 1202 additions and 2624 deletions
+9 -1
View File
@@ -54,6 +54,7 @@ static esp_err_t system_event_sta_start_handle_default(system_event_t *event);
static esp_err_t system_event_sta_stop_handle_default(system_event_t *event);
static esp_err_t system_event_sta_connected_handle_default(system_event_t *event);
static esp_err_t system_event_sta_disconnected_handle_default(system_event_t *event);
static esp_err_t system_event_sta_gotip_default(system_event_t *event);
static system_event_handle_t g_system_event_handle_table[] = {
{SYSTEM_EVENT_WIFI_READY, NULL},
@@ -63,7 +64,7 @@ static system_event_handle_t g_system_event_handle_table[] = {
{SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default},
{SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default},
{SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL},
{SYSTEM_EVENT_STA_GOTIP, NULL},
{SYSTEM_EVENT_STA_GOTIP, system_event_sta_gotip_default},
{SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default},
{SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default},
{SYSTEM_EVENT_AP_STACONNECTED, NULL},
@@ -72,6 +73,13 @@ static system_event_handle_t g_system_event_handle_table[] = {
{SYSTEM_EVENT_MAX, NULL},
};
static esp_err_t system_event_sta_gotip_default(system_event_t *event)
{
extern esp_err_t esp_wifi_set_sta_ip(void);
WIFI_API_CALL_CHECK("esp_wifi_set_sta_ip", esp_wifi_set_sta_ip(), ESP_OK);
return ESP_OK;
}
esp_err_t system_event_ap_start_handle_default(system_event_t *event)
{
struct ip_info ap_ip;
+1
View File
@@ -48,6 +48,7 @@ typedef struct {
typedef struct {
uint32_t status; /**< status of scanning APs*/
uint8_t number;
uint8_t scan_id;
} system_event_sta_scan_done_t;
typedef struct {
+18 -3
View File
@@ -122,6 +122,10 @@ esp_err_t esp_wifi_connect(void);
esp_err_t esp_wifi_disconnect(void);
esp_err_t esp_wifi_clear_fast_connect(void);
esp_err_t esp_wifi_kick_station(uint16_t aid);
typedef struct {
char *ssid; /**< SSID of AP */
uint8_t *bssid; /**< MAC address of AP */
@@ -129,7 +133,7 @@ typedef struct {
bool show_hidden; /**< enable to scan AP whose SSID is hidden */
} wifi_scan_config_t;
esp_err_t esp_wifi_scan_start(wifi_scan_config_t *conf);
esp_err_t esp_wifi_scan_start(wifi_scan_config_t *conf, bool block);
esp_err_t esp_wifi_scan_stop(void);
@@ -140,7 +144,7 @@ typedef struct {
uint8_t ssid[32]; /**< SSID of AP */
uint8_t primary; /**< channel of AP */
wifi_second_chan_t second; /**< second channel of AP */
char rssi; /**< single strength of AP */
signed char rssi; /**< single strength of AP */
wifi_auth_mode_t authmode; /**< authmode of AP */
}wifi_ap_list_t;
@@ -188,7 +192,7 @@ esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);
typedef void (* wifi_promiscuous_cb_t)(void *buf, uint16_t len);
wifi_promiscuous_cb_t wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
esp_err_t esp_wifi_set_promiscuous(uint8_t enable);
@@ -230,10 +234,21 @@ esp_err_t esp_wifi_get_station_list(struct station_info **station);
esp_err_t esp_wifi_free_station_list(void);
typedef enum {
WIFI_STORAGE_RAM,
WIFI_STORAGE_FLASH,
} wifi_storage_t;
esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
typedef esp_err_t (*wifi_rxcb_t)(void *buffer, uint16_t len, void* eb);
esp_err_t esp_wifi_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn);
esp_err_t esp_wifi_set_auto_connect(bool en);
esp_err_t esp_wifi_get_auto_connect(bool *en);
#ifdef __cplusplus
}
#endif
+3 -1
View File
@@ -69,12 +69,14 @@ static void esp_wifi_task(void *pvParameters)
#if CONFIG_WIFI_AUTO_CONNECT
wifi_mode_t mode;
bool auto_connect;
err = esp_wifi_get_mode(&mode);
if (err != ESP_OK){
WIFI_DEBUG("esp_wifi_get_mode fail, ret=%d\n", err);
}
if (mode == WIFI_MODE_STA || mode == WIFI_MODE_APSTA) {
err = esp_wifi_get_auto_connect(&auto_connect);
if ((mode == WIFI_MODE_STA || mode == WIFI_MODE_APSTA) && auto_connect) {
err = esp_wifi_connect();
if (err != ESP_OK) {
WIFI_DEBUG("esp_wifi_connect fail, ret=%d\n", err);