|
@ -116,21 +116,21 @@ public: |
|
|
return connect(ip, port, 75); |
|
|
return connect(ip, port, 75); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
virtual void stop() { |
|
|
|
|
|
|
|
|
virtual void stop(uint32_t maxWaitMs) { |
|
|
at->streamClear(); // Empty anything in the buffer |
|
|
at->streamClear(); // Empty anything in the buffer |
|
|
at->commandMode(); |
|
|
at->commandMode(); |
|
|
// For WiFi models, there's no direct way to close the socket. This is a |
|
|
// 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. |
|
|
// hack to shut the socket by setting the timeout to zero. |
|
|
if (at->beeType == XBEE_S6B_WIFI) { |
|
|
if (at->beeType == XBEE_S6B_WIFI) { |
|
|
at->sendAT(GF("TM0")); // Set socket timeout (using Digi default of 10 seconds) |
|
|
at->sendAT(GF("TM0")); // Set socket timeout (using Digi default of 10 seconds) |
|
|
at->waitResponse(5000); // This response can be slow |
|
|
|
|
|
|
|
|
at->waitResponse(maxWaitMs); // This response can be slow |
|
|
at->writeChanges(); |
|
|
at->writeChanges(); |
|
|
} |
|
|
} |
|
|
// For cellular models, per documentation: If you change the TM (socket |
|
|
// For cellular models, per documentation: If you change the TM (socket |
|
|
// timeout) value while in Transparent Mode, the current connection is |
|
|
// timeout) value while in Transparent Mode, the current connection is |
|
|
// immediately closed. |
|
|
// immediately closed. |
|
|
at->sendAT(GF("TM64")); // Set socket timeout (using Digi default of 10 seconds) |
|
|
at->sendAT(GF("TM64")); // Set socket timeout (using Digi default of 10 seconds) |
|
|
at->waitResponse(5000); // This response can be slow |
|
|
|
|
|
|
|
|
at->waitResponse(maxWaitMs); // This response can be slow |
|
|
at->writeChanges(); |
|
|
at->writeChanges(); |
|
|
at->exitCommand(); |
|
|
at->exitCommand(); |
|
|
at->streamClear(); // Empty anything remaining in the buffer |
|
|
at->streamClear(); // Empty anything remaining in the buffer |
|
@ -142,6 +142,8 @@ public: |
|
|
// much more nicely with libraries like PubSubClient. |
|
|
// much more nicely with libraries like PubSubClient. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual void stop() { stop(5000L); } |
|
|
|
|
|
|
|
|
virtual size_t write(const uint8_t *buf, size_t size) { |
|
|
virtual size_t write(const uint8_t *buf, size_t size) { |
|
|
TINY_GSM_YIELD(); |
|
|
TINY_GSM_YIELD(); |
|
|
return at->modemSend(buf, size, mux); |
|
|
return at->modemSend(buf, size, mux); |
|
|