mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
reorder part 3
This commit is contained in:
parent
20de9a5673
commit
d521cea232
@ -106,12 +106,21 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r
|
|||||||
// ---------------------------------------------------- ESP8266WiFiClass -------------------------------------------------
|
// ---------------------------------------------------- ESP8266WiFiClass -------------------------------------------------
|
||||||
// -----------------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ESP8266WiFiClass::ESP8266WiFiClass() :
|
ESP8266WiFiClass::ESP8266WiFiClass() {
|
||||||
_smartConfigStarted(false), _smartConfigDone(false), _useStaticIp(false), _persistent(true) {
|
|
||||||
|
_useStaticIp = false;
|
||||||
|
|
||||||
uint8 m = wifi_get_opmode();
|
uint8 m = wifi_get_opmode();
|
||||||
_useClientMode = (m & WIFI_STA);
|
|
||||||
_useApMode = (m & WIFI_AP);
|
_useApMode = (m & WIFI_AP);
|
||||||
|
_useClientMode = (m & WIFI_STA);
|
||||||
|
|
||||||
|
_persistent = true;
|
||||||
|
|
||||||
|
_smartConfigStarted = false;
|
||||||
|
_smartConfigDone = false;
|
||||||
|
|
||||||
wifi_set_event_handler_cb((wifi_event_handler_cb_t) &ESP8266WiFiClass::_eventCallback);
|
wifi_set_event_handler_cb((wifi_event_handler_cb_t) &ESP8266WiFiClass::_eventCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,12 +52,25 @@ typedef enum {
|
|||||||
} WiFiSleepType_t;
|
} WiFiSleepType_t;
|
||||||
|
|
||||||
class ESP8266WiFiClass {
|
class ESP8266WiFiClass {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
// -------------------------------------- ESP8266WiFiClass --------------------------------------
|
||||||
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ESP8266WiFiClass();
|
ESP8266WiFiClass();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static void _eventCallback(void *event);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ---------------------------------------- STA function ----------------------------------------
|
// ---------------------------------------- STA function ----------------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
int begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
|
int begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
|
||||||
int begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
|
int begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
|
||||||
int begin();
|
int begin();
|
||||||
@ -94,9 +107,16 @@ class ESP8266WiFiClass {
|
|||||||
|
|
||||||
int32_t RSSI();
|
int32_t RSSI();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool _useStaticIp;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ----------------------------------------- AP function ----------------------------------------
|
// ----------------------------------------- AP function ----------------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
void softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0);
|
void softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0);
|
||||||
void softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
void softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
||||||
int softAPdisconnect(bool wifioff = false);
|
int softAPdisconnect(bool wifioff = false);
|
||||||
@ -106,10 +126,14 @@ class ESP8266WiFiClass {
|
|||||||
uint8_t* softAPmacAddress(uint8_t* mac);
|
uint8_t* softAPmacAddress(uint8_t* mac);
|
||||||
String softAPmacAddress(void);
|
String softAPmacAddress(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ----------------------------------------- scan function --------------------------------------
|
// ----------------------------------------- scan function --------------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
int8_t scanNetworks(bool async = false, bool show_hidden = false);
|
int8_t scanNetworks(bool async = false, bool show_hidden = false);
|
||||||
|
|
||||||
int8_t scanComplete();
|
int8_t scanComplete();
|
||||||
@ -126,10 +150,24 @@ class ESP8266WiFiClass {
|
|||||||
int32_t channel(uint8_t networkItem);
|
int32_t channel(uint8_t networkItem);
|
||||||
bool isHidden(uint8_t networkItem);
|
bool isHidden(uint8_t networkItem);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static bool _scanAsync;
|
||||||
|
static bool _scanStarted;
|
||||||
|
static bool _scanComplete;
|
||||||
|
|
||||||
|
static size_t _scanCount;
|
||||||
|
static void* _scanResult;
|
||||||
|
|
||||||
|
static void _scanDone(void* result, int status);
|
||||||
|
void * _getScanInfoByIndex(int i);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// -------------------------------------- Generic WiFi function ---------------------------------
|
// -------------------------------------- Generic WiFi function ---------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
int32_t channel(void);
|
int32_t channel(void);
|
||||||
|
|
||||||
bool setSleepMode(WiFiSleepType_t type);
|
bool setSleepMode(WiFiSleepType_t type);
|
||||||
@ -142,49 +180,51 @@ class ESP8266WiFiClass {
|
|||||||
void mode(WiFiMode);
|
void mode(WiFiMode);
|
||||||
WiFiMode getMode();
|
WiFiMode getMode();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _useApMode;
|
||||||
|
bool _useClientMode;
|
||||||
|
bool _persistent;
|
||||||
|
void _mode(WiFiMode);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ------------------------------------ Generic Network function --------------------------------
|
// ------------------------------------ Generic Network function --------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
int hostByName(const char* aHostname, IPAddress& aResult);
|
int hostByName(const char* aHostname, IPAddress& aResult);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ------------------------------------ STA remote configure -----------------------------------
|
// ------------------------------------ STA remote configure -----------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
bool beginWPSConfig(void);
|
bool beginWPSConfig(void);
|
||||||
|
|
||||||
void beginSmartConfig();
|
void beginSmartConfig();
|
||||||
bool smartConfigDone();
|
bool smartConfigDone();
|
||||||
void stopSmartConfig();
|
void stopSmartConfig();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool _smartConfigStarted;
|
||||||
|
bool _smartConfigDone;
|
||||||
|
static void _smartConfigCallback(uint32_t status, void* result);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
// ------------------------------------------- Debug --------------------------------------------
|
// ------------------------------------------- Debug --------------------------------------------
|
||||||
// ----------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
void printDiag(Print& dest);
|
void printDiag(Print& dest);
|
||||||
|
|
||||||
friend class WiFiClient;
|
friend class WiFiClient;
|
||||||
friend class WiFiServer;
|
friend class WiFiServer;
|
||||||
|
|
||||||
protected:
|
|
||||||
void _mode(WiFiMode);
|
|
||||||
static void _scanDone(void* result, int status);
|
|
||||||
void * _getScanInfoByIndex(int i);
|
|
||||||
static void _smartConfigCallback(uint32_t status, void* result);
|
|
||||||
static void _eventCallback(void *event);bool _smartConfigStarted;bool _smartConfigDone;
|
|
||||||
|
|
||||||
bool _useApMode;bool _useClientMode;bool _useStaticIp;bool _persistent;
|
|
||||||
|
|
||||||
static bool _scanAsync;
|
|
||||||
static bool _scanStarted;
|
|
||||||
static bool _scanComplete;
|
|
||||||
|
|
||||||
static size_t _scanCount;
|
|
||||||
static void* _scanResult;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ESP8266WiFiClass WiFi;
|
extern ESP8266WiFiClass WiFi;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user