nRF5 SDK for Mesh v5.0.0
Light switch server details and Bluetooth 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 Bluetooth 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 Bluetooth mesh Proxy Service present, which a Proxy Client can connect to in order to interact with the Bluetooth mesh.

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


Scene model

The light switch server example implements one instance of the Scene Setup Server model and the associated root Default Transition Time Server model. The Scene Setup Server instance can be used together with the Scene Client, although both model instances are optional and can be excluded.

For the value stored and recalled by the Scene model, see the Bluetooth Mesh Model Specification (MshMDLv1.0.1), Table 3.85. For more information on how to use the Scene models, see the Scene example. The Default Transition Time Server instance can be used only when evaluating the example using mobile app.


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 Bluetooth 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 Bluetooth mesh stack APIs used by this example.

light_switch_server_interface.svg
Light switch server setup

Documentation feedback | Developer Zone | Subscribe | Updated