Updated examples after CoAP moved to module

This commit is contained in:
Niclas Finne 2017-09-01 17:45:50 +02:00
parent 5025769825
commit b4f8f21b4d
49 changed files with 91 additions and 93 deletions

View File

@ -44,24 +44,23 @@
microcontroller architecture used on the platform for which Contiki
is built): rules for the CPU architecture, located in the CPU
architecture's subdirectory in the cpu/ directory.
- <tt>Makefile.\$(APP)</tt> (where \$(APP) is the name of an
application in the apps/ directory): rules for applications in the
apps/ directories. Each application has its own makefile.
- <tt>Makefile.\$(MODULE)</tt> (where \$(MODULE) is the name of a
module in the Contiki directory): rules for modules in the
Contiki directories. Each module might have its own optional makefile.
The Makefile in the project's directory is intentionally simple. It
specifies where the Contiki source code resides in the system and
includes the system-wide Makefile, <tt>Makefile.include</tt>. The
project's makefile can also define in the <tt>APPS</tt> variable a
list of applications from the apps/ directory that should be included
in the Contiki system. The Makefile used in the hello-world example
project looks like this:
project's makefile can also define in the <tt>MODULES</tt> variable a
list of modules that should be included in the Contiki system.
The Makefile used in the hello-world example project looks like this:
\code
CONTIKI = ../..
all: hello-world
include $(CONTIKI)/Makefile.include
\endcode
First, the location of the Contiki source code tree is given by
defining the <tt>CONTIKI</tt> variable. Next, the name of the
application is defined. Finally, the system-wide
@ -71,7 +70,7 @@ include $(CONTIKI)/Makefile.include
the core Contiki system. <tt>Makefile.include</tt> always reside in
the root of the Contiki source tree. When <tt>make</tt> is run,
<tt>Makefile.include</tt> includes the <tt>Makefile.\$(TARGET)</tt>
as well as all makefiles for the applications in the <tt>APPS</tt>
as well as all makefiles for the modules in the <tt>MODULES</tt>
list (which is specified by the project's <tt>Makefile</tt>).
<tt>Makefile.\$(TARGET)</tt>, which is located in the
@ -86,11 +85,10 @@ include $(CONTIKI)/Makefile.include
used, the <tt>Makefile.\$(CPU)</tt> can either contain a conditional
expression that allows different C compilers to be defined, or it can
be completely overridden by the platform specific makefile
<tt>Makefile.\$(TARGET)</tt>.
<tt>Makefile.\$(TARGET)</tt>.
@{
*/
/**
@}
*/

View File

@ -1,5 +1,5 @@
all: er-example-server er-example-client
# use target "er-plugtest-server" explicitly when requried
all: coap-example-server coap-example-client
# use target "plugtest-server" explicitly when required
CONTIKI=../../..

View File

@ -4,13 +4,13 @@ A Quick Introduction to the Erbium (Er) REST Engine
EXAMPLE FILES
-------------
- er-example-server.c: A RESTful server example showing how to use the REST
- coap-example-server.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).
- er-example-client.c: A CoAP client that polls the /actuators/toggle resource
- coap-example-client.c: A CoAP client that polls the /actuators/toggle resource
every 10 seconds and cycles through 4 resources on button press (target
address is hard-coded).
- er-plugtest-server.c: The server used for draft compliance testing at ETSI
- plugtest-server.c: The server used for draft compliance testing at ETSI
IoT CoAP Plugtests. Erbium (Er) participated in Paris, France, March 2012 and
Sophia-Antipolis, France, November 2012 (configured for minimal-net).
@ -66,7 +66,7 @@ TMOTES HOWTO
1. Connect two Tmote Skys (check with $ make TARGET=sky sky-motelist)
make TARGET=sky er-example-server.upload MOTE=2
make TARGET=sky coap-example-server.upload MOTE=2
make TARGET=sky login MOTE=2
2. Press reset button, get address, abort with Ctrl+C:
@ -86,21 +86,21 @@ TMOTES HOWTO
### Add a client:
1. Change the hard-coded server address in er-example-client.c to fd00::____:____:____:____
1. Change the hard-coded server address in coap-example-client.c to fd00::____:____:____:____
2. Connect a third Tmote Sky
make TARGET=sky er-example-client.upload MOTE=3
make TARGET=sky coap-example-client.upload MOTE=3
MINIMAL-NET HOWTO
-----------------
With the target minimal-net you can test your CoAP applications without
constraints, i.e., with large buffers, debug output, memory protection, etc.
The er-plugtest-server is thought for the minimal-net platform, as it requires
The plugtest-server is thought for the minimal-net platform, as it requires
an 1280-byte IP buffer and 1024-byte blocks.
make TARGET=minimal-net er-plugtest-server
sudo ./er-plugtest-server.minimal-net
make TARGET=minimal-net plugtest-server
sudo ./plugtest-server.minimal-net
Open new terminal
@ -127,11 +127,11 @@ DETAILS
-------
Erbium implements the Proposed Standard of CoAP. Central features are commented
in er-example-server.c. In general, apps/er-coap supports:
in coap-example-server.c. In general, coap supports:
- All draft-18 header options
- CON Retransmissions (note COAP_MAX_OPEN_TRANSACTIONS)
- Blockwise Transfers (note REST_MAX_CHUNK_SIZE, see er-plugtest-server.c for
- Blockwise Transfers (note REST_MAX_CHUNK_SIZE, see plugtest-server.c for
Block1 uploads)
- Separate Responses (no rest_set_pre_handler() required anymore, note
coap_separate_accept(), _reject(), and _resume())

View File

@ -41,7 +41,7 @@
#include <string.h>
#include "contiki.h"
#include "contiki-net.h"
#include "er-coap-engine.h"
#include "coap-engine.h"
#include "dev/button-sensor.h"
/*----------------------------------------------------------------------------*/

View File

@ -41,11 +41,11 @@
#include <string.h>
#include "contiki.h"
#include "contiki-net.h"
#include "er-coap.h"
#include "er-coap-transactions.h"
#include "er-coap-separate.h"
#include "coap.h"
#include "coap-transactions.h"
#include "coap-separate.h"
#include "rest-engine.h"
#include "er-plugtest.h"
#include "plugtest.h"
/*
* Resources to be activated need to be imported through the extern keyword.

View File

@ -36,8 +36,8 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
#ifndef __ER_PLUGTEST_H__
#define __ER_PLUGTEST_H__
#ifndef PLUGTEST_H_
#define PLUGTEST_H_
#if !defined(CONTIKI_TARGET_NATIVE)
#warning "Should only be compiled for native!"
@ -63,4 +63,4 @@
#define MAX_PLUGFEST_BODY 2048
#define CHUNKS_TOTAL 2012
#endif /* __ER_PLUGTEST_H__ */
#endif /* PLUGTEST_H_ */

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_delete_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_delete_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -39,8 +39,8 @@
#include <string.h>
#include "sys/cc.h"
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,9 +38,9 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-coap-observe.h"
#include "er-plugtest.h"
#include "coap.h"
#include "coap-observe.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,10 +38,10 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-coap-transactions.h"
#include "er-coap-separate.h"
#include "er-plugtest.h"
#include "coap.h"
#include "coap-transactions.h"
#include "coap-separate.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_resume_handler(void);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -38,8 +38,8 @@
#include <string.h>
#include "rest-engine.h"
#include "er-coap.h"
#include "er-plugtest.h"
#include "coap.h"
#include "plugtest.h"
static void res_get_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
static void res_put_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);

View File

@ -1,4 +1,4 @@
examples/ipv6/er-rest-example<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
@ -48,9 +48,9 @@ examples/ipv6/er-rest-example<?xml version="1.0" encoding="UTF-8"?>
org.contikios.cooja.mspmote.SkyMoteType
<identifier>server</identifier>
<description>Erbium Server</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.c</source>
<commands EXPORT="discard">make er-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.c</source>
<commands EXPORT="discard">make coap-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
@ -71,9 +71,9 @@ examples/ipv6/er-rest-example<?xml version="1.0" encoding="UTF-8"?>
org.contikios.cooja.mspmote.SkyMoteType
<identifier>client</identifier>
<description>Erbium Client</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-client.c</source>
<commands EXPORT="discard">make er-example-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-client.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-client.c</source>
<commands EXPORT="discard">make coap-example-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-client.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -48,9 +48,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>server</identifier>
<description>Erbium Server</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.c</source>
<commands EXPORT="discard">make er-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.c</source>
<commands EXPORT="discard">make coap-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
@ -71,9 +71,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>client</identifier>
<description>Erbium Client</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-observe-client.c</source>
<commands EXPORT="discard">make er-example-observe-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-observe-client.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-observe-client.c</source>
<commands EXPORT="discard">make coap-example-observe-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-observe-client.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -48,9 +48,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>server</identifier>
<description>Erbium Server</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.c</source>
<commands EXPORT="discard">make er-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.c</source>
<commands EXPORT="discard">make coap-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
@ -71,9 +71,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>client</identifier>
<description>Erbium Client</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-client.c</source>
<commands EXPORT="discard">make er-example-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-client.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-client.c</source>
<commands EXPORT="discard">make coap-example-client.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-client.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -48,9 +48,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>server</identifier>
<description>Erbium Server</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.c</source>
<commands EXPORT="discard">make er-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/er-rest-example/er-example-server.sky</firmware>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.c</source>
<commands EXPORT="discard">make coap-example-server.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/coap-example/coap-example-server.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -37,7 +37,7 @@
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "rest-engine.h"
#include "er-coap.h"
#include "coap.h"
#include "rf-core/rf-ble.h"
#include <string.h>

View File

@ -38,7 +38,7 @@
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "rest-engine.h"
#include "er-coap.h"
#include "coap.h"
#include "sys/clock.h"
#include "coap-server.h"
#include "cc26xx-web-demo.h"

View File

@ -38,7 +38,7 @@
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "rest-engine.h"
#include "er-coap.h"
#include "coap.h"
#include "coap-server.h"
#include "cc26xx-web-demo.h"

View File

@ -38,7 +38,7 @@
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "rest-engine.h"
#include "er-coap.h"
#include "coap.h"
#include "cc26xx-web-demo.h"
#include "coap-server.h"