Add a Custom Application#

The example is the Wi-SUN Node Monitoring example application The reference code is provided on GitHub.

The example code being available on GitHub, it is recommended to:

node monitoring

Using the Wi-SUN Node Monitoring project removes the difficulties related to adding pieces of code along the way to reach a compilable project.

The goal of this application is to:

  • Follow the device connections from the Border Router.

    • The devices will send a UDP connection message to the Border Router on port 1237 after connecting for the first time.

    • The devices will automatically send a connection status message to the Border Router every auto_send seconds.

      • The default auto_send period is 30 seconds.

      • The auto_send period can be checked remotely via a CoAP get command for settings\auto_send.

      • It can be modified using the same CoAP command if adding -e <n> as the command payload, <n> being the new value.

      • This can be used as an example for sensor monitoring or actuator control in a final application.

      • The connection message contains time values in dd-hh:mm:ss format.

      • The start point of these time values is the moment the application is started.

      • The first connection message can be used to check the connection time.

  • Follow the device join state changes.

    • The history of these changes can be retrieved from the Border Router once connected.

  • Monitor application statistics.

    • Application statistics can be retrieved from the Border Router using CoAP requests.

    • A very important statistic is the availability rate, computed from the total connected and disconnected times, which should be as close to 100% as possible (counting starts on the very first connection).

  • Monitor Wi-SUN Stack statistics.

    • All statistics provided by the Wi-SUN Stack are available via CoAP requests.

  • Use OTA DFU to remotely update the WI-SUN devices via the Wi-SUN network.

Prerequisites#

Use Git to Store the Current State#

Before adding code, it is useful to use Git to track code changes, to be able to easily check the differences later on, and roll the code back if required.

Software Components#

The following software components are required to compile the application with the added code:

  • Third-Party / Segger / SEGGER RTT printf

  • Wi-SUN / Wi-SUN Services / CoAP

  • Wi-SUN / Wi-SUN Services / PoSIX-compliant Socket

  • Wi-SUN / Wi-SUN Services / Over-The-Air Firmware Upgrade (OTA DFU)

Note: It is possible to check which components are installed in a project looking at the .slcp file and the SOFTWARE COMPONENTS tab, checking the Installed box.

Using the Wi-SUN Node Monitoring example application, all components should already be installed. Just check their presence to get familiar with components used. Install the components now if they are not present.

Installed components

Installed Wi-SUN components are listed in autogen\sl_component_catalog.h:

component catalog

Custom Application#

The Custom Application pages explain how the custom application features are added to a Wi-SUN project. These features can be added to multiple projects if needed.