nRF5 SDK for Mesh v2.2.0
GATT provisioning and Proxy

Provisioning over GATT1 and the Proxy protocol2 are optional features that allow a device without support for the advertising bearer to provision and/or communicate with the mesh network through a device using a GATT interface.

A device does not need to support both the GATT provisioning bearer (PB-GATT) and the Proxy feature, but in the Light switch proxy example applications, both are supported by default. The sequence diagram below shows how a device is provisioned over GATT and then transitions to being a GATT Proxy server.

gatt_proxy.svg
GATT provisioning and Proxy server behavior

The figure shows that the device first advertises both connectable and non-connectable Unprovisioned Device beacons. The connectable beacon is used for PB-GATT and the non-connectable is for PB-ADV. The connectable beacon has a slightly different format as it also includes the Mesh Provisioning Service UUID3. PB-GATT uses the interface provided in mesh_adv.h for advertising. Immediately after the provisioner has connected to the device, it stops advertising both beacons. When the provisioning process is complete, the device must reset its GATT database to comply with the following requirement from the Mesh Profile Specification v1.0:

A device may support the Mesh Provisioning Service or the Mesh Proxy Service or both. If both are supported, only one of these services shall be exposed in the GATT database at a time.3

The reset is done by the helper module mesh_provisionee.c. To reset the database, the SoftDevice is disabled and re-enabled. This means that any application service or setting needs to be re-initialized after provisioning. This is done in the prov_complete_cb() callback from mesh_provisionee.h. For example, in the Light switch proxy server example:

static void provisioning_complete_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Successfully provisioned\n");
/* Restores the application parameters after switching from the Provisioning service to the Proxy */
gap_params_init();
conn_params_init();
// ...
}

GATT support in mesh is provided through the following source files:

Furthermore, there are two defines, MESH_FEATURE_GATT and GATT_PROXY, that control the inclusion of GATT related code in other sources. For example, the Configuration server (models/foundation/src/config_server.c) behaves diffently when GATT_PROXY is supported. MESH_FEATURE_GATT controls inclusion of all GATT related code in examples/common/src/mesh_provisionee.c, whereas GATT_PROXY controls the GATT Proxy feature specifically.

In the proxy examples, these macros are enabled as compile-time definitions. That means that they are set in the example's CMakeLists.txt or in the "Preprocessor Definitions" in the SEGGER Embedded Studio project.


1 Mesh Profile Specification v1.0 Section 5.2.2, page 229.
2 Mesh Profile Specification v1.0 Chapter 6, page 260.
3 Mesh Profile Specification v1.0 Section 7.1.2.2.1, page 271.
4 Mesh Profile Specification v1.0 Chapter 7, page 269.


Documentation feedback | Developer Zone | Subscribe | Updated