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
_status_handler – [in] Optional status message handler.
-
BT_MESH_MODEL_BATTERY_CLI
(_cli)¶ Generic Battery Client model composition data entry.
- Parameters
_cli – [in] 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
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
rsp – [out] Status response buffer, or NULL to keep from blocking.
- Returns 0
Successfully sent the message and populated the
rsp
buffer.- Returns -EALREADY
A blocking request is already in progress.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
- Returns -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
cli – [in] Client that received the status message.
ctx – [in] Context of the incoming message.
status – [in] Battery Status of the Generic Battery Server that published the message.
-
struct bt_mesh_msg_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
-