The command line interface can be useful for method discovery and testing
purposes. It currently has two subcommands:
list, which shows a list of
available methods and
call for calling methods. For more information, use
If the Arduino has exposed the functions
set_led like in the
example given in the device library documentation, the
will show the following.
$ simple_rpc list Available methods: inc a Increment a value. int a: Value. returns int: a + 1. set_led brightness Set LED brightness. int brightness: Brightness.
Any of these methods can be called by using the
$ simple_rpc call inc 1 2
Complex objects are passed on the command line interface as a JSON string. Binary encoding and decoding is taken care of by the CLI. The following example makes use of the demo sketch in the device examples.
$ simple_rpc call vector '[1, 2, 3, 4]' [1.40, 2.40, 3.40, 4.40] $ simple_rpc call object '["a", [10, "b"]]' ["b", [11, "c"]]