Check GPRS status on SIM7000

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-04-14 21:38:15 -04:00
parent 590736c973
commit eb9358f440
7 changed files with 18 additions and 20 deletions

View File

@@ -239,7 +239,15 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
*/
public:
RegStatus getRegistrationStatus() {
return (RegStatus)getRegistrationStatusXREG("CEREG");
RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG");
// If we're connected on EPS, great!
if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) {
return epsStatus;
} else {
// Otherwise, check GPRS network status
// We could be using GPRS fall-back or the board could be being moody
return (RegStatus)getRegistrationStatusXREG("CGREG");
}
}
protected: