Check for non-empty pin

This commit is contained in:
Sara Damiano
2019-08-28 13:04:44 -04:00
parent 958c303840
commit 2092163a36
4 changed files with 14 additions and 11 deletions

View File

@@ -73,8 +73,8 @@
//#define TINY_GSM_YIELD() { delay(2); }
// Define how you're planning to connect to the internet
#define TINY_GSM_USE_GPRS false
#define TINY_GSM_USE_WIFI true
#define TINY_GSM_USE_GPRS true
#define TINY_GSM_USE_WIFI false
// set GSM PIN, if any
#define GSM_PIN ""

View File

@@ -156,7 +156,7 @@ public:
if (!testAT()) {
return false;
}
if (pin != NULL) {
if (pin && strlen(pin) > 0) {
DBG("ESP8266 modules do not use an unlock pin!");
}
sendAT(GF("E0")); // Echo Off

View File

@@ -305,7 +305,7 @@ public:
digitalWrite(resetPin, HIGH);
}
if (pin != NULL) {
if (pin && strlen(pin) > 0) {
DBG("XBee's do not support SIMs that require an unlock pin!");
}
@@ -528,7 +528,7 @@ public:
*/
bool simUnlock(const char *pin) { // Not supported
if (pin != NULL) {
if (pin && strlen(pin) > 0) {
DBG("XBee's do not support SIMs that require an unlock pin!");
}
return false;
@@ -687,7 +687,7 @@ public:
//nh For no pwd don't set setscurity or pwd
if (ssid == NULL) retVal = false;;
if (pwd != NULL)
if (pwd && strlen(pwd) > 0)
{
sendAT(GF("EE"), 2); // Set security to WPA2
if (waitResponse() != 1) retVal = false;
@@ -743,10 +743,10 @@ public:
bool gprsConnect(const char* apn, const char* user = NULL,
const char* pwd = NULL) {
if (user != NULL) {
if (user && strlen(user) > 0) {
DBG("XBee's do not support SIMs that a user name/password!");
}
if (pwd != NULL) {
if (pwd && strlen(pwd) > 0) {
DBG("XBee's do not support SIMs that a user name/password!");
}
XBEE_COMMAND_START_DECORATOR(5, false)

View File

@@ -491,8 +491,11 @@ String TinyGsmDecodeHex16bit(String &instr) {
// Unlocks a sim via the 3GPP TS command AT+CPIN
#define TINY_GSM_MODEM_SIM_UNLOCK_CPIN() \
bool simUnlock(const char *pin) { \
if (pin && strlen(pin) > 0) { \
sendAT(GF("+CPIN=\""), pin, GF("\"")); \
return waitResponse() == 1; \
} \
return true; \
}