diff options
author | Brandon Bayer <bbayer@multitech.com> | 2016-03-31 15:09:18 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2016-04-05 09:29:51 -0500 |
commit | 1608c215dc576eb92dafc374c8151a373146cc76 (patch) | |
tree | ed1e343235b91a1c4e0ca3ccf52cfe1eb95577f5 | |
parent | e5b1c619c8672187551f3e3524ea0010fe1c80ec (diff) | |
download | libmts-io-1608c215dc576eb92dafc374c8151a373146cc76.tar.gz libmts-io-1608c215dc576eb92dafc374c8151a373146cc76.tar.bz2 libmts-io-1608c215dc576eb92dafc374c8151a373146cc76.zip |
check for SIM PIN before AT#RFSTS on LE910 radios0.6
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 71c4465..0ec7c05 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -936,8 +936,27 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) { const uint32_t LTE_NETWORK_FORMAT = 16; printTrace("%s| Get Network Status", m_sName.c_str()); - std::string sCmd("AT#RFSTS"); - std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 200); + + std::string sCmd; + std::string sResult; + // LE910 radios have a bug where issuing AT#RFSTS with a locked SIM + // will cause the radio to stop responding until a radio power cycle + // Telit Support Portal Case #5069697 + if (m_sName.find("LE910-") != std::string::npos) { + sCmd = "AT+CPIN?"; + sResult = sendCommand(sCmd); + if (sResult.find("+CPIN:") == std::string::npos) { + printDebug("%s| AT+CPIN? returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), sResult.c_str()); + return FAILURE; + } + if (sResult.find("SIM PIN") != std::string::npos) { + printError("%s| The SIM is locked and must first be unlocked", m_sName.c_str()); + return FAILURE; + } + } + + sCmd = "AT#RFSTS"; + sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 200); if (sResult.find("#RFSTS:") == std::string::npos) { printDebug("%s| Network Status command returned unexpected response: [%s][%s]", m_sName.c_str(), sCmd.c_str(), sResult.c_str()); return FAILURE; |