Proxy
The Proxy feature allows legacy devices such as phones to access the Bluetooth Mesh network through
GATT. The Proxy functionality is compiled into the system only when the CONFIG_BT_MESH_GATT_PROXY
option is set. The Proxy feature state is controlled by the Configuration Server,
and its initial value can be set with bt_mesh_cfg_srv.gatt_proxy
.
Nodes with the Proxy feature enabled can advertise using Network Identity and Node Identity, which is controlled by the Configuration Client.
The GATT Proxy state indicates whether the Proxy feature is supported.
Dedicated Proxy Server
Nodes that support the proxy feature and the blueooth_mesh_models_priv_beacon_srv()
model can
advertise using dedicated network and node identifier types, controlled by blueooth _mesh_models_prif_beacon_cli()
. By advertising with this set of identification types,
the node allows the legacy device to connect to the network over GATT while maintaining the
privacy of the network.
The Private GATT Proxy state indicates whether the Private Proxy functionality is supported.
Proxy Solicitation
When GATT Proxy and Dedicated GATT Proxy states are disabled on a node, traditional devices cannot connect to it.
However, nodes supporting the On-Demand Private Proxy Server can be requested to advertise connectable advertising events without enabling the Dedicated GATT Proxy state.
To request a node, traditional devices can send a Solicitation PDU by calling the
bt_mesh_proxy_solicit()
function. To enable this feature, the device must to be compiled with
the CONFIG_BT_MESH_PROXY_SOLICITATION
option set.
The Solicitation PDU is a non-mesh, non-connectable, undirected advertising message containing the Proxy Solicitation UUID, encrypted using the network key of the subnet that the traditional device intends to connect to. The PDU includes the source address and sequence number of the traditional device. The sequence number is maintained by the traditional device and increments for each new Solicitation PDU sent.
Each node supporting the receipt of Solicitation PDUs maintains its own Solicitation Replay Protection List (SRPL). The SRPL protects the Solicitation mechanism from replay attacks by storing pairs of Solicitation Sequence Numbers (SSEQ) and Solicitation Source Addresses (SSRC) for valid Solicitation PDUs processed by the node. The delay between updating the SRPL and storing changes to persistent storage is defined by``CONFIG_BT_MESH_RPL_STORE_TIMEOUT``.
The Solicitation PDU RPL Configuration models, PDU RPL Configuration Client Request and
PDU RPL Configuration Server Request, provide the functionality of saving and clearing SRPL entries. A
node that supports the Solicitation PDU RPL Configuration Client model can clear a section of the
SRPL on the target by calling the bt_mesh_sol_pdu_rpl_clear()
function. Communication between
the Solicitation PDU RPL Configuration Client and Server is encrypted using the application key,
therefore, the Solicitation PDU RPL Configuration Client can be instantiated on any device in the
network.
When the node receives the Solicitation PDU and successfully authenticates it, it will start advertising connectable advertisements with the Private Network Identity type. The duration of the advertisement can be configured by the On-Demand Private Proxy Client model.
API Reference
- group bt_mesh_proxy
Proxy.
Defines
-
BT_MESH_PROXY_CB_DEFINE(_name)
Register a callback structure for Proxy events.
Registers a structure with callback functions that gets called on various Proxy events.
- Parameters:
_name – Name of callback structure.
Functions
-
int bt_mesh_proxy_identity_enable(void)
Enable advertising with Node Identity.
This API requires that GATT Proxy support has been enabled. Once called each subnet will start advertising using Node Identity for the next 60 seconds.
- Returns:
0 on success, or (negative) error code on failure.
-
int bt_mesh_proxy_private_identity_enable(void)
Enable advertising with Private Node Identity.
This API requires that GATT Proxy support has been enabled. Once called each subnet will start advertising using Private Node Identity for the next 60 seconds.
- Returns:
0 on success, or (negative) error code on failure.
-
int bt_mesh_proxy_connect(uint16_t net_idx)
Allow Proxy Client to auto connect to a network.
This API allows a proxy client to auto-connect a given network.
- Parameters:
net_idx – Network Key Index
- Returns:
0 on success, or (negative) error code on failure.
-
int bt_mesh_proxy_disconnect(uint16_t net_idx)
Disallow Proxy Client to auto connect to a network.
This API disallows a proxy client to connect a given network.
- Parameters:
net_idx – Network Key Index
- Returns:
0 on success, or (negative) error code on failure.
-
int bt_mesh_proxy_solicit(uint16_t net_idx)
Schedule advertising of Solicitation PDUs on Proxy Client .
Once called Proxy Client will schedule advertising Solicitation PDUs for the amount of time defined by
adv_int
* (CONFIG_BT_MESH_SOL_ADV_XMIT
+ 1), whereadv_int
is 20ms for Bluetooth v5.0 or higher, or 100ms otherwise.If the number of advertised Solicitation PDUs reached 0xFFFFFF, the advertisements will no longer be started until the node is reprovisioned.
- Parameters:
net_idx – Network Key Index
- Returns:
0 on success, or (negative) error code on failure.
-
struct bt_mesh_proxy_cb
Callbacks for the Proxy feature.
Should be instantiated with BT_MESH_PROXY_CB_DEFINE.
-
BT_MESH_PROXY_CB_DEFINE(_name)