Browse Source

Update TinyGsmClientSIM800.h

implementation of audio capabilities
dependabot/github_actions/actions/checkout-4
fco.rivas 3 years ago
parent
commit
2f0b7978be
1 changed files with 40 additions and 0 deletions
  1. +40
    -0
      src/TinyGsmClientSIM800.h

+ 40
- 0
src/TinyGsmClientSIM800.h View File

@ -445,6 +445,46 @@ class TinyGsmSim800 : public TinyGsmModem<TinyGsmSim800>,
protected: protected:
// No functions of this type supported // No functions of this type supported
/*
* Audio functions
*/
public:
bool setVolume(uint8_t volume = 50){
//Set speaker volume
sendAT(GF("+CLVL="), volume);
return waitResponse() == 1;
}
uint8_t getVolume(){
//Get speaker volume
sendAT(GF("+CLVL?"));
if (waitResponse(GF(GSM_NL)) != 1) { return 0; }
String res = stream.readStringUntil('\n');
waitResponse();
res.replace("+CLVL:", "");
res.trim();
return res.toInt();
}
bool setMicVolume(uint8_t channel, uint8_t level){
if(channel > 4){
return 0;
}
sendAT(GF("+CMIC="), level);
return waitResponse() == 1;
}
bool setAudioChannel(uint8_t channel){
sendAT(GF("+CHFA="), channel);
return waitResponse() == 1;
}
bool playToolkitTone(uint8_t tone, uint32_t duration){
sendAT(GF("STTONE="), 1, tone);
delay(duration);
sendAT(GF("STTONE="), 0);
return waitResponse();
}
/* /*
* Time functions * Time functions
*/ */


Loading…
Cancel
Save