SIM7000: added methods to get some connection preferences, plus the
current connection technology
This commit is contained in:
@@ -262,6 +262,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
String getNetworkModes() {
|
String getNetworkModes() {
|
||||||
|
// Get the help string, not the setting value
|
||||||
sendAT(GF("+CNMP=?"));
|
sendAT(GF("+CNMP=?"));
|
||||||
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return ""; }
|
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return ""; }
|
||||||
String res = stream.readStringUntil('\n');
|
String res = stream.readStringUntil('\n');
|
||||||
@@ -269,6 +270,14 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getNetworkMode(int16_t & mode) {
|
||||||
|
sendAT(GF("+CNMP?"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return false; }
|
||||||
|
mode = streamGetIntBefore('\n');
|
||||||
|
waitResponse();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String setNetworkMode(uint8_t mode) {
|
String setNetworkMode(uint8_t mode) {
|
||||||
sendAT(GF("+CNMP="), mode);
|
sendAT(GF("+CNMP="), mode);
|
||||||
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return "OK"; }
|
if (waitResponse(GF(GSM_NL "+CNMP:")) != 1) { return "OK"; }
|
||||||
@@ -278,6 +287,7 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getPreferredModes() {
|
String getPreferredModes() {
|
||||||
|
// Get the help string, not the setting value
|
||||||
sendAT(GF("+CMNB=?"));
|
sendAT(GF("+CMNB=?"));
|
||||||
if (waitResponse(GF(GSM_NL "+CMNB:")) != 1) { return ""; }
|
if (waitResponse(GF(GSM_NL "+CMNB:")) != 1) { return ""; }
|
||||||
String res = stream.readStringUntil('\n');
|
String res = stream.readStringUntil('\n');
|
||||||
@@ -285,6 +295,14 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getPreferredMode(int16_t & mode) {
|
||||||
|
sendAT(GF("+CMNB?"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+CMNB:")) != 1) { return false; }
|
||||||
|
mode = streamGetIntBefore('\n');
|
||||||
|
waitResponse();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
String setPreferredMode(uint8_t mode) {
|
String setPreferredMode(uint8_t mode) {
|
||||||
sendAT(GF("+CMNB="), mode);
|
sendAT(GF("+CMNB="), mode);
|
||||||
if (waitResponse(GF(GSM_NL "+CMNB:")) != 1) { return "OK"; }
|
if (waitResponse(GF(GSM_NL "+CMNB:")) != 1) { return "OK"; }
|
||||||
@@ -293,6 +311,26 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getNetworkSystemMode(bool & n, int16_t & stat) {
|
||||||
|
// n: whether to automatically report the system mode info
|
||||||
|
// stat: the current service. 0 if it not connected
|
||||||
|
sendAT(GF("+CNSMOD?"));
|
||||||
|
if (waitResponse(GF(GSM_NL "+CNSMOD:")) != 1) { return false; }
|
||||||
|
n = streamGetIntBefore(',') != 0;
|
||||||
|
stat = streamGetIntBefore('\n');
|
||||||
|
waitResponse();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String setNetworkSystemMode(bool n) {
|
||||||
|
// n: whether to automatically report the system mode info
|
||||||
|
sendAT(GF("+CNSMOD="), int8_t(n));
|
||||||
|
if (waitResponse(GF(GSM_NL "+CNSMOD:")) != 1) { return "OK"; }
|
||||||
|
String res = stream.readStringUntil('\n');
|
||||||
|
waitResponse();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
String getLocalIPImpl() {
|
String getLocalIPImpl() {
|
||||||
sendAT(GF("+CIFSR;E0"));
|
sendAT(GF("+CIFSR;E0"));
|
||||||
String res;
|
String res;
|
||||||
|
Reference in New Issue
Block a user