Light CTL Temperature Server¶
The Color-Tunable Light (CTL) Temperature Server represents a single light on a mesh device. It should be instantiated in the light fixture node.
The Light CTL Temperature Server is normally instantiated as part of the Light CTL Server model, but may be instantiated as a stand-alone model.
Two states can be used to configure the lighting output of an element:
Temperature - This state determines the color temperature of tunable white light emitted by an element.
Delta UV - This state determines the distance from the black body curve. The color temperatures fall on the black body locus.
The Light CTL Temperature Server adds the following new model instances in the composition data, in addition to the extended Generic Level Server model:
Light CTL Temperature Server
States¶
- Temperature:
uint16_t
The Temperature state represents the color temperature of the tunable white light emitted by an element, and ranges from
800
to20000
.The Temperature state is bound to the Generic Level State of the extended Generic Level Server:
Light CTL Temperature = T_MIN + (Generic Level + 32768) * (T_MAX - T_MIN) / 65535
In the above formula, T_MIN and T_MAX are values representing the Light CTL Temperature Range Min and Light CTL Temperature Range Max states.
Your application is expected to hold the state memory and provide access to the state through the
bt_mesh_light_ctl_srv_handlers
handler structure.- Delta UV:
int16_t
The Temperature state represents the distance from the black body curve. The color temperatures all fall on the black body locus (curve). This is a 16-bit signed integer representation of a -1 to +1 scale using the formula:
Represented Delta UV = (Light CTL Delta UV) / 32768
Your application is expected to hold the state memory and provide access to the state through the
bt_mesh_light_ctl_srv_handlers
handler structure.- Temperature Range:
bt_mesh_light_temp_range
The Temperature Range state is a meta state that determines the accepted Temperature level range.
If the Temperature level is set to a value outside the current Temperature Range, it is moved to fit inside the range.
Access to the Temperature Range state can only be done when the Light CTL Temperature Server is associated with an instance of the Light CTL Server model. The default value for the Temperature Range is
800
for T_MIN, and20000
for T_MAX.
Extended models¶
The Light CTL Temperature Server extends the following model:
The states of the extended model are bound to the states in the Light CTL Temperature Server, and not directly exposed to the application.
Persistent storage¶
None.
API documentation¶
include/bluetooth/mesh/light_temp_srv.h
subsys/bluetooth/mesh/light_temp_srv.c
-
group
bt_mesh_light_temp_srv
API for the Light CTL Temperature Server model.
Defines
-
BT_MESH_LIGHT_TEMP_SRV_INIT
(_handlers)¶ Initialization parameters for a Light Temperature Server model instance.
- Parameters
[in] _handlers
: Light CTL Temperature Server callbacks.
-
BT_MESH_MODEL_LIGHT_TEMP_SRV
(_srv)¶ Light CTL Temperature Server model composition data entry.
- Parameters
[in] _srv
: Pointer to a Light Temperature Server model instance.
Functions
-
int32_t
bt_mesh_light_temp_srv_pub
(struct bt_mesh_light_temp_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_light_temp_status *status)¶ Publish the current CTL Temperature status.
Asynchronously publishes a CTL Temperature status message with the configured publish parameters.
- Note
This API is only used publishing unprompted status messages. Response messages for get and set messages are handled internally.
- Parameters
[in] srv
: Server instance to publish on.[in] ctx
: Message context to send with, or NULL to send with the default publish parameters.[in] status
: Current status.
- Return Value
0
: Successfully sent the message.-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.
-
struct
bt_mesh_light_temp_cb_set
¶ - #include <light_temp_srv.h>
Set structure for CTL Temperature messages
-
struct
bt_mesh_light_temp_srv_handlers
¶ - #include <light_temp_srv.h>
Light CTL Temperature Server state access handlers.
Public Members
-
void (*const
set
)(struct bt_mesh_light_temp_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_light_temp_cb_set *set, struct bt_mesh_light_temp_status *rsp)¶ Set the CTL Temperature state.
- Note
This handler is mandatory.
- Parameters
[in] srv
: Server to set the CTL Temperature state of.[in] ctx
: Message context.[in] set
: Parameters of the state change.[out] rsp
: Response structure to be filled.
-
void (*const
get
)(struct bt_mesh_light_temp_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_light_temp_status *rsp)¶ Get the CTL Temperature state.
- Note
This handler is mandatory.
- Parameters
[in] srv
: Server to get the CTL state of.[in] ctx
: Message context.[out] rsp
: Response structure to be filled.
-
void (*const
-
struct
bt_mesh_light_temp_srv
¶ - #include <light_temp_srv.h>
Light CTL Temperature Server instance. Should be initialized with BT_MESH_LIGHT_TEMP_SRV_INIT.
Public Members
-
struct bt_mesh_lvl_srv
lvl
¶ Light Level Server instance.
-
struct bt_mesh_model *
model
¶ Model entry.
-
struct bt_mesh_model_pub
pub
¶ Publish parameters.
-
struct bt_mesh_tid_ctx
prev_transaction
¶ Transaction ID tracker for the set messages.
-
struct bt_mesh_model_ack_ctx
ack_ctx
¶ Acknowledged message tracking.
-
const struct bt_mesh_light_temp_srv_handlers *
handlers
¶ Handler function structure.
-
uint16_t
temp_last
¶ The last known Temperature Level.
-
int16_t
delta_uv_last
¶ The last known Delta UV Level.
-
struct bt_mesh_light_temp_range
temp_range
¶ Current Temperature range.
-
struct bt_mesh_lvl_srv
-