Bluetooth LE Profile API document
Bluetooth LE Profile API document Rev.1.00 [May 22, 2020]
Current Time Service Server

This service defines how the current time can be exposed using the Generic Attribute Profile (GATT). More...

Detailed Description

This service defines how the current time can be exposed using the Generic Attribute Profile (GATT).

Data Structures

struct  st_ble_cts_cur_time_exact_time_256_t
 Current Time Exact Time 256 value structure. More...
 
struct  st_ble_cts_cur_time_adjust_reason_t
 Current Time Adjust Reason value structure. More...
 
struct  st_ble_cts_cur_time_t
 Current Time value structure. More...
 
struct  st_ble_cts_local_time_info_t
 Local Time Information value structure. More...
 
struct  st_ble_cts_ref_time_info_t
 Reference Time Information value structure. More...
 

Macros

#define BLE_CTS_DATA_FIELD_IGNORED_ERROR   (BLE_ERR_GROUP_GATT | 0x80)
 The server ignored one or more fields. More...
 

Enumerations

enum  e_ble_cts_local_time_info_daylight_saving_time_offset_t {
  BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_STANDARD_TIME = 0,
  BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_HALF_AN_HOUR_DAYLIGHT_TIME = 2,
  BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_DAYLIGHT_TIME = 4,
  BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_DOUBLE_DAYLIGHT_TIME = 8
}
 Local Time Information Daylight Saving Time Offset enumeration. More...
 
enum  e_ble_cts_ref_time_info_source_t {
  BLE_CTS_REF_TIME_INFO_SOURCE_UNKNOWN = 0,
  BLE_CTS_REF_TIME_INFO_SOURCE_NETWORK_TIME_PROTOCOL = 1,
  BLE_CTS_REF_TIME_INFO_SOURCE_GPS = 2,
  BLE_CTS_REF_TIME_INFO_SOURCE_RADIO_TIME_SIGNAL = 3,
  BLE_CTS_REF_TIME_INFO_SOURCE_MANUAL = 4,
  BLE_CTS_REF_TIME_INFO_SOURCE_ATOMIC_CLOCK = 5,
  BLE_CTS_REF_TIME_INFO_SOURCE_CELLULAR_NETWORK = 6
}
 Reference Time Information Source enumeration. More...
 
enum  e_ble_cts_char_idx_t {
  BLE_CTS_CUR_TIME_IDX,
  BLE_CTS_CUR_TIME_CLI_CNFG_IDX,
  BLE_CTS_LOCAL_TIME_INFO_IDX,
  BLE_CTS_REF_TIME_INFO_IDX
}
 Current Time Service characteristic Index. More...
 
enum  e_ble_cts_event_t {
  BLE_CTS_EVENT_CUR_TIME_WRITE_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_IDX, BLE_SERVS_WRITE_REQ),
  BLE_CTS_EVENT_CUR_TIME_WRITE_COMP = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_IDX, BLE_SERVS_WRITE_COMP),
  BLE_CTS_EVENT_CUR_TIME_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_IDX, BLE_SERVS_READ_REQ),
  BLE_CTS_EVENT_CUR_TIME_CLI_CNFG_WRITE_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_CLI_CNFG_IDX, BLE_SERVS_WRITE_REQ),
  BLE_CTS_EVENT_CUR_TIME_CLI_CNFG_WRITE_COMP = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_CLI_CNFG_IDX, BLE_SERVS_WRITE_COMP),
  BLE_CTS_EVENT_CUR_TIME_CLI_CNFG_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_CUR_TIME_CLI_CNFG_IDX, BLE_SERVS_READ_REQ),
  BLE_CTS_EVENT_LOCAL_TIME_INFO_WRITE_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_LOCAL_TIME_INFO_IDX, BLE_SERVS_WRITE_REQ),
  BLE_CTS_EVENT_LOCAL_TIME_INFO_WRITE_COMP = BLE_SERVS_ATTR_EVENT(BLE_CTS_LOCAL_TIME_INFO_IDX, BLE_SERVS_WRITE_COMP),
  BLE_CTS_EVENT_LOCAL_TIME_INFO_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_LOCAL_TIME_INFO_IDX, BLE_SERVS_READ_REQ),
  BLE_CTS_EVENT_REF_TIME_INFO_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_CTS_REF_TIME_INFO_IDX, BLE_SERVS_READ_REQ)
}
 Current Time Service event type. More...
 

Functions

ble_status_t R_BLE_CTS_SetCurTime (const st_ble_cts_cur_time_t *p_value)
 Set Current Time characteristic value to the local GATT database. More...
 
ble_status_t R_BLE_CTS_GetCurTime (st_ble_cts_cur_time_t *p_value)
 Get Current Time characteristic value from the local GATT database. More...
 
ble_status_t R_BLE_CTS_NotifyCurTime (uint16_t conn_hdl, const st_ble_cts_cur_time_t *p_value)
 Send notification of Current Time characteristic value to the remote device. More...
 
ble_status_t R_BLE_CTS_SetCurTimeCliCnfg (const uint16_t *p_value)
 Set Current Time cli cnfg descriptor value to the local GATT database. More...
 
ble_status_t R_BLE_CTS_GetCurTimeCliCnfg (uint16_t *p_value)
 Get Current Time cli cnfg descriptor value from the local GATT database. More...
 
ble_status_t R_BLE_CTS_SetLocalTimeInfo (const st_ble_cts_local_time_info_t *p_value)
 Set Local Time Information characteristic value to the local GATT database. More...
 
ble_status_t R_BLE_CTS_GetLocalTimeInfo (st_ble_cts_local_time_info_t *p_value)
 Get Local Time Information characteristic value from the local GATT database. More...
 
ble_status_t R_BLE_CTS_SetRefTimeInfo (const st_ble_cts_ref_time_info_t *p_value)
 Set Reference Time Information characteristic value to the local GATT database. More...
 
ble_status_t R_BLE_CTS_GetRefTimeInfo (st_ble_cts_ref_time_info_t *p_value)
 Get Reference Time Information characteristic value from the local GATT database. More...
 
ble_status_t R_BLE_CTS_Init (ble_servs_app_cb_t cb)
 Initialize Current Time Service service. More...
 

Macro Definition Documentation

◆ BLE_CTS_DATA_FIELD_IGNORED_ERROR

#define BLE_CTS_DATA_FIELD_IGNORED_ERROR   (BLE_ERR_GROUP_GATT | 0x80)

The server ignored one or more fields.

Enumeration Type Documentation

◆ e_ble_cts_local_time_info_daylight_saving_time_offset_t

Local Time Information Daylight Saving Time Offset enumeration.

Enumerator
BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_STANDARD_TIME 

Standard Time

BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_HALF_AN_HOUR_DAYLIGHT_TIME 

Half An Hour Daylight Time (+0.5h)

BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_DAYLIGHT_TIME 

Daylight Time (+1h)

BLE_CTS_LOCAL_TIME_INFO_DAYLIGHT_SAVING_TIME_OFFSET_DOUBLE_DAYLIGHT_TIME 

Double Daylight Time (+2h)

◆ e_ble_cts_ref_time_info_source_t

Reference Time Information Source enumeration.

Enumerator
BLE_CTS_REF_TIME_INFO_SOURCE_UNKNOWN 

Unknown

BLE_CTS_REF_TIME_INFO_SOURCE_NETWORK_TIME_PROTOCOL 

Network Time Protocol

BLE_CTS_REF_TIME_INFO_SOURCE_GPS 

GPS

BLE_CTS_REF_TIME_INFO_SOURCE_RADIO_TIME_SIGNAL 

Radio Time Signal

BLE_CTS_REF_TIME_INFO_SOURCE_MANUAL 

Manual

BLE_CTS_REF_TIME_INFO_SOURCE_ATOMIC_CLOCK 

Atomic Clock

BLE_CTS_REF_TIME_INFO_SOURCE_CELLULAR_NETWORK 

Cellular Network

◆ e_ble_cts_char_idx_t

Current Time Service characteristic Index.

◆ e_ble_cts_event_t

Current Time Service event type.

Function Documentation

◆ R_BLE_CTS_SetCurTime()

ble_status_t R_BLE_CTS_SetCurTime ( const st_ble_cts_cur_time_t p_value)

Set Current Time characteristic value to the local GATT database.

Parameters
[in]p_valueCharacteristic value to set.
Returns
ble_status_t

◆ R_BLE_CTS_GetCurTime()

ble_status_t R_BLE_CTS_GetCurTime ( st_ble_cts_cur_time_t p_value)

Get Current Time characteristic value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_CTS_NotifyCurTime()

ble_status_t R_BLE_CTS_NotifyCurTime ( uint16_t  conn_hdl,
const st_ble_cts_cur_time_t p_value 
)

Send notification of Current Time characteristic value to the remote device.

Parameters
[in]conn_hdlConnection handle.
[in]p_valueCharacteristic value to send.
Returns
ble_status_t

◆ R_BLE_CTS_SetCurTimeCliCnfg()

ble_status_t R_BLE_CTS_SetCurTimeCliCnfg ( const uint16_t *  p_value)

Set Current Time cli cnfg descriptor value to the local GATT database.

Parameters
[in]p_valueDescriptor value to set.
Returns
ble_status_t

◆ R_BLE_CTS_GetCurTimeCliCnfg()

ble_status_t R_BLE_CTS_GetCurTimeCliCnfg ( uint16_t *  p_value)

Get Current Time cli cnfg descriptor value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_CTS_SetLocalTimeInfo()

ble_status_t R_BLE_CTS_SetLocalTimeInfo ( const st_ble_cts_local_time_info_t p_value)

Set Local Time Information characteristic value to the local GATT database.

Parameters
[in]p_valueCharacteristic value to set.
Returns
ble_status_t

◆ R_BLE_CTS_GetLocalTimeInfo()

ble_status_t R_BLE_CTS_GetLocalTimeInfo ( st_ble_cts_local_time_info_t p_value)

Get Local Time Information characteristic value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_CTS_SetRefTimeInfo()

ble_status_t R_BLE_CTS_SetRefTimeInfo ( const st_ble_cts_ref_time_info_t p_value)

Set Reference Time Information characteristic value to the local GATT database.

Parameters
[in]p_valueCharacteristic value to set.
Returns
ble_status_t

◆ R_BLE_CTS_GetRefTimeInfo()

ble_status_t R_BLE_CTS_GetRefTimeInfo ( st_ble_cts_ref_time_info_t p_value)

Get Reference Time Information characteristic value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_CTS_Init()

ble_status_t R_BLE_CTS_Init ( ble_servs_app_cb_t  cb)

Initialize Current Time Service service.

Parameters
[in]cbService callback.
Returns
ble_status_t