Skip to content

Commit d521cea

Browse files
committed
reorder part 3
1 parent 20de9a5 commit d521cea

File tree

2 files changed

+68
-19
lines changed

2 files changed

+68
-19
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFi.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,21 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r
106106
// ---------------------------------------------------- ESP8266WiFiClass -------------------------------------------------
107107
// -----------------------------------------------------------------------------------------------------------------------
108108

109-
ESP8266WiFiClass::ESP8266WiFiClass() :
110-
_smartConfigStarted(false), _smartConfigDone(false), _useStaticIp(false), _persistent(true) {
109+
ESP8266WiFiClass::ESP8266WiFiClass() {
110+
111+
_useStaticIp = false;
112+
111113
uint8 m = wifi_get_opmode();
112-
_useClientMode = (m & WIFI_STA);
113114
_useApMode = (m & WIFI_AP);
115+
_useClientMode = (m & WIFI_STA);
116+
117+
_persistent = true;
118+
119+
_smartConfigStarted = false;
120+
_smartConfigDone = false;
121+
114122
wifi_set_event_handler_cb((wifi_event_handler_cb_t) &ESP8266WiFiClass::_eventCallback);
123+
115124
}
116125

117126
/**

libraries/ESP8266WiFi/src/ESP8266WiFi.h

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,25 @@ typedef enum {
5252
} WiFiSleepType_t;
5353

5454
class ESP8266WiFiClass {
55+
56+
// ----------------------------------------------------------------------------------------------
57+
// -------------------------------------- ESP8266WiFiClass --------------------------------------
58+
// ----------------------------------------------------------------------------------------------
59+
5560
public:
61+
5662
ESP8266WiFiClass();
5763

64+
protected:
65+
66+
static void _eventCallback(void *event);
67+
5868
// ----------------------------------------------------------------------------------------------
5969
// ---------------------------------------- STA function ----------------------------------------
6070
// ----------------------------------------------------------------------------------------------
71+
72+
public:
73+
6174
int begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
6275
int begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL);
6376
int begin();
@@ -94,9 +107,16 @@ class ESP8266WiFiClass {
94107

95108
int32_t RSSI();
96109

110+
protected:
111+
112+
bool _useStaticIp;
113+
97114
// ----------------------------------------------------------------------------------------------
98115
// ----------------------------------------- AP function ----------------------------------------
99116
// ----------------------------------------------------------------------------------------------
117+
118+
public:
119+
100120
void softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0);
101121
void softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
102122
int softAPdisconnect(bool wifioff = false);
@@ -106,10 +126,14 @@ class ESP8266WiFiClass {
106126
uint8_t* softAPmacAddress(uint8_t* mac);
107127
String softAPmacAddress(void);
108128

129+
protected:
130+
109131
// ----------------------------------------------------------------------------------------------
110132
// ----------------------------------------- scan function --------------------------------------
111133
// ----------------------------------------------------------------------------------------------
112134

135+
public:
136+
113137
int8_t scanNetworks(bool async = false, bool show_hidden = false);
114138

115139
int8_t scanComplete();
@@ -126,10 +150,24 @@ class ESP8266WiFiClass {
126150
int32_t channel(uint8_t networkItem);
127151
bool isHidden(uint8_t networkItem);
128152

153+
protected:
154+
155+
static bool _scanAsync;
156+
static bool _scanStarted;
157+
static bool _scanComplete;
158+
159+
static size_t _scanCount;
160+
static void* _scanResult;
161+
162+
static void _scanDone(void* result, int status);
163+
void * _getScanInfoByIndex(int i);
164+
129165
// ----------------------------------------------------------------------------------------------
130166
// -------------------------------------- Generic WiFi function ---------------------------------
131167
// ----------------------------------------------------------------------------------------------
132168

169+
public:
170+
133171
int32_t channel(void);
134172

135173
bool setSleepMode(WiFiSleepType_t type);
@@ -142,49 +180,51 @@ class ESP8266WiFiClass {
142180
void mode(WiFiMode);
143181
WiFiMode getMode();
144182

183+
protected:
184+
bool _useApMode;
185+
bool _useClientMode;
186+
bool _persistent;
187+
void _mode(WiFiMode);
188+
145189
// ----------------------------------------------------------------------------------------------
146190
// ------------------------------------ Generic Network function --------------------------------
147191
// ----------------------------------------------------------------------------------------------
148192

193+
public:
194+
149195
int hostByName(const char* aHostname, IPAddress& aResult);
150196

197+
protected:
151198

152199
// ----------------------------------------------------------------------------------------------
153200
// ------------------------------------ STA remote configure -----------------------------------
154201
// ----------------------------------------------------------------------------------------------
155202

203+
public:
204+
156205
bool beginWPSConfig(void);
157206

158207
void beginSmartConfig();
159208
bool smartConfigDone();
160209
void stopSmartConfig();
161210

211+
protected:
212+
213+
bool _smartConfigStarted;
214+
bool _smartConfigDone;
215+
static void _smartConfigCallback(uint32_t status, void* result);
162216

163217
// ----------------------------------------------------------------------------------------------
164218
// ------------------------------------------- Debug --------------------------------------------
165219
// ----------------------------------------------------------------------------------------------
166220

221+
public:
222+
167223
void printDiag(Print& dest);
168224

169225
friend class WiFiClient;
170226
friend class WiFiServer;
171227

172-
protected:
173-
void _mode(WiFiMode);
174-
static void _scanDone(void* result, int status);
175-
void * _getScanInfoByIndex(int i);
176-
static void _smartConfigCallback(uint32_t status, void* result);
177-
static void _eventCallback(void *event);bool _smartConfigStarted;bool _smartConfigDone;
178-
179-
bool _useApMode;bool _useClientMode;bool _useStaticIp;bool _persistent;
180-
181-
static bool _scanAsync;
182-
static bool _scanStarted;
183-
static bool _scanComplete;
184-
185-
static size_t _scanCount;
186-
static void* _scanResult;
187-
188228
};
189229

190230
extern ESP8266WiFiClass WiFi;

0 commit comments

Comments
 (0)