Generic Default Transition Time Server¶
The DTT Server provides a common way to specify the state transition time for other models on the same element. If other generic models on the same element receive state change commands without transition parameters, they will use the default transition time specified by the DTT Server model. This way, the DTT Server can define a consistent transition time for all states on their elements, without depending on client configurations.
The following configuration parameters are associated with the Generic DTT Server model:
The Generic Level Server model contains the following state:
- Generic Default Transition Time:
This state can have the following values:
0 to perform the state change instantly or when no transition is planned
Positive number of milliseconds that defines the transition time
SYS_FOREVER_MSif the transition time is undefined
On the air, the transition time is encoded into a single byte, and loses some of its granularity:
Step count: 6 bits (range 0x00 to 0x3e)
Step resolution: 2 bits
Step 0: 100-millisecond resolution
Step 1: 1-second resolution
Step 2: 10-second resolution
Step 3: 10-minute resolution
The state is encoded with the highest resolution available, and rounded to the nearest representation. Values lower than 100 milliseconds and higher than 0 are encoded as 100 milliseconds. Values higher than the max value of 620 minutes are encoded as “undefined”.
The DTT Server holds the memory for this state itself, and optionally notifies the user of any changes through
bt_mesh_dtt_srv.update_handler. If your application changes the transition time manually, the change must be published using
The Generic Default Transition Time is stored persistently if
CONFIG_BT_MESH_DTT_SRV_PERSISTENT is enabled.
API for the Generic Default Transition Time (DTT) Server model.
Initialization parameters for Generic Default Transition Time Server.
_update – [in] Update handler called on every change to the transition time in this server.
bt_mesh_dtt_srv_set(struct bt_mesh_dtt_srv *srv, uint32_t transition_time)¶
Set the Default Transition Time of the DTT server.
If an update handler is set, it’ll be called with the updated transition time. If publication is configured, the change will cause the server to publish.
srv – [in] Server to set the DTT of.
transition_time – [in] New Default Transition Time, in milliseconds.
bt_mesh_dtt_srv_pub(struct bt_mesh_dtt_srv *srv, struct bt_mesh_msg_ctx *ctx)¶
Publish the current transition time.
srv – [in] Server instance to publish with.
ctx – [in] Message context to publish with, or NULL to publish with the configured parameters.
0 – Successfully published the current transition time.
-EADDRNOTAVAIL – A message context was not provided and publishing is not configured.
-EAGAIN – The device has not been provisioned.
static inline struct bt_mesh_dtt_srv *
bt_mesh_dtt_srv_get(const struct bt_mesh_elem *elem)¶
Find the Generic DTT server in a given element.
elem – [in] Element to find the DTT server in.
A pointer to the DTT server instance, or NULL if no instance is found.
static inline bool
bt_mesh_dtt_srv_transition_get(struct bt_mesh_model *model, struct bt_mesh_model_transition *transition)¶
Get the default transition parameters for the given model.
model – [in] Model to get the DTT for.
transition – [out] Transition buffer.
Whether the transition was set.
- #include <gen_dtt_srv.h>
Generic Default Transition Time server instance.
Current transition time in milliseconds
update)(struct bt_mesh_dtt_srv *srv, struct bt_mesh_msg_ctx *ctx, uint32_t old_transition_time, uint32_t new_transition_time)¶
Update handler for the transition time state.
Called every time the transition time is updated.
srv – [in] Server instance that was updated.
ctx – [in] Context of the set message that caused the update, or NULL if the update was not a result of a set message.
old_transition_time – [in] The transition time prior to the update, in milliseconds.
new_transition_time – [in] The new transition time after the update, in milliseconds.