The provisoner example is the default Bluetooth mesh network configurator. It works in a fixed, predefined way and can be used as the static provisioner with the following examples:
Table of contents
Because of the asynchronous nature of the provisioning and configuration process, the provisioner is implemented as a multi-layered state machine. The application provisions and configures devices when it receives unprovisioned beacons from them.
Every supported example has a unique Uniform Resource Identifier (URI) included in the beacons. The provisioner example uses URI hash to understand the type of example being provisioned and to select the suitable configuration to be applied to the node after provisioning. For this reason, this provisioner can provision devices only with the known URI. The list of URIs is predefined.
The static provisioner has its own limitations and is provided as a tool to evaluate SDK examples without the need to use a mobile application provisioner. If you are using a mobile application for provisioning, you can see the models present on the device and configure the nodes accordingly. Moreover, you can also use more sophisticated automated provisioners that can use the UUID, URI, and the device composition data to understand which devices are being provisioned and configure them automatically.
The following diagram shows how the provisioner configures Bluetooth mesh examples.
During the provisioning procedure, the client boards are provisioned at random and their elements are assigned addresses starting in the following manner:
Example | Client board | Primary element address | First secondary element address | Second secondary element address |
---|---|---|---|---|
All examples | Primary element (1st board) | 0x100 | 0x101 | 0x102 |
All examples | Primary element (2nd board) | 0x104 | 0x105 | 0x106 |
All examples | Primary element (3rd board) | 0x108 | 0x109 | 0x10A |
All examples | ... | ... | ... | ... |
On each client example, the two instances of the client models are instantiated on separate secondary elements to communicate with the Odd and Even server groups. Each subsequent secondary element gets a consecutive address starting from the address of the primary element. The provisioner configures the client model instantiated on an element with the Odd address to communicate with the Odd group, and the client model instantiated on an element with the Even address to communicate with the Even group.
If you have multiple client boards in the network, their primary elements will receive a consecutive even address after the address of the last element on a previously provisioned client node.
The following table shows the list of client examples.
Example | Client example |
---|---|
Light CTL | Light CTL |
Light LC | Light switch |
Light lightness | Light Lightness |
Light switch | Light switch |
Dimming | Dimming |
EnOcean translator client | EnOcean (as a Light switch client) |
Scene client | Scene |
Sensor client | Sensor |
The provisioner also provisions and configures the servers at random. It assigns them addresses and adds them to Odd and Even groups.
The starting addresses are different for each server example. Subsequently provisioned server boards get the next consecutive Odd and Even addresses.
Example | Server example | Primary element address | 1st secondary element address | 2nd secondary element address | Next board's Primary element address | ... |
---|---|---|---|---|---|---|
Light CTL | Light CTL servers with Scene servers Light CTL Server with Light LC servers | 0x601 0x701 | 0x602 0x702 | NA 0x703 | 0x604 0x704 | ... |
Light LC | Light LC servers with Scene servers | 0x501 | 0x502 | NA | 0x504 | ... |
Light lightness | Lightness servers with Scene servers | 0x401 | NA | NA | 0x402 | ... |
Light switch | Light switch servers with Scene servers | 0x201 | NA | NA | 0x202 | ... |
Dimming | Dimming servers with Scene servers | 0x301 | NA | NA | 0x302 | ... |
EnOcean translator client | Any server that extends the generic OnOff server, for example Light switch server. | Depends on the server used. | Depends on the server used. | Depends on the server used. | Depends on the server used. | ... |
Sensor server | Sensor server | 0x801 | NA | NA | 0x802 | ... |
After getting provisioned, the device is configured depending on whether it is running a client example or a server example:
The following diagram shows the typical state transitions of the provisioner while provisioning and configuring a light switch client.
For more information on how a provisioning process works, see the provisioning guide.
The provisioner uses the following set of APIs:
The provisioner role is much more complex than the provisionee role, both in terms of resource requirements and application complexity. For these reasons, there is no simple API for the provisioning and configuration process.
However, for a specific use case, the API usage can be reduced into a set of simple steps, as implemented in the provisioner example:
In the example code, this behavior is split between the following modules:
examples/provisioner/src/main.c
– deals with the initialization and setup of the Bluetooth mesh stack.examples/provisioner/src/provisioner_helper.c
– deals with the provisioning process.examples/provisioner/src/node_setup.c
– deals with the configuration process of the node once the provisioning is completed.The following figure shows the details of how provisioning and configuration are implemented with the provided APIs. Note that the figure may simplify some API calls to provide a clearer picture. See the relevant source files for details.
You need one of the compatible development kits for the provisioner, in addition to the development kits required by the example you are using the provisioner with.
See Compatibility for information about the compatible development kits.
You can find the source code of the Bluetooth mesh provisioner in the following folder: <InstallFolder>/examples/provisioner
The buttons (1 to 4) are used to initiate certain actions, and the LEDs (1 to 4) are used to reflect the status of actions as follows:
There is no standalone testing procedure for the provisioner example. You need to use this example together with one of the examples that requires the static provisioner example. These examples are listed at the beginning of this page. Make sure to check their documentation pages, especially the section about testing the example.
If you have more than 40 servers and clients in the example you want to use the provisioner with, make sure to set MAX_PROVISIONEE_NUMBER
. This define specifies the maximum number of provisionee devices that the provisioner is able to introduce in the network.
Defining this value is important for setting key device array and TTL value, so that the network can work properly. This is because the provisioner keeps the device key for every provisioned device. Updating this define is also useful for calculating the replay cache size, which must be equal or higher to MAX_PROVISIONEE_NUMBER
. Otherwise, the transport layer will reject all incoming traffic from new devices, because it cannot guarantee protection from a replay attack.
Complete the following steps:
example_network_config.h
, set MAX_PROVISIONEE_NUMBER
to the total number of servers and clients available, if it is higher than 40.MAX_PROVISIONEE_NUMBER
increases, also scale up the replay protection list size (REPLAY_CACHE_ENTRIES).MAX_AVAILABLE_SERVER_NODE_NUMBER
in nrf_mesh_config_app.h
of the client example to the value set for MAX_PROVISIONEE_NUMBER
.Scene Setup Server model does not have a corresponding server example of its own and is instead showcased by several examples:
You can exclude this model for these examples. If you decide to do so, you will also need to exclude the Scene Setup Server model from the static provisioner to be able to provision the server example. Complete the following steps:
examples/provisioner/include/nrf_mesh_config_app.h
.SCENE_SETUP_SERVER_INSTANCES_MAX
define. By default, its value is set to 1
.0
and recompile.After building the examples (the provisioner example and the examples you want to evaluate) by following the instructions in Building the Bluetooth mesh stack, complete the following steps:
If the provisioner encounters an error during the provisioning or configuration process for a certain node, you can reset the provisioner to restart this process for that node.