nes-proj/examples/lwm2m/standalone
Niclas Finne 4a82bda543 Various updates in LWM2M standalone example
* Use LWM2M security object as DTLS keystore by default
* Mark endpoint as secure regardless if DTLS peer exists or not
* Somewhat less debug output by default
2018-01-12 01:18:41 +01:00
..
coap-hex CoAP: added make option to specify CoAP DTLS keystore to use by default. 2018-01-12 01:18:41 +01:00
coap-ipv4 Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
tinydtls-support Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
.gitignore Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
Hex2DTLS.java Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00
Hex2UDP.java Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00
Makefile Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
Makefile.contiki Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
README.md Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
contiki.h Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
generic-object-test.c Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00
ipso-control-test.c ipso-objects: updated IPSO objects sensor/controllers to latest LWM2M API. 2018-01-12 01:18:41 +01:00
ipso-sensor-temp.c ipso-objects: updated IPSO objects sensor/controllers to latest LWM2M API. 2018-01-12 01:18:41 +01:00
lwm2m-example.c Various updates in LWM2M standalone example 2018-01-12 01:18:41 +01:00
posix-coap-timer.c Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00
posix-main.c Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00
posix-main.h Imported LWM2M standalone example from lwm2m-contiki at https://github.com/sics-iot/lwm2m-contiki 2018-01-12 01:18:41 +01:00

README.md

LWM2M Standalone Example

This is an example of how to make use of the OMA LWM2M and CoAP implementation from Contiki-NG in a native application.

The Makefile will copy necessary files from Contiki-NG to the subfolder lwm2m-src and then compile the example lwm2m-example as a native application. By copying only the needed source files, the example can be used outside the Contiki-NG source tree.

Running the LWM2M example

cd contiki/examples/lwm2m/standalone
make
./lwm2m-example

The example application will start a CoAP server listening on localhost port 5683 with some example LWM2M objects. By default, the example application will also register itself with the Leshan server at leshan.eclipse.org. To specify a different LWM2M server: ./lwm2m-example coap://<server host address> <endpoint name>.

For example to connect to a locally running LWM2M server:

./lwm2m-example coap://127.0.0.1/ example-endpoint-name

Running the LWM2M example with DTLS

The example currently only supports PSK and the default credentials can be changed in the file lwm2m-example.c.

#define PSK_DEFAULT_IDENTITY "Client_identity"
#define PSK_DEFAULT_KEY      "secretPSK"

To compile with DTLS support and connect to a local LWM2M server with matching credentials configured:

cd contiki/examples/lwm2m/standalone
make clean
make MAKE_WITH_DTLS=1
./lwm2m-example coaps://127.0.0.1

Moving the example outside Contiki-NG

cd contiki/examples/lwm2m/standalone
make copy

Copy the example directory contents to a directory outside Contiki-NG. Remove the Makefile Makefile.contiki and the remaining Makefile will compile the example independent of the Contiki-NG source tree.

Running the LWM2M examle with HEX transport

The Hex Transport can be tested together with DTLS using:

make clean
make TRANSPORT=hex MAKE_WITH_DTLS=1
javac Hex2UDP.java
java Hex2UDP leshan.eclipse.org 5684 ./lwm2m-example

Note that you need to configure the Leshan server with the correct key and ID.

(without DTLS it should be 5683 for CoAP).