这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

按需专用代理客户端

按需私有代理客户端模型是 Bluetooth Mesh 规范定义的基础模型。该模型是可选的,并通过 CONFIG_BT_MESH_OD_PRIV_PROXY_CLI 选项启用。

按需私有代理客户端模型在 Bluetooth Mesh 协议规范版本1.1中引入,用于设置和检索按需私有 GATT 代理状态。 该状态定义节点在接收请求 PDU 后播发具有专用网络标识类型的 Mesh 代理服务的时间。

按需专用代理客户端模型使用包含目标按需专用 Proxy Server 模型实例的节点的设备密钥与按需私有代理服务器模型进行通信。

如果存在,则必须仅在主元素上实例化按需专用代理客户端模型。

配置

可以使用传输超时选项 CONFIG_BT_MESH_OD_PRIV_Proxy_CLI_timeout 配置按需专用代理客户端模型行为。 CONFIG_BT_MESH_OD_PRIV_PROXY_CLI_TIMEOUT 控制客户端等待状态响应消息到达的时间(以毫秒为单位)。 可以使用 bt_mesh_od_priv_proxy_cli_timeout_set() 在运行时更改该值。

API 参考

group bt_mesh_od_priv_proxy_cli

Defines

BT_MESH_MODEL_OD_PRIV_PROXY_CLI(cli_data)

On-Demand Private Proxy Client model composition data entry.

Functions

int bt_mesh_od_priv_proxy_cli_get(uint16_t net_idx, uint16_t addr, uint8_t *val_rsp)

Get the target’s On-Demand Private GATT Proxy state.

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

To process the response arguments of an async method, register the od_status callback in bt_mesh_od_priv_proxy_cli struct.

参数:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val_rsp – Response buffer for On-Demand Private GATT Proxy value.

返回:

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

int bt_mesh_od_priv_proxy_cli_set(uint16_t net_idx, uint16_t addr, uint8_t val, uint8_t *val_rsp)

Set the target’s On-Demand Private GATT Proxy state.

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

To process the response arguments of an async method, register the od_status callback in bt_mesh_od_priv_proxy_cli struct.

参数:
  • net_idx – Network index to encrypt with.

  • addr – Target node address.

  • val – On-Demand Private GATT Proxy state to be set

  • val_rsp – Response buffer for On-Demand Private GATT Proxy value.

返回:

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

void bt_mesh_od_priv_proxy_cli_timeout_set(int32_t timeout)

Set the transmission timeout value.

参数:

timeout – The new transmission timeout in milliseconds.

struct bt_mesh_od_priv_proxy_cli

On-Demand Private Proxy Client Model Context

Public Members

struct bt_mesh_model *model

Solicitation PDU RPL model entry pointer.

void (*od_status)(struct bt_mesh_od_priv_proxy_cli *cli, uint16_t addr, uint8_t state)

Optional callback for On-Demand Private Proxy Status messages.

Handles received On-Demand Private Proxy Status messages from a On-Demand Private Proxy server.The state param represents state of On-Demand Private Proxy server.

Param cli:

On-Demand Private Proxy client that received the status message.

Param addr:

Address of the sender.

Param state:

State value.