WncController
Fork of WncControllerLibrary by
Diff: WncController.cpp
- Revision:
- 30:98c9ff850c1b
- Parent:
- 29:69ada8524b4a
- Child:
- 31:5db38ccccd1d
--- a/WncController.cpp Fri Sep 23 05:00:00 2016 +0000 +++ b/WncController.cpp Fri Sep 23 14:55:35 2016 +0000 @@ -2071,14 +2071,23 @@ if (m_sState == WNC_OFF) return (false); - + m_sState = WNC_ON_NO_CELL_LINK; if (m_sMoreDebugEnabled) dbgPuts("<-------- Begin Cell Status ------------"); cmdRes1 = at_send_wnc_cmd("AT+CSQ", &pRespStr, m_sCmdTimeoutMs); // Check RSSI,BER - cmdRes2 = at_send_wnc_cmd("AT+CPIN?", &pRespStr, m_sCmdTimeoutMs); // Check if SIM locked + + // If no response, don't bother with more commands + if (cmdRes1 != WNC_AT_CMD_TIMEOUT) + cmdRes2 = at_send_wnc_cmd("AT+CPIN?", &pRespStr, m_sCmdTimeoutMs); // Check if SIM locked + else { + if (m_sMoreDebugEnabled) + dbgPuts("------------ WNC No Response! --------->"); + + return (false); + } if ((cmdRes1 != WNC_AT_CMD_OK) || (cmdRes2 != WNC_AT_CMD_OK) || (pRespStr->size() == 0)) { @@ -2089,7 +2098,10 @@ else dbgPuts("------------ WNC Cmd Error! ----------->"); } - return (false); + + // If by a miracle it responds to the 2nd after the 1st, keep going + if ((cmdRes2 == WNC_AT_CMD_TIMEOUT) || (pRespStr->size() == 0)) + return (false); } // If SIM Card not ready don't bother with commands!