Example Embedded Applications

Several examples of applications built with the Nabto Edge Embedded SDK can be found in the SDK github repo under the examples directory.

All examples prefixed with simple_ are minimal examples of the specific subject, omitting all access control and other complexities. For a thorough example demonstrating access control, see the heat pump example or the full Nabto Edge Tunnel app.

Corresponding example clients for all of the above examples are available in the nabto-client-sdk-examples github repo. The embedded application can be used with the Nabto Edge Tunnel CLI client tool.

Hello, World! CoAP Service

This example is a simple Hello, World! style Nabto Edge Embedded SDK application. It is located in examples/simple_coap in the SDK repo. The other simple_ examples are built an run in a similar way.

The application is a simple CoAP service, that handles a GET request at the path /hello-world. It replies with a string payload that says “Hello, world!” back to the client.

Configuration

The unique device configuration values are supplied on the command line. Obtain these from the Nabto Cloud Console as discussed in the intro.

Building and running

Follow the general build instructions on the Embedded SDK intro page to build the Hello, World CoAP service.

To run the application, execute the following in a terminal:

 _install/bin/simple_coap_device

Invoking CoAP service from a Nabto Edge client

You can use the corresponding simple CoAP commandline client:

$ ./simple_coap_get -H https://pr-vcizvpox.clients.nabto.net \
  -p <product id  (pr-...)> \
  -d <device id   (de-...)>\
  -s <server key  (sk-...)\
  -r '/hello-world'
connecting to pr-udnromc7.de-g9caq9qv
Created a new connection
Connected to device with fingerprint: 3b7144c34e4e1cd8821e641997110631
Sending CoAP GET request
Sending coap get-request:/hello-world
Received CoAP response data: Hello world
freed connection