Zephyr API 3.6.99
|
Current Time Service (CTS) . More...
Data Structures | |
struct | bt_cts_time_format |
Current Time service data format, Please refer to specifications for more details. More... | |
struct | bt_cts_cb |
Current Time Service callback structure. More... | |
Enumerations | |
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 that have enabled the current time update notification. | |
int | bt_cts_time_to_unix_ms (const struct bt_cts_time_format *ct_time, int64_t *unix_ms) |
Helper API to decode CTS formatted time into milliseconds since epoch. | |
int | bt_cts_time_from_unix_ms (struct bt_cts_time_format *ct_time, int64_t unix_ms) |
Helper API to encode milliseconds since epoch to CTS formatted time. | |
Current Time Service (CTS) .
enum bt_cts_update_reason |
#include <zephyr/bluetooth/services/cts.h>
CTS time update reason bits as defined in the specification.
Enumerator | |
---|---|
BT_CTS_UPDATE_REASON_UNKNOWN | |
BT_CTS_UPDATE_REASON_MANUAL | |
BT_CTS_UPDATE_REASON_EXTERNAL_REF | |
BT_CTS_UPDATE_REASON_TIME_ZONE_CHANGE | |
BT_CTS_UPDATE_REASON_DAYLIGHT_SAVING |
int bt_cts_init | ( | const struct bt_cts_cb * | cb | ) |
#include <zephyr/bluetooth/services/cts.h>
This API should be called at application init.
it is safe to call this API before or after bt_enable API
cb | pointer to required callback |
int bt_cts_send_notification | ( | enum bt_cts_update_reason | reason | ) |
#include <zephyr/bluetooth/services/cts.h>
Notify all connected clients that have enabled the current time update notification.
reason | update reason to be sent to the clients |
int bt_cts_time_from_unix_ms | ( | struct bt_cts_time_format * | ct_time, |
int64_t | unix_ms ) |
#include <zephyr/bluetooth/services/cts.h>
Helper API to encode milliseconds since epoch to CTS formatted time.
CONFIG_BT_CTS_HELPER_APIneeds to be enabled to use this API.
ct_time | [OUT] Pointer to store CTS formatted time |
unix_ms | [IN] milliseconds since epoch to be converted |
int bt_cts_time_to_unix_ms | ( | const struct bt_cts_time_format * | ct_time, |
int64_t * | unix_ms ) |
#include <zephyr/bluetooth/services/cts.h>
Helper API to decode CTS formatted time into milliseconds since epoch.
CONFIG_BT_CTS_HELPER_APIneeds to be enabled to use this API.
ct_time | [IN] cts time formatted time |
unix_ms | [OUT] pointer to store parsed millisecond since epoch |