Browse Source

Merge branch 'master' into v_master

v_master
Sara Damiano 4 years ago
parent
commit
16d33c7f18
20 changed files with 97 additions and 57 deletions
  1. +1
    -1
      .github/ISSUE_TEMPLATE.md
  2. +1
    -1
      README.md
  3. +1
    -1
      library.json
  4. +1
    -1
      library.properties
  5. +1
    -1
      src/TinyGsmBattery.tpp
  6. +2
    -1
      src/TinyGsmClientA6.h
  7. +2
    -1
      src/TinyGsmClientBG96.h
  8. +10
    -3
      src/TinyGsmClientESP8266.h
  9. +2
    -1
      src/TinyGsmClientM590.h
  10. +3
    -2
      src/TinyGsmClientM95.h
  11. +2
    -1
      src/TinyGsmClientMC60.h
  12. +15
    -3
      src/TinyGsmClientSIM5360.h
  13. +11
    -2
      src/TinyGsmClientSIM7000.h
  14. +9
    -2
      src/TinyGsmClientSIM7600.h
  15. +2
    -1
      src/TinyGsmClientSIM800.h
  16. +6
    -15
      src/TinyGsmClientSaraR4.h
  17. +23
    -17
      src/TinyGsmClientSequansMonarch.h
  18. +2
    -1
      src/TinyGsmClientUBLOX.h
  19. +2
    -1
      src/TinyGsmClientXBee.h
  20. +1
    -1
      src/TinyGsmCommon.h

+ 1
- 1
.github/ISSUE_TEMPLATE.md View File

@ -22,7 +22,7 @@ with your board before submitting any issues.
Main processor board: <!-- Uno, Zero, ESP32, Particle, etc --> Main processor board: <!-- Uno, Zero, ESP32, Particle, etc -->
Modem: <!-- Brand, model, variant, firmware version --> Modem: <!-- Brand, model, variant, firmware version -->
TinyGSM version: <!-- always try to use the latest (0.10.1) -->
TinyGSM version: <!-- always try to use the latest (0.10.2) -->
Code: <!-- Example name or paste in your code --> Code: <!-- Example name or paste in your code -->
### Scenario, steps to reproduce ### Scenario, steps to reproduce


+ 1
- 1
README.md View File

@ -115,7 +115,7 @@ Watch this repo for new updates! And of course, contributions are welcome ;)
**Location** **Location**
- GPS/GNSS - GPS/GNSS
- SIM808, SIM7000, SIM7500/7600/7800, BG96, u-blox - SIM808, SIM7000, SIM7500/7600/7800, BG96, u-blox
- NOTE: u-blox chips do NOT have embedded GPS - this function only works if a secondary GPS is connected to primary cellular chip over I2C
- NOTE: u-blox chips do _NOT_ have embedded GPS - this function only works if a secondary GPS is connected to primary cellular chip over I2C
- GSM location service - GSM location service
- SIM800, SIM7000, Quectel, u-blox - SIM800, SIM7000, Quectel, u-blox


+ 1
- 1
library.json View File

@ -1,6 +1,6 @@
{ {
"name": "TinyGSM", "name": "TinyGSM",
"version": "0.10.1",
"version": "0.10.2",
"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.", "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", "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": "authors":


+ 1
- 1
library.properties View File

@ -1,5 +1,5 @@
name=TinyGSM name=TinyGSM
version=0.10.1
version=0.10.2
author=Volodymyr Shymanskyy author=Volodymyr Shymanskyy
maintainer=Volodymyr Shymanskyy maintainer=Volodymyr Shymanskyy
sentence=A small Arduino library for GPRS modules, that just works. sentence=A small Arduino library for GPRS modules, that just works.


+ 1
- 1
src/TinyGsmBattery.tpp View File

@ -55,7 +55,7 @@ class TinyGsmBattery {
thisModem().streamSkipUntil(','); // Skip battery charge status thisModem().streamSkipUntil(','); // Skip battery charge status
thisModem().streamSkipUntil(','); // Skip battery charge level thisModem().streamSkipUntil(','); // Skip battery charge level
// return voltage in mV // return voltage in mV
uint16_t res = thisModem().streamGetIntBefore(',');
uint16_t res = thisModem().streamGetIntBefore('\n');
// Wait for final OK // Wait for final OK
thisModem().waitResponse(); thisModem().waitResponse();
return res; return res;


+ 2
- 1
src/TinyGsmClientA6.h View File

@ -560,8 +560,9 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientA6* sockets[TINY_GSM_MUX_COUNT]; GsmClientA6* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 2
- 1
src/TinyGsmClientBG96.h View File

@ -673,8 +673,9 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientBG96* sockets[TINY_GSM_MUX_COUNT]; GsmClientBG96* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 10
- 3
src/TinyGsmClientESP8266.h View File

@ -315,7 +315,10 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
// if the status is anything but 3, there are no connections open // if the status is anything but 3, there are no connections open
waitResponse(); // Returns an OK after the status waitResponse(); // Returns an OK after the status
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) { for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
sockets[muxNo]->sock_connected = false;
GsmClientESP8266* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = false;
}
} }
return false; return false;
} }
@ -336,7 +339,10 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
if (has_status == 2) break; // once we get to the ok, stop if (has_status == 2) break; // once we get to the ok, stop
} }
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) { for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
sockets[muxNo]->sock_connected = verified_connections[muxNo];
GsmClientESP8266* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = verified_connections[muxNo];
}
} }
return verified_connections[mux]; return verified_connections[mux];
} }
@ -435,8 +441,9 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientESP8266* sockets[TINY_GSM_MUX_COUNT]; GsmClientESP8266* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 2
- 1
src/TinyGsmClientM590.h View File

@ -452,8 +452,9 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientM590* sockets[TINY_GSM_MUX_COUNT]; GsmClientM590* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 3
- 2
src/TinyGsmClientM95.h View File

@ -387,7 +387,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
*/ */
protected: protected:
float getTemperatureImpl() { float getTemperatureImpl() {
sendAT(GF("+QTEMP"));
sendAT(GF("+QTEMP?"));
if (waitResponse(GF(GSM_NL "+QTEMP:")) != 1) { if (waitResponse(GF(GSM_NL "+QTEMP:")) != 1) {
return static_cast<float>(-9999); return static_cast<float>(-9999);
} }
@ -616,8 +616,9 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientM95* sockets[TINY_GSM_MUX_COUNT]; GsmClientM95* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 2
- 1
src/TinyGsmClientMC60.h View File

@ -588,8 +588,9 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
return waitResponse(1000, r1, r2, r3, r4, r5, r6); return waitResponse(1000, r1, r2, r3, r4, r5, r6);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientMC60* sockets[TINY_GSM_MUX_COUNT]; GsmClientMC60* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 15
- 3
src/TinyGsmClientSIM5360.h View File

@ -217,8 +217,13 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
bool restartImpl() { bool restartImpl() {
if (!testAT()) { return false; } if (!testAT()) { return false; }
sendAT(GF("+REBOOT")); sendAT(GF("+REBOOT"));
// Should return an 'OK' after reboot command is sent
if (waitResponse(10000L) != 1) { return false; } if (waitResponse(10000L) != 1) { return false; }
delay(3000L); // TODO(?): Test this delay!
// After booting, modem sends out messages as each of its
// internal modules loads. The final message is "PB DONE".
if (waitResponse(40000L, GF(GSM_NL "PB DONE")) != 1) {
return false;
}
return init(); return init();
} }
@ -574,7 +579,13 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
if (waitResponse(GF("+CIPCLOSE:")) != 1) { return false; } if (waitResponse(GF("+CIPCLOSE:")) != 1) { return false; }
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) { for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
// +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state> // +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state>
sockets[muxNo]->sock_connected = stream.parseInt();
bool thisMuxState = stream.parseInt();
// Need to make sure a socket instace for the socket number exists
// before setting its state
GsmClientSim5360* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = thisMuxState;
}
} }
waitResponse(); // Should be an OK at the end waitResponse(); // Should be an OK at the end
return sockets[mux]->sock_connected; return sockets[mux]->sock_connected;
@ -702,8 +713,9 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSim5360* sockets[TINY_GSM_MUX_COUNT]; GsmClientSim5360* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 11
- 2
src/TinyGsmClientSIM7000.h View File

@ -239,7 +239,15 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
*/ */
public: public:
RegStatus getRegistrationStatus() { RegStatus getRegistrationStatus() {
return (RegStatus)getRegistrationStatusXREG("CEREG");
RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG");
// If we're connected on EPS, great!
if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) {
return epsStatus;
} else {
// Otherwise, check GPRS network status
// We could be using GPRS fall-back or the board could be being moody
return (RegStatus)getRegistrationStatusXREG("CGREG");
}
} }
protected: protected:
@ -746,8 +754,9 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSim7000* sockets[TINY_GSM_MUX_COUNT]; GsmClientSim7000* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 9
- 2
src/TinyGsmClientSIM7600.h View File

@ -672,7 +672,13 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
} }
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) { for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
// +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state> // +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state>
sockets[muxNo]->sock_connected = stream.parseInt();
bool thisMuxState = stream.parseInt();
// Need to make sure a socket instace for the socket number exists
// before setting its state
GsmClientSim7600* sock = sockets[muxNo];
if (sock) {
sock->sock_connected = thisMuxState;
}
} }
waitResponse(); // Should be an OK at the end waitResponse(); // Should be an OK at the end
return sockets[mux]->sock_connected; return sockets[mux]->sock_connected;
@ -800,8 +806,9 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSim7600* sockets[TINY_GSM_MUX_COUNT]; GsmClientSim7600* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 2
- 1
src/TinyGsmClientSIM800.h View File

@ -720,8 +720,9 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSim800* sockets[TINY_GSM_MUX_COUNT]; GsmClientSim800* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 6
- 15
src/TinyGsmClientSaraR4.h View File

@ -317,24 +317,14 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
public: public:
RegStatus getRegistrationStatus() { RegStatus getRegistrationStatus() {
// Check first for EPS registration // Check first for EPS registration
sendAT(GF("+CEREG?"));
if (waitResponse(GF(GSM_NL "+CEREG:")) != 1) { return REG_UNKNOWN; }
streamSkipUntil(','); /* Skip format (0) */
int status = streamGetIntBefore('\n');
waitResponse();
RegStatus epsStatus = (RegStatus)getRegistrationStatusXREG("CEREG");
// If we're connected on EPS, great! // If we're connected on EPS, great!
if ((RegStatus)status == REG_OK_HOME ||
(RegStatus)status == REG_OK_ROAMING) {
return (RegStatus)status;
if (epsStatus == REG_OK_HOME || epsStatus == REG_OK_ROAMING) {
return epsStatus;
} else { } else {
// Otherwise, check generic network status // Otherwise, check generic network status
sendAT(GF("+CREG?"));
if (waitResponse(GF(GSM_NL "+CREG:")) != 1) { return REG_UNKNOWN; }
streamSkipUntil(','); /* Skip format (0) */
status = streamGetIntBefore('\n');
waitResponse();
return (RegStatus)status;
return (RegStatus)getRegistrationStatusXREG("CREG");
} }
} }
@ -887,8 +877,9 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSaraR4* sockets[TINY_GSM_MUX_COUNT]; GsmClientSaraR4* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
bool has2GFallback; bool has2GFallback;


+ 23
- 17
src/TinyGsmClientSequansMonarch.h View File

@ -571,7 +571,9 @@ class TinyGsmSequansMonarch
// six possible sockets. // six possible sockets.
sendAT(GF("+SQNSS")); sendAT(GF("+SQNSS"));
for (int muxNo = 1; muxNo <= TINY_GSM_MUX_COUNT; muxNo++) { for (int muxNo = 1; muxNo <= TINY_GSM_MUX_COUNT; muxNo++) {
if (waitResponse(GFP(GSM_OK), GF(GSM_NL "+SQNSS: ")) != 2) { break; }
if (waitResponse(GFP(GSM_OK), GF(GSM_NL "+SQNSS: ")) != 2) {
break;
}
uint8_t status = 0; uint8_t status = 0;
// if (streamGetIntBefore(',') != muxNo) { // check the mux no // if (streamGetIntBefore(',') != muxNo) { // check the mux no
// DBG("### Warning: misaligned mux numbers!"); // DBG("### Warning: misaligned mux numbers!");
@ -588,28 +590,31 @@ class TinyGsmSequansMonarch
// SOCK_LISTENING = 4, // SOCK_LISTENING = 4,
// SOCK_INCOMING = 5, // SOCK_INCOMING = 5,
// SOCK_OPENING = 6, // SOCK_OPENING = 6,
sockets[muxNo % TINY_GSM_MUX_COUNT]->sock_connected =
((status != SOCK_CLOSED) && (status != SOCK_INCOMING) &&
(status != SOCK_OPENING));
GsmClientSequansMonarch* sock = sockets[mux % TINY_GSM_MUX_COUNT];
if (sock) {
sock->sock_connected =
((status != SOCK_CLOSED) && (status != SOCK_INCOMING) &&
(status != SOCK_OPENING));
}
} }
waitResponse(); // Should be an OK at the end waitResponse(); // Should be an OK at the end
return sockets[mux % TINY_GSM_MUX_COUNT]->sock_connected; return sockets[mux % TINY_GSM_MUX_COUNT]->sock_connected;
} }
/*
* Utilities
*/
public:
// TODO(vshymanskyy): Optimize this!
int8_t waitResponse(uint32_t timeout_ms, String& data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
/*
* Utilities
*/
public:
// TODO(vshymanskyy): Optimize this!
int8_t waitResponse(uint32_t timeout_ms, String & data,
GsmConstStr r1 = GFP(GSM_OK),
GsmConstStr r2 = GFP(GSM_ERROR),
#if defined TINY_GSM_DEBUG #if defined TINY_GSM_DEBUG
GsmConstStr r3 = GFP(GSM_CME_ERROR),
GsmConstStr r3 = GFP(GSM_CME_ERROR),
#else #else
GsmConstStr r3 = NULL,
GsmConstStr r3 = NULL,
#endif #endif
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
GsmConstStr r4 = NULL, GsmConstStr r5 = NULL) {
/*String r1s(r1); r1s.trim(); /*String r1s(r1); r1s.trim();
String r2s(r2); r2s.trim(); String r2s(r2); r2s.trim();
String r3s(r3); r3s.trim(); String r3s(r3); r3s.trim();
@ -701,10 +706,11 @@ class TinyGsmSequansMonarch
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientSequansMonarch* sockets[TINY_GSM_MUX_COUNT]; GsmClientSequansMonarch* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
};
};
#endif // SRC_TINYGSMCLIENTSEQUANSMONARCH_H_ #endif // SRC_TINYGSMCLIENTSEQUANSMONARCH_H_

+ 2
- 1
src/TinyGsmClientUBLOX.h View File

@ -810,8 +810,9 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
return waitResponse(1000, r1, r2, r3, r4, r5); return waitResponse(1000, r1, r2, r3, r4, r5);
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientUBLOX* sockets[TINY_GSM_MUX_COUNT]; GsmClientUBLOX* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
}; };


+ 2
- 1
src/TinyGsmClientXBee.h View File

@ -1440,8 +1440,9 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
return false; return false;
} }
protected:
public:
Stream& stream; Stream& stream;
protected:
GsmClientXBee* sockets[TINY_GSM_MUX_COUNT]; GsmClientXBee* sockets[TINY_GSM_MUX_COUNT];
const char* gsmNL = GSM_NL; const char* gsmNL = GSM_NL;
int16_t guardTime; int16_t guardTime;


+ 1
- 1
src/TinyGsmCommon.h View File

@ -10,7 +10,7 @@
#define SRC_TINYGSMCOMMON_H_ #define SRC_TINYGSMCOMMON_H_
// The current library version number // The current library version number
#define TINYGSM_VERSION "0.10.1"
#define TINYGSM_VERSION "0.10.2"
#if defined(SPARK) || defined(PARTICLE) #if defined(SPARK) || defined(PARTICLE)
#include "Particle.h" #include "Particle.h"


Loading…
Cancel
Save