From 48ae1327a4fc10438b3896cca15cdd821d7d8d06 Mon Sep 17 00:00:00 2001 From: Stefano-Orsolini Date: Mon, 25 Jul 2016 10:31:40 +0200 Subject: [PATCH 1/4] Update ESP8266WiFiAP.cpp It is not very common but some might require to set the maximum number of clients, from code, to smaller than 4. in my case i must allow only one client at a time (TESTED WORKING) --- libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp index 81f3c3a703..e252c24f9f 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp @@ -66,6 +66,9 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r if(lhs.ssid_hidden != rhs.ssid_hidden) { return false; } + if(lhs.max_connection != rhs.max_connection) { + return false; + } return true; } @@ -81,7 +84,7 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r * @param channel WiFi channel number, 1 - 13. * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) */ -bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden) { +bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden, int max_connection) { if(!WiFi.enableAP(true)) { // enable AP failed @@ -108,7 +111,7 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int ch conf.channel = channel; conf.ssid_len = strlen(ssid); conf.ssid_hidden = ssid_hidden; - conf.max_connection = 4; + conf.max_connection = max_connection; conf.beacon_interval = 100; if(!passphrase || strlen(passphrase) == 0) { From 2077808fa0b79b6aeeeb664bab876dd33cb2bf19 Mon Sep 17 00:00:00 2001 From: Stefano-Orsolini Date: Mon, 25 Jul 2016 10:48:44 +0200 Subject: [PATCH 2/4] Update ESP8266WiFiAP.h as discussed in the .cpp (set max connections) --- libraries/ESP8266WiFi/src/ESP8266WiFiAP.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.h b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.h index c9eff914ae..fae8efd567 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.h +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.h @@ -36,7 +36,7 @@ class ESP8266WiFiAPClass { public: - bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0); + bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4); bool softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet); bool softAPdisconnect(bool wifioff = false); From 49c06d7b0395610715f9874d07ccae4009e49e4e Mon Sep 17 00:00:00 2001 From: Stefano-Orsolini Date: Wed, 27 Jul 2016 10:20:34 +0200 Subject: [PATCH 3/4] Update ESP8266WiFiAP.cpp corrected indentation @70 add param comment @86 --- libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp index e252c24f9f..38d338a539 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp @@ -67,7 +67,7 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r return false; } if(lhs.max_connection != rhs.max_connection) { - return false; + return false; } return true; } @@ -79,10 +79,11 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r /** * Set up an access point - * @param ssid Pointer to the SSID (max 63 char). - * @param passphrase (for WPA2 min 8 char, for open use NULL) - * @param channel WiFi channel number, 1 - 13. - * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) + * @param ssid Pointer to the SSID (max 63 char). + * @param passphrase (for WPA2 min 8 char, for open use NULL) + * @param channel WiFi channel number, 1 - 13. + * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) + * @param max_connection Max simultaneous connected clients, 1 - 4. */ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden, int max_connection) { From 70b7197ad047070a6788dedb17fd097e5c89b5ec Mon Sep 17 00:00:00 2001 From: Stefano-Orsolini Date: Wed, 27 Jul 2016 10:22:10 +0200 Subject: [PATCH 4/4] Update ESP8266WiFiAP.cpp --- libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp index 38d338a539..a424eece10 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp @@ -79,11 +79,11 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r /** * Set up an access point - * @param ssid Pointer to the SSID (max 63 char). - * @param passphrase (for WPA2 min 8 char, for open use NULL) - * @param channel WiFi channel number, 1 - 13. - * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) - * @param max_connection Max simultaneous connected clients, 1 - 4. + * @param ssid Pointer to the SSID (max 63 char). + * @param passphrase (for WPA2 min 8 char, for open use NULL) + * @param channel WiFi channel number, 1 - 13. + * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) + * @param max_connection Max simultaneous connected clients, 1 - 4. */ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel, int ssid_hidden, int max_connection) {