osd-contiki/examples/er-rest-example
2011-10-10 16:09:17 +02:00
..
coap-client-example.c Added Erbium REST engine with new CoAP implementation 2011-09-14 16:33:01 +02:00
coap-client-server-example.csc Added Erbium REST engine with new CoAP implementation 2011-09-14 16:33:01 +02:00
Makefile Fixed Erbium example simulation 2011-10-10 14:16:27 +02:00
project-conf.h Fixed Erbium example simulation 2011-10-10 14:16:27 +02:00
README Added Erbium REST engine with new CoAP implementation 2011-09-14 16:33:01 +02:00
rest-server-example.c Fixed Erbium chunks for minimal-net 2011-10-10 16:09:17 +02:00
rest-server-example.csc Fixed Erbium example simulation 2011-10-10 14:16:27 +02:00
static-routing.c Added Erbium REST engine with new CoAP implementation 2011-09-14 16:33:01 +02:00
static-routing.h Added Erbium REST engine with new CoAP implementation 2011-09-14 16:33:01 +02:00

This is the new example for the Erbium REST Engine
==================================================

EXAMPLE FILES
-------------
rest-server-example.c: A RESTful server example showing how to use the REST layer to develop server-side applications (at the moment only CoAP is implemented for the REST Engine).
coap-client-example.c: A CoAP client that polls the /toggle resource every 10 seconds and cycles through 4 resources on button press (target address is hard-coded).

PRELIMINARIES
-------------
a) For convenience, define the Cooja addresses in /etc/hosts
   aaaa::0212:7401:0001:0101	cooja1
   aaaa::0212:7402:0002:0202	cooja2
   ...
b) Get the Copper CoAP browser from https://addons.mozilla.org/en-US/firefox/addon/copper-270430/
c) Optional: Save Tmotes as default target
   $ make TARGET=sky savetarget

COOJA HOWTO
-----------
Server only:
1) $ make TARGET=cooja rest-server-example.csc
2) Open new terminal
3) $ make connect-router-cooja
4) Start Copper and discover resources at coap://cooja2:5683/

With client:
1) $ make TARGET=cooja coap-client-server-example.csc
2) Wait until red LED toggles on mote 2 (server)
3) Choose "Click button on Sky 3" from the context menu of mote 3 (client) and watch serial output

TMOTES HOWTO
------------
Server:
1) Connect two Tmote Skys (check with $ make TARGET=sky sky-motelist)
2) $ make TARGET=sky rest-server-example.upload MOTE=2
3) $ make TARGET=sky login MOTE=2
4) Press reset button, get address, abort with Ctrl+C:
   Line: "Tentative link-local IPv6 address fe80:0000:0000:0000:____:____:____:____"
5) $ cd ../ipv6/rpl-border-router/
6) $ make TARGET=sky border-router.upload MOTE=1
7) $ make connect-router
   For a BR tty other than USB0: $ make connect-router-port PORT=X
8) Start Copper and discover resources at coap://[aaaa::____:____:____:____]:5683/

Add a client:
1) Change the hard-coded server address in coap-client-example.c to aaaa::____:____:____:____
2) Connect a third Tmote Sky
3) $ make TARGET=sky coap-client-example.upload MOTE=3

DETAILS
-------
The Erbium CoAP currently implements draft 07.
Central features are commented in rest-server-example.c.
In general, apps/er-coap-07 supports:
* All CoAP-07 header options
* CON Retransmissions (note COAP_MAX_OPEN_TRANSACTIONS)
* Blockwise Transfers (note REST_MAX_CHUNK_SIZE)
* Separate Responses (see rest_set_pre_handler() and coap_separate_handler())
* Resource discovery
* Observing Resources (see EVENT_ and PRERIODIC_RESOURCE, note COAP_MAX_OBSERVERS)

TODOs
-----
* Blockwise uploads (for POST/PUT payload)
* Multiple If-Match ETags
* (Message deduplication)