From 1c3fe4e068360c29ef6ca8666815f8bfdf8738ec Mon Sep 17 00:00:00 2001 From: Veijo Pesonen Date: Wed, 17 Oct 2018 11:43:53 +0300 Subject: [PATCH] Refreshes connection state when retrieving connection status Requires C++11 --- ESP8266Interface.cpp | 3 +++ ESP8266Interface.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ESP8266Interface.cpp b/ESP8266Interface.cpp index 1abd966..7c23ec1 100644 --- a/ESP8266Interface.cpp +++ b/ESP8266Interface.cpp @@ -640,6 +640,9 @@ void ESP8266Interface::attach(mbed::Callback stat nsapi_connection_status_t ESP8266Interface::get_connection_status() const { + if (_initialized) { + _esp.bg_process_oob(ESP8266_RECV_TIMEOUT, true); + } return _conn_stat; } diff --git a/ESP8266Interface.h b/ESP8266Interface.h index ebd6411..643480a 100644 --- a/ESP8266Interface.h +++ b/ESP8266Interface.h @@ -332,7 +332,7 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface private: // AT layer - ESP8266 _esp; + mutable ESP8266 _esp; void update_conn_state_cb(); // Credentials