![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A simple project for sending button input up to AT&T Flow
Dependencies: FXOS8700CQ MODSERIAL mbed
For instructions on using this program, see the AT&T Starter Kit tutorial on it.
Diff: main.cpp
- Revision:
- 52:9dafcb7f320f
- Parent:
- 50:8ac42961458c
- Child:
- 53:dcccf2881fa0
diff -r d9e5952545da -r 9dafcb7f320f main.cpp --- a/main.cpp Sun Jul 24 21:56:14 2016 +0000 +++ b/main.cpp Sun Jul 24 22:10:12 2016 +0000 @@ -518,12 +518,17 @@ printf(YEL "Read back : %s" DEF "\r\n", &MySocketData[0]); char myJsonResponse[512]; char stringToCharBuf[BUF_SIZE_FOR_N_MAX_SOCKREAD*MAX_WNC_SOCKREAD_PAYLOAD+1]; // WNC can return max of 1500 (per sockread) - strcpy(stringToCharBuf, MySocketData.c_str()); - if (extract_JSON(stringToCharBuf, &myJsonResponse[0])) + if ((MySocketData.length() + 1) < sizeof(stringToCharBuf)) { - printf(GRN "JSON : %s" DEF "\n", &myJsonResponse[0]); - parse_JSON(&myJsonResponse[0]); + strcpy(stringToCharBuf, MySocketData.c_str()); + if (extract_JSON(stringToCharBuf, &myJsonResponse[0])) + { + printf(GRN "JSON : %s" DEF "\n", &myJsonResponse[0]); + parse_JSON(&myJsonResponse[0]); + } } + else + puts("BUFFER not big enough for sock data!\r\n"); } else {