Clarify units of timeouts
This commit is contained in:
		@@ -66,12 +66,12 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    uint8_t newMux = -1;
 | 
					    uint8_t newMux = -1;
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, &newMux, timeout)
 | 
					    sock_connected = at->modemConnect(host, port, &newMux, timeout_s)
 | 
				
			||||||
    if (sock_connected) {
 | 
					    if (sock_connected) {
 | 
				
			||||||
      mux = newMux;
 | 
					      mux = newMux;
 | 
				
			||||||
      at->sockets[mux] = this;
 | 
					      at->sockets[mux] = this;
 | 
				
			||||||
@@ -222,8 +222,8 @@ TINY_GSM_MODEM_SIM_UNLOCK_CPIN()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -504,16 +504,17 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t* mux, int timeout = 75000L) {
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t* mux, int timeout_s = 75) {
 | 
				
			||||||
    unsigned long startMillis = millis();
 | 
					    unsigned long startMillis = millis();
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sendAT(GF("+CIPSTART="),  GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
					    sendAT(GF("+CIPSTART="),  GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
				
			||||||
    if (waitResponse(timeout, GF(GSM_NL "+CIPNUM:")) != 1) {
 | 
					    if (waitResponse(timeout_ms, GF(GSM_NL "+CIPNUM:")) != 1) {
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    int newMux = stream.readStringUntil('\n').toInt();
 | 
					    int newMux = stream.readStringUntil('\n').toInt();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int rsp = waitResponse((timeout - (millis() - startMillis)),
 | 
					    int rsp = waitResponse((timeout_ms- (millis() - startMillis)),
 | 
				
			||||||
                           GF("CONNECT OK" GSM_NL),
 | 
					                           GF("CONNECT OK" GSM_NL),
 | 
				
			||||||
                           GF("CONNECT FAIL" GSM_NL),
 | 
					                           GF("CONNECT FAIL" GSM_NL),
 | 
				
			||||||
                           GF("ALREADY CONNECT" GSM_NL));
 | 
					                           GF("ALREADY CONNECT" GSM_NL));
 | 
				
			||||||
@@ -554,7 +555,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -614,7 +615,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -627,12 +628,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,11 +71,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,11 +134,11 @@ private:
 | 
				
			|||||||
//   {}
 | 
					//   {}
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// public:
 | 
					// public:
 | 
				
			||||||
//   virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					//   virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
//     stop();
 | 
					//     stop();
 | 
				
			||||||
//     TINY_GSM_YIELD();
 | 
					//     TINY_GSM_YIELD();
 | 
				
			||||||
//     rx.clear();
 | 
					//     rx.clear();
 | 
				
			||||||
//     sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					//     sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
//     return sock_connected;
 | 
					//     return sock_connected;
 | 
				
			||||||
//   }
 | 
					//   }
 | 
				
			||||||
// };
 | 
					// };
 | 
				
			||||||
@@ -257,8 +257,8 @@ TINY_GSM_MODEM_SIM_UNLOCK_CPIN()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -471,15 +471,17 @@ TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 20000L)
 | 
					                    bool ssl = false, int timeout_s = 20)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    int rsp;
 | 
					    int rsp;
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // <PDPcontextID>(1-16), <connectID>(0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE",
 | 
					    // <PDPcontextID>(1-16), <connectID>(0-11),"TCP/UDP/TCP LISTENER/UDP SERVICE",
 | 
				
			||||||
    // "<IP_address>/<domain_name>",<remote_port>,<local_port>,<access_mode>(0-2 0=buffer)
 | 
					    // "<IP_address>/<domain_name>",<remote_port>,<local_port>,<access_mode>(0-2 0=buffer)
 | 
				
			||||||
    sendAT(GF("+QIOPEN=1,"), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port, GF(",0,0"));
 | 
					    sendAT(GF("+QIOPEN=1,"), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port, GF(",0,0"));
 | 
				
			||||||
    rsp = waitResponse();
 | 
					    rsp = waitResponse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (waitResponse(timeout, GF(GSM_NL "+QIOPEN:")) != 1) {
 | 
					    if (waitResponse(timeout_ms, GF(GSM_NL "+QIOPEN:")) != 1) {
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -569,7 +571,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -625,7 +627,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          data = "";
 | 
					          data = "";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -638,12 +640,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,11 +68,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,11 +118,11 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -270,8 +270,8 @@ TINY_GSM_MODEM_MAINTAIN_LISTEN()
 | 
				
			|||||||
    return (s == REG_OK_IP || s == REG_OK_TCP);
 | 
					    return (s == REG_OK_IP || s == REG_OK_TCP);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool waitForNetwork(unsigned long timeout = 60000L) {
 | 
					  bool waitForNetwork(unsigned long timeout_ms = 60000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CIPSTATUS"));
 | 
					      sendAT(GF("+CIPSTATUS"));
 | 
				
			||||||
      int res1 = waitResponse(3000, GF("busy p..."), GF("STATUS:"));
 | 
					      int res1 = waitResponse(3000, GF("busy p..."), GF("STATUS:"));
 | 
				
			||||||
      if (res1 == 2) {
 | 
					      if (res1 == 2) {
 | 
				
			||||||
@@ -332,8 +332,9 @@ TINY_GSM_MODEM_MAINTAIN_LISTEN()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    if (ssl) {
 | 
					    if (ssl) {
 | 
				
			||||||
      sendAT(GF("+CIPSSLSIZE=4096"));
 | 
					      sendAT(GF("+CIPSSLSIZE=4096"));
 | 
				
			||||||
      waitResponse();
 | 
					      waitResponse();
 | 
				
			||||||
@@ -341,7 +342,7 @@ protected:
 | 
				
			|||||||
    sendAT(GF("+CIPSTART="), mux, ',', ssl ? GF("\"SSL") : GF("\"TCP"),
 | 
					    sendAT(GF("+CIPSTART="), mux, ',', ssl ? GF("\"SSL") : GF("\"TCP"),
 | 
				
			||||||
           GF("\",\""), host, GF("\","), port, GF(","), TINY_GSM_TCP_KEEP_ALIVE);
 | 
					           GF("\",\""), host, GF("\","), port, GF(","), TINY_GSM_TCP_KEEP_ALIVE);
 | 
				
			||||||
    // TODO: Check mux
 | 
					    // TODO: Check mux
 | 
				
			||||||
    int rsp = waitResponse(timeout,
 | 
					    int rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                           GFP(GSM_OK),
 | 
					                           GFP(GSM_OK),
 | 
				
			||||||
                           GFP(GSM_ERROR),
 | 
					                           GFP(GSM_ERROR),
 | 
				
			||||||
                           GF("ALREADY CONNECT"));
 | 
					                           GF("ALREADY CONNECT"));
 | 
				
			||||||
@@ -376,7 +377,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -438,7 +439,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -451,12 +452,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,11 +68,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -219,8 +219,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -276,8 +276,8 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
    sendAT(GF("+XIIC=1"));
 | 
					    sendAT(GF("+XIIC=1"));
 | 
				
			||||||
    waitResponse();
 | 
					    waitResponse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const unsigned long timeout = 60000L;
 | 
					    const unsigned long timeout_ms = 60000L;
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      if (isGprsConnected()) {
 | 
					      if (isGprsConnected()) {
 | 
				
			||||||
        //goto set_dns; // TODO
 | 
					        //goto set_dns; // TODO
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
@@ -413,12 +413,13 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux, int timeout = 75000L) {
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux, int timeout_s = 75) {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    for (int i=0; i<3; i++) { // TODO: no need for loop?
 | 
					    for (int i=0; i<3; i++) { // TODO: no need for loop?
 | 
				
			||||||
      String ip = dnsIpQuery(host);
 | 
					      String ip = dnsIpQuery(host);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      sendAT(GF("+TCPSETUP="), mux, GF(","), ip, GF(","), port);
 | 
					      sendAT(GF("+TCPSETUP="), mux, GF(","), ip, GF(","), port);
 | 
				
			||||||
      int rsp = waitResponse(timeout,
 | 
					      int rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                            GF(",OK" GSM_NL),
 | 
					                            GF(",OK" GSM_NL),
 | 
				
			||||||
                            GF(",FAIL" GSM_NL),
 | 
					                            GF(",FAIL" GSM_NL),
 | 
				
			||||||
                            GF("+TCPSETUP:Error" GSM_NL));
 | 
					                            GF("+TCPSETUP:Error" GSM_NL));
 | 
				
			||||||
@@ -475,7 +476,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -536,7 +537,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -549,12 +550,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,11 +71,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,11 +134,11 @@ private:
 | 
				
			|||||||
//   {}
 | 
					//   {}
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// public:
 | 
					// public:
 | 
				
			||||||
//   virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					//   virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
//     stop();
 | 
					//     stop();
 | 
				
			||||||
//     TINY_GSM_YIELD();
 | 
					//     TINY_GSM_YIELD();
 | 
				
			||||||
//     rx.clear();
 | 
					//     rx.clear();
 | 
				
			||||||
//     sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					//     sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
//     return sock_connected;
 | 
					//     return sock_connected;
 | 
				
			||||||
//   }
 | 
					//   }
 | 
				
			||||||
// };
 | 
					// };
 | 
				
			||||||
@@ -265,8 +265,8 @@ TINY_GSM_MODEM_SIM_UNLOCK_CPIN()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -519,10 +519,11 @@ TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
					    sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
				
			||||||
    int rsp = waitResponse(timeout,
 | 
					    int rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                           GF("CONNECT OK" GSM_NL),
 | 
					                           GF("CONNECT OK" GSM_NL),
 | 
				
			||||||
                           GF("CONNECT FAIL" GSM_NL),
 | 
					                           GF("CONNECT FAIL" GSM_NL),
 | 
				
			||||||
                           GF("ALREADY CONNECT" GSM_NL));
 | 
					                           GF("ALREADY CONNECT" GSM_NL));
 | 
				
			||||||
@@ -624,7 +625,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -677,7 +678,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -690,12 +691,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,11 +75,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -138,11 +138,11 @@ private:
 | 
				
			|||||||
//   {}
 | 
					//   {}
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// public:
 | 
					// public:
 | 
				
			||||||
//   virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					//   virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
//     stop();
 | 
					//     stop();
 | 
				
			||||||
//     TINY_GSM_YIELD();
 | 
					//     TINY_GSM_YIELD();
 | 
				
			||||||
//     rx.clear();
 | 
					//     rx.clear();
 | 
				
			||||||
//     sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					//     sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
//     return sock_connected;
 | 
					//     return sock_connected;
 | 
				
			||||||
//   }
 | 
					//   }
 | 
				
			||||||
// };
 | 
					// };
 | 
				
			||||||
@@ -278,8 +278,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -538,10 +538,11 @@ TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
					    sendAT(GF("+QIOPEN="), mux, GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
				
			||||||
    int rsp = waitResponse(timeout,
 | 
					    int rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                           GF("CONNECT OK" GSM_NL),
 | 
					                           GF("CONNECT OK" GSM_NL),
 | 
				
			||||||
                           GF("CONNECT FAIL" GSM_NL),
 | 
					                           GF("CONNECT FAIL" GSM_NL),
 | 
				
			||||||
                           GF("ALREADY CONNECT" GSM_NL));
 | 
					                           GF("ALREADY CONNECT" GSM_NL));
 | 
				
			||||||
@@ -644,7 +645,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -701,7 +702,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -714,12 +715,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL, GsmConstStr r6=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5, r6);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5, r6);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,11 +76,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -140,11 +140,11 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -269,8 +269,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -761,11 +761,12 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    int rsp;
 | 
					    int rsp;
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
					    sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
				
			||||||
    rsp = waitResponse(timeout,
 | 
					    rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                       GF("CONNECT OK" GSM_NL),
 | 
					                       GF("CONNECT OK" GSM_NL),
 | 
				
			||||||
                       GF("CONNECT FAIL" GSM_NL),
 | 
					                       GF("CONNECT FAIL" GSM_NL),
 | 
				
			||||||
                       GF("ALREADY CONNECT" GSM_NL),
 | 
					                       GF("ALREADY CONNECT" GSM_NL),
 | 
				
			||||||
@@ -862,7 +863,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -928,7 +929,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -941,12 +942,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,11 +77,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -141,11 +141,11 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -301,8 +301,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -682,9 +682,10 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    int rsp;
 | 
					    int rsp;
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
#if !defined(TINY_GSM_MODEM_SIM900)
 | 
					#if !defined(TINY_GSM_MODEM_SIM900)
 | 
				
			||||||
    sendAT(GF("+CIPSSL="), ssl);
 | 
					    sendAT(GF("+CIPSSL="), ssl);
 | 
				
			||||||
    rsp = waitResponse();
 | 
					    rsp = waitResponse();
 | 
				
			||||||
@@ -693,7 +694,7 @@ protected:
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
					    sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);
 | 
				
			||||||
    rsp = waitResponse(timeout,
 | 
					    rsp = waitResponse(timeout_ms,
 | 
				
			||||||
                       GF("CONNECT OK" GSM_NL),
 | 
					                       GF("CONNECT OK" GSM_NL),
 | 
				
			||||||
                       GF("CONNECT FAIL" GSM_NL),
 | 
					                       GF("CONNECT FAIL" GSM_NL),
 | 
				
			||||||
                       GF("ALREADY CONNECT" GSM_NL),
 | 
					                       GF("ALREADY CONNECT" GSM_NL),
 | 
				
			||||||
@@ -790,7 +791,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -856,7 +857,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -869,12 +870,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    // If we're creating a new connection on the same client, we need to wait
 | 
					    // If we're creating a new connection on the same client, we need to wait
 | 
				
			||||||
    // until the async close has finished on Cat-M modems.
 | 
					    // until the async close has finished on Cat-M modems.
 | 
				
			||||||
@@ -94,7 +94,7 @@ public:
 | 
				
			|||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint8_t oldMux = mux;
 | 
					    uint8_t oldMux = mux;
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, &mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, &mux, timeout_s);
 | 
				
			||||||
    if (mux != oldMux) {
 | 
					    if (mux != oldMux) {
 | 
				
			||||||
        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
					        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
				
			||||||
        at->sockets[oldMux] = NULL;
 | 
					        at->sockets[oldMux] = NULL;
 | 
				
			||||||
@@ -159,12 +159,12 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    uint8_t oldMux = mux;
 | 
					    uint8_t oldMux = mux;
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, &mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, &mux, true, timeout_s);
 | 
				
			||||||
    if (mux != oldMux) {
 | 
					    if (mux != oldMux) {
 | 
				
			||||||
        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
					        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
				
			||||||
        at->sockets[oldMux] = NULL;
 | 
					        at->sockets[oldMux] = NULL;
 | 
				
			||||||
@@ -325,8 +325,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
    return res;
 | 
					    return res;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -529,8 +529,9 @@ TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t* mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t* mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 120000L)
 | 
					                    bool ssl = false, int timeout_s = 120)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    sendAT(GF("+USOCR=6"));  // create a socket
 | 
					    sendAT(GF("+USOCR=6"));  // create a socket
 | 
				
			||||||
    if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) {  // reply is +USOCR: ## of socket created
 | 
					    if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) {  // reply is +USOCR: ## of socket created
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
@@ -555,7 +556,7 @@ protected:
 | 
				
			|||||||
    // TODO:  Use faster "asynchronous" connection?
 | 
					    // TODO:  Use faster "asynchronous" connection?
 | 
				
			||||||
    // We would have to wait for the +UUSOCO URC to verify connection
 | 
					    // We would have to wait for the +UUSOCO URC to verify connection
 | 
				
			||||||
    sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port);
 | 
					    sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port);
 | 
				
			||||||
    int rsp = waitResponse(timeout);
 | 
					    int rsp = waitResponse(timeout_ms);
 | 
				
			||||||
    return (1 == rsp);
 | 
					    return (1 == rsp);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -663,7 +664,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -715,7 +716,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -728,12 +729,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,11 +83,11 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    if (sock_connected) stop();
 | 
					    if (sock_connected) stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -150,7 +150,7 @@ protected:
 | 
				
			|||||||
  bool          strictSSL = false;
 | 
					  bool          strictSSL = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
@@ -172,7 +172,7 @@ public:
 | 
				
			|||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,8 +217,8 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_SET_BAUD_IPR()
 | 
					TINY_GSM_MODEM_SET_BAUD_IPR()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool testAT(unsigned long timeout = 10000L) {
 | 
					  bool testAT(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF(""));
 | 
					      sendAT(GF(""));
 | 
				
			||||||
      if (waitResponse(200) == 1) {
 | 
					      if (waitResponse(200) == 1) {
 | 
				
			||||||
          delay(100);
 | 
					          delay(100);
 | 
				
			||||||
@@ -317,8 +317,8 @@ TINY_GSM_MODEM_SIM_UNLOCK_CPIN()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
					TINY_GSM_MODEM_GET_IMEI_GSN()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -478,10 +478,11 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
 {
 | 
					 {
 | 
				
			||||||
    int rsp;
 | 
					    int rsp;
 | 
				
			||||||
    unsigned long startMillis = millis();
 | 
					    unsigned long startMillis = millis();
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ssl) {
 | 
					    if (ssl) {
 | 
				
			||||||
      // enable SSl and use security profile 1
 | 
					      // enable SSl and use security profile 1
 | 
				
			||||||
@@ -499,7 +500,7 @@ protected:
 | 
				
			|||||||
    waitResponse();
 | 
					    waitResponse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sendAT(GF("+SQNSD="), mux, ",0,", port, ',', GF("\""), host, GF("\""), ",0,0,1");
 | 
					    sendAT(GF("+SQNSD="), mux, ",0,", port, ',', GF("\""), host, GF("\""), ",0,0,1");
 | 
				
			||||||
    rsp = waitResponse((timeout - (millis() - startMillis)),
 | 
					    rsp = waitResponse((timeout_ms - (millis() - startMillis)),
 | 
				
			||||||
                      GF("OK" GSM_NL),
 | 
					                      GF("OK" GSM_NL),
 | 
				
			||||||
                      GF("NO CARRIER" GSM_NL)
 | 
					                      GF("NO CARRIER" GSM_NL)
 | 
				
			||||||
                      );
 | 
					                      );
 | 
				
			||||||
@@ -509,7 +510,7 @@ protected:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // wait until we get a good status
 | 
					    // wait until we get a good status
 | 
				
			||||||
    bool connected = false;
 | 
					    bool connected = false;
 | 
				
			||||||
    while (!connected && ((millis() - startMillis) < timeout)) {
 | 
					    while (!connected && ((millis() - startMillis) < timeout_ms)) {
 | 
				
			||||||
      connected = modemGetConnected(mux);
 | 
					      connected = modemGetConnected(mux);
 | 
				
			||||||
      delay(100); // socket may be in opening state
 | 
					      delay(100); // socket may be in opening state
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -593,7 +594,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -643,7 +644,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -655,12 +656,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,13 +72,13 @@ public:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint8_t oldMux = mux;
 | 
					    uint8_t oldMux = mux;
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, &mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, &mux, timeout_s);
 | 
				
			||||||
    if (mux != oldMux) {
 | 
					    if (mux != oldMux) {
 | 
				
			||||||
        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
					        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
				
			||||||
        at->sockets[oldMux] = NULL;
 | 
					        at->sockets[oldMux] = NULL;
 | 
				
			||||||
@@ -143,12 +143,12 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    stop();
 | 
					    stop();
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    rx.clear();
 | 
					    rx.clear();
 | 
				
			||||||
    uint8_t oldMux = mux;
 | 
					    uint8_t oldMux = mux;
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, &mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, &mux, true, timeout_s);
 | 
				
			||||||
    if (mux != oldMux) {
 | 
					    if (mux != oldMux) {
 | 
				
			||||||
        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
					        DBG("WARNING:  Mux number changed from", oldMux, "to", mux);
 | 
				
			||||||
        at->sockets[oldMux] = NULL;
 | 
					        at->sockets[oldMux] = NULL;
 | 
				
			||||||
@@ -314,8 +314,8 @@ TINY_GSM_MODEM_GET_SIMCCID_CCID()
 | 
				
			|||||||
    return res;
 | 
					    return res;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      sendAT(GF("+CPIN?"));
 | 
					      sendAT(GF("+CPIN?"));
 | 
				
			||||||
      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
					      if (waitResponse(GF(GSM_NL "+CPIN:")) != 1) {
 | 
				
			||||||
        delay(1000);
 | 
					        delay(1000);
 | 
				
			||||||
@@ -512,8 +512,9 @@ TINY_GSP_MODEM_GET_GPRS_IP_CONNECTED()
 | 
				
			|||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t* mux,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t* mux,
 | 
				
			||||||
                    bool ssl = false, int timeout = 120000L)
 | 
					                    bool ssl = false, int timeout_s = 120)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    sendAT(GF("+USOCR=6"));  // create a socket
 | 
					    sendAT(GF("+USOCR=6"));  // create a socket
 | 
				
			||||||
    if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) {  // reply is +USOCR: ## of socket created
 | 
					    if (waitResponse(GF(GSM_NL "+USOCR:")) != 1) {  // reply is +USOCR: ## of socket created
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
@@ -538,7 +539,7 @@ protected:
 | 
				
			|||||||
    // TODO:  Use faster "asynchronous" connection?
 | 
					    // TODO:  Use faster "asynchronous" connection?
 | 
				
			||||||
    // We would have to wait for the +UUSOCO URC to verify connection
 | 
					    // We would have to wait for the +UUSOCO URC to verify connection
 | 
				
			||||||
    sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port);
 | 
					    sendAT(GF("+USOCO="), *mux, ",\"", host, "\",", port);
 | 
				
			||||||
    int rsp = waitResponse(timeout);
 | 
					    int rsp = waitResponse(timeout_ms);
 | 
				
			||||||
    return (1 == rsp);
 | 
					    return (1 == rsp);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -648,7 +649,7 @@ public:
 | 
				
			|||||||
TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
					TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: Optimize this!
 | 
					  // TODO: Optimize this!
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -700,7 +701,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          DBG("### Closed: ", mux);
 | 
					          DBG("### Closed: ", mux);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -713,12 +714,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=GFP(GSM_CME_ERROR), GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,20 +96,20 @@ public:
 | 
				
			|||||||
  // last set.  The TCP connection itself is not opened until you attempt to send data.
 | 
					  // last set.  The TCP connection itself is not opened until you attempt to send data.
 | 
				
			||||||
  // Because all settings are saved to flash, it is possible (or likely) that
 | 
					  // Because all settings are saved to flash, it is possible (or likely) that
 | 
				
			||||||
  // you could send data even if you haven't "made" any connection.
 | 
					  // you could send data even if you haven't "made" any connection.
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    // NOTE:  Not caling stop() or yeild() here
 | 
					    // NOTE:  Not caling stop() or yeild() here
 | 
				
			||||||
    at->streamClear();  // Empty anything in the buffer before starting
 | 
					    at->streamClear();  // Empty anything in the buffer before starting
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port) {
 | 
					  virtual int connect(const char *host, uint16_t port) {
 | 
				
			||||||
    return connect(host, port, 75000L);
 | 
					    return connect(host, port, 75000L);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  virtual int connect(IPAddress ip, uint16_t port, int timeout) {
 | 
					  virtual int connect(IPAddress ip, uint16_t port, int timeout_s) {
 | 
				
			||||||
    // NOTE:  Not caling stop() or yeild() here
 | 
					    // NOTE:  Not caling stop() or yeild() here
 | 
				
			||||||
    at->streamClear();  // Empty anything in the buffer before starting
 | 
					    at->streamClear();  // Empty anything in the buffer before starting
 | 
				
			||||||
    sock_connected = at->modemConnect(ip, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(ip, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  virtual int connect(IPAddress ip, uint16_t port) {
 | 
					  virtual int connect(IPAddress ip, uint16_t port) {
 | 
				
			||||||
@@ -237,17 +237,17 @@ public:
 | 
				
			|||||||
  {}
 | 
					  {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port, int timeout) {
 | 
					  virtual int connect(const char *host, uint16_t port, int timeout_s) {
 | 
				
			||||||
    // NOTE:  Not caling stop() or yeild() here
 | 
					    // NOTE:  Not caling stop() or yeild() here
 | 
				
			||||||
    at->streamClear();  // Empty anything in the buffer before starting
 | 
					    at->streamClear();  // Empty anything in the buffer before starting
 | 
				
			||||||
    sock_connected = at->modemConnect(host, port, mux, true, timeout);
 | 
					    sock_connected = at->modemConnect(host, port, mux, true, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  virtual int connect(IPAddress ip, uint16_t port, int timeout) {
 | 
					  virtual int connect(IPAddress ip, uint16_t port, int timeout_s) {
 | 
				
			||||||
    // NOTE:  Not caling stop() or yeild() here
 | 
					    // NOTE:  Not caling stop() or yeild() here
 | 
				
			||||||
    at->streamClear();  // Empty anything in the buffer before starting
 | 
					    at->streamClear();  // Empty anything in the buffer before starting
 | 
				
			||||||
    sock_connected = at->modemConnect(ip, port, mux, timeout);
 | 
					    sock_connected = at->modemConnect(ip, port, mux, timeout_s);
 | 
				
			||||||
    return sock_connected;
 | 
					    return sock_connected;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -347,10 +347,10 @@ public:
 | 
				
			|||||||
    XBEE_COMMAND_END_DECORATOR
 | 
					    XBEE_COMMAND_END_DECORATOR
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool testAT(unsigned long timeout = 10000L) {
 | 
					  bool testAT(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    unsigned long start = millis();
 | 
					    unsigned long start = millis();
 | 
				
			||||||
    bool success = false;
 | 
					    bool success = false;
 | 
				
			||||||
    while (!success && millis() - start < timeout) {
 | 
					    while (!success && millis() - start < timeout_ms) {
 | 
				
			||||||
      if (!inCommandMode) {
 | 
					      if (!inCommandMode) {
 | 
				
			||||||
        success = commandMode();
 | 
					        success = commandMode();
 | 
				
			||||||
        if (success) exitCommand();
 | 
					        if (success) exitCommand();
 | 
				
			||||||
@@ -525,7 +525,7 @@ public:
 | 
				
			|||||||
    return sendATGetString(GF("IM"));
 | 
					    return sendATGetString(GF("IM"));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SimStatus getSimStatus(unsigned long timeout = 10000L) {
 | 
					  SimStatus getSimStatus(unsigned long timeout_ms = 10000L) {
 | 
				
			||||||
    return SIM_READY;  // unsupported
 | 
					    return SIM_READY;  // unsupported
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -644,9 +644,9 @@ public:
 | 
				
			|||||||
    return (s == REG_OK);
 | 
					    return (s == REG_OK);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool waitForNetwork(unsigned long timeout = 60000L) {
 | 
					  bool waitForNetwork(unsigned long timeout_ms = 60000L) {
 | 
				
			||||||
    XBEE_COMMAND_START_DECORATOR(5, false)
 | 
					    XBEE_COMMAND_START_DECORATOR(5, false)
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      if (isNetworkConnected()) {
 | 
					      if (isNetworkConnected()) {
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -791,17 +791,18 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  IPAddress getHostIP(const char* host, int timeout = 45000L) {
 | 
					  IPAddress getHostIP(const char* host, int timeout_s = 45) {
 | 
				
			||||||
    String strIP; strIP.reserve(16);
 | 
					    String strIP; strIP.reserve(16);
 | 
				
			||||||
    unsigned long startMillis = millis();
 | 
					    unsigned long startMillis = millis();
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    bool gotIP = false;
 | 
					    bool gotIP = false;
 | 
				
			||||||
    XBEE_COMMAND_START_DECORATOR(5, IPAddress(0,0,0,0))
 | 
					    XBEE_COMMAND_START_DECORATOR(5, IPAddress(0,0,0,0))
 | 
				
			||||||
    // XBee's require a numeric IP address for connection, but do provide the
 | 
					    // XBee's require a numeric IP address for connection, but do provide the
 | 
				
			||||||
    // functionality to look up the IP address from a fully qualified domain name
 | 
					    // functionality to look up the IP address from a fully qualified domain name
 | 
				
			||||||
    while (millis() - startMillis < timeout)  // the lookup can take a while
 | 
					    while (millis() - startMillis < timeout_ms)  // the lookup can take a while
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      sendAT(GF("LA"), host);
 | 
					      sendAT(GF("LA"), host);
 | 
				
			||||||
      while (stream.available() < 4 && (millis() - startMillis < timeout)) {};  // wait for any response
 | 
					      while (stream.available() < 4 && (millis() - startMillis < timeout_ms)) {};  // wait for any response
 | 
				
			||||||
      strIP = stream.readStringUntil('\r');  // read result
 | 
					      strIP = stream.readStringUntil('\r');  // read result
 | 
				
			||||||
      strIP.trim();
 | 
					      strIP.trim();
 | 
				
			||||||
      if (!strIP.endsWith(GF("ERROR"))) {
 | 
					      if (!strIP.endsWith(GF("ERROR"))) {
 | 
				
			||||||
@@ -820,9 +821,10 @@ protected:
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(const char* host, uint16_t port, uint8_t mux = 0,
 | 
					  bool modemConnect(const char* host, uint16_t port, uint8_t mux = 0,
 | 
				
			||||||
                    bool ssl = false, int timeout = 75000L)
 | 
					                    bool ssl = false, int timeout_s = 75)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    unsigned long startMillis = millis();
 | 
					    unsigned long startMillis = millis();
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    bool retVal = false;
 | 
					    bool retVal = false;
 | 
				
			||||||
     XBEE_COMMAND_START_DECORATOR(5, false)
 | 
					     XBEE_COMMAND_START_DECORATOR(5, false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -830,12 +832,12 @@ protected:
 | 
				
			|||||||
    // search for the IP to connect to
 | 
					    // search for the IP to connect to
 | 
				
			||||||
    if (this->savedHost != String(host) || savedIP == IPAddress(0,0,0,0)) {
 | 
					    if (this->savedHost != String(host) || savedIP == IPAddress(0,0,0,0)) {
 | 
				
			||||||
      this->savedHost = String(host);
 | 
					      this->savedHost = String(host);
 | 
				
			||||||
      savedIP = getHostIP(host, timeout);  // This will return 0.0.0.0 if lookup fails
 | 
					      savedIP = getHostIP(host, timeout_s);  // This will return 0.0.0.0 if lookup fails
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // If we now have a valid IP address, use it to connect
 | 
					    // If we now have a valid IP address, use it to connect
 | 
				
			||||||
    if (savedIP != IPAddress(0,0,0,0)) {  // Only re-set connection information if we have an IP address
 | 
					    if (savedIP != IPAddress(0,0,0,0)) {  // Only re-set connection information if we have an IP address
 | 
				
			||||||
      retVal = modemConnect(savedIP, port, mux, ssl, timeout - (millis() - startMillis));
 | 
					      retVal = modemConnect(savedIP, port, mux, ssl, timeout_ms - (millis() - startMillis));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    XBEE_COMMAND_END_DECORATOR
 | 
					    XBEE_COMMAND_END_DECORATOR
 | 
				
			||||||
@@ -843,10 +845,11 @@ protected:
 | 
				
			|||||||
    return retVal;
 | 
					    return retVal;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 0, bool ssl = false, int timeout = 75000L) {
 | 
					  bool modemConnect(IPAddress ip, uint16_t port, uint8_t mux = 0, bool ssl = false, int timeout_s = 75) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    savedIP = ip;  // Set the newly requested IP address
 | 
					    savedIP = ip;  // Set the newly requested IP address
 | 
				
			||||||
    bool success = true;
 | 
					    bool success = true;
 | 
				
			||||||
 | 
					    uint32_t timeout_ms = timeout_s*1000;
 | 
				
			||||||
    XBEE_COMMAND_START_DECORATOR(5, false)
 | 
					    XBEE_COMMAND_START_DECORATOR(5, false)
 | 
				
			||||||
    String host; host.reserve(16);
 | 
					    String host; host.reserve(16);
 | 
				
			||||||
    host += ip[0];
 | 
					    host += ip[0];
 | 
				
			||||||
@@ -870,7 +873,7 @@ protected:
 | 
				
			|||||||
    sendAT(GF("DE"), String(port, HEX));  // Set the destination port
 | 
					    sendAT(GF("DE"), String(port, HEX));  // Set the destination port
 | 
				
			||||||
    success &= (1 == waitResponse());
 | 
					    success &= (1 == waitResponse());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) {
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) {
 | 
				
			||||||
      if (modemGetConnected()) {
 | 
					      if (modemGetConnected()) {
 | 
				
			||||||
        sockets[mux]->sock_connected = true;
 | 
					        sockets[mux]->sock_connected = true;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
@@ -956,7 +959,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
  // NOTE:  This function is used while INSIDE command mode, so we're only
 | 
					  // NOTE:  This function is used while INSIDE command mode, so we're only
 | 
				
			||||||
  // waiting for requested responses.  The XBee has no unsoliliced responses
 | 
					  // waiting for requested responses.  The XBee has no unsoliliced responses
 | 
				
			||||||
  // (URC's) when in command mode.
 | 
					  // (URC's) when in command mode.
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout, String& data,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms, String& data,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -992,7 +995,7 @@ TINY_GSP_MODEM_STREAM_UTILITIES()
 | 
				
			|||||||
          goto finish;
 | 
					          goto finish;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } while (millis() - startMillis < timeout);
 | 
					    } while (millis() - startMillis < timeout_ms);
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (!index) {
 | 
					    if (!index) {
 | 
				
			||||||
      data.trim();
 | 
					      data.trim();
 | 
				
			||||||
@@ -1014,12 +1017,12 @@ finish:
 | 
				
			|||||||
    return index;
 | 
					    return index;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(uint32_t timeout,
 | 
					  uint8_t waitResponse(uint32_t timeout_ms,
 | 
				
			||||||
                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					                       GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
					                       GsmConstStr r3=NULL, GsmConstStr r4=NULL, GsmConstStr r5=NULL)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String data;
 | 
					    String data;
 | 
				
			||||||
    return waitResponse(timeout, data, r1, r2, r3, r4, r5);
 | 
					    return waitResponse(timeout_ms, data, r1, r2, r3, r4, r5);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
					  uint8_t waitResponse(GsmConstStr r1=GFP(GSM_OK), GsmConstStr r2=GFP(GSM_ERROR),
 | 
				
			||||||
@@ -1092,17 +1095,17 @@ finish:
 | 
				
			|||||||
    DBG(GF("### Modem: "), getModemName());
 | 
					    DBG(GF("### Modem: "), getModemName());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  String readResponseString(uint32_t timeout = 1000) {
 | 
					  String readResponseString(uint32_t timeout_ms = 1000) {
 | 
				
			||||||
    TINY_GSM_YIELD();
 | 
					    TINY_GSM_YIELD();
 | 
				
			||||||
    unsigned long startMillis = millis();
 | 
					    unsigned long startMillis = millis();
 | 
				
			||||||
    while (!stream.available() && millis() - startMillis < timeout) {};
 | 
					    while (!stream.available() && millis() - startMillis < timeout_ms) {};
 | 
				
			||||||
    String res = stream.readStringUntil('\r');  // lines end with carriage returns
 | 
					    String res = stream.readStringUntil('\r');  // lines end with carriage returns
 | 
				
			||||||
    res.trim();
 | 
					    res.trim();
 | 
				
			||||||
    return res;
 | 
					    return res;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int16_t readResponseInt(uint32_t timeout = 1000) {
 | 
					  int16_t readResponseInt(uint32_t timeout_ms = 1000) {
 | 
				
			||||||
    String res = readResponseString(timeout);  // it just works better reading a string first
 | 
					    String res = readResponseString(timeout_ms);  // it just works better reading a string first
 | 
				
			||||||
    char buf[5] = {0,};
 | 
					    char buf[5] = {0,};
 | 
				
			||||||
    res.toCharArray(buf, 5);
 | 
					    res.toCharArray(buf, 5);
 | 
				
			||||||
    int16_t intRes = strtol(buf, 0, 16);
 | 
					    int16_t intRes = strtol(buf, 0, 16);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -202,7 +202,7 @@ String TinyGsmDecodeHex16bit(String &instr) {
 | 
				
			|||||||
// Connect to a IP address given as an IPAddress object by
 | 
					// Connect to a IP address given as an IPAddress object by
 | 
				
			||||||
// converting said IP address to text
 | 
					// converting said IP address to text
 | 
				
			||||||
#define TINY_GSM_CLIENT_CONNECT_OVERLOADS() \
 | 
					#define TINY_GSM_CLIENT_CONNECT_OVERLOADS() \
 | 
				
			||||||
  virtual int connect(IPAddress ip, uint16_t port, int timeout) { \
 | 
					  virtual int connect(IPAddress ip, uint16_t port, int timeout_s) { \
 | 
				
			||||||
    String host; host.reserve(16); \
 | 
					    String host; host.reserve(16); \
 | 
				
			||||||
    host += ip[0]; \
 | 
					    host += ip[0]; \
 | 
				
			||||||
    host += "."; \
 | 
					    host += "."; \
 | 
				
			||||||
@@ -211,13 +211,13 @@ String TinyGsmDecodeHex16bit(String &instr) {
 | 
				
			|||||||
    host += ip[2]; \
 | 
					    host += ip[2]; \
 | 
				
			||||||
    host += "."; \
 | 
					    host += "."; \
 | 
				
			||||||
    host += ip[3]; \
 | 
					    host += ip[3]; \
 | 
				
			||||||
    return connect(host.c_str(), port, timeout); \
 | 
					    return connect(host.c_str(), port, timeout_s); \
 | 
				
			||||||
  } \
 | 
					  } \
 | 
				
			||||||
  virtual int connect(const char *host, uint16_t port) \
 | 
					  virtual int connect(const char *host, uint16_t port) { \
 | 
				
			||||||
    return connect(host, port, 75000L); \
 | 
					    return connect(host, port, 75); \
 | 
				
			||||||
  } \
 | 
					  } \
 | 
				
			||||||
  virtual int connect(IPAddress ip, uint16_t port) \
 | 
					  virtual int connect(IPAddress ip, uint16_t port) { \
 | 
				
			||||||
    return connect(ip, port, 75000L); \
 | 
					    return connect(ip, port, 75); \
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -415,8 +415,8 @@ String TinyGsmDecodeHex16bit(String &instr) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Test response to AT commands
 | 
					// Test response to AT commands
 | 
				
			||||||
#define TINY_GSM_MODEM_TEST_AT() \
 | 
					#define TINY_GSM_MODEM_TEST_AT() \
 | 
				
			||||||
  bool testAT(unsigned long timeout = 10000L) { \
 | 
					  bool testAT(unsigned long timeout_ms = 10000L) { \
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) { \
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) { \
 | 
				
			||||||
      sendAT(GF("")); \
 | 
					      sendAT(GF("")); \
 | 
				
			||||||
      if (waitResponse(200) == 1) return true; \
 | 
					      if (waitResponse(200) == 1) return true; \
 | 
				
			||||||
      delay(100); \
 | 
					      delay(100); \
 | 
				
			||||||
@@ -535,8 +535,8 @@ String TinyGsmDecodeHex16bit(String &instr) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Waits for network attachment
 | 
					// Waits for network attachment
 | 
				
			||||||
#define TINY_GSM_MODEM_WAIT_FOR_NETWORK() \
 | 
					#define TINY_GSM_MODEM_WAIT_FOR_NETWORK() \
 | 
				
			||||||
  bool waitForNetwork(unsigned long timeout = 60000L) { \
 | 
					  bool waitForNetwork(unsigned long timeout_ms = 60000L) { \
 | 
				
			||||||
    for (unsigned long start = millis(); millis() - start < timeout; ) { \
 | 
					    for (unsigned long start = millis(); millis() - start < timeout_ms; ) { \
 | 
				
			||||||
      if (isNetworkConnected()) { \
 | 
					      if (isNetworkConnected()) { \
 | 
				
			||||||
        return true; \
 | 
					        return true; \
 | 
				
			||||||
      } \
 | 
					      } \
 | 
				
			||||||
@@ -596,10 +596,10 @@ String TinyGsmDecodeHex16bit(String &instr) {
 | 
				
			|||||||
    /* DBG("### AT:", cmd...); */ \
 | 
					    /* DBG("### AT:", cmd...); */ \
 | 
				
			||||||
  } \
 | 
					  } \
 | 
				
			||||||
  \
 | 
					  \
 | 
				
			||||||
  bool streamSkipUntil(const char c, const unsigned long timeout = 1000L) { \
 | 
					  bool streamSkipUntil(const char c, const unsigned long timeout_ms = 1000L) { \
 | 
				
			||||||
    unsigned long startMillis = millis(); \
 | 
					    unsigned long startMillis = millis(); \
 | 
				
			||||||
    while (millis() - startMillis < timeout) { \
 | 
					    while (millis() - startMillis < timeout_ms) { \
 | 
				
			||||||
      while (millis() - startMillis < timeout && !stream.available()) { \
 | 
					      while (millis() - startMillis < timeout_ms && !stream.available()) { \
 | 
				
			||||||
        TINY_GSM_YIELD(); \
 | 
					        TINY_GSM_YIELD(); \
 | 
				
			||||||
      } \
 | 
					      } \
 | 
				
			||||||
      if (stream.read() == c) { \
 | 
					      if (stream.read() == c) { \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user