Time Client

The Time Client model provides time sources for and configures Time Server models.

Unlike the server model, the 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.

API documentation

Header file: include/bluetooth/mesh/time_cli.h
Source file: subsys/bluetooth/mesh/time_cli.c
group bt_mesh_time_cli

API for the Time Client model.

Defines

BT_MESH_TIME_CLI_INIT

Initialization parameters for a Time Client model instance.

BT_MESH_MODEL_TIME_CLI(_cli)

Time Client model composition data entry.

Parameters

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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 the rsp buffer.

  • -EALREADY: A blocking request is already in progress.

  • -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.

  • -ETIMEDOUT: The request timed out without a response.

  • -EFAULT: Response buffer pointer is NULL.

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.