Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
Revision 14:cd53f77f8afe, committed 2013-10-01
- Comitter:
- sam_grove
- Date:
- Tue Oct 01 22:14:15 2013 +0000
- Parent:
- 13:c920eb6774de
- Child:
- 15:48374c26e004
- Child:
- 16:b6e5ed3cf18a
- Commit message:
- Added Websockets test to the code base
Changed in this revision
WebSocketClient.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebSocketClient.lib Tue Oct 01 22:14:15 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/WebSocketClient/#4567996414a5
--- 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");