From a129331e426214870e5e777447778c548fd13b72 Mon Sep 17 00:00:00 2001 From: SRGDamia1 Date: Tue, 6 Jun 2017 16:53:13 -0400 Subject: [PATCH] Added getSignalQuality for ESP8266 --- TinyGsmClientESP8266.h | 17 +++++++++++++++++ TinyGsmClientXBee.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/TinyGsmClientESP8266.h b/TinyGsmClientESP8266.h index 0013eea..21885c1 100644 --- a/TinyGsmClientESP8266.h +++ b/TinyGsmClientESP8266.h @@ -203,6 +203,20 @@ public: return autoBaud(); } + /* + * SIM card & Network Operator functions + */ + + int getSignalQuality() { + sendAT(GF("+CWLAP=\""), _ssid, GF("\"")); + String res1 = stream.readStringUntil(':'); + DBG(GSM_NL, res1, ':'); + String res2 = stream.readStringUntil(','); + DBG(res2); + waitResponse(); + return res2.toInt(); + } + bool waitForNetwork(unsigned long timeout = 60000L) { for (unsigned long start = millis(); millis() - start < timeout; ) { sendAT(GF("+CIPSTATUS")); @@ -224,6 +238,8 @@ public: */ bool networkConnect(const char* ssid, const char* pwd) { + _ssid = ssid; + sendAT(GF("+CIPMUX=1")); if (waitResponse() != 1) { return false; @@ -418,6 +434,7 @@ private: private: Stream& stream; GsmClient* sockets[5]; + const char* _ssid; }; typedef TinyGsm::GsmClient TinyGsmClient; diff --git a/TinyGsmClientXBee.h b/TinyGsmClientXBee.h index 72b3c9d..b837cb5 100644 --- a/TinyGsmClientXBee.h +++ b/TinyGsmClientXBee.h @@ -219,7 +219,7 @@ public: } /* - * SIM card & Networ Operator functions + * SIM card & Network Operator functions */ bool simUnlock(const char *pin) { // Not supported