Generic Power OnOff Client¶
The Generic Power OnOff Client model remotely controls the state of a Generic Power OnOff Server model.
Unlike the Generic Power OnOff Server, the Generic Power OnOff Client only adds one model instance to the composition data. The Generic Power OnOff Client may send messages to both the Generic Power OnOff Server and the Generic Power OnOff Setup server, as long as it has the right application keys.
Extended models¶
None.
Persistent storage¶
None.
API documentation¶
include/bluetooth/mesh/gen_ponoff_cli.h
subsys/bluetooth/mesh/gen_ponoff_cli.c
-
group
bt_mesh_ponoff_cli
API for the Generic Power OnOff Client.
Defines
-
BT_MESH_PONOFF_CLI_INIT
(_power_onoff_status_handler)¶ Initialization parameters for Generic Power OnOff Client.
- Parameters
_power_onoff_status_handler – [in] OnPowerUp status handler.
-
BT_MESH_MODEL_PONOFF_CLI
(_cli)¶ Generic Power OnOff Client model composition data entry.
- Parameters
_cli – [in] Pointer to a Generic Power OnOff Client instance.
Functions
-
int
bt_mesh_ponoff_cli_on_power_up_get
(struct bt_mesh_ponoff_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_on_power_up *rsp)¶ Get the OnPowerUp state of 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_ponoff_cli::status_handler callback.- Parameters
cli – [in] Power OnOff client to send the message on.
ctx – [in] Context of the message, or NULL to send on the configured publish parameters.
rsp – [out] Response buffer to put the received response in, or NULL to process the response in the status handler callback.
- Returns 0
Successfully sent a get message. If a response buffer is provided, it has been populated.
- 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.
-
int
bt_mesh_ponoff_cli_on_power_up_set
(struct bt_mesh_ponoff_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_on_power_up on_power_up, enum bt_mesh_on_power_up *rsp)¶ Set the OnPowerUp state of 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_ponoff_cli::status_handler callback.- Parameters
cli – [in] Power OnOff client to send the message on.
ctx – [in] Context of the message, or NULL to send with the configured publish parameters.
on_power_up – [in] New OnPowerUp state of the server.
rsp – [out] Response buffer to put the received response in, or NULL to keep from blocking.
- Returns 0
Successfully sent a set message. If a response buffer is provided, it has been populated.
- 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.
-
int
bt_mesh_ponoff_cli_on_power_up_set_unack
(struct bt_mesh_ponoff_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_on_power_up on_power_up)¶ Set the OnPowerUp state of a server without requesting a response.
- Parameters
cli – [in] Power OnOff client to send the message on.
ctx – [in] Context of the message, or NULL to send with the configured publish parameters.
on_power_up – [in] New OnPowerUp state of the server.
- Returns 0
Successfully sent a set message.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
-
struct
bt_mesh_ponoff_cli
¶ - #include <gen_ponoff_cli.h>
Generic Power OnOff client instance.
Should be initialized with BT_MESH_PONOFF_CLI_INIT.
Public Members
-
struct bt_mesh_model *
model
¶ Model entry pointer.
-
struct bt_mesh_model_pub
pub
¶ Publish parameters.
-
struct bt_mesh_msg_ack_ctx
ack_ctx
¶ Response context for tracking acknowledged messages.
-
void (*const
status_handler
)(struct bt_mesh_ponoff_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_on_power_up on_power_up)¶ OnPowerUp status message handler.
- Parameters
cli – [in] Client that received the status message.
ctx – [in] Message context the message was received with.
on_power_up – [in] The OnPowerUp state presented in the message.
-
struct bt_mesh_model *
-