这个页面的 最新开发版本 可能比这个发布的 2.3-beta.2 版本新。

大型组合数据客户端

大组合数据客户端模型是 Bluetooth Mesh 规范定义的基础模型。该模型是可选的,并通过 CONFIG_BT_MESH_LARGE_COMP_DATA_CLI 选项启用。

大合成数据客户端模型在 Bluetooth Mesh 协议规范版本1.1中引入,支持读取不适合配置合成数据状态消息的合成数据页面,以及读取支持 大型组合数据服务器 模型的节点上模型实例的元数据的功能。

大组合数据客户端模型使用包含目标大组合数据服务器模型实例的节点的设备密钥与大组合数据服务模型通信。

如果存在,则必须仅在主元素上实例化大型组合数据客户端模型。

API 参考

group bt_mesh_large_comp_data_cli

Defines

BT_MESH_MODEL_LARGE_COMP_DATA_CLI(cli_data)

Large Composition Data Client model Composition Data entry.

参数:

Functions

int bt_mesh_large_comp_data_get(uint16_t net_idx, uint16_t addr, uint8_t page, size_t offset, struct bt_mesh_large_comp_data_rsp *rsp)

Send Large Composition Data Get message.

This API is used to read a portion of a Composition Data Page.

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

When rsp is set, the user is responsible for providing a buffer for the Composition Data in bt_mesh_large_comp_data_rsp::data. If a buffer is not provided, the metadata won’t be copied.

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

  • addr – Target node element address.

  • page – Composition Data Page to read.

  • offset – Offset within the Composition Data Page.

  • rsp – Pointer to a struct storing the received response from the server, or NULL to not wait for a response.

返回:

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

int bt_mesh_models_metadata_get(uint16_t net_idx, uint16_t addr, uint8_t page, size_t offset, struct bt_mesh_large_comp_data_rsp *rsp)

Send Models Metadata Get message.

This API is used to read a portion of a Models Metadata Page.

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

When rsp is set, a user is responsible for providing a buffer for metadata in bt_mesh_large_comp_data_rsp::data. If a buffer is not provided, the metadata won’t be copied.

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

  • addr – Target node element address.

  • page – Models Metadata Page to read.

  • offset – Offset within the Models Metadata Page.

  • rsp – Pointer to a struct storing the received response from the server, or NULL to not wait for a response.

返回:

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

struct bt_mesh_large_comp_data_rsp

Large Composition Data response.

Public Members

uint8_t page

Page number.

uint16_t offset

Offset within the page.

uint16_t total_size

Total size of the page.

struct net_buf_simple *data

Pointer to allocated buffer for storing received data.

struct bt_mesh_large_comp_data_cli_cb

Large Composition Data Status messages callbacks

Public Members

void (*large_comp_data_status)(struct bt_mesh_large_comp_data_cli *cli, uint16_t addr, struct bt_mesh_large_comp_data_rsp *rsp)

Optional callback for Large Composition Data Status message.

Handles received Large Composition Data Status messages from a Large Composition Data Server.

If the content of rsp is needed after exiting this callback, a user should deep copy it.

Param cli:

Large Composition Data Client context.

Param addr:

Address of the sender.

Param rsp:

Response received from the server.

void (*models_metadata_status)(struct bt_mesh_large_comp_data_cli *cli, uint16_t addr, struct bt_mesh_large_comp_data_rsp *rsp)

Optional callback for Models Metadata Status message.

Handles received Models Metadata Status messages from a Large Composition Data Server.

If the content of rsp is needed after exiting this callback, a user should deep copy it.

Param cli:

Large Composition Data Client context.

Param addr:

Address of the sender.

Param rsp:

Response received from the server.

struct bt_mesh_large_comp_data_cli

Large Composition Data Client model context

Public Members

struct bt_mesh_model *model

Model entry pointer.

struct bt_mesh_msg_ack_ctx ack_ctx

Internal parameters for tracking message responses.

const struct bt_mesh_large_comp_data_cli_cb *cb

Optional callback for Large Composition Data Status messages.