mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-02 19:29:30 +00:00
Added some more description to README.
Makefile update is about changing ifdef to ifeq so that users don't be misleaded.
This commit is contained in:
parent
7110afdad5
commit
dfa12351da
@ -7,11 +7,11 @@ CONTIKI=../..
|
||||
WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
|
||||
WITH_COAP = 1
|
||||
WITH_COAP = 0
|
||||
|
||||
CFLAGS += -DPROJECT_CONF_H=1
|
||||
|
||||
ifdef WITH_COAP
|
||||
ifeq ($(WITH_COAP), 1)
|
||||
CFLAGS += -DWITH_COAP
|
||||
APPS = rest-coap
|
||||
else
|
||||
|
@ -1,4 +1,6 @@
|
||||
Open a terminal and go to "examples/rest-example/" directory.
|
||||
|
||||
|
||||
Open a terminal and go to "<CONTIKI_HOME>/examples/rest-example/" directory.
|
||||
|
||||
MAIN EXAMPLE:
|
||||
rest-server-example.c : A RESTful server example showing how to use the REST layer to develop server-side applications (possible to run it over either COAP or HTTP)
|
||||
@ -16,9 +18,13 @@ Start COOJA and load the simulation "rest-server-example.csc" by the following c
|
||||
> make TARGET=cooja rest-server-example.csc
|
||||
After loading the cooja file, open another another terminal pointing to the same directory and connect to the COOJA simulation using tunslip6:
|
||||
>make connect-router-cooja
|
||||
Now you need to use a COAP or HTTP client to interact with the COOJA nodes running REST code.
|
||||
|
||||
Now, you need to use a COAP or HTTP client to interact with the COOJA nodes running REST code.
|
||||
In this setting, two servers are available:
|
||||
IP addresses are aaaa::0212:7402:0002:0202 and aaaa::0212:7403:0003:0303. COAP uses 61616, whereas HTTP uses 8080 port in default configuration.
|
||||
First, ping the COOJA nodes to test the connectivity.
|
||||
>ping6 aaaa::0212:7402:0002:0202
|
||||
>ping6 aaaa::0212:7403:0003:0303
|
||||
|
||||
HTTP Examples
|
||||
You can use curl as an http client to interact with the COOJA motes running REST code.
|
||||
@ -27,6 +33,8 @@ You can use curl as an http client to interact with the COOJA motes running REST
|
||||
>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 should run a COAP client on your computer. You can use the URLs and methods provided above in HTTP examples to test the COAP Server.
|
||||
|
||||
Accessing the server inside the sensor network:
|
||||
(Note: Provided only for COAP implementation)
|
||||
@ -36,6 +44,10 @@ coap-client-server-example.csc : Runs rest-server-example.c as the server (over
|
||||
in one node and coap-client-example.c as the client (IP: aaaa::0212:7402:0002:0202) in another node.
|
||||
Client periodically accesses resources of server and prints the payload.
|
||||
|
||||
Note: If the generated binary is bigger than the MOTE code size, then you will get a "region text is full" error.
|
||||
Right now, REST+HTTP example uses (Contiki + ContikiMAC + uIPv6 + RPL + HTTP Server + REST Layer) which does not fit in Tmote Sky memory.
|
||||
To save same code space and make the example fit, you can define static routes rather than using RPL or use nullrdc rather than ContikiMAC.
|
||||
|
||||
|
||||
To run REST server on real nodes under Linux
|
||||
--------------------------------------------
|
||||
@ -51,4 +63,16 @@ To run REST server on real nodes under Linux
|
||||
|
||||
4. Reconnect the motes, reboot them and note their IP addresses.
|
||||
|
||||
5. Test the connectivity by pinging them.
|
||||
>ping6 <IPv6 Address of the MOTE>
|
||||
|
||||
5. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it is available at <NODE_IP_ADDR>:61616)
|
||||
|
||||
|
||||
ToDo
|
||||
*Better option handling needed - ex: critical options are not differentiated for now. Need to add support for some such as Tokens.
|
||||
*Reilable message sending is missing. i.e. client example should resend request in case ACK does not arrive. Same for server pushing (in case of subscriptions)
|
||||
*Add Block transfer example
|
||||
*Add Subscription example
|
||||
*Add an Android/Java COAP Client to Contikiprojects to be able to interact with Contiki.
|
||||
*COAP-specific Method Codes
|
||||
|
Loading…
Reference in New Issue
Block a user