From dfa12351da3bd03f9d5e14573c2d72cd39f25823 Mon Sep 17 00:00:00 2001 From: doganyazar Date: Mon, 29 Nov 2010 12:55:35 +0000 Subject: [PATCH] Added some more description to README. Makefile update is about changing ifdef to ifeq so that users don't be misleaded. --- examples/rest-example/Makefile | 4 ++-- examples/rest-example/README | 30 +++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/examples/rest-example/Makefile b/examples/rest-example/Makefile index 6ce29e628..2d52f9ad7 100644 --- a/examples/rest-example/Makefile +++ b/examples/rest-example/Makefile @@ -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 diff --git a/examples/rest-example/README b/examples/rest-example/README index de1aee627..9a6e2d2f3 100644 --- a/examples/rest-example/README +++ b/examples/rest-example/README @@ -1,4 +1,6 @@ -Open a terminal and go to "examples/rest-example/" directory. + + +Open a terminal and go to "/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. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it is available at :61616) \ No newline at end of file +5. Test the connectivity by pinging them. +>ping6 + +5. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it is available at :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