Light Lightness Control Client¶
The Light Lightness Control (LC) Client configures and interacts with the Light Lightness Control Server.
The Light LC Client creates a single model instance in the mesh composition data, and it can send messages to both the Light LC Server and the Light LC Setup Server, as long as it has the right application keys.
Extended models¶
None.
Persistent storage¶
None.
API documentation¶
include/bluetooth/mesh/light_ctrl_cli.h
subsys/bluetooth/mesh/light_ctrl_cli.c
-
group
bt_mesh_light_ctrl_cli
Light Lightness Control Client model API.
Defines
-
BT_MESH_LIGHT_CTRL_CLI_INIT
(_handlers)¶ Initialization parameters for the Light Lightness Control Client.
- Parameters
_handlers – [in] Optional message handler structure.
-
BT_MESH_MODEL_LIGHT_CTRL_CLI
(_cli)¶ Light Lightness Control Client model composition data entry.
- Parameters
_cli – [in] Pointer to a Light Lightness Control Client instance.
Functions
-
int
bt_mesh_light_ctrl_cli_mode_get
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool *rsp)¶ Get a Light Lightness Control Server’s current Mode.
The Mode determines whether the Server is actively controlling its Lightness Server’s state.
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_light_ctrl_cli_handlers::mode callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
rsp – [out] Response status buffer, returning the Server’s current mode, 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.
-
int
bt_mesh_light_ctrl_cli_mode_set
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled, bool *rsp)¶ Set a Light Lightness Control Server’s current Mode.
The Mode determines whether the Server is actively controlling its Lightness Server’s state.
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_light_ctrl_cli_handlers::mode callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
enabled – [in] The new Mode to set.
rsp – [out] Response status buffer, returning the Server’s current mode, 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.
-
int
bt_mesh_light_ctrl_cli_mode_set_unack
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled)¶ Set a Light Lightness Control Server’s current Mode without requesting a response.
The Mode determines whether the Server is actively controlling its Lightness Server’s state.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
enabled – [in] The new Mode to set.
- Returns 0
Successfully sent the message.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
-
int
bt_mesh_light_ctrl_cli_occupancy_enabled_get
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool *rsp)¶ Get a Light Lightness Control Server’s current Occupancy Mode.
The Occupancy Mode determines whether the Server accepts messages from Occupancy Servers.
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_light_ctrl_cli_handlers::occupancy_mode callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
rsp – [out] Response status buffer, returning whether the Server’s occupancy mode is currently enabled, 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.
-
int
bt_mesh_light_ctrl_cli_occupancy_enabled_set
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled, bool *rsp)¶ Set a Light Lightness Control Server’s current Occupancy Mode.
The Occupancy Mode determines whether the Server accepts messages from Occupancy Servers.
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_light_ctrl_cli_handlers::occupancy_mode callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
enabled – [in] The new Occupancy Mode to set.
rsp – [out] Response status buffer, returning whether the Server’s occupancy mode is currently enabled, 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.
-
int
bt_mesh_light_ctrl_cli_occupancy_enabled_set_unack
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled)¶ Set a Light Lightness Control Server’s current Occupancy Mode without requesting a response.
The Occupancy Mode determines whether the Server accepts messages from Occupancy Servers.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
enabled – [in] The new Occupancy Mode to set.
- Returns 0
Successfully sent the message.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
-
int
bt_mesh_light_ctrl_cli_light_onoff_get
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_onoff_status *rsp)¶ Get a Light Lightness Control Server’s current OnOff state.
The OnOff state determines whether the Server is currently keeping the light of its Lightness Server on.
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_light_ctrl_cli_handlers::light_onoff callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
rsp – [out] Response status buffer, returning the Server’s current OnOff state, 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.
-
int
bt_mesh_light_ctrl_cli_light_onoff_set
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_onoff_set *set, struct bt_mesh_onoff_status *rsp)¶ Tell a Light Lightness Control Server to turn the light on or off.
The OnOff state determines whether the Server is currently keeping the light of its Lightness Server on.
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_light_ctrl_cli_handlers::light_onoff callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
set – [in] Set parameters. The
transition::time
parameter may be set to override the Server’s default fade time, ortransition
may be set to NULL.rsp – [out] Response status buffer, returning the Server’s current OnOff state, 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.
-
int
bt_mesh_light_ctrl_cli_light_onoff_set_unack
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_onoff_set *set)¶ Tell a Light Lightness Control Server to turn the light on or off without requesting a response.
The OnOff state determines whether the Server is currently keeping the light of its Lightness Server on.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
set – [in] Set parameters. The
transition::time
parameter may be set to override the Server’s default fade time, ortransition
may be set to NULL.
- Returns 0
Successfully sent the message.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
-
int
bt_mesh_light_ctrl_cli_prop_get
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_prop id, struct sensor_value *rsp)¶ Get a Light Lightness Control Server property value.
Properties are the configuration parameters for the Light Lightness Control Server. Each property value is represented as a single sensor channel.
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_light_ctrl_cli_handlers::prop callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server property to get.
rsp – [out] Property value 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.
-
int
bt_mesh_light_ctrl_cli_prop_set
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_prop id, const struct sensor_value *val, struct sensor_value *rsp)¶ Set a Light Lightness Control Server property value.
Properties are the configuration parameters for the Light Lightness Control Server. Each property value is represented as a single sensor channel.
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_light_ctrl_cli_handlers::prop callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server property to set.
val – [in] New property value.
rsp – [out] Property value 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.
-
int
bt_mesh_light_ctrl_cli_prop_set_unack
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_prop id, const struct sensor_value *val)¶ Set a Light Lightness Control Server property value without requesting a response.
Properties are the configuration parameters for the Light Lightness Control Server. Each property value is represented as a single sensor channel.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server property to set.
val – [in] New property value.
- Returns 0
Successfully sent the message.
- Returns -EADDRNOTAVAIL
A message context was not provided and publishing is not configured.
- Returns -EAGAIN
The device has not been provisioned.
-
int
bt_mesh_light_ctrl_cli_coeff_get
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_coeff id, float *rsp)¶ Get a Light Lightness Control Server Regulator Coefficient value.
Regulator coefficients are the configuration parameters for the Light Lightness Control Server Illuminance Regulator.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server coefficient to get.
rsp – [in] Coefficient value 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.
-
int
bt_mesh_light_ctrl_cli_coeff_set
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_coeff id, float val, float *rsp)¶ Set a Light Lightness Control Server Regulator Coefficient value.
Regulator coefficients are the configuration parameters for the Light Lightness Control Server Illuminance Regulator.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server coefficient to set.
val – [in] New coefficient value.
rsp – [in] Coefficient value 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.
-
int
bt_mesh_light_ctrl_cli_coeff_set_unack
(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_coeff id, float val)¶ Set a Light Lightness Control Server Regulator Coefficient value without requesting a response.
Regulator coefficients are the configuration parameters for the Light Lightness Control Server Illuminance Regulator.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context, or NULL to use the configured publish parameters.
id – [in] Light Lightness Control Server coefficient to set.
val – [in] New coefficient value.
- Returns 0
Successfully sent the 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_light_ctrl_cli_handlers
¶ - #include <light_ctrl_cli.h>
Light Control Client handlers
Public Members
-
void (*
mode
)(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled)¶ Light LC Mode status handler.
The Light Lightness Control Server will only control its Lightness Server when in enabled mode.
- Parameters
cli – [in] Client that received the status message.
ctx – [in] Context of the message.
enabled – [in] Whether the reporting server is enabled.
-
void (*
occupancy_mode
)(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, bool enabled)¶ Light LC Occupancy Mode status handler.
The Occupancy Mode state controls whether the Light Lightness Control accepts occupancy sensor messages for controlling it.
- Parameters
cli – [in] Client that received the message.
ctx – [in] Context of the message.
enabled – [in] Whether the reporting server accepts occupancy sensor messages.
-
void (*
light_onoff
)(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_onoff_status *status)¶ Light LC OnOff status handler.
The Light OnOff state indicates whether the Light Lightness Control Server is enabled and has turned the Lightness Server on.
- Parameters
cli – [in] Client that received the message.
ctx – [in] Context of the message.
status – [in] Current OnOff state of the reporting server. The remaining time indicates the remaining fading time.
-
void (*
prop
)(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_prop id, const struct sensor_value *value)¶ Light LC Property status handler.
The Light Lightness Control Server’s properties are configuration parameters for its behavior. All properties are represented as a single sensor value channel.
- Parameters
cli – [in] Client that received the message.
ctx – [in] Context of the message.
id – [in] ID of the property.
value – [in] Value of the property.
-
void (*
coeff
)(struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_light_ctrl_coeff id, float value)¶ Light LC Regulator Coefficient status handler.
The Light Lightness Control Server’s Regulator Coeffients control its Illuminance Regulator’s response.
- Parameters
cli – [in] Client that received the message.
ctx – [in] Context of the message.
id – [in] ID of the property.
value – [in] Value of the property.
-
void (*
-
struct
bt_mesh_light_ctrl_cli
¶ - #include <light_ctrl_cli.h>
Light Lightness Control Client instance.
Should be initialized with BT_MESH_LIGHT_CTRL_CLI_INIT.
Public Members
-
struct bt_mesh_model *
model
¶ Composition data model entry pointer.
-
struct bt_mesh_model_pub
pub
¶ Publication parameters.
-
struct bt_mesh_msg_ack_ctx
ack_ctx
¶ Acknowledged message tracking.
-
const struct bt_mesh_light_ctrl_cli_handlers *
handlers
¶ Collection of handler callbacks.
-
uint8_t
tid
¶ Current transaction ID.
-
struct bt_mesh_model *
-