Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: wnc_control.cpp
- Revision:
- 33:eaf45dab650a
- Parent:
- 32:8ba73eab6c72
- Child:
- 35:d0d86a2bcdb3
diff -r 8ba73eab6c72 -r eaf45dab650a wnc_control.cpp --- a/wnc_control.cpp Thu Jul 21 01:51:59 2016 +0000 +++ b/wnc_control.cpp Thu Jul 21 15:26:42 2016 +0000 @@ -104,8 +104,10 @@ puts("Socket is closed for write!\r\n"); } -void sockread_mdm(string * sockData, int len, int retries) +unsigned sockread_mdm(string * sockData, int len, int retries) { + // Clear out any possible old data + sockData->erase(); if (socketOpen == 1) { do @@ -123,6 +125,8 @@ } else puts("Socket is closed for read\r\n"); + + return (sockData->size()); } void sockclose_mdm(void) @@ -322,6 +326,10 @@ unsigned i; string * pRespStr; string cmd_str("AT@SOCKREAD=1,"); + + // Don't assume clean slate: + pS->erase(); + if (n <= 1500) { char num2str[6]; @@ -344,7 +352,6 @@ { retries = 0; // If any data found stop retrying string byte; - pS->erase(); while (pos_start < pos_end) { byte = pRespStr->substr(pos_start, 2);