Split SIM7000, add SIM7070, NTP

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2021-05-11 16:40:32 -04:00
parent 93fc96d9ec
commit 0879deab70
14 changed files with 2162 additions and 621 deletions

View File

@@ -24,6 +24,8 @@
#include "TinyGsmTCP.tpp"
#include "TinyGsmTemperature.tpp"
#include "TinyGsmTime.tpp"
#include "TinyGsmNTP.tpp"
#define GSM_NL "\r\n"
static const char GSM_OK[] TINY_GSM_PROGMEM = "OK" GSM_NL;
@@ -50,6 +52,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
public TinyGsmGSMLocation<TinyGsmSim7600>,
public TinyGsmGPS<TinyGsmSim7600>,
public TinyGsmTime<TinyGsmSim7600>,
public TinyGsmNTP<TinyGsmSim7600>,
public TinyGsmBattery<TinyGsmSim7600>,
public TinyGsmTemperature<TinyGsmSim7600> {
friend class TinyGsmModem<TinyGsmSim7600>;
@@ -59,6 +62,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
friend class TinyGsmGPS<TinyGsmSim7600>;
friend class TinyGsmGSMLocation<TinyGsmSim7600>;
friend class TinyGsmTime<TinyGsmSim7600>;
friend class TinyGsmNTP<TinyGsmSim7600>;
friend class TinyGsmBattery<TinyGsmSim7600>;
friend class TinyGsmTemperature<TinyGsmSim7600>;
@@ -271,12 +275,17 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
return res;
}
String setNetworkMode(uint8_t mode) {
sendAT(GF("+CNMP="), mode);
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return "OK"; }
String res = stream.readStringUntil('\n');
int16_t getNetworkMode() {
sendAT(GF("+CNMP?"));
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return false; }
int16_t mode = streamGetIntBefore('\n');
waitResponse();
return res;
return mode;
}
bool setNetworkMode(uint8_t mode) {
sendAT(GF("+CNMP="), mode);
return waitResponse() == 1;
}
String getLocalIPImpl() {
@@ -558,6 +567,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
protected:
// Can follow the standard CCLK function in the template
/*
* NTP server functions
*/
// Can sync with server using CNTP as per template
/*
* Battery functions
*/