Stop does not need to be virtual at this time
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// or Software Serial on Uno, Nano
|
// or Software Serial on Uno, Nano
|
||||||
//#include <SoftwareSerial.h>
|
//#include <SoftwareSerial.h>
|
||||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
// SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
// See all AT commands, if wanted
|
// See all AT commands, if wanted
|
||||||
// #define DUMP_AT_COMMANDS
|
// #define DUMP_AT_COMMANDS
|
||||||
@@ -58,9 +58,9 @@
|
|||||||
#define TINY_GSM_TEST_WIFI false
|
#define TINY_GSM_TEST_WIFI false
|
||||||
#define TINY_GSM_TEST_TCP true
|
#define TINY_GSM_TEST_TCP true
|
||||||
#define TINY_GSM_TEST_SSL true
|
#define TINY_GSM_TEST_SSL true
|
||||||
#define TINY_GSM_TEST_CALL false
|
#define TINY_GSM_TEST_CALL true
|
||||||
#define TINY_GSM_TEST_SMS false
|
#define TINY_GSM_TEST_SMS true
|
||||||
#define TINY_GSM_TEST_USSD false
|
#define TINY_GSM_TEST_USSD true
|
||||||
#define TINY_GSM_TEST_BATTERY true
|
#define TINY_GSM_TEST_BATTERY true
|
||||||
#define TINY_GSM_TEST_TEMPERATURE true
|
#define TINY_GSM_TEST_TEMPERATURE true
|
||||||
#define TINY_GSM_TEST_GSM_LOCATION true
|
#define TINY_GSM_TEST_GSM_LOCATION true
|
||||||
@@ -332,19 +332,19 @@ void loop() {
|
|||||||
int sec = 0;
|
int sec = 0;
|
||||||
for (int8_t i = 5; i; i--) {
|
for (int8_t i = 5; i; i--) {
|
||||||
DBG("Waiting for GSM location");
|
DBG("Waiting for GSM location");
|
||||||
if (modem.getGsmLocation(&lat, &lon, &accuracy, &year, &month, &day, &hour,
|
if (modem.getGsmLocation(&lat, &lon, &accuracy, &year, &month, &day, &hour,
|
||||||
&min, &sec)) {
|
&min, &sec)) {
|
||||||
DBG("Latitude:", String(lat, 8));
|
DBG("Latitude:", String(lat, 8));
|
||||||
DBG("Longitude:", String(lon, 8));
|
DBG("Longitude:", String(lon, 8));
|
||||||
DBG("Accuracy:", accuracy);
|
DBG("Accuracy:", accuracy);
|
||||||
DBG("Year:", year);
|
DBG("Year:", year);
|
||||||
DBG("Month:", month);
|
DBG("Month:", month);
|
||||||
DBG("Day:", day);
|
DBG("Day:", day);
|
||||||
DBG("Hour:", hour);
|
DBG("Hour:", hour);
|
||||||
DBG("Minute:", min);
|
DBG("Minute:", min);
|
||||||
DBG("Second:", sec);
|
DBG("Second:", sec);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
DBG("Couldn't get GSM location, retrying in 10s.");
|
DBG("Couldn't get GSM location, retrying in 10s.");
|
||||||
delay(10000L);
|
delay(10000L);
|
||||||
}
|
}
|
||||||
@@ -372,22 +372,22 @@ void loop() {
|
|||||||
for (int8_t i = 5; i; i--) {
|
for (int8_t i = 5; i; i--) {
|
||||||
DBG("Waiting for GPS/GNSS/GLONASS location");
|
DBG("Waiting for GPS/GNSS/GLONASS location");
|
||||||
if (modem.getGPS(&lat2, &lon2, &speed2, &alt2, &vsat2, &usat2, &accuracy2,
|
if (modem.getGPS(&lat2, &lon2, &speed2, &alt2, &vsat2, &usat2, &accuracy2,
|
||||||
&year2, &month2, &day2, &hour2, &min2, &sec2)) {
|
&year2, &month2, &day2, &hour2, &min2, &sec2)) {
|
||||||
DBG("Latitude:", String(lat2, 8));
|
DBG("Latitude:", String(lat2, 8));
|
||||||
DBG("Longitude:", String(lon2, 8));
|
DBG("Longitude:", String(lon2, 8));
|
||||||
DBG("Speed:", speed2);
|
DBG("Speed:", speed2);
|
||||||
DBG("Altitude:", alt2);
|
DBG("Altitude:", alt2);
|
||||||
DBG("Visible Satellites:", vsat2);
|
DBG("Visible Satellites:", vsat2);
|
||||||
DBG("Used Satellites:", usat2);
|
DBG("Used Satellites:", usat2);
|
||||||
DBG("Accuracy:", accuracy2);
|
DBG("Accuracy:", accuracy2);
|
||||||
DBG("Year:", year2);
|
DBG("Year:", year2);
|
||||||
DBG("Month:", month2);
|
DBG("Month:", month2);
|
||||||
DBG("Day:", day2);
|
DBG("Day:", day2);
|
||||||
DBG("Hour:", hour2);
|
DBG("Hour:", hour2);
|
||||||
DBG("Minute:", min2);
|
DBG("Minute:", min2);
|
||||||
DBG("Second:", sec2);
|
DBG("Second:", sec2);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
DBG("Couldn't get GSM location, retrying in 10s.");
|
DBG("Couldn't get GSM location, retrying in 10s.");
|
||||||
delay(10000L);
|
delay(10000L);
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -92,7 +92,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+QICLOSE="), mux);
|
at->sendAT(GF("+QICLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -81,7 +81,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -83,7 +83,7 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
at->sendAT(GF("+TCPCLOSE="), mux);
|
at->sendAT(GF("+TCPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -94,7 +94,7 @@ class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
uint32_t startMillis = millis();
|
uint32_t startMillis = millis();
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+QICLOSE="), mux);
|
at->sendAT(GF("+QICLOSE="), mux);
|
||||||
|
@@ -93,7 +93,7 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
uint32_t startMillis = millis();
|
uint32_t startMillis = millis();
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+QICLOSE="), mux);
|
at->sendAT(GF("+QICLOSE="), mux);
|
||||||
|
@@ -95,7 +95,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -92,7 +92,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -98,7 +98,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux);
|
at->sendAT(GF("+CIPCLOSE="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -98,7 +98,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+CIPCLOSE="), mux, GF(",1")); // Quick close
|
at->sendAT(GF("+CIPCLOSE="), mux, GF(",1")); // Quick close
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -118,7 +118,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
|||||||
return connect(ip, port, 120);
|
return connect(ip, port, 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
uint32_t startMillis = millis();
|
uint32_t startMillis = millis();
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
// We want to use an async socket close because the syncrhonous close of
|
// We want to use an async socket close because the syncrhonous close of
|
||||||
@@ -186,7 +186,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
|||||||
at->maintain();
|
at->maintain();
|
||||||
return sock_connected;
|
return sock_connected;
|
||||||
}
|
}
|
||||||
virtual int connect(IPAddress ip, uint16_t port, int timeout_s) {
|
int connect(IPAddress ip, uint16_t port, int timeout_s) override {
|
||||||
return connect(TinyGsmStringFromIp(ip).c_str(), port, timeout_s);
|
return connect(TinyGsmStringFromIp(ip).c_str(), port, timeout_s);
|
||||||
}
|
}
|
||||||
int connect(const char* host, uint16_t port) override {
|
int connect(const char* host, uint16_t port) override {
|
||||||
|
@@ -108,7 +108,7 @@ class TinyGsmSequansMonarch
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+SQNSH="), mux);
|
at->sendAT(GF("+SQNSH="), mux);
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
@@ -110,7 +110,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
|||||||
}
|
}
|
||||||
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
TINY_GSM_CLIENT_CONNECT_OVERRIDES
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
dumpModemBuffer(maxWaitMs);
|
dumpModemBuffer(maxWaitMs);
|
||||||
at->sendAT(GF("+USOCL="), mux);
|
at->sendAT(GF("+USOCL="), mux);
|
||||||
at->waitResponse(); // should return within 1s
|
at->waitResponse(); // should return within 1s
|
||||||
|
@@ -137,7 +137,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
|
|||||||
return connect(ip, port, 0);
|
return connect(ip, port, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void stop(uint32_t maxWaitMs) {
|
void stop(uint32_t maxWaitMs) {
|
||||||
at->streamClear(); // Empty anything in the buffer
|
at->streamClear(); // Empty anything in the buffer
|
||||||
// empty the saved currently-in-use destination address
|
// empty the saved currently-in-use destination address
|
||||||
at->modemStop(maxWaitMs);
|
at->modemStop(maxWaitMs);
|
||||||
|
@@ -51,7 +51,7 @@ class TinyGsmSSL {
|
|||||||
: GsmClientSim800(modem, mux) {}
|
: GsmClientSim800(modem, mux) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int connect(const char* host, uint16_t port, int timeout_s) {
|
int connect(const char* host, uint16_t port, int timeout_s) overide {
|
||||||
stop();
|
stop();
|
||||||
TINY_GSM_YIELD();
|
TINY_GSM_YIELD();
|
||||||
rx.clear();
|
rx.clear();
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
// Because of the ordering of resolution of overrides in templates, these need
|
// Because of the ordering of resolution of overrides in templates, these need
|
||||||
// to be written out every time. This macro is to shorten that.
|
// to be written out every time. This macro is to shorten that.
|
||||||
#define TINY_GSM_CLIENT_CONNECT_OVERRIDES \
|
#define TINY_GSM_CLIENT_CONNECT_OVERRIDES \
|
||||||
virtual int connect(IPAddress ip, uint16_t port, int timeout_s) { \
|
int connect(IPAddress ip, uint16_t port, int timeout_s) { \
|
||||||
return connect(TinyGsmStringFromIp(ip).c_str(), port, timeout_s); \
|
return connect(TinyGsmStringFromIp(ip).c_str(), port, timeout_s); \
|
||||||
} \
|
} \
|
||||||
int connect(const char* host, uint16_t port) override { \
|
int connect(const char* host, uint16_t port) override { \
|
||||||
|
Reference in New Issue
Block a user