Generic Property Client¶
The Generic Property Client model can access properties from a Property Server remotely. The Property Client can talk directly to all types of Property Servers, but only if it shares an application key with the target server.
Generally, the Property Client should only target User Property Servers, unless it is part of a network administrator node that is responsible for configuring the other mesh nodes.
To ease the configuration, the Property Client can be paired with a Client Property Server that lists which properties this Property Client will request.
Extended models¶
None.
API documentation¶
include/bluetooth/mesh/gen_prop_cli.h
subsys/bluetooth/mesh/gen_prop_cli.c
-
group
bt_mesh_prop_cli
API for the Generic Property Client model.
Defines
-
BT_MESH_PROP_CLI_INIT
(_prop_list_handler, _prop_status_handler)¶ Initialization parameters for the Generic Property Client model.
- See
- See
- Parameters
[in] _prop_list_handler
: Optional status message handler.
- Parameters
[in] _prop_status_handler
: Optional status message handler.
-
BT_MESH_MODEL_PROP_CLI
(_cli)¶ Generic Property Client model composition data entry.
- Parameters
[in] _cli
: Pointer to a Generic Property Client model instance.
Functions
-
int
bt_mesh_prop_cli_client_props_get
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, uint16_t id, struct bt_mesh_prop_list *rsp)¶ Get the list of Generic Client Properties of the bound server.
To get the list of other property states, use :ref:
bt_mesh_prop_cli_props_get
.This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_list callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] id
: A starting Client Property ID present within an element.[out] rsp
: Response buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EINVAL
: Thersp::ids
list was NULL.-ENOBUFS
: The client received a response, but the supplied response buffer was too small to hold all the properties. All property IDs that could fit in the response buffers were copied into it, and thersp::count
field was left unchanged.-EALREADY
: A blocking request is already in progress.-ENOTSUP
: A message context was not provided and publishing is not supported.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_props_get
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_prop_srv_kind kind, struct bt_mesh_prop_list *rsp)¶ Get the list of properties of the bound server.
This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_list callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] kind
: Kind of Property Server to query. Use with every property kind except for BT_MESH_PROP_SRV_KIND_CLIENT. To get the list of client property states, use :ref:bt_mesh_prop_cli_client_props_get
.[out] rsp
: Response buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EINVAL
: Thersp::ids
list was NULL.-ENOBUFS
: The client received a response, but the supplied response buffer was too small to hold all the properties. All property IDs that could fit in the response buffers were copied into it, and thersp::count
field was left unchanged.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_prop_get
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_prop_srv_kind kind, uint16_t id, struct bt_mesh_prop_val *rsp)¶ Get the value of a property in a server.
This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_status callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] kind
: Kind of Property Server to query.[in] id
: ID of the property to get.[out] rsp
: Response buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EINVAL
: Thersp::ids
list was NULL.-ENOBUFS
: The client received a response, but the supplied response buffer was too small to hold all the properties. All property IDs that could fit in the response buffers were copied into it, and thersp::count
field was left unchanged.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_user_prop_set
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val, struct bt_mesh_prop_val *rsp)¶ Set a property value in a User Property Server.
The User Property may only be set if the server enabled user write access to it. If this is not the case, the server will only respond with the set user access mode for the given property.
This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_status callback.- Note
The
val::meta::user_access
level will be ignored.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] val
: New property value to set. Note that the user_access mode will be ignored.[out] rsp
: Response status buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_user_prop_set_unack
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val)¶ Set a property value in a User Property Server without requesting a response.
The User Property may only be set if the server enabled user write access to it. If this is not the case, the server will only respond with the set user access mode for the given property.
- Note
The
val::meta::user_access
level will be ignored.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] val
: New property value to set. Note that the user_access mode will be ignored.
- Return Value
0
: Successfully sent the message.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.
-
int
bt_mesh_prop_cli_admin_prop_set
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val, struct bt_mesh_prop_val *rsp)¶ Set a property value in an Admin Property server.
This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_status callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] val
: New property value to set.[out] rsp
: Response status buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_admin_prop_set_unack
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val)¶ Set a property value in an Admin Property server without requesting a response.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] val
: New property value to set.
- Return Value
0
: Successfully sent the message.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.
-
int
bt_mesh_prop_cli_mfr_prop_set
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop *prop, struct bt_mesh_prop_val *rsp)¶ Set the user access of a property in a Manufacturer Property server.
This call is blocking if the
rsp
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_prop_cli::prop_status callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] prop
: New property value to set.[out] rsp
: Response status buffer, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_prop_cli_mfr_prop_set_unack
(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop *prop)¶ Set the user access of a property in a Manufacturer Property server without requesting a response.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] prop
: New property value to set.
- Return Value
0
: Successfully sent the message.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.
-
struct
bt_mesh_prop_list
¶ - #include <gen_prop_cli.h>
List of property IDs.
-
struct
bt_mesh_prop_cli
¶ - #include <gen_prop_cli.h>
Generic Property Client instance. Should be initialized with BT_MESH_PROP_CLI_INIT.
Public Members
-
struct bt_mesh_model *
model
¶ Model entry.
-
struct bt_mesh_model_pub
pub
¶ Publish parameters.
-
struct bt_mesh_model_ack_ctx
ack_ctx
¶ Acknowledged message tracking.
-
void (*const
prop_list
)(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_prop_srv_kind kind, const struct bt_mesh_prop_list *list)¶ Property list message handler.
- Parameters
[in] cli
: Client that received the message.[in] ctx
: Context of the message.[in] kind
: Kind of Property Server that sent the message.[in] list
: List of properties supported by the server.
-
void (*const
prop_status
)(struct bt_mesh_prop_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_prop_srv_kind kind, const struct bt_mesh_prop_val *prop)¶ Property status message handler.
- Parameters
[in] cli
: Client that received the message.[in] ctx
: Context of the message.[in] kind
: Kind of Property Server that sent the message.[in] prop
: Property value.
-
struct bt_mesh_model *
-