mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Change from switch case to required define
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 8 | ||||
| #define TINY_GSM_NO_MODEM_BUFFER | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -37,17 +38,16 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmA6 | ||||
|     : public TinyGsmModem<TinyGsmA6>, | ||||
|       public TinyGsmGPRS<TinyGsmA6>, | ||||
|       public TinyGsmTCP<TinyGsmA6, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmCalling<TinyGsmA6>, | ||||
|       public TinyGsmSMS<TinyGsmA6>, | ||||
|       public TinyGsmTime<TinyGsmA6>, | ||||
|       public TinyGsmBattery<TinyGsmA6> { | ||||
| class TinyGsmA6 : public TinyGsmModem<TinyGsmA6>, | ||||
|                   public TinyGsmGPRS<TinyGsmA6>, | ||||
|                   public TinyGsmTCP<TinyGsmA6, TINY_GSM_MUX_COUNT>, | ||||
|                   public TinyGsmCalling<TinyGsmA6>, | ||||
|                   public TinyGsmSMS<TinyGsmA6>, | ||||
|                   public TinyGsmTime<TinyGsmA6>, | ||||
|                   public TinyGsmBattery<TinyGsmA6> { | ||||
|   friend class TinyGsmModem<TinyGsmA6>; | ||||
|   friend class TinyGsmGPRS<TinyGsmA6>; | ||||
|   friend class TinyGsmTCP<TinyGsmA6, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmA6, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmCalling<TinyGsmA6>; | ||||
|   friend class TinyGsmSMS<TinyGsmA6>; | ||||
|   friend class TinyGsmTime<TinyGsmA6>; | ||||
| @@ -439,13 +439,6 @@ class TinyGsmA6 | ||||
|     return len; | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t, uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|   size_t modemGetAvailable(uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   bool modemGetConnected(uint8_t) { | ||||
|     sendAT(GF("+CIPSTATUS"));  // TODO(?) mux? | ||||
|     int8_t res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 12 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -37,17 +38,16 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmBG96 | ||||
|     : public TinyGsmModem<TinyGsmBG96>, | ||||
|       public TinyGsmGPRS<TinyGsmBG96>, | ||||
|       public TinyGsmTCP<TinyGsmBG96, READ_AND_CHECK_SIZE, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmCalling<TinyGsmBG96>, | ||||
|       public TinyGsmSMS<TinyGsmBG96>, | ||||
|       public TinyGsmTime<TinyGsmBG96>, | ||||
|       public TinyGsmBattery<TinyGsmBG96> { | ||||
| class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>, | ||||
|                     public TinyGsmGPRS<TinyGsmBG96>, | ||||
|                     public TinyGsmTCP<TinyGsmBG96, TINY_GSM_MUX_COUNT>, | ||||
|                     public TinyGsmCalling<TinyGsmBG96>, | ||||
|                     public TinyGsmSMS<TinyGsmBG96>, | ||||
|                     public TinyGsmTime<TinyGsmBG96>, | ||||
|                     public TinyGsmBattery<TinyGsmBG96> { | ||||
|   friend class TinyGsmModem<TinyGsmBG96>; | ||||
|   friend class TinyGsmGPRS<TinyGsmBG96>; | ||||
|   friend class TinyGsmTCP<TinyGsmBG96, READ_AND_CHECK_SIZE, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmBG96, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmCalling<TinyGsmBG96>; | ||||
|   friend class TinyGsmSMS<TinyGsmBG96>; | ||||
|   friend class TinyGsmTime<TinyGsmBG96>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 5 | ||||
| #define TINY_GSM_NO_MODEM_BUFFER | ||||
|  | ||||
| #include "TinyGsmModem.tpp" | ||||
| #include "TinyGsmSSL.tpp" | ||||
| @@ -37,14 +38,13 @@ enum RegStatus { | ||||
|   REG_UNKNOWN   = 6, | ||||
| }; | ||||
|  | ||||
| class TinyGsmESP8266 | ||||
|     : public TinyGsmModem<TinyGsmESP8266>, | ||||
|       public TinyGsmWifi<TinyGsmESP8266>, | ||||
|       public TinyGsmTCP<TinyGsmESP8266, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmESP8266> { | ||||
| class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>, | ||||
|                        public TinyGsmWifi<TinyGsmESP8266>, | ||||
|                        public TinyGsmTCP<TinyGsmESP8266, TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmSSL<TinyGsmESP8266> { | ||||
|   friend class TinyGsmModem<TinyGsmESP8266>; | ||||
|   friend class TinyGsmWifi<TinyGsmESP8266>; | ||||
|   friend class TinyGsmTCP<TinyGsmESP8266, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmESP8266, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmESP8266>; | ||||
|  | ||||
|   /* | ||||
| @@ -301,13 +301,6 @@ class TinyGsmESP8266 | ||||
|     return len; | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t, uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|   size_t modemGetAvailable(uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   bool modemGetConnected(uint8_t mux) { | ||||
|     sendAT(GF("+CIPSTATUS")); | ||||
|     if (waitResponse(3000, GF("STATUS:")) != 1) { return false; } | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 2 | ||||
| #define TINY_GSM_NO_MODEM_BUFFER | ||||
|  | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| #include "TinyGsmModem.tpp" | ||||
| @@ -35,15 +36,14 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmM590 | ||||
|     : public TinyGsmModem<TinyGsmM590>, | ||||
|       public TinyGsmGPRS<TinyGsmM590>, | ||||
|       public TinyGsmTCP<TinyGsmM590, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSMS<TinyGsmM590>, | ||||
|       public TinyGsmTime<TinyGsmM590> { | ||||
| class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>, | ||||
|                     public TinyGsmGPRS<TinyGsmM590>, | ||||
|                     public TinyGsmTCP<TinyGsmM590, TINY_GSM_MUX_COUNT>, | ||||
|                     public TinyGsmSMS<TinyGsmM590>, | ||||
|                     public TinyGsmTime<TinyGsmM590> { | ||||
|   friend class TinyGsmModem<TinyGsmM590>; | ||||
|   friend class TinyGsmGPRS<TinyGsmM590>; | ||||
|   friend class TinyGsmTCP<TinyGsmM590, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmM590, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSMS<TinyGsmM590>; | ||||
|   friend class TinyGsmTime<TinyGsmM590>; | ||||
|  | ||||
| @@ -317,13 +317,6 @@ class TinyGsmM590 | ||||
|     return len; | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t, uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|   size_t modemGetAvailable(uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   bool modemGetConnected(uint8_t mux) { | ||||
|     sendAT(GF("+CIPSTATUS="), mux); | ||||
|     int8_t res = waitResponse(GF(",\"CONNECTED\""), GF(",\"CLOSED\""), | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 6 | ||||
| #define TINY_GSM_BUFFER_READ_NO_CHECK | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -39,18 +40,17 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmM95 | ||||
|     : public TinyGsmModem<TinyGsmM95>, | ||||
|       public TinyGsmGPRS<TinyGsmM95>, | ||||
|       public TinyGsmTCP<TinyGsmM95, READ_NO_CHECK, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmCalling<TinyGsmM95>, | ||||
|       public TinyGsmSMS<TinyGsmM95>, | ||||
|       public TinyGsmTime<TinyGsmM95>, | ||||
|       public TinyGsmBattery<TinyGsmM95>, | ||||
|       public TinyGsmTemperature<TinyGsmM95> { | ||||
| class TinyGsmM95 : public TinyGsmModem<TinyGsmM95>, | ||||
|                    public TinyGsmGPRS<TinyGsmM95>, | ||||
|                    public TinyGsmTCP<TinyGsmM95, TINY_GSM_MUX_COUNT>, | ||||
|                    public TinyGsmCalling<TinyGsmM95>, | ||||
|                    public TinyGsmSMS<TinyGsmM95>, | ||||
|                    public TinyGsmTime<TinyGsmM95>, | ||||
|                    public TinyGsmBattery<TinyGsmM95>, | ||||
|                    public TinyGsmTemperature<TinyGsmM95> { | ||||
|   friend class TinyGsmModem<TinyGsmM95>; | ||||
|   friend class TinyGsmGPRS<TinyGsmM95>; | ||||
|   friend class TinyGsmTCP<TinyGsmM95, READ_NO_CHECK, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmM95, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmCalling<TinyGsmM95>; | ||||
|   friend class TinyGsmSMS<TinyGsmM95>; | ||||
|   friend class TinyGsmTime<TinyGsmM95>; | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 6 | ||||
| #define TINY_GSM_BUFFER_READ_NO_CHECK | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -40,17 +41,16 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmMC60 | ||||
|     : public TinyGsmModem<TinyGsmMC60>, | ||||
|       public TinyGsmGPRS<TinyGsmMC60>, | ||||
|       public TinyGsmTCP<TinyGsmMC60, READ_NO_CHECK, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmCalling<TinyGsmMC60>, | ||||
|       public TinyGsmSMS<TinyGsmMC60>, | ||||
|       public TinyGsmTime<TinyGsmMC60>, | ||||
|       public TinyGsmBattery<TinyGsmMC60> { | ||||
| class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>, | ||||
|                     public TinyGsmGPRS<TinyGsmMC60>, | ||||
|                     public TinyGsmTCP<TinyGsmMC60, TINY_GSM_MUX_COUNT>, | ||||
|                     public TinyGsmCalling<TinyGsmMC60>, | ||||
|                     public TinyGsmSMS<TinyGsmMC60>, | ||||
|                     public TinyGsmTime<TinyGsmMC60>, | ||||
|                     public TinyGsmBattery<TinyGsmMC60> { | ||||
|   friend class TinyGsmModem<TinyGsmMC60>; | ||||
|   friend class TinyGsmGPRS<TinyGsmMC60>; | ||||
|   friend class TinyGsmTCP<TinyGsmMC60, READ_NO_CHECK, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmMC60, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmCalling<TinyGsmMC60>; | ||||
|   friend class TinyGsmSMS<TinyGsmMC60>; | ||||
|   friend class TinyGsmTime<TinyGsmMC60>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_USE_HEX | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 10 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| @@ -40,8 +41,7 @@ enum RegStatus { | ||||
|  | ||||
| class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|                        public TinyGsmGPRS<TinyGsmSim5360>, | ||||
|                        public TinyGsmTCP<TinyGsmSim5360, READ_AND_CHECK_SIZE, | ||||
|                                          TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmTCP<TinyGsmSim5360, TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmSMS<TinyGsmSim5360>, | ||||
|                        public TinyGsmTime<TinyGsmSim5360>, | ||||
|                        public TinyGsmGSMLocation<TinyGsmSim5360>, | ||||
| @@ -49,8 +49,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>, | ||||
|                        public TinyGsmTemperature<TinyGsmSim5360> { | ||||
|   friend class TinyGsmModem<TinyGsmSim5360>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSim5360>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim5360, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim5360, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSMS<TinyGsmSim5360>; | ||||
|   friend class TinyGsmTime<TinyGsmSim5360>; | ||||
|   friend class TinyGsmGSMLocation<TinyGsmSim5360>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_USE_HEX | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 8 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| @@ -39,16 +40,14 @@ enum RegStatus { | ||||
|  | ||||
| class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | ||||
|                        public TinyGsmGPRS<TinyGsmSim7000>, | ||||
|                        public TinyGsmTCP<TinyGsmSim7000, READ_AND_CHECK_SIZE, | ||||
|                                          TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmTCP<TinyGsmSim7000, TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmSMS<TinyGsmSim7000>, | ||||
|                        public TinyGsmGPS<TinyGsmSim7000>, | ||||
|                        public TinyGsmTime<TinyGsmSim7000>, | ||||
|                        public TinyGsmBattery<TinyGsmSim7000> { | ||||
|   friend class TinyGsmModem<TinyGsmSim7000>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSim7000>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim7000, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim7000, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSMS<TinyGsmSim7000>; | ||||
|   friend class TinyGsmGPS<TinyGsmSim7000>; | ||||
|   friend class TinyGsmTime<TinyGsmSim7000>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_USE_HEX | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 10 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| @@ -41,8 +42,7 @@ enum RegStatus { | ||||
|  | ||||
| class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|                        public TinyGsmGPRS<TinyGsmSim7600>, | ||||
|                        public TinyGsmTCP<TinyGsmSim7600, READ_AND_CHECK_SIZE, | ||||
|                                          TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmTCP<TinyGsmSim7600, TINY_GSM_MUX_COUNT>, | ||||
|                        public TinyGsmSMS<TinyGsmSim7600>, | ||||
|                        public TinyGsmGSMLocation<TinyGsmSim7600>, | ||||
|                        public TinyGsmGPS<TinyGsmSim7600>, | ||||
| @@ -51,8 +51,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>, | ||||
|                        public TinyGsmTemperature<TinyGsmSim7600> { | ||||
|   friend class TinyGsmModem<TinyGsmSim7600>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSim7600>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim7600, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim7600, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSMS<TinyGsmSim7600>; | ||||
|   friend class TinyGsmGPS<TinyGsmSim7600>; | ||||
|   friend class TinyGsmGSMLocation<TinyGsmSim7600>; | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
| // #define TINY_GSM_USE_HEX | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 5 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -39,20 +40,18 @@ enum RegStatus { | ||||
|   REG_OK_ROAMING   = 5, | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
| class TinyGsmSim800 | ||||
|     : public TinyGsmModem<TinyGsmSim800>, | ||||
|       public TinyGsmGPRS<TinyGsmSim800>, | ||||
|       public TinyGsmTCP<TinyGsmSim800, READ_AND_CHECK_SIZE, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmSim800>, | ||||
|       public TinyGsmCalling<TinyGsmSim800>, | ||||
|       public TinyGsmSMS<TinyGsmSim800>, | ||||
|       public TinyGsmGSMLocation<TinyGsmSim800>, | ||||
|       public TinyGsmTime<TinyGsmSim800>, | ||||
|       public TinyGsmBattery<TinyGsmSim800> { | ||||
| class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>, | ||||
|                       public TinyGsmGPRS<TinyGsmSim800>, | ||||
|                       public TinyGsmTCP<TinyGsmSim800, TINY_GSM_MUX_COUNT>, | ||||
|                       public TinyGsmSSL<TinyGsmSim800>, | ||||
|                       public TinyGsmCalling<TinyGsmSim800>, | ||||
|                       public TinyGsmSMS<TinyGsmSim800>, | ||||
|                       public TinyGsmGSMLocation<TinyGsmSim800>, | ||||
|                       public TinyGsmTime<TinyGsmSim800>, | ||||
|                       public TinyGsmBattery<TinyGsmSim800> { | ||||
|   friend class TinyGsmModem<TinyGsmSim800>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSim800>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim800, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSim800, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmSim800>; | ||||
|   friend class TinyGsmCalling<TinyGsmSim800>; | ||||
|   friend class TinyGsmSMS<TinyGsmSim800>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 7 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| @@ -40,21 +41,19 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmSaraR4 | ||||
|     : public TinyGsmModem<TinyGsmSaraR4>, | ||||
|       public TinyGsmGPRS<TinyGsmSaraR4>, | ||||
|       public TinyGsmTCP<TinyGsmSaraR4, READ_AND_CHECK_SIZE, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmSaraR4>, | ||||
|       public TinyGsmBattery<TinyGsmSaraR4>, | ||||
|       public TinyGsmGSMLocation<TinyGsmSaraR4>, | ||||
|       public TinyGsmGPS<TinyGsmSaraR4>, | ||||
|       public TinyGsmSMS<TinyGsmSaraR4>, | ||||
|       public TinyGsmTemperature<TinyGsmSaraR4>, | ||||
|       public TinyGsmTime<TinyGsmSaraR4> { | ||||
| class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>, | ||||
|                       public TinyGsmGPRS<TinyGsmSaraR4>, | ||||
|                       public TinyGsmTCP<TinyGsmSaraR4, TINY_GSM_MUX_COUNT>, | ||||
|                       public TinyGsmSSL<TinyGsmSaraR4>, | ||||
|                       public TinyGsmBattery<TinyGsmSaraR4>, | ||||
|                       public TinyGsmGSMLocation<TinyGsmSaraR4>, | ||||
|                       public TinyGsmGPS<TinyGsmSaraR4>, | ||||
|                       public TinyGsmSMS<TinyGsmSaraR4>, | ||||
|                       public TinyGsmTemperature<TinyGsmSaraR4>, | ||||
|                       public TinyGsmTime<TinyGsmSaraR4> { | ||||
|   friend class TinyGsmModem<TinyGsmSaraR4>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSaraR4>; | ||||
|   friend class TinyGsmTCP<TinyGsmSaraR4, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSaraR4, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmSaraR4>; | ||||
|   friend class TinyGsmBattery<TinyGsmSaraR4>; | ||||
|   friend class TinyGsmGSMLocation<TinyGsmSaraR4>; | ||||
|   | ||||
| @@ -12,6 +12,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 6 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmCalling.tpp" | ||||
| #include "TinyGsmGPRS.tpp" | ||||
| @@ -50,8 +51,7 @@ enum SocketStatus { | ||||
| class TinyGsmSequansMonarch | ||||
|     : public TinyGsmModem<TinyGsmSequansMonarch>, | ||||
|       public TinyGsmGPRS<TinyGsmSequansMonarch>, | ||||
|       public TinyGsmTCP<TinyGsmSequansMonarch, READ_AND_CHECK_SIZE, | ||||
|                         TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmTCP<TinyGsmSequansMonarch, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmSequansMonarch>, | ||||
|       public TinyGsmCalling<TinyGsmSequansMonarch>, | ||||
|       public TinyGsmSMS<TinyGsmSequansMonarch>, | ||||
| @@ -59,8 +59,7 @@ class TinyGsmSequansMonarch | ||||
|       public TinyGsmTemperature<TinyGsmSequansMonarch> { | ||||
|   friend class TinyGsmModem<TinyGsmSequansMonarch>; | ||||
|   friend class TinyGsmGPRS<TinyGsmSequansMonarch>; | ||||
|   friend class TinyGsmTCP<TinyGsmSequansMonarch, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmSequansMonarch, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmSequansMonarch>; | ||||
|   friend class TinyGsmCalling<TinyGsmSequansMonarch>; | ||||
|   friend class TinyGsmSMS<TinyGsmSequansMonarch>; | ||||
|   | ||||
| @@ -13,6 +13,7 @@ | ||||
| // #define TINY_GSM_DEBUG Serial | ||||
|  | ||||
| #define TINY_GSM_MUX_COUNT 7 | ||||
| #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| #include "TinyGsmBattery.tpp" | ||||
| #include "TinyGsmCalling.tpp" | ||||
| @@ -40,21 +41,19 @@ enum RegStatus { | ||||
|   REG_UNKNOWN      = 4, | ||||
| }; | ||||
|  | ||||
| class TinyGsmUBLOX | ||||
|     : public TinyGsmModem<TinyGsmUBLOX>, | ||||
|       public TinyGsmGPRS<TinyGsmUBLOX>, | ||||
|       public TinyGsmTCP<TinyGsmUBLOX, READ_AND_CHECK_SIZE, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmUBLOX>, | ||||
|       public TinyGsmCalling<TinyGsmUBLOX>, | ||||
|       public TinyGsmSMS<TinyGsmUBLOX>, | ||||
|       public TinyGsmGSMLocation<TinyGsmUBLOX>, | ||||
|       public TinyGsmGPS<TinyGsmUBLOX>, | ||||
|       public TinyGsmTime<TinyGsmUBLOX>, | ||||
|       public TinyGsmBattery<TinyGsmUBLOX> { | ||||
| class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>, | ||||
|                      public TinyGsmGPRS<TinyGsmUBLOX>, | ||||
|                      public TinyGsmTCP<TinyGsmUBLOX, TINY_GSM_MUX_COUNT>, | ||||
|                      public TinyGsmSSL<TinyGsmUBLOX>, | ||||
|                      public TinyGsmCalling<TinyGsmUBLOX>, | ||||
|                      public TinyGsmSMS<TinyGsmUBLOX>, | ||||
|                      public TinyGsmGSMLocation<TinyGsmUBLOX>, | ||||
|                      public TinyGsmGPS<TinyGsmUBLOX>, | ||||
|                      public TinyGsmTime<TinyGsmUBLOX>, | ||||
|                      public TinyGsmBattery<TinyGsmUBLOX> { | ||||
|   friend class TinyGsmModem<TinyGsmUBLOX>; | ||||
|   friend class TinyGsmGPRS<TinyGsmUBLOX>; | ||||
|   friend class TinyGsmTCP<TinyGsmUBLOX, READ_AND_CHECK_SIZE, | ||||
|                           TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmUBLOX, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmUBLOX>; | ||||
|   friend class TinyGsmCalling<TinyGsmUBLOX>; | ||||
|   friend class TinyGsmSMS<TinyGsmUBLOX>; | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
| // XBee's do not support multi-plexing in transparent/command mode | ||||
| // The much more complicated API mode is needed for multi-plexing | ||||
| #define TINY_GSM_MUX_COUNT 1 | ||||
| #define TINY_GSM_NO_MODEM_BUFFER | ||||
| // XBee's have a default guard time of 1 second (1000ms, 10 extra for safety | ||||
| // here) | ||||
| #define TINY_GSM_XBEE_GUARD_TIME 1010 | ||||
| @@ -65,19 +66,18 @@ enum XBeeType { | ||||
|   XBEE3_LTEM_ATT = 0xB08,  // Digi XBee3 Cellular LTE-M | ||||
| }; | ||||
|  | ||||
| class TinyGsmXBee | ||||
|     : public TinyGsmModem<TinyGsmXBee>, | ||||
|       public TinyGsmGPRS<TinyGsmXBee>, | ||||
|       public TinyGsmWifi<TinyGsmXBee>, | ||||
|       public TinyGsmTCP<TinyGsmXBee, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>, | ||||
|       public TinyGsmSSL<TinyGsmXBee>, | ||||
|       public TinyGsmSMS<TinyGsmXBee>, | ||||
|       public TinyGsmBattery<TinyGsmXBee>, | ||||
|       public TinyGsmTemperature<TinyGsmXBee> { | ||||
| class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>, | ||||
|                     public TinyGsmGPRS<TinyGsmXBee>, | ||||
|                     public TinyGsmWifi<TinyGsmXBee>, | ||||
|                     public TinyGsmTCP<TinyGsmXBee, TINY_GSM_MUX_COUNT>, | ||||
|                     public TinyGsmSSL<TinyGsmXBee>, | ||||
|                     public TinyGsmSMS<TinyGsmXBee>, | ||||
|                     public TinyGsmBattery<TinyGsmXBee>, | ||||
|                     public TinyGsmTemperature<TinyGsmXBee> { | ||||
|   friend class TinyGsmModem<TinyGsmXBee>; | ||||
|   friend class TinyGsmGPRS<TinyGsmXBee>; | ||||
|   friend class TinyGsmWifi<TinyGsmXBee>; | ||||
|   friend class TinyGsmTCP<TinyGsmXBee, NO_MODEM_BUFFER, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmTCP<TinyGsmXBee, TINY_GSM_MUX_COUNT>; | ||||
|   friend class TinyGsmSSL<TinyGsmXBee>; | ||||
|   friend class TinyGsmSMS<TinyGsmXBee>; | ||||
|   friend class TinyGsmBattery<TinyGsmXBee>; | ||||
| @@ -1117,13 +1117,6 @@ class TinyGsmXBee | ||||
|     return len; | ||||
|   } | ||||
|  | ||||
|   size_t modemRead(size_t, uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|   size_t modemGetAvailable(uint8_t) { | ||||
|     return 0; | ||||
|   } | ||||
|  | ||||
|   // NOTE:  The CI command returns the status of the TCP connection as open only | ||||
|   // after data has been sent on the socket.  If it returns 0xFF the socket may | ||||
|   // really be open, but no data has yet been sent.  We return this unknown | ||||
|   | ||||
| @@ -19,8 +19,8 @@ | ||||
| #define TINY_GSM_RX_BUFFER 64 | ||||
| #endif | ||||
|  | ||||
| // Because of the ordering of resolution of overrides in templates, hese need to | ||||
| // be written out every time.  This macro is to shorten that. | ||||
| // 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) {   \ | ||||
|     return connect(TinyGsmStringFromIp(ip).c_str(), port, timeout_s); \ | ||||
| @@ -32,16 +32,16 @@ | ||||
|     return connect(ip, port, 75);                                     \ | ||||
|   } | ||||
|  | ||||
| enum modemInternalBuffferType { | ||||
|   NO_MODEM_BUFFER = | ||||
|       0,  // For modules that do not store incoming data in any sort of buffer | ||||
|   READ_NO_CHECK = 1,  // Data is stored in a buffer, but we can only read from | ||||
|                       // the buffer, not check how much data is stored in it | ||||
|   READ_AND_CHECK_SIZE = 2,  // Data is stored in a buffer and we can both read | ||||
|                             // and check the size of the buffer | ||||
| }; | ||||
| // // For modules that do not store incoming data in any sort of buffer | ||||
| // #define TINY_GSM_NO_MODEM_BUFFER | ||||
| // // Data is stored in a buffer, but we can only read from the buffer, | ||||
| // // not check how much data is stored in it | ||||
| // #define TINY_GSM_BUFFER_READ_NO_CHECK | ||||
| // // Data is stored in a buffer and we can both read and check the size | ||||
| // // of the buffer | ||||
| // #define TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|  | ||||
| template <class modemType, modemInternalBuffferType bufType, uint8_t muxCount> | ||||
| template <class modemType, uint8_t muxCount> | ||||
| class TinyGsmTCP { | ||||
|  public: | ||||
|   /* | ||||
| @@ -68,7 +68,7 @@ class TinyGsmTCP { | ||||
|  public: | ||||
|   class GsmClient : public Client { | ||||
|     // Make all classes created from the modem template friends | ||||
|     friend class TinyGsmTCP<modemType, bufType, muxCount>; | ||||
|     friend class TinyGsmTCP<modemType, muxCount>; | ||||
|     typedef TinyGsmFifo<uint8_t, TINY_GSM_RX_BUFFER> RxFifo; | ||||
|  | ||||
|    public: | ||||
| @@ -77,14 +77,14 @@ class TinyGsmTCP { | ||||
|  | ||||
|     // Connect to a IP address given as an IPAddress object by | ||||
|     // converting said IP address to text | ||||
|     // virtual int connect(IPAddress ip, uint16_t port, int timeout_s) { | ||||
|     // virtual 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 { | ||||
|     //   return connect(host, port, 75); | ||||
|     // } | ||||
|     // int connect(IPAddress ip, uint16_t port) override { | ||||
|     // int connect(IPAddress ip,uint16_t port) override { | ||||
|     //   return connect(ip, port, 75); | ||||
|     // } | ||||
|  | ||||
| @@ -124,107 +124,111 @@ class TinyGsmTCP { | ||||
|  | ||||
|     int available() override { | ||||
|       TINY_GSM_YIELD(); | ||||
|       switch (bufType) { | ||||
|         // Returns the number of characters available in the TinyGSM fifo | ||||
|         case NO_MODEM_BUFFER: | ||||
|           if (!rx.size() && sock_connected) { at->maintain(); } | ||||
|           return rx.size(); | ||||
| #if defined TINY_GSM_NO_MODEM_BUFFER | ||||
|       // Returns the number of characters available in the TinyGSM fifo | ||||
|       if (!rx.size() && sock_connected) { at->maintain(); } | ||||
|       return rx.size(); | ||||
|  | ||||
|         // Returns the combined number of characters available in the TinyGSM | ||||
|         // fifo and the modem chips internal fifo. | ||||
|         case READ_NO_CHECK: | ||||
|           if (!rx.size()) { at->maintain(); } | ||||
|           return rx.size() + sock_available; | ||||
| #elif defined TINY_GSM_NO_MODEM_BUFFER | ||||
|       // Returns the combined number of characters available in the TinyGSM | ||||
|       // fifo and the modem chips internal fifo. | ||||
|       if (!rx.size()) { at->maintain(); } | ||||
|       return rx.size() + sock_available; | ||||
|  | ||||
|         // Returns the combined number of characters available in the TinyGSM | ||||
|         // fifo and the modem chips internal fifo, doing an extra check-in | ||||
|         // with the modem to see if anything has arrived without a UURC. | ||||
|         case READ_AND_CHECK_SIZE: | ||||
|           if (!rx.size()) { | ||||
|             if (millis() - prev_check > 500) { | ||||
|               got_data   = true; | ||||
|               prev_check = millis(); | ||||
|             } | ||||
|             at->maintain(); | ||||
|           } | ||||
|           return rx.size() + sock_available; | ||||
| #elif defined TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|       // Returns the combined number of characters available in the TinyGSM | ||||
|       // fifo and the modem chips internal fifo, doing an extra check-in | ||||
|       // with the modem to see if anything has arrived without a UURC. | ||||
|       if (!rx.size()) { | ||||
|         if (millis() - prev_check > 500) { | ||||
|           got_data   = true; | ||||
|           prev_check = millis(); | ||||
|         } | ||||
|         at->maintain(); | ||||
|       } | ||||
|       return rx.size() + sock_available; | ||||
|  | ||||
| #else | ||||
| #error Modem client has been incorrectly created | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     int read(uint8_t* buf, size_t size) override { | ||||
|       TINY_GSM_YIELD(); | ||||
|       size_t   cnt          = 0; | ||||
|       size_t cnt = 0; | ||||
|  | ||||
| #if defined TINY_GSM_NO_MODEM_BUFFER | ||||
|       // Reads characters out of the TinyGSM fifo, waiting for any URC's | ||||
|       // from the modem for new data if there's nothing in the fifo. | ||||
|       uint32_t _startMillis = millis(); | ||||
|  | ||||
|       switch (bufType) { | ||||
|         // Reads characters out of the TinyGSM fifo, waiting for any URC's | ||||
|         // from the modem for new data if there's nothing in the fifo. | ||||
|         case NO_MODEM_BUFFER: | ||||
|           while (cnt < size && millis() - _startMillis < _timeout) { | ||||
|             size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|             if (chunk > 0) { | ||||
|               rx.get(buf, chunk); | ||||
|               buf += chunk; | ||||
|               cnt += chunk; | ||||
|               continue; | ||||
|             } /* TODO: Read directly into user buffer? */ | ||||
|             if (!rx.size() && sock_connected) { at->maintain(); } | ||||
|           } | ||||
|           return cnt; | ||||
|  | ||||
|         // Reads characters out of the TinyGSM fifo, and from the modem chip's | ||||
|         // internal fifo if avaiable. | ||||
|         case READ_NO_CHECK: | ||||
|           at->maintain(); | ||||
|           while (cnt < size) { | ||||
|             size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|             if (chunk > 0) { | ||||
|               rx.get(buf, chunk); | ||||
|               buf += chunk; | ||||
|               cnt += chunk; | ||||
|               continue; | ||||
|             } /* TODO: Read directly into user buffer? */ | ||||
|             at->maintain(); | ||||
|             if (sock_available > 0) { | ||||
|               int n = at->modemRead( | ||||
|                   TinyGsmMin((uint16_t)rx.free(), sock_available), mux); | ||||
|               if (n == 0) break; | ||||
|             } else { | ||||
|               break; | ||||
|             } | ||||
|           } | ||||
|           return cnt; | ||||
|  | ||||
|         // Reads characters out of the TinyGSM fifo, and from the modem chips | ||||
|         // internal fifo if avaiable, also double checking with the modem if | ||||
|         // data has arrived without issuing a UURC. | ||||
|         case READ_AND_CHECK_SIZE: | ||||
|           at->maintain(); | ||||
|           while (cnt < size) { | ||||
|             size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|             if (chunk > 0) { | ||||
|               rx.get(buf, chunk); | ||||
|               buf += chunk; | ||||
|               cnt += chunk; | ||||
|               continue; | ||||
|             } | ||||
|             // Workaround: Some modules "forget" to notify about data arrival | ||||
|             if (millis() - prev_check > 500) { | ||||
|               got_data   = true; | ||||
|               prev_check = millis(); | ||||
|             } | ||||
|             // TODO(vshymanskyy): Read directly into user buffer? | ||||
|             at->maintain(); | ||||
|             if (sock_available > 0) { | ||||
|               int n = at->modemRead( | ||||
|                   TinyGsmMin((uint16_t)rx.free(), sock_available), mux); | ||||
|               if (n == 0) break; | ||||
|             } else { | ||||
|               break; | ||||
|             } | ||||
|           } | ||||
|           return cnt; | ||||
|       while (cnt < size && millis() - _startMillis < _timeout) { | ||||
|         size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|         if (chunk > 0) { | ||||
|           rx.get(buf, chunk); | ||||
|           buf += chunk; | ||||
|           cnt += chunk; | ||||
|           continue; | ||||
|         } /* TODO: Read directly into user buffer? */ | ||||
|         if (!rx.size() && sock_connected) { at->maintain(); } | ||||
|       } | ||||
|       return cnt; | ||||
|  | ||||
| #elif defined TINY_GSM_BUFFER_READ_NO_CHECK | ||||
|       // Reads characters out of the TinyGSM fifo, and from the modem chip's | ||||
|       // internal fifo if avaiable. | ||||
|       at->maintain(); | ||||
|       while (cnt < size) { | ||||
|         size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|         if (chunk > 0) { | ||||
|           rx.get(buf, chunk); | ||||
|           buf += chunk; | ||||
|           cnt += chunk; | ||||
|           continue; | ||||
|         } /* TODO: Read directly into user buffer? */ | ||||
|         at->maintain(); | ||||
|         if (sock_available > 0) { | ||||
|           int n = at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), | ||||
|                                 mux); | ||||
|           if (n == 0) break; | ||||
|         } else { | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|       return cnt; | ||||
|  | ||||
| #elif defined TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|       // Reads characters out of the TinyGSM fifo, and from the modem chips | ||||
|       // internal fifo if avaiable, also double checking with the modem if | ||||
|       // data has arrived without issuing a UURC. | ||||
|       at->maintain(); | ||||
|       while (cnt < size) { | ||||
|         size_t chunk = TinyGsmMin(size - cnt, rx.size()); | ||||
|         if (chunk > 0) { | ||||
|           rx.get(buf, chunk); | ||||
|           buf += chunk; | ||||
|           cnt += chunk; | ||||
|           continue; | ||||
|         } | ||||
|         // Workaround: Some modules "forget" to notify about data arrival | ||||
|         if (millis() - prev_check > 500) { | ||||
|           got_data   = true; | ||||
|           prev_check = millis(); | ||||
|         } | ||||
|         // TODO(vshymanskyy): Read directly into user buffer? | ||||
|         at->maintain(); | ||||
|         if (sock_available > 0) { | ||||
|           int n = at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), | ||||
|                                 mux); | ||||
|           if (n == 0) break; | ||||
|         } else { | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|       return cnt; | ||||
|  | ||||
| #else | ||||
| #error Modem client has been incorrectly created | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     int read() override { | ||||
| @@ -264,12 +268,21 @@ class TinyGsmTCP { | ||||
|     // Doing it this way allows the external mcu to find and get all of the | ||||
|     // data that it wants from the socket even if it was closed externally. | ||||
|     inline void dumpModemBuffer(uint32_t maxWaitMs) { | ||||
| #if defined TINY_GSM_BUFFER_READ_AND_CHECK_SIZE || \ | ||||
|     defined TINY_GSM_BUFFER_READ_NO_CHECK | ||||
|       TINY_GSM_YIELD(); | ||||
|       uint32_t startMillis = millis(); | ||||
|       do { | ||||
|         rx.clear(); | ||||
|         at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux); | ||||
|       } while (sock_available > 0 && (millis() - startMillis < maxWaitMs)); | ||||
|  | ||||
| #elif defined TINY_GSM_NO_MODEM_BUFFER | ||||
|       // Do nothing | ||||
|  | ||||
| #else | ||||
| #error Modem client has been incorrectly created | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     modemType* at; | ||||
| @@ -286,26 +299,27 @@ class TinyGsmTCP { | ||||
|    */ | ||||
|  protected: | ||||
|   void maintainImpl() { | ||||
|     switch (bufType) { | ||||
|       case READ_AND_CHECK_SIZE: | ||||
|         // Keep listening for modem URC's and proactively iterate through | ||||
|         // sockets asking if any data is avaiable | ||||
|         for (int mux = 0; mux < muxCount; mux++) { | ||||
|           GsmClient* sock = thisModem().sockets[mux]; | ||||
|           if (sock && sock->got_data) { | ||||
|             sock->got_data       = false; | ||||
|             sock->sock_available = thisModem().modemGetAvailable(mux); | ||||
|           } | ||||
|         } | ||||
|         while (thisModem().stream.available()) { | ||||
|           thisModem().waitResponse(15, NULL, NULL); | ||||
|         } | ||||
|         break; | ||||
|       default: | ||||
|         // Just listen for any URC's | ||||
|         thisModem().waitResponse(100, NULL, NULL); | ||||
|         break; | ||||
| #if defined TINY_GSM_BUFFER_READ_AND_CHECK_SIZE | ||||
|     // Keep listening for modem URC's and proactively iterate through | ||||
|     // sockets asking if any data is avaiable | ||||
|     for (int mux = 0; mux < muxCount; mux++) { | ||||
|       GsmClient* sock = thisModem().sockets[mux]; | ||||
|       if (sock && sock->got_data) { | ||||
|         sock->got_data       = false; | ||||
|         sock->sock_available = thisModem().modemGetAvailable(mux); | ||||
|       } | ||||
|     } | ||||
|     while (thisModem().stream.available()) { | ||||
|       thisModem().waitResponse(15, NULL, NULL); | ||||
|     } | ||||
|  | ||||
| #elif defined TINY_GSM_NO_MODEM_BUFFER || defined TINY_GSM_BUFFER_READ_NO_CHECK | ||||
|     // Just listen for any URC's | ||||
|     thisModem().waitResponse(100, NULL, NULL); | ||||
|  | ||||
| #else | ||||
| #error Modem client has been incorrectly created | ||||
| #endif | ||||
|   } | ||||
|  | ||||
|   // Yields up to a time-out period and then reads a character from the stream | ||||
|   | ||||
		Reference in New Issue
	
	Block a user