Reports NSAPI_STATUS_CONNECTING when trying to reconnect

pull/9064/head
Veijo Pesonen 2018-11-22 10:26:46 +02:00 committed by Cruz Monrreal II
parent a10e299bd9
commit 891d756a1a
2 changed files with 9 additions and 1 deletions

View File

@ -45,6 +45,7 @@ ESP8266::ESP8266(PinName tx, PinName rx, bool debug, PinName rts, PinName cts)
_packets_end(&_packets),
_heap_usage(0),
_connect_error(0),
_disconnect(false),
_fail(false),
_sock_already(false),
_closed(false),
@ -306,6 +307,7 @@ nsapi_error_t ESP8266::connect(const char *ap, const char *passPhrase)
bool ESP8266::disconnect(void)
{
_smutex.lock();
_disconnect = true;
bool done = _parser.send("AT+CWQAP") && _parser.recv("OK\n");
_smutex.unlock();
@ -1043,7 +1045,12 @@ void ESP8266::_oob_connection_status()
if (strcmp(status, "GOT IP\n") == 0) {
_conn_status = NSAPI_STATUS_GLOBAL_UP;
} else if (strcmp(status, "DISCONNECT\n") == 0) {
_conn_status = NSAPI_STATUS_DISCONNECTED;
if (_disconnect) {
_conn_status = NSAPI_STATUS_DISCONNECTED;
_disconnect = false;
} else {
_conn_status = NSAPI_STATUS_CONNECTING;
}
} else if (strcmp(status, "CONNECTED\n") == 0) {
_conn_status = NSAPI_STATUS_CONNECTING;
} else {

View File

@ -428,6 +428,7 @@ private:
// OOB state variables
int _connect_error;
bool _disconnect;
bool _fail;
bool _sock_already;
bool _closed;