From c83063fa5dba1f5b75dc605c19ca215843d25f35 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 6 Sep 2019 15:09:49 -0400 Subject: [PATCH] Fix QIRDI --- .github/ISSUE_TEMPLATE.md | 2 +- library.json | 2 +- library.properties | 2 +- src/TinyGsmClientM95.h | 13 +++++++------ src/TinyGsmClientMC60.h | 13 +++++++------ src/TinyGsmCommon.h | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5c6066b..729dc17 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -23,7 +23,7 @@ with your board before submitting any issues. Main processor board: Modem: -TinyGSM version: +TinyGSM version: Code: ### Scenario, steps to reproduce diff --git a/library.json b/library.json index fecff3d..c9fcf2a 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TinyGSM", - "version": "0.9.13", + "version": "0.9.14", "description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.", "keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M", "authors": diff --git a/library.properties b/library.properties index 386f113..ed9d8ad 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TinyGSM -version=0.9.13 +version=0.9.14 author=Volodymyr Shymanskyy maintainer=Volodymyr Shymanskyy sentence=A small Arduino library for GPRS modules, that just works. diff --git a/src/TinyGsmClientM95.h b/src/TinyGsmClientM95.h index 8b091fe..8877625 100644 --- a/src/TinyGsmClientM95.h +++ b/src/TinyGsmClientM95.h @@ -340,12 +340,6 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() return false; } - //Start TCPIP Task and Set APN, User Name and Password - sendAT("+QIREGAPP=\"", apn, "\",\"", user, "\",\"", pwd, "\"" ); - if (waitResponse() != 1) { - return false; - } - // Select TCP/IP transfer mode - NOT transparent mode sendAT(GF("+QIMODE=0")); if (waitResponse() != 1) { @@ -358,6 +352,12 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() return false; } + //Start TCPIP Task and Set APN, User Name and Password + sendAT("+QIREGAPP=\"", apn, "\",\"", user, "\",\"", pwd, "\"" ); + if (waitResponse() != 1) { + return false; + } + //Activate GPRS/CSD Context sendAT(GF("+QIACT")); if (waitResponse(60000L) != 1) { @@ -727,6 +727,7 @@ TINY_GSM_MODEM_STREAM_UTILITIES() if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { sockets[mux]->got_data = true; } + data = ""; } else if (data.endsWith(GF("CLOSED" GSM_NL))) { int nl = data.lastIndexOf(GSM_NL, data.length()-8); int coma = data.indexOf(',', nl+2); diff --git a/src/TinyGsmClientMC60.h b/src/TinyGsmClientMC60.h index ae15de1..61d6a2e 100644 --- a/src/TinyGsmClientMC60.h +++ b/src/TinyGsmClientMC60.h @@ -352,12 +352,6 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() sendAT(GF("+CGACT=1,1")); waitResponse(60000L); - //Start TCPIP Task and Set APN, User Name and Password - sendAT("+QIREGAPP=\"", apn, "\",\"", user, "\",\"", pwd, "\"" ); - if (waitResponse() != 1) { - return false; - } - // Select TCP/IP transfer mode - NOT transparent mode sendAT(GF("+QIMODE=0")); if (waitResponse() != 1) { @@ -370,6 +364,12 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK() return false; } + //Start TCPIP Task and Set APN, User Name and Password + sendAT("+QIREGAPP=\"", apn, "\",\"", user, "\",\"", pwd, "\"" ); + if (waitResponse() != 1) { + return false; + } + //Activate GPRS/CSD Context sendAT(GF("+QIACT")); if (waitResponse(60000L) != 1) { @@ -732,6 +732,7 @@ TINY_GSM_MODEM_STREAM_UTILITIES() if (mux >= 0 && mux < TINY_GSM_MUX_COUNT && sockets[mux]) { sockets[mux]->got_data = true; } + data = ""; } else if (data.endsWith(GF("CLOSED" GSM_NL))) { int nl = data.lastIndexOf(GSM_NL, data.length()-8); int coma = data.indexOf(',', nl+2); diff --git a/src/TinyGsmCommon.h b/src/TinyGsmCommon.h index 789eeae..5df479a 100644 --- a/src/TinyGsmCommon.h +++ b/src/TinyGsmCommon.h @@ -10,7 +10,7 @@ #define TinyGsmCommon_h // The current library version number -#define TINYGSM_VERSION "0.9.13" +#define TINYGSM_VERSION "0.9.14" #if defined(SPARK) || defined(PARTICLE) #include "Particle.h"