Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cts.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  bt_cts_time_format
 Current Time service data format, Please refer to specifications for more details. More...
struct  bt_cts_local_time
 CTS Local Time Information. More...
struct  bt_cts_cb
 Current Time Service callback structure. More...

Macros

#define BT_CTS_ATT_ERR_VALUES_IGNORED   0x80U
 ATT error code for ignored values during CTS write operations.
#define BT_CTS_FRACTION_256_MAX_VALUE   255U
 Maximum value for the 1/256-second fractions field in CTS time format.
#define BT_CTS_TIMEZONE_DEFAULT_VALUE   -128
 Default timezone offset value indicating the timezone is unknown (15-minute increments).
#define BT_CTS_TIMEZONE_INCREMENT_MIN   15U
 Timezone offset increment in minutes.
#define BT_CTS_DST_INCREMENT_MIN   15U
 DST offset increment in minutes.
#define BT_CTS_TIMEZONE_MIN   -48
 Minimum valid timezone offset in 15-minute increments (-48 means UTC-12:00).
#define BT_CTS_TIMEZONE_MAX   56
 Maximum valid timezone offset in 15-minute increments (56 means UTC+14:00).

Enumerations

enum  bt_cts_dst_offset {
  BT_CTS_DST_OFFSET_STANDARD_TIME = 0 , BT_CTS_DST_OFFSET_HALF_HOUR_DAYLIGHT_TIME = 2 , BT_CTS_DST_OFFSET_DAYLIGHT_TIME = 4 , BT_CTS_DST_OFFSET_DOUBLE_DAYLIGHT_TIME = 8 ,
  BT_CTS_DST_OFFSET_UNKNOWN = 255
}
 Daylight Saving Time (DST) offsets as defined in the specification. More...
enum  bt_cts_update_reason {
  BT_CTS_UPDATE_REASON_UNKNOWN = 0 , BT_CTS_UPDATE_REASON_MANUAL = BIT(0) , BT_CTS_UPDATE_REASON_EXTERNAL_REF = BIT(1) , BT_CTS_UPDATE_REASON_TIME_ZONE_CHANGE = BIT(2) ,
  BT_CTS_UPDATE_REASON_DAYLIGHT_SAVING = BIT(3)
}
 CTS time update reason bits as defined in the specification. More...

Functions

int bt_cts_init (const struct bt_cts_cb *cb)
 This API should be called at application init.
int bt_cts_send_notification (enum bt_cts_update_reason reason)
 Notify all connected clients with CTS enabled.
int bt_cts_time_to_unix_ms (const struct bt_cts_time_format *ct_time, int64_t *unix_ms)
 Convert CTS formatted time to milliseconds since epoch.
int bt_cts_time_from_unix_ms (struct bt_cts_time_format *ct_time, int64_t unix_ms)
 Convert milliseconds since epoch to CTS formatted time.
int bt_cts_local_time_to_ms (const struct bt_cts_local_time *local_time, int32_t *relative_ms)
 Convert CTS local time to milliseconds.