mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-26 10:28:58 +00:00
.. | ||
Makefile | ||
project-conf.h | ||
README | ||
rest-example-no-rpl.csc | ||
rest-example-with-rpl.csc | ||
rest-example.c |
COOJA RUN: Open a terminal and go to "rest" directory. In rest/Makefile, define WITH_COAP = 1 if you want to use COAP, rather than HTTP. Issue following command to load and compile Rest api with COOJA. >make rest-example-no-rpl.csc TARGET=cooja In another terminal, issue the following command >make connect-router-cooja There are 2 nodes running the Rest code in COOJA (node 2 and 6). Their IP addresses are aaaa::0212:7402:0002:0202 and aaaa::0212:7406:0006:0606 respectively. TEST: Please check the rest/rest-example.c source code to see which resources are available. (check the RESOURCE macros in the code). HTTP Examples You can use curl as an http client to interact with the COOJA motes running REST code. curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #get helloworld plain text curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/led?color=green -d mode=off -i #turn off the green led curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/.well-known/core -i curl -X POST -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #method not allowed COAP Examples: You need a COAP client to be able to to interact with the COOJA motes running REST code. URIs are same with the HTTP examples.