Time Client¶
The Time Client model provides time sources for and configures Time Server models.
Unlike the Time Server model, the Time Client only creates a single model instance in the mesh composition data. The Time Client can send messages to both the Time Server and the Time Setup Server, as long as it has the right application keys.
Extended models¶
None.
Persistent storage¶
None.
API documentation¶
include/bluetooth/mesh/time_cli.h
subsys/bluetooth/mesh/time_cli.c
-
group
bt_mesh_time_cli
API for the Time Client model.
Defines
-
BT_MESH_TIME_CLI_INIT
(_handlers)¶ Initialization parameters for a Time Client model instance.
- See
- Parameters
[in] _handlers
: Optional message handler structure.
-
BT_MESH_MODEL_TIME_CLI
(_cli)¶ Time Client model composition data entry.
- Parameters
[in] _cli
: Pointer to a Time Client model instance.
Functions
-
int
bt_mesh_time_cli_time_get
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_time_status *rsp)¶ Get the current Time Status of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[out] rsp
: Status response buffer, returning the Server’s current time Status, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_time_set
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_status *set, struct bt_mesh_time_status *rsp)¶ Set the Time Status of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] set
: Time Status parameter to set.[out] rsp
: Status response buffer, returning the Server’s current time Status, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_zone_get
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_time_zone_status *rsp)¶ Get the Time Zone status of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[out] rsp
: Status response buffer, returning the Server’s current Time Zone Offset new state, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_zone_set
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_zone_change *set, struct bt_mesh_time_zone_status *rsp)¶ Schedule a Time Zone change for the Time Server.
Used to set the point in TAI a Time Server is to update its Time Zone Offset, and what this new offset should be
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] set
: Time Zone Change parameters to set.[out] rsp
: Status response buffer, returning the Server’s current time Status, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_tai_utc_delta_get
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_time_tai_utc_delta_status *rsp)¶ Get the UTC Delta status of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[out] rsp
: Status response buffer, returning the Server’s TAI-UTC Delta new state, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_tai_utc_delta_set
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_tai_utc_change *set, struct bt_mesh_time_tai_utc_delta_status *rsp)¶ Schedule a UTC Delta change for the Timer Server.
Used to set the point in TAI a Time Server is to update its TAI-UTC Delta, and what this new offset should be
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] set
: TAI-UTC Delta Change parameters to set.[out] rsp
: Status response buffer, returning the Server’s current time Status, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_role_get
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t *rsp)¶ Get the Time Role state of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[out] rsp
: Status response buffer, returning the Server’s current Time Role state, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
int
bt_mesh_time_cli_role_set
(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const uint8_t *set, uint8_t *rsp)¶ Set the Time Role state of a Time Server.
- Parameters
[in] cli
: Client model to send on.[in] ctx
: Message context, or NULL to use the configured publish parameters.[in] set
: Time Role to set.[out] rsp
: Status response buffer, returning the Server’s current time Status, or NULL to keep from blocking.
- Return Value
0
: Successfully sent the message and populated thersp
buffer.-EALREADY
: A blocking request is already in progress.-EADDRNOTAVAIL
: A message context was not provided and publishing is not configured.-EAGAIN
: The device has not been provisioned.-ETIMEDOUT
: The request timed out without a response.
-
struct
bt_mesh_time_cli_handlers
¶ - #include <time_cli.h>
Time Client handler functions.
Public Members
-
void (*const
time_status
)(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_status *status)¶ Time status message handler.
Called when the client receives a Time Status message, either as a result of calling bt_mesh_time_cli_time_get, bt_mesh_time_cli_time_set, or as an unsolicited message.
- Note
This handler is optional.
- Parameters
[in] cli
: Client that received the status message.[in] ctx
: Context of the incoming message.[in] status
: Time Status contained in the message.
-
void (*const
time_zone_status
)(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_zone_status *status)¶ Time Zone status message handler.
Called when the client receives a Time Zone Status message, either as a result of calling bt_mesh_time_cli_zone_get, bt_mesh_time_cli_zone_set, or as an unsolicited message.
- Note
This handler is optional.
- Parameters
[in] cli
: Client that received the status message.[in] ctx
: Context of the incoming message.[in] status
: Time Zone Status contained in the message.
-
void (*const
tai_utc_delta_status
)(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_time_tai_utc_delta_status *status)¶ TAI-UTC Delta status message handler.
Called when the client receives a TAI-UTC Delta Status message, either as a result of calling bt_mesh_time_cli_tai_utc_delta_get, bt_mesh_time_cli_tai_utc_delta_set, or as an unsolicited message.
- Note
This handler is optional.
- Parameters
[in] cli
: Client that received the status message.[in] ctx
: Context of the incoming message.[in] status
: TAI-UTC Delta Status contained in the message.
-
void (*const
time_role_status
)(struct bt_mesh_time_cli *cli, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_time_role time_role)¶ Time Role status message handler.
Called when the client receives a Time Role Status message, either as a result of calling bt_mesh_time_cli_role_get, bt_mesh_time_cli_role_set, or as an unsolicited message.
- Note
This handler is optional.
- Parameters
[in] cli
: Client that received the status message.[in] ctx
: Context of the incoming message.[in] time_role
: Time Role of the server.
-
void (*const
-
struct
bt_mesh_time_cli
¶ - #include <time_cli.h>
Time Client instance. Should be initialized with BT_MESH_TIME_CLI_INIT.
Public Members
-
struct bt_mesh_model *
model
¶ Model entry.
-
struct bt_mesh_model_pub
pub
¶ Publish parameters.
-
struct bt_mesh_model_ack_ctx
ack_ctx
¶ Acknowledged message tracking.
-
const struct bt_mesh_time_cli_handlers *
handlers
¶ Collection of handler callbacks.
- Note
Must point to memory that remains valid.
-
struct bt_mesh_model *
-