Skip to content

Commit d0059d0

Browse files
committed
Update getCCID
1 parent 4f52858 commit d0059d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/SparkFun_u-blox_SARA-R5_Arduino_Library.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,15 @@ String SARA_R5::getCCID(void)
10371037
SARA_R5_RESPONSE_OK_OR_ERROR, response, SARA_R5_STANDARD_RESPONSE_TIMEOUT);
10381038
if (err == SARA_R5_ERROR_SUCCESS)
10391039
{
1040-
if (sscanf(response, "\r\n+CCID: %s", ccidResponse) != 1)
1040+
char *searchPtr = strstr(response, "\r\n+CCID:");
1041+
if (searchPtr != nullptr)
10411042
{
1042-
memset(ccidResponse, 0, 21);
1043+
searchPtr += strlen("\r\n+CCID:"); // Move searchPtr to first character - probably a space
1044+
while (*searchPtr == ' ') searchPtr++; // skip spaces
1045+
if (sscanf(searchPtr, "%s", ccidResponse) != 1)
1046+
{
1047+
memset(ccidResponse, 0, 21);
1048+
}
10431049
}
10441050
}
10451051
free(response);

0 commit comments

Comments
 (0)