mesh GATT service使用场景和示例

这篇文章讲述了mesh GATT service (Mesh Provisioning Service 和 Mesh Proxy Service)的一个场景和示例。

涉及到三个Device:Provisioner、Node 1、Node 2。

三个过程:

(1) Node 1发送可被连线的包含mesh provisioning service的unprovisioned beacon,Provisioner发起GATT连线并对其进行provision以及基本的configuration;

(2)Node 1 reset后发送包含mesh proxy service的广播包,Provisioner发起GATT连线,Node 1作为mesh proxy Node;

(3)Provisioner通过Node 1对Node 2进行provision。

 

以下是原文:

链接:https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v3.1.0%2Fmd_doc_getting_started_how_to_run_examples.html

GATT provisioning and Proxy (experimental)

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 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 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 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:

  • mesh/gatt/src/mesh_gatt.c
    • Bearer for the (GATT) Proxy protocol.
    • Required for both PB-GATT and GATT Proxy support.
  • mesh/gatt/src/proxy.c
    • Implements a core_tx.h interface for the GATT bearer.
    • Handles starting and stopping of Proxy advertisements.
    • Required for GATT Proxy support.
  • mesh/gatt/src/proxy_filter.c
    • Implements the filters used by the Proxy protocol.
    • Required for GATT Proxy support.
  • mesh/prov/src/nrf_mesh_prov_bearer_gatt.c
    • Implements the generic provisioning bearer interface for GATT.
    • Required for PB-GATT support.
  • examples/common/src/mesh_adv.c
    • Implements an advertising API for the mesh stack. The implementation is provided as an example module to give the user as much control as possible over the SoftDevice's API (for example, to add more AD-types into the advertising data or scan response).
    • Required for both PB-GATT and GATT Proxy support.

Furthermore, there are two defines, MESH_FEATURE_PB_GATT_ENABLED and MESH_FEATURE_GATT_PROXY_ENABLED, 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 MESH_FEATURE_GATT_PROXY_ENABLED is supported. MESH_FEATURE_PB_GATT_ENABLED controls inclusion of all GATT related code in examples/common/src/mesh_provisionee.c, whereas MESH_FEATURE_GATT_PROXY_ENABLED controls the GATT Proxy feature specifically.


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. 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值