Merge pull request #389 from adrianca88/set_phone_functionality

Added setPhoneFunctionality method
This commit is contained in:
Sara Damiano
2020-10-01 14:04:31 -04:00
committed by GitHub
15 changed files with 78 additions and 28 deletions

View File

@@ -254,10 +254,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();
}
@@ -276,6 +274,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
*/