diff options
Diffstat (limited to 'src/MTS_IO_QuectelRadio.cpp')
-rw-r--r-- | src/MTS_IO_QuectelRadio.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index b6eab80..7a1a1a7 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -37,6 +37,7 @@ const std::string QuectelRadio::CMD_ABORT_UPLOAD = "+++"; // It is strongly recommended to use DOS 8.3 file name format for <filename>. const std::string QuectelRadio::VALUE_MTS_DELTA_NAME = "mtsdelta.zip"; const std::string QuectelRadio::VALUE_MTS_DELTA_PATH = "/data/ufs/" + QuectelRadio::VALUE_MTS_DELTA_NAME; +const std::string QuectelRadio::VALUE_QNVR_DISABLE_VOICE = "0102000000000000"; QuectelRadio::QuectelRadio(const std::string& sName, const std::string& sRadioPort) : CellularRadio (sName, sRadioPort) @@ -1376,3 +1377,94 @@ ICellularRadio::CODE QuectelRadio::getUeModeOfOperation(ICellularRadio::UE_MODES mode = ICellularRadio::UE_MODES_OF_OPERATION::UNKNOWN_MODE; return FAILURE; } + +ICellularRadio::CODE QuectelRadio::disableVoiceSupport() { + printTrace("%s| Disable Voice Support", getName().c_str()); + + CODE rc; + const int dTimeout = 1000; // ms + std::string sCommand = "AT+QNVFW=\"/nv/item_files/ims/IMS_enable\",00"; + + rc = sendBasicCommand(sCommand, dTimeout); + if (rc != SUCCESS) { + printError("%s| Failed to disable IMS support: [%d]", getName().c_str(), rc); + return rc; + } + + sCommand = "AT+QNVW=5280,0,\"0102000000000000\""; + + rc = sendBasicCommand(sCommand, dTimeout); + if (rc != SUCCESS) { + printError("%s| Failed to disable voice support via +QNVW=5280,0: [%d]", getName().c_str(), rc); + return rc; + } + + sCommand = "AT+QNVFW=\"/nv/item_files/modem/mmode/sms_only\",01"; + + rc = sendBasicCommand(sCommand, dTimeout); + if (rc != SUCCESS) { + printError("%s| Failed to enable \"SMS only\" registration flag: [%d]", getName().c_str(), rc); + return rc; + } + + return SUCCESS; +} + +ICellularRadio::CODE QuectelRadio::getVoiceSupport(bool& bVoiceEnabled, bool& bSmsOnly) { + printTrace("%s| Get Voice Support status", getName().c_str()); + + CODE rc; + + bool bImsEnabled = false; + const int dTimeout = 1000; // ms + + std::string sResult; + std::string sCommand; + std::string sLabel; + + bVoiceEnabled = false; + bSmsOnly = false; + + printTrace("%s| Get IP Multimedia Subsystem status", getName().c_str()); + sCommand = "AT+QNVFR=\"/nv/item_files/ims/IMS_enable\""; + sLabel = "+QNVFR: "; + + rc = sendBasicQuery(sCommand, sLabel, sResult, dTimeout); + if (rc != SUCCESS) { + return rc; + } + + if (sResult != "00") { + bImsEnabled = true; + } + + printTrace("%s| Get +QNVR=5280,0 status", getName().c_str()); + sCommand = "AT+QNVR=5280,0"; + sLabel = "+QNVR: "; + + rc = sendBasicQuery(sCommand, sLabel, sResult, dTimeout); + if (rc != SUCCESS) { + return rc; + } + + sResult = MTS::Text::strip(sResult, '"'); + + if (bImsEnabled || sResult != VALUE_QNVR_DISABLE_VOICE) { + bVoiceEnabled = true; + } + + printTrace("%s| Get \"SMS only\" registration status", getName().c_str()); + sCommand = "AT+QNVFR=\"/nv/item_files/modem/mmode/sms_only\""; + sLabel = "+QNVFR: "; + + rc = sendBasicQuery(sCommand, sLabel, sResult, dTimeout); + if (rc != SUCCESS) { + return rc; + } + + if (sResult == "01") { + bSmsOnly = true; + } + + return SUCCESS; +} |