Private Beacon Client

The Private Beacon Client model is a foundation model defined by the Bluetooth mesh specification. It is enabled with the CONFIG_BT_MESH_PRIV_BEACON_CLI option.

The Private Beacon Client model is introduced in the Bluetooth Mesh Protocol Specification version 1.1, and provides functionality for configuring the Private Beacon Server models.

The Private Beacons feature adds privacy to the different Bluetooth Mesh beacons by periodically randomizing the beacon input data. This protects the mesh node from being tracked by devices outside the mesh network, and hides the network’s IV index, IV update and the Key Refresh state.

The Private Beacon Client model communicates with a Private Beacon Server model using the device key of the target node. The Private Beacon Client model may communicate with servers on other nodes or self-configure through the local Private Beacon Server model.

All configuration functions in the Private Beacon Client API have net_idx and addr as their first parameters. These should be set to the network index and the primary unicast address the target node was provisioned with.

If present, the Private Beacon Client model must only be instantiated on the primary element.

API reference

group bt_mesh_priv_beacon_cli

Defines

BT_MESH_MODEL_PRIV_BEACON_CLI(cli_data)

Private Beacon Client model composition data entry.

Parameters:

Functions

int bt_mesh_priv_beacon_cli_set(uint16_t net_idx, uint16_t addr, struct bt_mesh_priv_beacon *val, struct bt_mesh_priv_beacon *rsp)

Set the target’s Private Beacon state.

This method can be used asynchronously by setting rsp as NULL. This way the method will not wait for response and will return immediately after sending the command.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – New Private Beacon value.

  • rsp – If set, returns response status on success.

Returns:

0 on success, or (negative) error code otherwise.

int bt_mesh_priv_beacon_cli_get(uint16_t net_idx, uint16_t addr, struct bt_mesh_priv_beacon *val)

Get the target’s Private Beacon state.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – Response buffer for Private Beacon value.

Returns:

0 on success, or (negative) error code otherwise.

int bt_mesh_priv_beacon_cli_gatt_proxy_set(uint16_t net_idx, uint16_t addr, uint8_t val, uint8_t *rsp)

Set the target’s Private GATT Proxy state.

This method can be used asynchronously by setting rsp as NULL. This way the method will not wait for response and will return immediately after sending the command.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – New Private GATT Proxy value.

  • rsp – If set, returns response status on success.

Returns:

0 on success, or (negative) error code otherwise.

int bt_mesh_priv_beacon_cli_gatt_proxy_get(uint16_t net_idx, uint16_t addr, uint8_t *val)

Get the target’s Private GATT Proxy state.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – Response buffer for Private GATT Proxy value.

Returns:

0 on success, or (negative) error code otherwise.

int bt_mesh_priv_beacon_cli_node_id_set(uint16_t net_idx, uint16_t addr, struct bt_mesh_priv_node_id *val, struct bt_mesh_priv_node_id *rsp)

Set the target’s Private Node Identity state.

This method can be used asynchronously by setting rsp as NULL. This way the method will not wait for response and will return immediately after sending the command.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – New Private Node Identity value.

  • rsp – If set, returns response status on success.

Returns:

0 on success, or (negative) error code otherwise.

int bt_mesh_priv_beacon_cli_node_id_get(uint16_t net_idx, uint16_t addr, uint16_t key_net_idx, struct bt_mesh_priv_node_id *val)

Get the target’s Private Node Identity state.

Parameters:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • key_net_idx – Network index to get the Private Node Identity state of.

  • val – Response buffer for Private Node Identity value.

Returns:

0 on success, or (negative) error code otherwise.

struct bt_mesh_priv_beacon
#include <priv_beacon_cli.h>

Private Beacon.

Public Members

uint8_t enabled

Private beacon is enabled.

uint8_t rand_interval

Random refresh interval (in 10 second steps), or 0 to keep current value.

struct bt_mesh_priv_node_id
#include <priv_beacon_cli.h>

Private Node Identity.

Public Members

uint16_t net_idx

Index of the NetKey.

uint8_t state

Private Node Identity state.

uint8_t status

Response status code.

struct bt_mesh_priv_beacon_cli_cb
#include <priv_beacon_cli.h>

Private Beacon Client Status messages callbacks.

Public Members

void (*priv_beacon_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr, struct bt_mesh_priv_beacon *priv_beacon)

Optional callback for Private Beacon Status message.

Handles received Private Beacon Status messages from a Private Beacon server.

Param cli:

Private Beacon client context.

Param addr:

Address of the sender.

Param priv_beacon:

Mesh Private Beacon state received from the server.

void (*priv_gatt_proxy_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr, uint8_t gatt_proxy)

Optional callback for Private GATT Proxy Status message.

Handles received Private GATT Proxy Status messages from a Private Beacon server.

Param cli:

Private Beacon client context.

Param addr:

Address of the sender.

Param gatt_proxy:

Private GATT Proxy state received from the server.

void (*priv_node_id_status)(struct bt_mesh_priv_beacon_cli *cli, uint16_t addr, struct bt_mesh_priv_node_id *priv_node_id)

Optional callback for Private Node Identity Status message.

Handles received Private Node Identity Status messages from a Private Beacon server.

Param cli:

Private Beacon client context.

Param addr:

Address of the sender.

Param priv_node_id:

Private Node Identity state received from the server.

struct bt_mesh_priv_beacon_cli
#include <priv_beacon_cli.h>

Mesh Private Beacon Client model.

Public Members

const struct bt_mesh_priv_beacon_cli_cb *cb

Optional callback for Private Beacon Client Status messages.