Try again to get stop right
This commit is contained in:
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@@ -23,7 +23,7 @@ with your board before submitting any issues.
|
|||||||
|
|
||||||
Main processor board: <!-- Uno, Zero, ESP32, Particle, etc -->
|
Main processor board: <!-- Uno, Zero, ESP32, Particle, etc -->
|
||||||
Modem: <!-- Brand, model, variant, firmware version -->
|
Modem: <!-- Brand, model, variant, firmware version -->
|
||||||
TinyGSM version: <!-- always try to use the latest (0.9.15) -->
|
TinyGSM version: <!-- always try to use the latest (0.9.16) -->
|
||||||
Code: <!-- Example name or paste in your code -->
|
Code: <!-- Example name or paste in your code -->
|
||||||
|
|
||||||
### Scenario, steps to reproduce
|
### Scenario, steps to reproduce
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TinyGSM",
|
"name": "TinyGSM",
|
||||||
"version": "0.9.15",
|
"version": "0.9.16",
|
||||||
"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.9.15
|
version=0.9.16
|
||||||
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.
|
||||||
|
@@ -124,31 +124,10 @@ public:
|
|||||||
virtual void stop(uint32_t maxWaitMs) {
|
virtual void stop(uint32_t maxWaitMs) {
|
||||||
at->streamClear(); // Empty anything in the buffer
|
at->streamClear(); // Empty anything in the buffer
|
||||||
// empty the saved currently-in-use destination address
|
// empty the saved currently-in-use destination address
|
||||||
at->savedOperatingIP = IPAddress(0, 0, 0, 0);
|
at->modemStop(maxWaitMs);
|
||||||
at->commandMode();
|
at->streamClear(); // Empty anything in the buffer
|
||||||
|
|
||||||
// Get the current socket timeout
|
|
||||||
at->sendAT(GF("TM"));
|
|
||||||
String timeoutUsed = at->readResponseString(5000L);
|
|
||||||
|
|
||||||
// For WiFi models, there's no direct way to close the socket. This is a
|
|
||||||
// hack to shut the socket by setting the timeout to zero.
|
|
||||||
if (at->beeType == XBEE_S6B_WIFI) {
|
|
||||||
at->sendAT(GF("TM0")); // Set socket timeout to 0
|
|
||||||
at->waitResponse(maxWaitMs); // This response can be slow
|
|
||||||
at->writeChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
// For cellular models, per documentation: If you write the TM (socket
|
|
||||||
// timeout) value while in Transparent Mode, the current connection is
|
|
||||||
// immediately closed - this works even if the TM values is unchanged
|
|
||||||
at->sendAT(GF("TM"), timeoutUsed); // Re-set socket timeout
|
|
||||||
at->waitResponse(maxWaitMs); // This response can be slow
|
|
||||||
at->writeChanges();
|
|
||||||
at->exitCommand();
|
|
||||||
at->streamClear(); // Empty anything remaining in the buffer
|
|
||||||
sock_connected = false;
|
sock_connected = false;
|
||||||
|
|
||||||
// Note: because settings are saved in flash, the XBEE will attempt to
|
// Note: because settings are saved in flash, the XBEE will attempt to
|
||||||
// reconnect to the previous socket if it receives any outgoing data.
|
// reconnect to the previous socket if it receives any outgoing data.
|
||||||
// Setting sock_connected to false after the stop ensures that connected()
|
// Setting sock_connected to false after the stop ensures that connected()
|
||||||
@@ -1016,6 +995,36 @@ public:
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool modemStop(uint32_t maxWaitMs) {
|
||||||
|
streamClear(); // Empty anything in the buffer
|
||||||
|
// empty the saved currently-in-use destination address
|
||||||
|
savedOperatingIP = IPAddress(0, 0, 0, 0);
|
||||||
|
|
||||||
|
XBEE_COMMAND_START_DECORATOR(5, false)
|
||||||
|
|
||||||
|
// Get the current socket timeout
|
||||||
|
sendAT(GF("TM"));
|
||||||
|
String timeoutUsed = readResponseString(5000L);
|
||||||
|
|
||||||
|
// For WiFi models, there's no direct way to close the socket. This is a
|
||||||
|
// hack to shut the socket by setting the timeout to zero.
|
||||||
|
if (beeType == XBEE_S6B_WIFI) {
|
||||||
|
sendAT(GF("TM0")); // Set socket timeout to 0
|
||||||
|
waitResponse(maxWaitMs); // This response can be slow
|
||||||
|
writeChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
// For cellular models, per documentation: If you write the TM (socket
|
||||||
|
// timeout) value while in Transparent Mode, the current connection is
|
||||||
|
// immediately closed - this works even if the TM values is unchanged
|
||||||
|
sendAT(GF("TM"), timeoutUsed); // Re-set socket timeout
|
||||||
|
waitResponse(maxWaitMs); // This response can be slow
|
||||||
|
writeChanges();
|
||||||
|
|
||||||
|
XBEE_COMMAND_END_DECORATOR
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int16_t modemSend(const void* buff, size_t len, uint8_t mux = 0) {
|
int16_t modemSend(const void* buff, size_t len, uint8_t mux = 0) {
|
||||||
if (mux != 0) {
|
if (mux != 0) {
|
||||||
DBG("XBee only supports 1 IP channel in transparent mode!");
|
DBG("XBee only supports 1 IP channel in transparent mode!");
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#define TinyGsmCommon_h
|
#define TinyGsmCommon_h
|
||||||
|
|
||||||
// The current library version number
|
// The current library version number
|
||||||
#define TINYGSM_VERSION "0.9.15"
|
#define TINYGSM_VERSION "0.9.16"
|
||||||
|
|
||||||
#if defined(SPARK) || defined(PARTICLE)
|
#if defined(SPARK) || defined(PARTICLE)
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
|
Reference in New Issue
Block a user