diff options
Diffstat (limited to 'src/MTS_IO_CellularRadio.cpp')
| -rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 54 | 
1 files changed, 54 insertions, 0 deletions
| diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 1850a60..6236c3f 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -1609,3 +1609,57 @@ ICellularRadio::CODE CellularRadio::getUeModeOfOperation(ICellularRadio::UE_MODE      mode = ICellularRadio::UE_MODES_OF_OPERATION::UNKNOWN_MODE;      return NOT_APPLICABLE;  } + +ICellularRadio::CODE CellularRadio::disableVoiceSupport() { +    printTrace("%s| Disable Voice Support: not applicable", m_sName.c_str()); +    return NOT_APPLICABLE; +} + +ICellularRadio::CODE CellularRadio::getVoiceSupport(Json::Value& jData) { +    bool bVoiceEnabled, bSmsOnly; +    CODE rc; + +    rc = getVoiceSupport(bVoiceEnabled, bSmsOnly); + +    if (rc == SUCCESS) { +        jData[KEY_VOICE_ENABLED] = bVoiceEnabled; +        jData[KEY_SMS_ONLY] = bSmsOnly; +    } + +    return rc; +} + +ICellularRadio::CODE CellularRadio::getVoiceSupport(bool&, bool&) { +    printTrace("%s| Get Voice Support: not applicable", m_sName.c_str()); +    return NOT_APPLICABLE; +} + +ICellularRadio::CODE CellularRadio::sendBasicQuery(const std::string& sCmd, const std::string& sLabel, std::string& sResult, int32_t iTimeoutMillis, const char& ESC) { +    sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, iTimeoutMillis, ESC); +    printTrace("%s| Got response from the radio: [%s]", getName().c_str(), sResult.c_str()); + +    if (sResult.empty()) { +        return NO_RESPONSE; +    } + +    if (sResult.rfind(ICellularRadio::RSP_ERROR) != std::string::npos) { +        return ERROR; +    } + +    size_t end = sResult.rfind(ICellularRadio::RSP_OK); +    if (end == std::string::npos) { +        printError("%s| \"OK\" not found in the response: [%s]", getName().c_str(), sResult.c_str()); +        return FAILURE; +    } + +    size_t start = sResult.find(sLabel); +    if (start == std::string::npos) { +        printError("%s| Unexpected radio response: [%s]", getName().c_str(), sResult.c_str()); +        return FAILURE; +    } + +    start += sLabel.length(); +    sResult = MTS::Text::trim(sResult.substr(start, end-start)); + +    return SUCCESS; +} | 
