Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
Diff: main.cpp
- Revision:
- 14:cd53f77f8afe
- Parent:
- 13:c920eb6774de
- Child:
- 19:f1d893c651e5
--- a/main.cpp Tue Oct 01 21:39:27 2013 +0000 +++ b/main.cpp Tue Oct 01 22:14:15 2013 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "SprintUSBModem.h" #include "HTTPClient.h" +#include "Websocket.h" char const *msg = "need another reason to merge\n"; //char const *URL = "http://mbed.org/"; @@ -24,6 +25,24 @@ printf("Could not connect\r\n"); return; } + // See the output on http://sockets.mbed.org/sg_test/viewer + Websocket ws("ws://sockets.mbed.org:443/ws/sg_test/rw"); + ws.connect(); + char json_str[100]; + for(int i=0; i<100; ++i) + { + // create json string with acc/tmp data + sprintf(json_str, "{\"id\":\"test\",\"ax\":%d,\"ay\":%d,\"az\":%d, \"tmp\":%d}", i, i, i, i); + // send str + ws.send(json_str); + wait(1.0f); + memset(json_str, 0, 100); + if (ws.read(json_str)) + { + printf("rcv: %s\r\n", json_str); + } + } + //GET data printf("Trying to fetch page...\r\n");