From a27d39c7f9b6e2df809573c20cd7312af6a7e821 Mon Sep 17 00:00:00 2001 From: Bernd Giesecke Date: Sat, 23 Nov 2019 12:28:28 +0800 Subject: [PATCH] Fix BG96 bugs - bool isGprsConnected() is now returning correct status - bool modemGetConnected() is now working as expected --- src/TinyGsmClientBG96.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index c9f4510..f21a56b 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -338,7 +338,21 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() return true; } -TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() + // TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() + bool isGprsConnected() + { + sendAT(GF("+CGATT?")); + if (waitResponse(GF(GSM_NL "+CGATT:")) != 1) + { + return false; + } + int res = stream.readStringUntil('\n').toInt(); + waitResponse(); + if (res != 1) + return false; + + return true; + } /* * IP Address functions @@ -587,7 +601,7 @@ protected: sendAT(GF("+QISTATE=1,"), mux); //+QISTATE: 0,"TCP","151.139.237.11",80,5087,4,1,0,0,"uart1" - if (waitResponse(GF("+QISTATE:"))) + if (waitResponse(GF("+QISTATE:")) != 1) return false; streamSkipUntil(','); // Skip mux