From 18ae639241894900064213b74853a8778dbb1a25 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 20 Feb 2020 14:05:28 -0500 Subject: [PATCH] Add new functions 19Feb20's XBee firmware Signed-off-by: Sara Damiano --- src/TinyGsmClientSequansMonarch.h | 8 ++------ src/TinyGsmClientXBee.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index c49b5d9..2cde01c 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -238,18 +238,14 @@ class TinyGsmSequansMonarch String getModemNameImpl() { sendAT(GF("+CGMI")); String res1; - if (waitResponse(1000L, res1) != 1) { - return "unknown"; - } + if (waitResponse(1000L, res1) != 1) { return "unknown"; } res1.replace("\r\nOK\r\n", ""); res1.replace("\rOK\r", ""); res1.trim(); sendAT(GF("+CGMM")); String res2; - if (waitResponse(1000L, res2) != 1) { - return "unknown"; - } + if (waitResponse(1000L, res2) != 1) { return "unknown"; } res2.replace("\r\nOK\r\n", ""); res2.replace("\rOK\r", ""); res2.trim(); diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index b08d5c2..50fb394 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -780,15 +780,18 @@ class TinyGsmXBee : public TinyGsmModem, protected: bool gprsConnectImpl(const char* apn, const char* user = NULL, const char* pwd = NULL) { + bool success = true; if (user && strlen(user) > 0) { - DBG("XBee's do not support SIMs that a user name/password!"); + sendAT(GF("CU"), user); // Set the user for the APN + success &= waitResponse() == 1; } if (pwd && strlen(pwd) > 0) { - DBG("XBee's do not support SIMs that a user name/password!"); + sendAT(GF("CW"), pwd); // Set the password for the APN + success &= waitResponse() == 1; } XBEE_COMMAND_START_DECORATOR(5, false) sendAT(GF("AN"), apn); // Set the APN - bool success = waitResponse() == 1; + success &= waitResponse() == 1; sendAT(GF("AM0")); // Airplane mode off waitResponse(5000); writeChanges(); @@ -823,7 +826,8 @@ class TinyGsmXBee : public TinyGsmModem, protected: bool simUnlockImpl(const char* pin) { // Not supported if (pin && strlen(pin) > 0) { - DBG("XBee's do not support SIMs that require an unlock pin!"); + sendAT(GF("PN"), pin); + return waitResponse() == 1; } return false; }