
Example using MbedJSONRpc: call distant method
Dependencies: MbedJSONRpc EthernetNetIf mbed DNSResolver MbedJSONValue
Revision 2:d439eefcc605, committed 2011-10-03
- Comitter:
- samux
- Date:
- Mon Oct 03 09:00:22 2011 +0000
- Parent:
- 1:5929c085acec
- Commit message:
Changed in this revision
MbedJSONRpc.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 |
diff -r 5929c085acec -r d439eefcc605 MbedJSONRpc.lib --- a/MbedJSONRpc.lib Thu Sep 22 12:33:32 2011 +0000 +++ b/MbedJSONRpc.lib Mon Oct 03 09:00:22 2011 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/samux/code/MbedJSONRpc/#88e1902947e5 +http://mbed.org/users/samux/code/MbedJSONRpc/#0ec91dd0e80e
diff -r 5929c085acec -r d439eefcc605 main.cpp --- a/main.cpp Thu Sep 22 12:33:32 2011 +0000 +++ b/main.cpp Mon Oct 03 09:00:22 2011 +0000 @@ -6,21 +6,23 @@ Serial pc(USBTX, USBRX); //websocket: configuration with sub-network = samux and mbed_id = mbed_acc -Websocket webs("ws://sockets.mbed.org:888/ws/samux/client"); +Websocket webs("ws://sockets.mbed.org/rpc/samux/mbed_client"); //RPC object attached to the websocket server MbedJSONRpc rpc(&webs); int main() { + pc.printf("\x1B[2J"); + pc.printf("\x1B[H"); + RPC_TYPE t; //in: argument for the distant method (here empty) //out results of the distant method (accelerometers values) MbedJSONValue in, out; - while (!webs.connect()) - pc.printf("cannot connect websocket, retrying\r\n"); + while (!webs.connect()); //CALL getAcc on mbed_acc if ((t = rpc.call("getAcc", "mbed_acc", in, out)) == CALL_OK) {