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

@@ -236,8 +236,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
}
/*
@@ -246,8 +245,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();
}
@@ -259,6 +257,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
*/