diff --git a/src/TinyGsmClientA6.h b/src/TinyGsmClientA6.h index eb22be6..d1104db 100644 --- a/src/TinyGsmClientA6.h +++ b/src/TinyGsmClientA6.h @@ -439,88 +439,6 @@ public: return TinyGsmIpFromString(getLocalIP()); } - /* - * Phone Call functions - */ - - bool setGsmBusy(bool busy = true) TINY_GSM_ATTR_NOT_AVAILABLE; - - bool callAnswer() { - sendAT(GF("A")); - return waitResponse() == 1; - } - - // Returns true on pick-up, false on error/busy - bool callNumber(const String& number) { - if (number == GF("last")) { - sendAT(GF("DLST")); - } else { - sendAT(GF("D\""), number, "\";"); - } - - if (waitResponse(5000L) != 1) { - return false; - } - - if (waitResponse(60000L, - GF(GSM_NL "+CIEV: \"CALL\",1"), - GF(GSM_NL "+CIEV: \"CALL\",0"), - GFP(GSM_ERROR)) != 1) - { - return false; - } - - int rsp = waitResponse(60000L, - GF(GSM_NL "+CIEV: \"SOUNDER\",0"), - GF(GSM_NL "+CIEV: \"CALL\",0")); - - int rsp2 = waitResponse(300L, GF(GSM_NL "BUSY" GSM_NL), GF(GSM_NL "NO ANSWER" GSM_NL)); - - return rsp == 1 && rsp2 == 0; - } - - bool callHangup() { - sendAT(GF("H")); - return waitResponse() == 1; - } - - // 0-9,*,#,A,B,C,D - bool dtmfSend(char cmd, unsigned duration_ms = 100) { - duration_ms = constrain(duration_ms, 100, 1000); - - // The duration parameter is not working, so we simulate it using delay.. - // TODO: Maybe there's another way... - - //sendAT(GF("+VTD="), duration_ms / 100); - //waitResponse(); - - sendAT(GF("+VTS="), cmd); - if (waitResponse(10000L) == 1) { - delay(duration_ms); - return true; - } - return false; - } - - /* - * Audio functions - */ - - bool audioSetHeadphones() { - sendAT(GF("+SNFS=0")); - return waitResponse() == 1; - } - - bool audioSetSpeaker() { - sendAT(GF("+SNFS=1")); - return waitResponse() == 1; - } - - bool audioMuteMic(bool mute) { - sendAT(GF("+CMUT="), mute); - return waitResponse() == 1; - } - /* * Messaging functions */ diff --git a/src/TinyGsmClientM590.h b/src/TinyGsmClientM590.h index 07c4e2b..e3d3cd3 100644 --- a/src/TinyGsmClientM590.h +++ b/src/TinyGsmClientM590.h @@ -445,18 +445,6 @@ set_dns: return TinyGsmIpFromString(getLocalIP()); } - /* - * Phone Call functions - */ - - bool setGsmBusy(bool busy = true) TINY_GSM_ATTR_NOT_AVAILABLE; - - bool callAnswer() TINY_GSM_ATTR_NOT_AVAILABLE; - - bool callNumber(const String& number) TINY_GSM_ATTR_NOT_AVAILABLE; - - bool callHangup() TINY_GSM_ATTR_NOT_AVAILABLE; - /* * Messaging functions */ diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 074dddc..acdfcf8 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -331,28 +331,6 @@ public: return true; } - bool enableBluetooth() { - uint16_t state; - - sendAT(GF("+BTPOWER=1")); - if (waitResponse() != 1) { - return false; - } - - return true; - } - - bool disableBluetooth() { - uint16_t state; - - sendAT(GF("+BTPOWER=0")); - if (waitResponse() != 1) { - return false; - } - - return true; - } - /* During sleep, the SIM800 module has its serial communication disabled. In order to reestablish communication pull the DRT-pin of the SIM800 module LOW for at least 50ms. Then use this function to disable sleep mode. @@ -599,56 +577,6 @@ public: return TinyGsmIpFromString(getLocalIP()); } - /* - * Phone Call functions - */ - - bool setGsmBusy(bool busy = true) { - sendAT(GF("+GSMBUSY="), busy ? 1 : 0); - return waitResponse() == 1; - } - - bool callAnswer() { - sendAT(GF("A")); - return waitResponse() == 1; - } - - // Returns true on pick-up, false on error/busy - bool callNumber(const String& number) { - if (number == GF("last")) { - sendAT(GF("DL")); - } else { - sendAT(GF("D"), number, ";"); - } - int status = waitResponse(60000L, - GFP(GSM_OK), - GF("BUSY" GSM_NL), - GF("NO ANSWER" GSM_NL), - GF("NO CARRIER" GSM_NL)); - switch (status) { - case 1: return true; - case 2: - case 3: return false; - default: return false; - } - } - - bool callHangup() { - sendAT(GF("H")); - return waitResponse() == 1; - } - - // 0-9,*,#,A,B,C,D - bool dtmfSend(char cmd, int duration_ms = 100) { - duration_ms = constrain(duration_ms, 100, 1000); - - sendAT(GF("+VTD="), duration_ms / 100); // VTD accepts in 1/10 of a second - waitResponse(); - - sendAT(GF("+VTS="), cmd); - return waitResponse(10000L) == 1; - } - /* * Messaging functions */ @@ -679,162 +607,6 @@ public: } } - int8_t getSMSInterrupt(void){ - sendAT(GF("+CFGRI?")); - if(waitResponse(GF(GSM_NL "+CFGRI:")) != 1) return -1; - return stream.readStringUntil('\n').toInt(); - } - - bool setSMSInterrupt(uint8_t status){ - sendAT(GF("+CFGRI="), status); - if(waitResponse() != 1) return false; - return true; - } - - int8_t countSMS(void){ - sendAT(GF("+CMGF=1")); - if(waitResponse() != 1) return -1; - - sendAT(GF("+CPMS?")); - if(waitResponse(GF(GSM_NL "+CPMS:")) != 1) return -1; - - streamSkipUntil(','); - uint8_t count = stream.readStringUntil(',').toInt() - 1; - waitResponse(); - - return count; - } - - bool deleteSMS(){ - sendAT(GF("+CMGF=1")); - if(waitResponse() != 1) return false; - - sendAT(GF("+CMGDA=\"DEL ALL\"")); - if(waitResponse() != 1) return false; - - return true; - } - - bool deleteSMS(uint8_t i){ - sendAT(GF("+CMGF=1")); - if(waitResponse() != 1) return false; - - sendAT(GF("+CMGD="), i); - if(waitResponse() != 1) return false; - - return true; - } - - String deleteSMSOpt() { - sendAT(GF("+CMGD=?")); - if (waitResponse() != 1) { - return ""; - } - if (waitResponse(10000L, GF(GSM_NL "+CMGD::")) != 1) { - return ""; - } - stream.readStringUntil('"'); - String indexes = stream.readStringUntil('"'); - stream.readStringUntil(','); - String options = stream.readStringUntil('\n'); - return indexes; - } - - bool readSMS(uint8_t i, String& msg){ - // set message format to text mode - sendAT(GF("+CMGF=1")); - if (waitResponse() != 1) return false; - // show sms text mode parameters - sendAT(GF("+CSDH=1")); - if (waitResponse() != 1) return false; - // set GSM charset - sendAT(GF("+CSCS=\"GSM\"")); - if (waitResponse() != 1) return false; - - sendAT(GF("+CMGR="), i); - uint8_t cmgrResponse = waitResponse(GF(GSM_NL "+CMGR:")); - if ( cmgrResponse == 1 ) { - streamSkipUntil('\n'); - msg = stream.readStringUntil('\n'); - return true; - } - - return false; - } - - uint8_t getNewSMSIndex() { - if (waitResponse(GF(GSM_NL "+CMTI:")) != 1) { - return false; - } - - streamSkipUntil(','); - int res = stream.readStringUntil('\n').toInt(); - return res; - } - - bool readSMSRaw(uint8_t i, String& msg) { - // set message format to text mode - sendAT(GF("+CMGF=1")); - if (waitResponse() != 1) return false; - // show sms text mode parameters - sendAT(GF("+CSDH=1")); - if (waitResponse() != 1) return false; - // set GSM charset - sendAT(GF("+CSCS=\"GSM\"")); - if (waitResponse() != 1) return false; - - // get message by index - sendAT(GF("+CMGR="), i); - uint8_t cmgrResponse = waitResponse(GF(GSM_NL "+CMGR:")); - if ( cmgrResponse != 1 ) { - return false; - } - - msg = stream.readStringUntil('\n') + '\n' - + stream.readStringUntil('\n') + '\n'; - - if (waitResponse() != 1) { - return false; - } - - return true; - } - - bool readAllSMSRaw(String& msg) { - // set message format to text mode - sendAT(GF("+CMGF=1")); - if (waitResponse() != 1) return false; - // show sms text mode parameters - sendAT(GF("+CSDH=1")); - if (waitResponse() != 1) return false; - // set GSM charset - sendAT(GF("+CSCS=\"GSM\"")); - if (waitResponse() != 1) return false; - - // get all messages - sendAT(GF("+CMGL=\"ALL\"")); - - const unsigned long timeout = 10000L; - unsigned long startMillis = millis(); - bool isTimeout = false; - String line; - do { - line = stream.readStringUntil('\n'); - line.trim(); - if ( line != "" && line != "OK" ) { - msg = msg + line + String("\r\n"); - } - isTimeout = (millis() - startMillis) > timeout; - delay(0); - if ( isTimeout ) { - DBG("timeout"); - break; - } - } while (line != "OK"); - - return (line == "OK"); - } - bool sendSMS(const String& number, const String& text) { sendAT(GF("+CMGF=1")); waitResponse(); diff --git a/src/TinyGsmClientU201.h b/src/TinyGsmClientU201.h index 7548899..64d6f2a 100644 --- a/src/TinyGsmClientU201.h +++ b/src/TinyGsmClientU201.h @@ -454,19 +454,6 @@ public: IPAddress localIP() { return TinyGsmIpFromString(getLocalIP()); } - - /* - * Phone Call functions - */ - - bool setGsmBusy(bool busy = true) TINY_GSM_ATTR_NOT_IMPLEMENTED; - - bool callAnswer() TINY_GSM_ATTR_NOT_IMPLEMENTED; - - bool callNumber(const String& number) TINY_GSM_ATTR_NOT_IMPLEMENTED; - - bool callHangup() TINY_GSM_ATTR_NOT_IMPLEMENTED; - /* * Messaging functions */