nRF5 SDK for Mesh v4.1.0
Light switch server details and Mesh APIs

The light switch server is a Generic OnOff server that has a provisionee role in the light switch example network demonstration, which is also composed of light switch client and mesh provisioner. There can be one or more servers in this network, for example light bulbs.

The light switch server instantiates one instance of the Generic OnOff server model to control the state of LED 1.

Table of contents

The server can either be provisioned and configured:

The provisioner configures this server model instance to communicate with the client model.

light_switch_server_state_diagram.svg
State diagram for the Light switch server

After provisioning, the proxy server application starts sending out connectable advertisements with Mesh Proxy Service present, which a Proxy Client can connect to in order to interact with the mesh.

The Proxy Client acts like any other mesh device, but sends all of its mesh communication over a BLE connection to a Proxy Server, which relays it into the mesh.


Source code

You can find the source code of the light switch server in the following folder: <InstallFolder>/examples/light_switch/server

To run the light switch server example, see Light switch example.


Use of Mesh APIs

The server uses the following set of APIs:

The management module implements the behavior of a provisionee device. It handles the interface with the provisioning stack, setting up the configuration server, and restoring the device state from flash.

The main application (examples/light_switch/server/src/main.c) implements the following functionalities:

When the provisioning_complete_cb() callback is called, the device is provisioned and ready to be configured by the provisioner.

The following figure shows the calling sequence of key mesh stack APIs used by this example.

light_switch_server_interface.svg
Light switch server setup

Documentation feedback | Developer Zone | Subscribe | Updated