Added setPhoneFunctionalityImpl function
This commit is contained in:
@@ -203,8 +203,7 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
protected:
|
||||
bool restartImpl() {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=1,1"));
|
||||
if (waitResponse(10000L, GF("OK")) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
waitResponse(10000L, GF("APP RDY"));
|
||||
return init();
|
||||
}
|
||||
@@ -225,6 +224,11 @@ class TinyGsmBG96 : public TinyGsmModem<TinyGsmBG96>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L, GF("OK")) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -172,8 +172,7 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
protected:
|
||||
bool restartImpl() {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=15"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(15)) { return false; }
|
||||
// MODEM:STARTUP
|
||||
waitResponse(60000L, GF(GSM_NL "+PBREADY" GSM_NL));
|
||||
return init();
|
||||
@@ -189,6 +188,11 @@ class TinyGsmM590 : public TinyGsmModem<TinyGsmM590>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -198,10 +198,8 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
protected:
|
||||
bool restartImpl() {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=0"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
sendAT(GF("+CFUN=1,1"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(0)) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
delay(3000);
|
||||
return init();
|
||||
}
|
||||
@@ -221,6 +219,11 @@ class TinyGsmMC60 : public TinyGsmModem<TinyGsmMC60>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -233,8 +233,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
}
|
||||
|
||||
bool radioOffImpl() {
|
||||
sendAT(GF("+CFUN=4"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(4)) { return false; }
|
||||
delay(3000);
|
||||
return true;
|
||||
}
|
||||
@@ -244,6 +243,11 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -212,10 +212,8 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
||||
*/
|
||||
protected:
|
||||
bool restartImpl() {
|
||||
sendAT(GF("+CFUN=0"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
sendAT(GF("+CFUN=1,1"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(0)) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
waitResponse(10000L, GF("SMS Ready"), GF("RDY"));
|
||||
return init();
|
||||
}
|
||||
@@ -234,6 +232,11 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -232,8 +232,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
}
|
||||
|
||||
bool radioOffImpl() {
|
||||
sendAT(GF("+CFUN=4"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(4)) { return false; }
|
||||
delay(3000);
|
||||
return true;
|
||||
}
|
||||
@@ -243,6 +242,11 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -253,10 +253,8 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("&W"));
|
||||
waitResponse();
|
||||
sendAT(GF("+CFUN=0"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
sendAT(GF("+CFUN=1,1"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(0)) { return false; }
|
||||
if (!setPhoneFunctionality(1, true)) { return false; }
|
||||
delay(3000);
|
||||
return init();
|
||||
}
|
||||
@@ -275,6 +273,15 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
|
||||
return waitResponse() == 1;
|
||||
}
|
||||
|
||||
// <fun> 0 Minimum functionality
|
||||
// <fun> 1 Full functionality (Default)
|
||||
// <fun> 4 Disable phone both transmit and receive RF circuits.
|
||||
// <rst> Reset the MT before setting it to <fun> power level.
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -298,8 +298,7 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
// using +CFUN=15 instead of the more common CFUN=1,1
|
||||
bool restartImpl() {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=15"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(15)) { return false; }
|
||||
delay(3000); // TODO(?): Verify delay timing here
|
||||
return init();
|
||||
}
|
||||
@@ -311,6 +310,11 @@ class TinyGsmSaraR4 : public TinyGsmModem<TinyGsmSaraR4>,
|
||||
|
||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -235,8 +235,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
bool factoryDefaultImpl() {
|
||||
sendAT(GF("+UFACTORY=0,1")); // No factory restore, erase NVM
|
||||
waitResponse();
|
||||
sendAT(GF("+CFUN=16")); // Reset
|
||||
return waitResponse() == 1;
|
||||
return setPhoneFunctionality(16); // Reset
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -245,8 +244,7 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
protected:
|
||||
bool restartImpl() {
|
||||
if (!testAT()) { return false; }
|
||||
sendAT(GF("+CFUN=16"));
|
||||
if (waitResponse(10000L) != 1) { return false; }
|
||||
if (!setPhoneFunctionality(16)) { return false; }
|
||||
delay(3000); // TODO(?): Verify delay timing here
|
||||
return init();
|
||||
}
|
||||
@@ -258,6 +256,11 @@ class TinyGsmUBLOX : public TinyGsmModem<TinyGsmUBLOX>,
|
||||
|
||||
bool sleepEnableImpl(bool enable = true) TINY_GSM_ATTR_NOT_AVAILABLE;
|
||||
|
||||
bool setPhoneFunctionalityImpl(uint8_t fun, bool reset = false) {
|
||||
sendAT(GF("+CFUN="), fun, reset ? ",1" : "");
|
||||
return waitResponse(10000L) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
*/
|
||||
|
@@ -65,6 +65,9 @@ class TinyGsmModem {
|
||||
bool sleepEnable(bool enable = true) {
|
||||
return thisModem().sleepEnableImpl(enable);
|
||||
}
|
||||
bool setPhoneFunctionality(uint8_t fun, bool reset = false) {
|
||||
return thisModem().setPhoneFunctionality(fun, reset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic network functions
|
||||
@@ -164,8 +167,7 @@ class TinyGsmModem {
|
||||
*/
|
||||
protected:
|
||||
bool radioOffImpl() {
|
||||
thisModem().sendAT(GF("+CFUN=0"));
|
||||
if (thisModem().waitResponse(10000L) != 1) { return false; }
|
||||
if (!thisModem().setPhoneFunctionality(0)) { return false; }
|
||||
delay(3000);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user