1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/examples/wakaama
Alexandre Abadie ab6aa862a5
examples/wakaama: remove useless BOARD_BLACKLIST
The wakaama examples now builds fine on pic32 boards
2019-12-04 08:08:58 +01:00
..
lwm2m_cli.c examples: Add Wakaama LwM2M example application 2019-11-29 20:31:41 +01:00
main.c examples: Add Wakaama LwM2M example application 2019-11-29 20:31:41 +01:00
Makefile examples: Add Wakaama LwM2M example application 2019-11-29 20:31:41 +01:00
Makefile.ci examples/wakaama: remove useless BOARD_BLACKLIST 2019-12-04 08:08:58 +01:00
README.md examples: Add Wakaama LwM2M example application 2019-11-29 20:31:41 +01:00

Wakaama LwM2M example client

This application starts a LwM2M client on the node with instances of the following objects:

The application is based on the Eclipse Wakaama example client .

Usage

Setting up a LwM2M Test Server

To test the client a LwM2M server where to register is needed. Eclipse Leshan demo is a good option for running one locally.

To run the demo server:

wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-server-demo.jar

java -jar ./leshan-server-demo.jar

It will output the addresses where it is listening:

INFO LeshanServer - LWM2M server started at coap://0.0.0.0/0.0.0.0:5683 coaps://0.0.0.0/0.0.0.0:5684
INFO LeshanServerDemo - Web server started at http://0.0.0.0:8080/.

Bootstrap server

LwM2M provides a bootstrapping mechanism to provide the clients with information to register to one or more servers. To test this mechanism both the previous server and a bootstrap server should be running. Eclipse Leshan also provides a bootstrap server demo.

By default the bootstrap server option is disabled, it can be enabled by defining LWM2M_BOOTSTRAP as 1 (see the Makefile in this application).

To run the bootstrap server, make sure that the ports it uses are different from the ones of previous server (default are 5683 for CoAP, 5684 for CoAPs, and 8080 for the webserver), and that it corresponds to the one set in lwm2m.h as LWM2M_BSSERVER_PORT:

# download demo
wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-bsserver-demo.jar

# set CoAP, CoAPs and webserver ports for bootstrap server
BS_COAPPORT=5685
BS_COAPSPORT=5686
BS_WEBPORT=8888

# run the server
java -jar ./leshan-bsserver-demo.jar --coapport ${BS_COAPPORT} \
            --coapsport ${BS_COAPSPORT} --webport ${BS_WEBPORT}

To set up the configuration of the node and the server:

  1. Click the Add new client bootstrap configuration button.
  2. Fill in the name of the device, it should match the one set in lwm2m.h as LWM2M_DEVICE_NAME.
  3. Using the LWM2M Server tab enter the address where the LwM2M server is listening. For now only No security mode can be used.

Running the client

The address set in lwm2m.h as LWM2M_SERVER_URI should be reachable from the node, e.g. either running on native with a tap interface or as a mote connected to a border router.

Also, if a bootstrap server is being used the macro LWM2M_BOOTSTRAP should be defined as 1.

The server URI for the example is being defined using the variable SERVER_URI in the Makefile, and can be changed when compiling.

Compile and run

For debugging purposes there are two types of messages that can be enabled:

  • The lwm2m client adaptation debug can be enabled by setting ENABLE_DEBUG in lwm2m_client.c and lwm2m_client_connection.c to 1
  • The wakaama internal logging can be enabled by adding LWM2M_WITH_LOGS to the CFLAGS (CFLAGS += -DLWM2M_WITH_LOGS)

For memory allocation the TLSF package is being used, with a private heap. If memory usage has to be tweaked the heap size can be modified via the macro LWM2M_TLSF_BUFFER.

To compile run:

BOARD=<board> make clean all flash term

Shell commands

  • lwm2m start: Starts the LwM2M by configuring the module and registering to the server.