diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index bca20c1..ab37837 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -189,7 +189,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -197,12 +196,11 @@ public: if (waitResponse() != 1) { return false; } - sendAT(GF("+CMEE=0")); + sendAT(GF("+CMEE=0")); // Turn of verbose errors waitResponse(); - - sendAT(GF("+CMER=3,0,0,2")); + sendAT(GF("+CMER=3,0,0,2")); // Set unsolicited result code output destination waitResponse(); - + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } diff --git a/src/TinyGsmClientBG96.h b/src/TinyGsmClientBG96.h index 78ef722..30c17e2 100644 --- a/src/TinyGsmClientBG96.h +++ b/src/TinyGsmClientBG96.h @@ -213,7 +213,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -221,6 +220,7 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 8718aa8..fa75abe 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -206,7 +206,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -222,6 +221,7 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); return true; } diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index c289ad1..b2eb97d 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -186,7 +186,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -198,7 +197,7 @@ public: sendAT(GF("+CMEE=2")); waitResponse(); #endif - + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 325028f..1b9e869 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -213,7 +213,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -225,7 +224,7 @@ public: sendAT(GF("+CMEE=2")); waitResponse(); #endif - + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } @@ -329,6 +328,8 @@ public: return true; } + bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED; + /* * SIM card functions */ @@ -644,14 +645,11 @@ public: protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool ssl = false) { - sendAT(GF("+QIOPEN="), GF("\"TCP"), GF("\",\""), host, GF("\","), port); + sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(75000L, GF("CONNECT OK" GSM_NL), GF("CONNECT FAIL" GSM_NL), GF("ALREADY CONNECT" GSM_NL)); - if ( rsp != 1 ) { - return false; - } return (1 == rsp); } diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index 1b33bcc..265cd4b 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -217,7 +217,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -227,6 +226,7 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } @@ -350,6 +350,8 @@ public: return true; } + bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED; + /* * SIM card functions */ @@ -671,14 +673,11 @@ public: protected: bool modemConnect(const char* host, uint16_t port, uint8_t mux, bool ssl = false) { - sendAT(GF("+QIOPEN="), GF("\"TCP"), GF("\",\""), host, GF("\","), port); + sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port); int rsp = waitResponse(75000L, GF("CONNECT OK" GSM_NL), GF("CONNECT FAIL" GSM_NL), GF("ALREADY CONNECT" GSM_NL)); - if ( rsp != 1 ) { - return false; - } return (1 == rsp); } diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 165b03d..24fcacb 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -227,7 +227,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -237,6 +236,7 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); getSimStatus(); return true; } diff --git a/src/TinyGsmClientUBLOX.h b/src/TinyGsmClientUBLOX.h index cf9a62e..8afb3f3 100644 --- a/src/TinyGsmClientUBLOX.h +++ b/src/TinyGsmClientUBLOX.h @@ -212,7 +212,6 @@ public: */ bool init(const char* pin = NULL) { - DBG(GF("### Modem Defined:"), getModemName()); if (!testAT()) { return false; } @@ -220,6 +219,7 @@ public: if (waitResponse() != 1) { return false; } + DBG(GF("### Modem:"), getModemName()); int ret = getSimStatus(); if (ret != SIM_READY && pin != NULL && strlen(pin) > 0) { simUnlock(pin); @@ -228,7 +228,7 @@ public: } String getModemName() { - sendAT(GF("CGMI")); + sendAT(GF("+CGMI")); String res1; if (waitResponse(1000L, res1) != 1) { return "u-blox Cellular Modem"; @@ -237,7 +237,7 @@ public: res1.replace(GSM_NL, " "); res1.trim(); - sendAT(GF("GMM")); + sendAT(GF("+GMM")); String res2; if (waitResponse(1000L, res1) != 1) { return "u-blox Cellular Modem"; @@ -589,8 +589,8 @@ public: protected: bool modemConnect(const char* host, uint16_t port, uint8_t* mux, bool ssl = false) { - sendAT(GF("+USOCR=6")); - if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) { + sendAT(GF("+USOCR=6")); // create a socket + if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) { // reply is +USOCR: ## of socket created return false; } *mux = stream.readStringUntil('\n').toInt(); @@ -609,7 +609,7 @@ protected: //sendAT(GF("+USOSO="), *mux, GF(",6,2,30000")); //waitResponse(); - sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port); + sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port); // connect on socket int rsp = waitResponse(75000L); return (1 == rsp); }