FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.
Dependencies: mbed FXOS8700CQ MODSERIAL
Diff: wnc_control.cpp
- Revision:
- 82:65cde5d7070c
- Parent:
- 80:d635c0eddd6e
- Child:
- 84:fc8c9b39723a
--- a/wnc_control.cpp Thu Nov 17 18:21:52 2016 +0000 +++ b/wnc_control.cpp Mon Dec 11 21:49:43 2017 +0000 @@ -491,6 +491,14 @@ cmdRes = at_send_wnc_cmd("AT", &pRespStr, WNC_TIMEOUT_MS); // Heartbeat? cmdRes += at_send_wnc_cmd("ATE0", &pRespStr, WNC_TIMEOUT_MS); // Echo Off cmdRes += at_send_wnc_cmd("AT+CMEE=2", &pRespStr, WNC_TIMEOUT_MS); // 2 - verbose error, 1 - numeric error, 0 - just ERROR + /* Disable unsolicited RRCSTATE responses from interfering with DNS + * resolution which was introduced with release of the + * NQ_MPSS_IMA3_v10.58.174043 LTE-M firmware and is a more elegant + * solution than disabling ALL unsoliceted responses as WNC suggested + * in ticket 2017090085. + */ + //cmdRes += at_send_wnc_cmd("AT%NOTIFYEV=\"RRCSTATE\",0", &pRespStr, WNC_TIMEOUT_MS); + cmdRes += at_send_wnc_cmd("AT%NOTIFYEV=\"ALL\",0", &pRespStr, WNC_TIMEOUT_MS); // If the simple commands are not working no chance of more complex. // I have seen re-trying commands make it worse. @@ -564,10 +572,18 @@ str = "AT@DNSRESVDON=\"" + str + "\""; if (send_wnc_cmd(str.c_str(), &pRespStr, 60000) == 0) { - size_t pos_start = pRespStr->find(":\"") + 2; - size_t pos_end = pRespStr->find("\"", pos_start) - 1; + size_t pos_start = pRespStr->find("ON:\""); // See there are 4 characters in the search string + size_t pos_end = pRespStr->find("\"", (pos_start + 4)); if ((pos_start != string::npos) && (pos_end != string::npos)) { + /* The substring identified was indeed located within the returned + * response. Adjust the start position ahead by 2 and move the end + * position back by l to narrow the answer down to to the response + * string contained within the quote bookends --> ON:"<response>". + */ + pos_start += 4; + pos_end -= 1; + if (pos_end > pos_start) { // Make a copy for use later (the source string is re-used)