Generic Default Transition Time Client
The Generic DTT Client remotely controls the transition time state of a Generic Default Transition Time Server.
The client can be used to set up the server’s default transition time behavior when changing states in other models on the same element.
Extended models
None.
Persistent storage
None.
Shell commands
The Bluetooth mesh shell subsystem provides a set of commands to interact with the Generic DTT Client model instantiated on a device.
To make these commands available, enable the following Kconfig options:
- mesh models dtt instance get-all
Print all instances of the Generic Default Transition Time Client model on the device.
- mesh models dtt instance set <elem_idx>
Select the Generic Default Transition Time Client model instantiated on the specified element ID. This instance will be used in message sending. If no model instance is selected, the first model instance found on the device will be used by default.
elem_idx
- Element index where the model instance is found.
- mesh models dtt get
Get the Default Transition Time of the bound server.
- mesh models dtt set <transition_time_ms>
Set the Default Transition Time of the server and wait for a response.
transition_time_ms
- Default transition time in milliseconds.
- mesh models dtt set-unack <transition_time_ms>
Set the Default Transition Time of the server without requesting a response.
transition_time_ms
- Default transition time in milliseconds.
API documentation
include/bluetooth/mesh/gen_dtt_cli.h
subsys/bluetooth/mesh/gen_dtt_cli.c
- group bt_mesh_dtt_cli
API for the Generic Default Transition Time (DTT) Client.
Defines
-
BT_MESH_DTT_CLI_INIT(_status_handler)
Initialization parameters for the Generic Default Transition Time Client API.
See also
- Parameters
_status_handler – [in] Optional status message handler.
-
BT_MESH_MODEL_DTT_CLI(_cli)
Generic DTT Client model composition data entry.
- Parameters
_cli – [in] Pointer to a Generic Default Transition Time Client API instance.
Functions
-
int bt_mesh_dtt_get(struct bt_mesh_dtt_cli *cli, struct bt_mesh_msg_ctx *ctx, int32_t *rsp_transition_time)
Get the Default Transition Time of the server.
This call is blocking if the
rsp_transition_time
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_dtt_cli::status_handler callback.- Parameters
cli – [in] Client making the request.
ctx – [in] Message context to use for sending, or NULL to publish with the configured parameters.
rsp_transition_time – [out] Pointer to a response buffer, or NULL to keep from blocking. The response denotes the configured transition time in milliseconds. Can be SYS_FOREVER_MS if the current state is unknown or too large to represent.
- Return values
0 – Successfully retrieved the status of the bound srv.
-EALREADY – A blocking operation is already in progress in this model.
-EAGAIN – The device has not been provisioned.
-ETIMEDOUT – The request timed out without a response.
-
int bt_mesh_dtt_set(struct bt_mesh_dtt_cli *cli, struct bt_mesh_msg_ctx *ctx, uint32_t transition_time, int32_t *rsp_transition_time)
Set the Default Transition Time of the server.
This call is blocking if the
rsp_transition_time
buffer is non-NULL. Otherwise, this function will return, and the response will be passed to the bt_mesh_dtt_cli::status_handler callback.- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context to use for sending, or NULL to publish with the configured parameters.
transition_time – [in] Transition time to set (in milliseconds). Must be less than BT_MESH_MODEL_TRANSITION_TIME_MAX_MS.
rsp_transition_time – [out] Pointer to a response buffer, or NULL to keep from blocking. The response denotes the configured transition time in milliseconds. Can be SYS_FOREVER_MS if the current state is unknown or too large to represent.
- Return values
0 – Successfully sent the message and populated the
rsp_transition_time
buffer.-EINVAL – The given transition time is invalid.
-EALREADY – A blocking operation is already in progress in this model.
-EAGAIN – The device has not been provisioned.
-ETIMEDOUT – The request timed out without a response.
-
int bt_mesh_dtt_set_unack(struct bt_mesh_dtt_cli *cli, struct bt_mesh_msg_ctx *ctx, uint32_t transition_time)
Set the Default Transition Time of the server without requesting a response.
- Parameters
cli – [in] Client model to send on.
ctx – [in] Message context to use for sending, or NULL to publish with the configured parameters.
transition_time – [in] Transition time to set (in milliseconds). Must be less than BT_MESH_MODEL_TRANSITION_TIME_MAX_MS.
- Return values
0 – Successfully sent the message.
-EINVAL – The given transition time is invalid.
-EADDRNOTAVAIL – A message context was not provided and publishing is not configured.
-EAGAIN – The device has not been provisioned.
-
struct bt_mesh_dtt_cli
- #include <gen_dtt_cli.h>
Generic DTT client structure.
Should be initialized using the BT_MESH_DTT_CLI_INIT macro.
Public Members
-
void (*const status_handler)(struct bt_mesh_dtt_cli *cli, struct bt_mesh_msg_ctx *ctx, int32_t transition_time)
Default Transition Time status message handler.
- Param cli
[in] Client that received the message.
- Param ctx
[in] Message context.
- Param transition_time
[in] Transition time presented in the message, in milliseconds.
-
struct bt_mesh_msg_ack_ctx ack_ctx
Response context for tracking acknowledged messages.
-
struct bt_mesh_model_pub pub
Model publish parameters.
-
struct bt_mesh_model *model
Composition data model entry pointer.
-
void (*const status_handler)(struct bt_mesh_dtt_cli *cli, struct bt_mesh_msg_ctx *ctx, int32_t transition_time)
-
BT_MESH_DTT_CLI_INIT(_status_handler)