2015-04-30 04:00:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 -2014 Espressif System
|
|
|
|
*
|
2015-05-30 09:11:04 +00:00
|
|
|
* Adapted from BSD licensed esp_iot_rtos_sdk v0.9.9
|
|
|
|
*
|
|
|
|
* Functions declared in this header are defined in libmain.a
|
2015-04-30 04:00:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ESP_WIFI_H__
|
|
|
|
#define __ESP_WIFI_H__
|
2015-08-13 07:11:07 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include <lwip/ip_addr.h>
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-07-30 17:34:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-30 04:00:03 +00:00
|
|
|
enum {
|
|
|
|
NULL_MODE = 0,
|
|
|
|
STATION_MODE,
|
|
|
|
SOFTAP_MODE,
|
|
|
|
STATIONAP_MODE,
|
|
|
|
MAX_MODE
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum _auth_mode {
|
|
|
|
AUTH_OPEN = 0,
|
|
|
|
AUTH_WEP,
|
|
|
|
AUTH_WPA_PSK,
|
|
|
|
AUTH_WPA2_PSK,
|
|
|
|
AUTH_WPA_WPA2_PSK,
|
|
|
|
AUTH_MAX
|
|
|
|
} AUTH_MODE;
|
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
uint8_t sdk_wifi_get_opmode(void);
|
|
|
|
bool sdk_wifi_set_opmode(uint8_t opmode);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
STATION_IF = 0,
|
|
|
|
SOFTAP_IF,
|
|
|
|
MAX_IF
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ip_info {
|
2017-06-06 02:47:21 +00:00
|
|
|
struct ip4_addr ip;
|
|
|
|
struct ip4_addr netmask;
|
|
|
|
struct ip4_addr gw;
|
2015-04-30 04:00:03 +00:00
|
|
|
};
|
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
bool sdk_wifi_get_ip_info(uint8_t if_index, struct ip_info *info);
|
|
|
|
bool sdk_wifi_set_ip_info(uint8_t if_index, struct ip_info *info);
|
|
|
|
bool sdk_wifi_get_macaddr(uint8_t if_index, uint8_t *macaddr);
|
|
|
|
bool sdk_wifi_set_macaddr(uint8_t if_index, uint8_t *macaddr);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
uint8_t sdk_wifi_get_channel(void);
|
|
|
|
bool sdk_wifi_set_channel(uint8_t channel);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
void sdk_wifi_status_led_install(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
void sdk_wifi_promiscuous_enable(uint8_t promiscuous);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
typedef void (* sdk_wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
void sdk_wifi_set_promiscuous_rx_cb(sdk_wifi_promiscuous_cb_t cb);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-05-30 09:11:04 +00:00
|
|
|
enum sdk_phy_mode {
|
2015-04-30 04:00:03 +00:00
|
|
|
PHY_MODE_11B = 1,
|
|
|
|
PHY_MODE_11G = 2,
|
|
|
|
PHY_MODE_11N = 3
|
|
|
|
};
|
|
|
|
|
2015-07-30 17:34:13 +00:00
|
|
|
enum sdk_phy_mode sdk_wifi_get_phy_mode(void);
|
2015-05-30 09:11:04 +00:00
|
|
|
bool sdk_wifi_set_phy_mode(enum sdk_phy_mode mode);
|
2015-04-30 04:00:03 +00:00
|
|
|
|
2015-07-30 17:34:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-30 04:00:03 +00:00
|
|
|
#endif
|