M2XStreamClient fork with a workaround in M2XStreamClient.cpp for the MTS_Wifi_Connect_M2X example.
Dependents: STM32_MTS_Wifi_Connect_M2X M2X_STM32_MTS_Temp MTS_WiFi_Connect_M2X_Example
Fork of M2XStreamClient by
Diff: M2XStreamClient.cpp
- Revision:
- 1:cf982472fc7c
- Parent:
- 0:f479e4f4db0e
--- a/M2XStreamClient.cpp Wed Feb 12 19:43:34 2014 +0000 +++ b/M2XStreamClient.cpp Fri Jul 25 16:29:47 2014 +0000 @@ -317,9 +317,11 @@ jsonlite_parser_set_callback(p, &cbs); jsonlite_result result = jsonlite_result_unknown; + + wait_ms(100); // Workaround - 100ms delay necessary for data fetches to work while (index < length) { int i = 0; - + DBG("%s", "Received Data: "); while ((i < BUF_LEN) && _client->available()) { buf[i++] = _client->read(); @@ -355,20 +357,20 @@ void* context) { const int BUF_LEN = 40; char buf[BUF_LEN]; - + int length = readContentLength(); if (length < 0) { close(); return length; } - + int index = skipHttpHeader(); if (index != E_OK) { close(); return index; } index = 0; - + location_parsing_context_state state; state.state = state.index = 0; state.callback = callback; @@ -383,9 +385,11 @@ jsonlite_parser_set_callback(p, &cbs); jsonlite_result result = jsonlite_result_unknown; + + wait_ms(100); // Workaround - 100ms delay necessary for data fetches to work while (index < length) { int i = 0; - + DBG("%s", "Received Data: "); while ((i < BUF_LEN) && _client->available()) { buf[i++] = _client->read(); @@ -411,7 +415,7 @@ index += i; } - + jsonlite_parser_release(p); close(); return (result == jsonlite_result_ok) ? (E_OK) : (E_JSON_INVALID);