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