diff options
Diffstat (limited to 'src/MTS_IO_LE910C4NFRadio.cpp')
-rw-r--r-- | src/MTS_IO_LE910C4NFRadio.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/MTS_IO_LE910C4NFRadio.cpp b/src/MTS_IO_LE910C4NFRadio.cpp index 770a2c4..0f7bb92 100644 --- a/src/MTS_IO_LE910C4NFRadio.cpp +++ b/src/MTS_IO_LE910C4NFRadio.cpp @@ -128,3 +128,79 @@ CellularRadio::CODE LE910C4NFRadio::getActiveFirmware(std::string& sFwId) { TelitRadio::FOTA_GROUP LE910C4NFRadio::getFotaGroup() { return VALUE_GROUP_B; } + +CellularRadio::CODE LE910C4NFRadio::getIsVoiceSupportConfigurable() { + CellularRadio::CODE rc; + const std::string sCommand = "AT#CALLDISA=?"; + + rc = sendBasicCommand(sCommand); + if (rc == ERROR) { + printTrace("%s| This radio does not support voice call enable/disable", getName().c_str()); + return NOT_APPLICABLE; + } + + return rc; +} + +CellularRadio::CODE LE910C4NFRadio::disableVoiceSupport() { + printTrace("%s| Disable Voice Support", getName().c_str()); + + CellularRadio::CODE rc; + + rc = getIsVoiceSupportConfigurable(); + if (rc != SUCCESS) { + return rc; + } + + const int dTimeout = 1000; // ms + const std::string sCommand = "AT#CALLDISA=1,1"; + + return sendBasicCommand(sCommand, dTimeout); +} + +CellularRadio::CODE LE910C4NFRadio::getVoiceSupport(bool& bVoiceEnabled, bool& bSmsOnly) { + printTrace("%s| Get Voice Support", getName().c_str()); + + CellularRadio::CODE rc; + + bVoiceEnabled = false; + bSmsOnly = false; + + rc = getIsVoiceSupportConfigurable(); + if (rc != SUCCESS) { + return rc; + } + + const int dTimeout = 1000; // ms + const std::string sCommand = "AT#CALLDISA?"; + const std::string sLabel = "#CALLDISA: "; + std::string sResult; + + rc = sendBasicQuery(sCommand, sLabel, sResult, dTimeout); + if (rc != SUCCESS) { + return rc; + } + + std::vector<std::string> vParts = MTS::Text::split(sResult, ','); + if (vParts.size() != 2) { + printError("Unexpected number of parameters in response [%s]", sResult.c_str()); + return FAILURE; + } + + /* + * vParts[0] - value indicating that "voice support" is enabled. + * Valid parameters: + * 0 - Enable voice support + * 1 - Disable voice support + * 2 - Disable voice support (same as 1) + * + * vParts[1] - value indicating that "SMS only" registration flag is enabled. + * Valid parameters: + * 0 - Disable "SMS only" registration flag + * 1 - Enable "SMS only" registration flag + */ + bVoiceEnabled = (vParts[0] == "0"); + bSmsOnly = (vParts[1] == "1"); + + return SUCCESS; +} |