summaryrefslogtreecommitdiff
path: root/src/MTS_IO_QuectelRadio.cpp
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-07-15 17:10:08 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-07-15 17:25:14 +0300
commit6042426e8d21b9b92f7078f64f4b50c2f1b8bc8d (patch)
tree557a133740c1dfb34bfd52da0048096f457d1c58 /src/MTS_IO_QuectelRadio.cpp
parent0de89b68bd4471df424eca976d60ae98dea309df (diff)
downloadlibmts-io-6042426e8d21b9b92f7078f64f4b50c2f1b8bc8d.tar.gz
libmts-io-6042426e8d21b9b92f7078f64f4b50c2f1b8bc8d.tar.bz2
libmts-io-6042426e8d21b9b92f7078f64f4b50c2f1b8bc8d.zip
[MTX-2886] MTR_MTQ - radio-cmd shows invalid message on valid SIM PIN
Fixed the timeouts for several AT commands, including SIM-related commands
Diffstat (limited to 'src/MTS_IO_QuectelRadio.cpp')
-rw-r--r--src/MTS_IO_QuectelRadio.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp
index 6f97989..b8c781f 100644
--- a/src/MTS_IO_QuectelRadio.cpp
+++ b/src/MTS_IO_QuectelRadio.cpp
@@ -73,8 +73,11 @@ CellularRadio::CODE QuectelRadio::getModel(std::string& sModel) {
CellularRadio::CODE QuectelRadio::getIccid(std::string& sIccid) {
printTrace("%s| Get ICCID", getName().c_str());
sIccid = ICellularRadio::VALUE_NOT_SUPPORTED;
+
+ // AT+QCCID execution can take up to 300ms according to the datasheet. Setting timeout to 500ms just for sure.
std::string sCmd("AT+QCCID");
- std::string sResult = sendCommand(sCmd);
+ std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 500);
+
size_t end = sResult.find(ICellularRadio::RSP_OK);
if (end == std::string::npos) {
printWarning("%s| Unable to get ICCID from radio using command [%s]", getName().c_str(), sCmd.c_str());
@@ -482,8 +485,10 @@ bool QuectelRadio::getHardwareVersionFromFirmware(const std::string& sFirmware,
CellularRadio::CODE QuectelRadio::getIsSimInserted(bool& bData) {
printTrace("%s| Get SIM insertion status", getName().c_str());
+
+ // AT+QSIMSTAT? execution can take up to 300ms according to the datasheet. Setting timeout to 500ms just for sure.
std::string sCmd("AT+QSIMSTAT?");
- std::string sResult = sendCommand(sCmd);
+ std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 500);
const std::string sPrefix = "+QSIMSTAT: ";
size_t start = sResult.find(sPrefix);
@@ -519,8 +524,10 @@ CellularRadio::CODE QuectelRadio::getIsSimInserted(bool& bData) {
CellularRadio::CODE QuectelRadio::getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) {
printTrace("%s| Get SIM unlock attempts left", getName().c_str());
+
+ // AT+QPINC execution can take up to 300ms according to the datasheet. Setting timeout to 500ms just for sure.
std::string sCmd("AT+QPINC=\"SC\"");
- std::string sResult = sendCommand(sCmd);
+ std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 500);
const std::string sPrefix = "+QPINC: \"SC\",";
size_t start = sResult.find(sPrefix);
@@ -578,8 +585,10 @@ CellularRadio::CODE QuectelRadio::convertToActiveBand(const std::string& sQuecte
ICellularRadio::CODE QuectelRadio::getRadioNetworkMode(RADIO_NETWORK_MODE &mode)
{
+ // AT+QCFG="nwscanmode" execution can take up to 300ms according to the datasheet. Setting timeout to 500ms just for sure.
std::string sCmd("AT+QCFG=\"nwscanmode\"");
- std::string cmdResult = sendCommand(sCmd);
+ std::string cmdResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 500);
+
if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) {
printDebug("%s| AT+QCFG? returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str());
return FAILURE;
@@ -604,7 +613,10 @@ ICellularRadio::CODE QuectelRadio::setRadioNetworkMode(RADIO_NETWORK_MODE mode)
}
std::string sCmd("AT+QCFG=\"nwscanmode\",");
sCmd += value;
- std::string cmdResult = sendCommand(sCmd);
+
+ // AT+QCFG="nwscanmode" execution can take up to 300ms according to the datasheet. Setting timeout to 500ms just for sure.
+ std::string cmdResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 500);
+
if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) {
printDebug("%s| AT+QCFG? returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str());
return FAILURE;