Fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TinyGSM",
|
"name": "TinyGSM",
|
||||||
"version": "0.7.1",
|
"version": "0.7.3",
|
||||||
"description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.",
|
"description": "A small Arduino library for GPRS modules, that just works. Includes examples for Blynk, MQTT, File Download, and Web Client. Supports many GSM, LTE, and WiFi modules with AT command interfaces.",
|
||||||
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M",
|
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M",
|
||||||
"authors":
|
"authors":
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=TinyGSM
|
name=TinyGSM
|
||||||
version=0.7.1
|
version=0.7.3
|
||||||
author=Volodymyr Shymanskyy
|
author=Volodymyr Shymanskyy
|
||||||
maintainer=Volodymyr Shymanskyy
|
maintainer=Volodymyr Shymanskyy
|
||||||
sentence=A small Arduino library for GPRS modules, that just works.
|
sentence=A small Arduino library for GPRS modules, that just works.
|
||||||
|
@@ -71,7 +71,7 @@ public:
|
|||||||
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_s)
|
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;
|
||||||
|
@@ -374,7 +374,7 @@ TINY_GSM_MODEM_WAIT_FOR_NETWORK()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that we have a local IP address
|
// Check that we have a local IP address
|
||||||
if (localIP() != 0) {
|
if (localIP() != IPAddress(0,0,0,0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -814,26 +814,37 @@ protected:
|
|||||||
// ^^ Confirmed number of data bytes to be read, which may be less than requested.
|
// ^^ Confirmed number of data bytes to be read, which may be less than requested.
|
||||||
// 0 indicates that no data can be read.
|
// 0 indicates that no data can be read.
|
||||||
|
|
||||||
size_t len_read = 0;
|
|
||||||
for (size_t i=0; i<TinyGsmMin(len_confirmed, len_requested) ; i++) {
|
for (size_t i=0; i<TinyGsmMin(len_confirmed, len_requested) ; i++) {
|
||||||
#ifdef TINY_GSM_USE_HEX
|
#ifdef TINY_GSM_USE_HEX
|
||||||
while (stream.available() < 2) { TINY_GSM_YIELD(); }
|
while (stream.available() < 2) { TINY_GSM_YIELD(); }
|
||||||
char buf[4] = { 0, };
|
char buf[4] = { 0, };
|
||||||
buf[0] = stream.read();
|
buf[0] = stream.read();
|
||||||
len_read++;
|
|
||||||
buf[1] = stream.read();
|
buf[1] = stream.read();
|
||||||
char c = strtol(buf, NULL, 16);
|
char c = strtol(buf, NULL, 16);
|
||||||
len_read++;
|
|
||||||
#else
|
#else
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
while (!stream.available()) { TINY_GSM_YIELD(); }
|
||||||
char c = stream.read();
|
char c = stream.read();
|
||||||
len_read++;
|
|
||||||
#endif
|
#endif
|
||||||
sockets[mux]->rx.put(c);
|
sockets[mux]->rx.put(c);
|
||||||
}
|
}
|
||||||
waitResponse();
|
waitResponse();
|
||||||
DBG("### READ:", len_read, "from", mux);
|
DBG("### READ:", len_read, "from", mux);
|
||||||
return len_read;
|
return TinyGsmMin(len_confirmed, len_requested);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t modemGetAvailable(uint8_t mux) {
|
||||||
|
sendAT(GF("+CIPRXGET=4,"), mux);
|
||||||
|
size_t result = 0;
|
||||||
|
if (waitResponse(GF("+CIPRXGET:")) == 1) {
|
||||||
|
streamSkipUntil(','); // Skip mode 4
|
||||||
|
streamSkipUntil(','); // Skip mux
|
||||||
|
result = stream.readStringUntil('\n').toInt();
|
||||||
|
waitResponse();
|
||||||
|
}
|
||||||
|
if (!result) {
|
||||||
|
sockets[mux]->sock_connected = modemGetConnected(mux);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modemGetConnected(uint8_t mux) {
|
bool modemGetConnected(uint8_t mux) {
|
||||||
|
@@ -742,26 +742,22 @@ protected:
|
|||||||
// ^^ Confirmed number of data bytes to be read, which may be less than requested.
|
// ^^ Confirmed number of data bytes to be read, which may be less than requested.
|
||||||
// 0 indicates that no data can be read.
|
// 0 indicates that no data can be read.
|
||||||
|
|
||||||
size_t len_read = 0;
|
|
||||||
for (size_t i=0; i<TinyGsmMin(len_confirmed, len_requested) ; i++) {
|
for (size_t i=0; i<TinyGsmMin(len_confirmed, len_requested) ; i++) {
|
||||||
#ifdef TINY_GSM_USE_HEX
|
#ifdef TINY_GSM_USE_HEX
|
||||||
while (stream.available() < 2) { TINY_GSM_YIELD(); }
|
while (stream.available() < 2) { TINY_GSM_YIELD(); }
|
||||||
char buf[4] = { 0, };
|
char buf[4] = { 0, };
|
||||||
buf[0] = stream.read();
|
buf[0] = stream.read();
|
||||||
len_read++;
|
|
||||||
buf[1] = stream.read();
|
buf[1] = stream.read();
|
||||||
char c = strtol(buf, NULL, 16);
|
char c = strtol(buf, NULL, 16);
|
||||||
len_read++;
|
|
||||||
#else
|
#else
|
||||||
while (!stream.available()) { TINY_GSM_YIELD(); }
|
while (!stream.available()) { TINY_GSM_YIELD(); }
|
||||||
char c = stream.read();
|
char c = stream.read();
|
||||||
len_read++;
|
|
||||||
#endif
|
#endif
|
||||||
sockets[mux]->rx.put(c);
|
sockets[mux]->rx.put(c);
|
||||||
}
|
}
|
||||||
waitResponse();
|
waitResponse();
|
||||||
DBG("### READ:", len_read, "from", mux);
|
DBG("### READ:", len_read, "from", mux);
|
||||||
return len_read;
|
return TinyGsmMin(len_confirmed, len_requested);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t modemGetAvailable(uint8_t mux) {
|
size_t modemGetAvailable(uint8_t mux) {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#define TinyGsmCommon_h
|
#define TinyGsmCommon_h
|
||||||
|
|
||||||
// The current library version number
|
// The current library version number
|
||||||
#define TINYGSM_VERSION "0.7.1"
|
#define TINYGSM_VERSION "0.7.3"
|
||||||
|
|
||||||
#if defined(SPARK) || defined(PARTICLE)
|
#if defined(SPARK) || defined(PARTICLE)
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
|
Reference in New Issue
Block a user