From dac86a22cd1b149ab32c2e0f28d39d7bcb1d0336 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 27 Aug 2019 16:39:29 -0400 Subject: [PATCH] Fix all Wextra warnings --- src/TinyGsmClientA6.h | 27 ++++++++-- src/TinyGsmClientBG96.h | 23 +++++++-- src/TinyGsmClientESP8266.h | 17 ++++--- src/TinyGsmClientM590.h | 24 +++++++-- src/TinyGsmClientM95.h | 30 ++++++++--- src/TinyGsmClientMC60.h | 24 +++++++-- src/TinyGsmClientSIM5360.h | 24 +++++++-- src/TinyGsmClientSIM7000.h | 22 ++++++-- src/TinyGsmClientSIM7600.h | 84 +++++++++++++++++-------------- src/TinyGsmClientSIM800.h | 15 +++++- src/TinyGsmClientSaraR4.h | 8 ++- src/TinyGsmClientSequansMonarch.h | 18 ++++++- src/TinyGsmClientUBLOX.h | 4 ++ src/TinyGsmClientXBee.h | 19 ++++++- 14 files changed, 253 insertions(+), 86 deletions(-) diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index e20c973..fa22c5e 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -122,7 +122,7 @@ public: { memset(sockets, 0, sizeof(sockets)); } - + virtual ~TinyGsmA6() {} /* @@ -135,20 +135,38 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("&FZE0")); // Factory + Reset + Echo Off if (waitResponse() != 1) { return false; } - sendAT(GF("+CMEE=0")); // Turn off verbose errors + +#ifdef TINY_GSM_DEBUG + sendAT(GF("+CMEE=2")); // turn on verbose error codes +#else + sendAT(GF("+CMEE=0")); // turn off error codes +#endif waitResponse(); sendAT(GF("+CMER=3,0,0,2")); // Set unsolicited result code output destination waitResponse(); + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -525,6 +543,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() } chargeState = stream.readStringUntil(',').toInt(); percent = stream.readStringUntil('\n').toInt(); + milliVolts = 0; // Wait for final OK waitResponse(); return true; diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index c54ec08..5964e64 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -158,16 +158,29 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("&FZE0")); // Factory + Reset + Echo Off if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -497,10 +510,10 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 20) - { + bool ssl = false, int timeout_s = 20) { + if (ssl) DBG("SSL not yet supported on this module!"); int rsp; - uint32_t timeout_ms = ((uint32_t)timeout_s)*1000; + uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; // (1-16), (0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE", // "/",,,(0-2 0=buffer) diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index c14ec8b..2e567e3 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -31,15 +31,14 @@ static unsigned TINY_GSM_TCP_KEEP_ALIVE = 120; // 4 : the TCP or UDP transmission of ESP8266 station disconnected // 5 : ESP8266 station did NOT connect to an AP enum RegStatus { - REG_OK_IP = 2, - REG_OK_TCP = 3, - REG_UNREGISTERED = 4, - REG_DENIED = 5, - REG_UNKNOWN = 6, + REG_OK_IP = 2, + REG_OK_TCP = 3, + REG_OK_NO_TCP = 4, + REG_DENIED = 5, + REG_UNKNOWN = 6, }; - class TinyGsmESP8266 { @@ -157,6 +156,9 @@ public: if (!testAT()) { return false; } + if (pin != NULL) { + DBG("ESP8266 modules do not use an unlock pin!"); + } sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; @@ -249,7 +251,8 @@ TINY_GSM_MODEM_MAINTAIN_LISTEN() RegStatus getRegistrationStatus() { sendAT(GF("+CIPSTATUS")); if (waitResponse(3000, GF("STATUS:")) != 1) return REG_UNKNOWN; - int status = waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5")); + int status = + waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5")); waitResponse(); // Returns an OK after the status return (RegStatus)status; } diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index 42e6ca0..91d0bde 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -133,20 +133,36 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("&FZE0")); // Factory + Reset + Echo Off if (waitResponse() != 1) { return false; } + #ifdef TINY_GSM_DEBUG - sendAT(GF("+CMEE=2")); - waitResponse(); + sendAT(GF("+CMEE=2")); // turn on verbose error codes +#else + sendAT(GF("+CMEE=0")); // turn off error codes #endif + waitResponse(); + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 2f52589..7e9bf93 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -157,20 +157,36 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("&FZE0")); // Factory + Reset + Echo Off if (waitResponse() != 1) { return false; } + #ifdef TINY_GSM_DEBUG - sendAT(GF("+CMEE=2")); - waitResponse(); + sendAT(GF("+CMEE=2")); // turn on verbose error codes +#else + sendAT(GF("+CMEE=0")); // turn off error codes #endif + waitResponse(); + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -557,9 +573,9 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 75) - { - uint32_t timeout_ms = ((uint32_t)timeout_s)*1000; + bool ssl = false, int timeout_s = 75) { + if (ssl) DBG("SSL not yet supported on this module!"); + uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(timeout_ms, GF("CONNECT OK" GSM_NL), diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index adac7e9..c0c13cf 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -161,18 +161,32 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("&FZ")); // Factory + Reset waitResponse(); + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -563,9 +577,9 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 75) - { - uint32_t timeout_ms = ((uint32_t)timeout_s)*1000; + bool ssl = false, int timeout_s = 75) { + if (ssl) DBG("SSL not yet supported on this module!"); + uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(timeout_ms, GF("CONNECT OK" GSM_NL), diff --git a/src/TinyGsmClientSIM5360.h b/src/TinyGsmClientSIM5360.h index a19b83a..e97df2c 100644 --- a/src/TinyGsmClientSIM5360.h +++ b/src/TinyGsmClientSIM5360.h @@ -142,16 +142,29 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -640,17 +653,20 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 75) { + bool ssl = false, int timeout_s = 15) { // Make sure we'll be getting data manually on this connection sendAT(GF("+CIPRXGET=1")); if (waitResponse() != 1) { return false; } + if (ssl) DBG("SSL not yet supported on this module!"); + // Establish a connection in multi-socket mode + uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; sendAT(GF("+CIPOPEN="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); // The reply is +CIPOPEN: ## of socket created - if (waitResponse(15000L, GF(GSM_NL "+CIPOPEN:")) != 1) { + if (waitResponse(timeout_ms, GF(GSM_NL "+CIPOPEN:")) != 1) { return false; } return true; diff --git a/src/TinyGsmClientSIM7000.h b/src/TinyGsmClientSIM7000.h index d6339af..90602db 100644 --- a/src/TinyGsmClientSIM7000.h +++ b/src/TinyGsmClientSIM7000.h @@ -166,16 +166,29 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -801,8 +814,9 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 75) - { + bool ssl = false, int timeout_s = 75) { + if (ssl) DBG("SSL not yet supported on this module!"); + int rsp; uint32_t timeout_ms = ((uint32_t)timeout_s)*1000; sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); diff --git a/src/TinyGsmClientSIM7600.h b/src/TinyGsmClientSIM7600.h index 94026ee..0a344ed 100644 --- a/src/TinyGsmClientSIM7600.h +++ b/src/TinyGsmClientSIM7600.h @@ -142,16 +142,29 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { @@ -555,7 +568,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() } // get GPS informations - bool getGPS(float *lat, float *lon, float *speed=0, int *alt=0, int *vsat=0, int *usat=0) { + bool getGPS(float *lat, float *lon, float *speed=0, int *alt=0) { //String buffer = ""; bool fix = false; @@ -567,14 +580,14 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() //stream.readStringUntil(','); // mode if ( stream.readStringUntil(',').toInt() == 1 ) fix = true; stream.readStringUntil(','); //gps - stream.readStringUntil(','); // glonass - stream.readStringUntil(','); // beidu + stream.readStringUntil(','); // glonass + stream.readStringUntil(','); // beidu *lat = stream.readStringUntil(',').toFloat(); //lat - stream.readStringUntil(','); // N/S + stream.readStringUntil(','); // N/S *lon = stream.readStringUntil(',').toFloat(); //lon - stream.readStringUntil(','); // E/W - stream.readStringUntil(','); // date - stream.readStringUntil(','); // UTC time + stream.readStringUntil(','); // E/W + stream.readStringUntil(','); // date + stream.readStringUntil(','); // UTC time if (alt != NULL) *alt = stream.readStringUntil(',').toFloat(); //alt if (speed != NULL) *speed = stream.readStringUntil(',').toFloat(); //speed stream.readStringUntil(','); //course @@ -582,8 +595,6 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() stream.readStringUntil(',');//PDOP stream.readStringUntil(',');//HDOP stream.readStringUntil(',');//VDOP - //if (vsat != NULL) *vsat = stream.readStringUntil(',').toInt(); //viewed satelites - //if (usat != NULL) *usat = stream.readStringUntil(',').toInt(); //used satelites stream.readStringUntil('\n'); waitResponse(); @@ -610,7 +621,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() // Wait for final OK waitResponse(); // Return millivolts - uint16_t res = voltage*1000; + uint16_t res = voltage*1000; return res; } @@ -618,16 +629,11 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() uint8_t getBattChargeState() TINY_GSM_ATTR_NOT_AVAILABLE; - bool getBattStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) { - sendAT(GF("+CBC?")); - if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { - return false; - } - // get voltage in VOLTS - float voltage = stream.readStringUntil('\n').toFloat(); - milliVolts = voltage*1000; - // Wait for final OK - waitResponse(); + bool getBattStats(uint8_t& chargeState, int8_t& percent, + uint16_t& milliVolts) { + chargeState = 0; + percent = 0; + milliVolts = getBattVoltage(); return true; } @@ -649,22 +655,24 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() */ protected: - - bool modemConnect(const char* host, uint16_t port, uint8_t mux, - bool ssl = false, int timeout_s = 75) { - // Make sure we'll be getting data manually on this connection - sendAT(GF("+CIPRXGET=1")); - if (waitResponse() != 1) { - return false; - } - - // Establish a connection in multi-socket mode - sendAT(GF("+CIPOPEN="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port); - // The reply is +CIPOPEN: ## of socket created - if (waitResponse(15000L, GF(GSM_NL "+CIPOPEN:")) != 1) { - return false; - } - return true; + bool modemConnect(const char* host, uint16_t port, uint8_t mux, + bool ssl = false, int timeout_s = 15) { + if (ssl) DBG("SSL not yet supported on this module!"); + // Make sure we'll be getting data manually on this connection + sendAT(GF("+CIPRXGET=1")); + if (waitResponse() != 1) { + return false; + } + + // Establish a connection in multi-socket mode + uint32_t timeout_ms = ((uint32_t)timeout_s) * 1000; + sendAT(GF("+CIPOPEN="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), + port); + // The reply is +CIPOPEN: ## of socket created + if (waitResponse(timeout_ms, GF(GSM_NL "+CIPOPEN:")) != 1) { + return false; + } + return true; } int16_t modemSend(const void* buff, size_t len, uint8_t mux) { diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index b5f2b6f..5bef12e 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -165,6 +165,7 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } @@ -174,9 +175,19 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); - getSimStatus(); - return true; + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { diff --git a/src/TinyGsmClientSaraR4.h b/src/TinyGsmClientSaraR4.h index dec40b1..84b00a9 100644 --- a/src/TinyGsmClientSaraR4.h +++ b/src/TinyGsmClientSaraR4.h @@ -176,9 +176,11 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; @@ -191,7 +193,7 @@ public: #endif waitResponse(); - getModemName(); + DBG(GF("### Modem:"), getModemName()); int ret = getSimStatus(); // if the sim isn't ready and a pin has been provided, try to unlock the sim @@ -509,6 +511,8 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() bool getBattStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) { percent = getBattPercent(); + chargeState = 0; + milliVolts = 0; return true; } @@ -525,7 +529,7 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() streamSkipUntil(','); // Skip units (C/F) int16_t res = stream.readStringUntil('\n').toInt(); float temp = -9999; - if (res != 65535) { + if (res != -1) { temp = ((float)res)/10; } return temp; diff --git a/src/TinyGsmClientSequansMonarch.h b/src/TinyGsmClientSequansMonarch.h index 7810193..efc6c27 100644 --- a/src/TinyGsmClientSequansMonarch.h +++ b/src/TinyGsmClientSequansMonarch.h @@ -195,15 +195,29 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; } - getSimStatus(); - return true; + + DBG(GF("### Modem:"), getModemName()); + + int ret = getSimStatus(); + // if the sim isn't ready and a pin has been provided, try to unlock the sim + if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { + simUnlock(pin); + return (getSimStatus() == SIM_READY); + } + // if the sim is ready, or it's locked but no pin has been provided, return + // true + else { + return (ret == SIM_READY || ret == SIM_LOCKED); + } } String getModemName() { diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index 3fa2f25..df49ffe 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -176,9 +176,11 @@ public: bool init(const char* pin = NULL) { DBG(GF("### TinyGSM Version:"), TINYGSM_VERSION); + if (!testAT()) { return false; } + sendAT(GF("E0")); // Echo Off if (waitResponse() != 1) { return false; @@ -535,7 +537,9 @@ TINY_GSM_MODEM_GET_GPRS_IP_CONNECTED() uint8_t getBattChargeState() TINY_GSM_ATTR_NOT_AVAILABLE; bool getBattStats(uint8_t &chargeState, int8_t &percent, uint16_t &milliVolts) { + chargeState = 0; percent = getBattPercent(); + milliVolts = 0; return true; } diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 02d723f..519c04f 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -305,6 +305,10 @@ public: digitalWrite(resetPin, HIGH); } + if (pin != NULL) { + DBG("XBee's do not support SIMs that require an unlock pin!"); + } + XBEE_COMMAND_START_DECORATOR(10, false) sendAT(GF("AP0")); // Put in transparent mode @@ -524,6 +528,9 @@ public: */ bool simUnlock(const char *pin) { // Not supported + if (pin != NULL) { + DBG("XBee's do not support SIMs that require an unlock pin!"); + } return false; } @@ -535,7 +542,7 @@ public: return sendATGetString(GF("IM")); } - SimStatus getSimStatus(unsigned long timeout_ms = 10000L) { + SimStatus getSimStatus() { return SIM_READY; // unsupported } @@ -734,7 +741,14 @@ public: * GPRS functions */ - bool gprsConnect(const char* apn, const char* user = NULL, const char* pwd = NULL) { + bool gprsConnect(const char* apn, const char* user = NULL, + const char* pwd = NULL) { + if (user != NULL) { + DBG("XBee's do not support SIMs that a user name/password!"); + } + if (pwd != NULL) { + DBG("XBee's do not support SIMs that a user name/password!"); + } XBEE_COMMAND_START_DECORATOR(5, false) sendAT(GF("AN"), apn); // Set the APN bool success = waitResponse() == 1; @@ -922,6 +936,7 @@ protected: } int16_t modemSend(const void* buff, size_t len, uint8_t mux = 0) { + if (mux != 0) DBG("XBee only supports 1 IP channel in transparent mode!"); stream.write((uint8_t*)buff, len); stream.flush(); return len;