Deactivate contexts on Monarch
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,6 +24,7 @@ extra_envs.ini
|
||||
lib/readme.txt
|
||||
include/readme.txt
|
||||
.atomrc.cson
|
||||
.history
|
||||
|
||||
# VSCode
|
||||
.vscode/*
|
||||
|
@@ -383,7 +383,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
sendAT(GF("+CIPSHUT"));
|
||||
if (waitResponse(60000L) != 1) { return false; }
|
||||
|
||||
sendAT(GF("+CGATT=0")); // Deactivate the bearer context
|
||||
sendAT(GF("+CGATT=0")); // Detach from GPRS
|
||||
if (waitResponse(60000L) != 1) { return false; }
|
||||
|
||||
return true;
|
||||
@@ -396,9 +396,7 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
// May not return the "+CCID" before the number
|
||||
String getSimCCIDImpl() {
|
||||
sendAT(GF("+CCID"));
|
||||
if (waitResponse(GF(GSM_NL)) != 1) {
|
||||
return "";
|
||||
}
|
||||
if (waitResponse(GF(GSM_NL)) != 1) { return ""; }
|
||||
String res = stream.readStringUntil('\n');
|
||||
waitResponse();
|
||||
// Trim out the CCID header in case it is there
|
||||
|
@@ -367,8 +367,12 @@ class TinyGsmSequansMonarch
|
||||
}
|
||||
|
||||
bool gprsDisconnectImpl() {
|
||||
// Detach from PS network
|
||||
sendAT(GF("+CGATT=0"));
|
||||
if (waitResponse(60000L) != 1) { return false; }
|
||||
// Dectivate all PDP contexts
|
||||
sendAT(GF("+CGACT=0"));
|
||||
if (waitResponse(60000L) != 1) { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -572,9 +576,7 @@ class TinyGsmSequansMonarch
|
||||
// six possible sockets.
|
||||
sendAT(GF("+SQNSS"));
|
||||
for (int muxNo = 1; muxNo <= TINY_GSM_MUX_COUNT; muxNo++) {
|
||||
if (waitResponse(GFP(GSM_OK), GF(GSM_NL "+SQNSS: ")) != 2) {
|
||||
break;
|
||||
}
|
||||
if (waitResponse(GFP(GSM_OK), GF(GSM_NL "+SQNSS: ")) != 2) { break; }
|
||||
uint8_t status = 0;
|
||||
// if (streamGetIntBefore(',') != muxNo) { // check the mux no
|
||||
// DBG("### Warning: misaligned mux numbers!");
|
||||
@@ -593,8 +595,8 @@ class TinyGsmSequansMonarch
|
||||
// SOCK_OPENING = 6,
|
||||
GsmClientSequansMonarch* sock = sockets[mux % TINY_GSM_MUX_COUNT];
|
||||
if (sock) {
|
||||
sock->sock_connected =
|
||||
((status != SOCK_CLOSED) && (status != SOCK_INCOMING) &&
|
||||
sock->sock_connected = ((status != SOCK_CLOSED) &&
|
||||
(status != SOCK_INCOMING) &&
|
||||
(status != SOCK_OPENING));
|
||||
}
|
||||
}
|
||||
@@ -677,9 +679,7 @@ class TinyGsmSequansMonarch
|
||||
finish:
|
||||
if (!index) {
|
||||
data.trim();
|
||||
if (data.length()) {
|
||||
DBG("### Unhandled:", data);
|
||||
}
|
||||
if (data.length()) { DBG("### Unhandled:", data); }
|
||||
data = "";
|
||||
}
|
||||
// data.replace(GSM_NL, "/");
|
||||
|
Reference in New Issue
Block a user