From d3d7cada547695fdec680bc76db8c4f8dbce6c00 Mon Sep 17 00:00:00 2001 From: Rocketct Date: Thu, 11 Jan 2024 12:29:14 +0100 Subject: [PATCH] fix soft ap start error check mbed os doesn't allow to use password with length lower than 8 character or higher then 64, when a password < 8 char is provided it returns an error this error was not managed. with this patch the error is handled and retur imediatly. --- libraries/WiFi/src/WiFi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index 6f017972b..8dbac0d80 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -61,6 +61,10 @@ int arduino::WiFiClass::beginAP(const char* ssid, const char* passphrase, uint8_ //Set ap ssid, password and channel softAPInterface->set_network(_ip, _netmask, _gateway); nsapi_error_t result = softAPInterface->start(ssid, passphrase, NSAPI_SECURITY_WPA2, channel, true /* dhcp server */, NULL, true /* cohexistance */); + if (result != NSAPI_ERROR_OK) { + _currentNetworkStatus = WL_AP_FAILED; + return _currentNetworkStatus; + } nsapi_error_t registrationResult; softAPInterface->unregister_event_handler();