Go to the documentation of this file.
63 #include "custom_config.h"
72 #define CTS_C_CONNECTION_MAX 10
73 #define CTS_C_CUR_TIME_VAL_LEN 10
74 #define CTS_C_LOC_TIME_INFO_VAL_LEN 2
75 #define CTS_C_TIME_Y_M_D_UNKNOWN 0
76 #define CTS_C_TIME_YEAR_VALID_VAL_MIN 1582
77 #define CTS_C_TIME_YEAR_VALID_VAL_MAX 9999
78 #define CTS_C_TIME_ZONE_OFFSET_MIN -48
79 #define CTS_C_TIME_ZONE_OFFSET_MAX 56
80 #define CTS_C_TIME_ACCURACY_OUT_RANGE 254
81 #define CTS_C_TIME_ACCURACT_UNKNOWN 255
82 #define CTS_C_ERROR_FIELDS_IGNORED 0x80
89 #define CTS_C_AR_NO_CHANGE (0x00 << 0)
90 #define CTS_C_AR_MAUAL_TIME_UPDATE (0x01 << 0)
91 #define CTS_C_AR_EXT_REF_TIME_UPDATE (0x01 << 1)
92 #define CTS_C_AR_TIME_ZONE_CHANGE (0x01 << 2)
93 #define CTS_C_AR_DST_CHANGE (0x01 << 3)
@ CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL
Network Time Protocol.
uint8_t hours_since_update
Hours Since Update.
@ CTS_C_WEEK_THURSDAT
Thursday.
uint16_t cts_cur_time_handle
CTS Current Time characteristic Value handle which has been got from peer.
@ CTS_C_EVT_INVALID_CUR_TIME_REC
CTS Client has received invalid Current Time value (Read or Notification from peer).
@ CTS_C_EVT_CUR_TIME_SET_SUCCESS
CTS Client has writen Current Time completely.
cts_c_ref_time_source_t
Reference time information:Time Source.
@ CTS_C_WEEK_UNKNOWN_DAY
Day of week is not known.
@ CTS_C_REF_TIME_SRC_UNKNOWN
Unknown.
cts_c_cur_time_t cur_time
Curren time received.
@ CTS_C_EVT_VALID_REF_TIME_INFO_REC
CTS Client has received valid Reference Time Information Value (Read from peer).
cts_c_ref_time_source_t source
Time Source.
cts_c_exact_time_256_t day_date_time
Exact Time 256.
sdk_err_t cts_c_loc_time_info_read(uint8_t conn_idx)
Read Local Time Information characteristic value.
prf_date_time_t date_time
Date Time.
uint8_t accuracy
Accuracy of time information.
@ CTS_C_EVT_INVALID_LOC_TIME_INFO_REC
CTS Client has received invalid Local Time Information value (Read from peer).
@ CTS_C_WEEK_WEDNESDAY
Wednesday.
@ CTS_C_DST_OFFSET_HALF_HOUR
Half An Hour Daylight Time (+0.5h).
int8_t time_zone
Time Zone, Offset from UTC in number of 15 minutes increments.
@ CTS_C_EVT_INVALID_REF_TIME_INFO_REC
CTS Client has received invalid Reference Time Information Value (Read from peer).
@ CTS_C_EVT_INVALID
CTS Client invalid event.
uint16_t cts_cur_time_cccd_handle
CTS CCCD handle of Current Time characteristic which has been got from peer.
uint16_t cts_ref_time_info_handle
CTS Reference Time Information characteristic Value handle which has been got from peer.
@ CTS_C_EVT_VALID_LOC_TIME_INFO_REC
CTS Client has received valid Local Time Information value (Read from peer).
@ CTS_C_REF_TIME_SRC_RADIO_TIME_SIGNAL
Radio Time Signal.
Handles on the connected peer device needed to interact with it.
@ CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME
Double Daylight Time (+2h).
uint16_t cts_loc_time_info_handle
CTS Local Time Information characteristic Value handle which has been got from peer.
Current Time Service Client event.
void cts_c_data_parse(uint8_t *p_data, uint16_t length)
Data accepts data and processing functions.
sdk_err_t cts_c_disc_srvc_start(uint8_t conn_idx)
Discovery Current Time Service on peer.
@ CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS
CTS Client has set Notification of Current Time characteristic.
uint8_t adjust_reason
Adjust Reason.
cts_c_dst_offset_t
Local time information:Daylight Saving Time Offset.
@ CTS_C_REF_TIME_SRC_MANUAL
Manual.
Reference Time Information.
cts_c_loc_time_info_t loc_time_info
Local time information received.
uint16_t cts_srvc_end_handle
CTS Service end handle.
cts_c_ref_time_info_t ref_time_info
Referen time information received.
sdk_err_t cts_c_cur_time_set(uint8_t conn_idx, cts_c_cur_time_t *p_cur_time)
Set Current Time characteristic value.
@ CTS_C_REF_TIME_SRC_ATOMIC_CLOCK
Atomic Clock.
sdk_err_t cts_c_loc_time_info_set(uint8_t conn_idx, cts_c_loc_time_info_t *p_loc_time_info)
Set Local Time Information characteristic value.
uint16_t sdk_err_t
SDK API result type.
@ CTS_C_WEEK_MONDAY
Monday.
The date and time structure.
sdk_err_t cts_client_init(cts_c_evt_handler_t evt_handler)
Register CTS Client event handler.
sdk_err_t cts_c_ref_time_info_read(uint8_t conn_idx)
Read Reference Time Information characteristic value.
@ CTS_C_DST_OFFSET_STANDAR_TIME
Standard Time.
uint8_t fractions_256
1/256th of a second.
cts_c_evt_type_t
Current Time Service Client event type.
uint16_t cts_srvc_start_handle
CTS Service start handle.
cts_c_dst_offset_t dst_offset
Daylight Saving Time Offset.
sdk_err_t cts_c_cur_time_read(uint8_t conn_idx)
Read Current Time characteristic value.
@ CTS_C_REF_TIME_SRC_GPS
GPS.
@ CTS_C_WEEK_FRIDAY
Friday.
uint8_t day_of_week
Day of Week.
cts_c_evt_type_t evt_type
The CTS client event type.
@ CTS_C_EVT_DISCOVERY_FAIL
CTS Client found CTS service failed because of invalid operation or no found at the peer.
@ CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS
CTS Client has writen Local Time Information completely.
uint8_t conn_idx
The index of the connection.
@ CTS_C_WEEK_TUSEDAY
Tuesday.
void(* cts_c_evt_handler_t)(cts_c_evt_t *p_evt)
Current Time Service Client event handler type.
Profile/Service Utilities API.
@ CTS_C_WEEK_SATURDAY
Saturday.
cts_c_week_day_t
Current Time Day of week.
@ CTS_C_WEEK_SUNDAY
Sunday.
@ CTS_C_DST_OFFSET_DAYLIGHT_TIME
Daylight Time (+1h).
@ CTS_C_EVT_DISCOVERY_COMPLETE
CTS Client has found CTS service and its characteristics.
@ CTS_C_EVT_WRITE_OP_ERR
Error occured when CTS Client writen to peer.
@ CTS_C_EVT_VALID_CUR_TIME_REC
CTS Client has received valid Current Time value (Read or Notification from peer).
@ CTS_C_REF_TIME_SRC_CELLUAR_NET
Cellular Network.
sdk_err_t cts_c_cur_time_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer Current Time characteristic notify.
uint8_t days_since_update
Days Since Update.