asebahttp connects Aseba with HTTP
Provide a simple REST interface with introspection for Aseba devices.
GET /nodes - JSON list of all known nodes
GET /nodes/:NODENAME - JSON attributes for :NODENAME
PUT /nodes/:NODENAME - install new Aesl program
GET /nodes/:NODENAME/:VARIABLE - retrieve JSON value for :VARIABLE
POST /nodes/:NODENAME/:VARIABLE - send new values(s) for :VARIABLE
POST /nodes/:NODENAME/:EVENT - call an event :EVENT
GET /events[/:EVENT]* - create SSE stream for all known nodes
GET /nodes/:NODENAME/events[/:EVENT]* - create SSE stream for :NODENAME
Typical use: asebahttp -p 3000 -a vmcode.aesl ser:name=Thymio-II
Variables and events are learned from the node description and parsed from AESL source when provided. Server-side event (SSE) streams are updated as events arrive. The two POST forms expect JSON, but also sloppily accept slash-delimited GET, for example
- GET
/nodes/thymio-II/motor.left.target/100
sets the speed of the left motor - GET
/nodes/thymio-II/sound_system/4/10
might record sound 4 for 10 seconds (if such an event were defined in AESL).
Compiled and tested on:
- MacOS Yosemite (clang-602.0.53)
- Ubuntu 12.04 (GNU g++ 4.6.3)
- Windows XP using MING32 under msys2-i686-20150202 (GNU g++ 4.9.2)
Unit tests (tests/test-asebahttp
) require a dummy node at dashel target tcp:;port=33333.
They are defined using https://github.com/philsquared/Catch, which is included as a git submodule.