Generic Battery Client¶
The Generic Battery Client model can query the state of a Generic Battery Server model remotely, but does not have any ability to control the Battery state.
Extended models¶
None.
Persistent storage¶
None.
API documentation¶
include/bluetooth/mesh/gen_battery_cli.h
subsys/bluetooth/mesh/gen_battery_cli.c
-
group
bt_mesh_battery_cli
API for the Generic Battery Client model.
Defines
-
BT_MESH_BATTERY_CLI_INIT
(_status_handler)¶ Initialization parameters for a Generic Battery Client model instance.
- Parameters
[in] _status_handler
: Optional status message handler.
-
BT_MESH_MODEL_BATTERY_CLI
(_cli)¶ Generic Battery Client model composition data entry.
- Parameters
[in] _cli
: Pointer to a Generic Battery Client model instance.
Functions
-
int
bt_mesh_battery_cli_get
(struct bt_mesh_battery_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_battery_status *rsp)¶ Get the status of the bound srv.
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_battery_cli::status_handler callback.- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[out] rsp
: Status response 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.-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.
-
struct
bt_mesh_battery_cli
¶ - #include <gen_battery_cli.h>
Generic Battery Client structure.
Should be initialized with the BT_MESH_BATTERY_CLI_INIT macro.
Public Members
-
void (*const
status_handler
)(struct bt_mesh_battery_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_battery_status *status)¶ Battery status message handler.
- Parameters
[in] cli
: Client that received the status message.[in] ctx
: Context of the incoming message.[in] status
: Battery Status of the Generic Battery Server that published the message.
-
struct bt_mesh_model_ack_ctx
ack_ctx
¶ Response context for tracking acknowledged messages.
-
struct bt_mesh_model_pub
pub
¶ Publish parameters.
-
struct bt_mesh_model *
model
¶ Composition data model entry pointer.
-
void (*const
-