Go to the documentation of this file.
61 #include "custom_config.h"
70 #define CTS_CONNECTION_MAX 10
71 #define CTS_CUR_TIME_VAL_LEN 10
72 #define TOTAL_CTS_CUR_TIME_VAL_LEN 27
73 #define CTS_LOC_TIME_INFO_VAL_LEN 2
74 #define TOTAL_CTS_LOC_TIME_INFO_VAL_LEN 6
75 #define CTS_REF_TIME_INFO_VAL_LEN 4
76 #define CTS_TIME_YEAR_VALID_VAL_MIN 1582
77 #define CTS_TIME_YEAR_VALID_VAL_MAX 9999
78 #define CTS_TIME_ZONE_OFFSET_MIN -48
79 #define CTS_TIME_ZONE_OFFSET_MAX 56
80 #define CTS_TIME_ACCURACY_OUT_RANGE 254
81 #define CTS_TIME_ACCURACT_UNKNOWN 255
82 #define CTS_ERROR_FIELDS_IGNORED 0x80
89 #define CTS_CHAR_MANDATORY 0x0f
90 #define CTS_CHAR_LOC_TIME_INFO_SUP 0x30
91 #define CTS_CHAR_REF_TIME_INFO_SUP 0xc0
92 #define CTS_CHAR_FULL 0xff
100 #define CTS_AR_NO_CHANGE (0x00 << 0)
101 #define CTS_AR_MAUAL_TIME_UPDATE (0x01 << 0)
102 #define CTS_AR_EXT_REF_TIME_UPDATE (0x01 << 1)
103 #define CTS_AR_TIME_ZONE_CHANGE (0x01 << 2)
104 #define CTS_AR_DST_CHANGE (0x01 << 3)
cts_evt_type_t evt_type
The CTS event type.
uint8_t days_since_update
Days Since Update.
@ CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME
Double Daylight Time (+2h).
cts_ref_time_info_t ref_time_info
Reference Time information.
cts_loc_time_info_t loc_time_info
Local Time information.
@ CTS_EVT_CUR_TIME_SET_BY_PEER
Current Time has been set by peer.
@ CTS_REF_TIME_SRC_MANUAL
Manual.
uint8_t day_of_week
Day of Week.
uint16_t length
Length of event data.
@ CTS_WEEK_UNKNOWN_DAY
Day of week is not known.
void cts_exact_time_update(cts_init_t *p_cts_exact_time)
Update exact time.
cts_dst_offset_t dst_offset
Daylight Saving Time Offset.
uint8_t before_updata_sec
The second before the update.
@ CTS_EVT_LOC_TIME_INFO_SET_BY_PEER
Local Time information has been set by peer.
CTS Reference Time Updata Information.
uint8_t current_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt)
Decode for a Current Time.
GATT write attribute result description.
cts_evt_handler_t evt_handler
Current Time Service event handler.
@ CTS_DST_OFFSET_HALF_HOUR
Half An Hour Daylight Time (+0.5h).
@ CTS_REF_TIME_SRC_ATOMIC_CLOCK
Atomic Clock.
@ CTS_DST_OFFSET_STANDAR_TIME
Standard Time.
CTS Reference Time Information.
void reference_time_encode(uint8_t *p_data, uint16_t length)
Serial port data is converted into reference time.
@ CTS_WEEK_WEDNESDAY
Wednesday.
void current_time_encode(uint8_t *p_data, uint16_t length)
Serial port data is converted into current time.
@ CTS_REF_TIME_SRC_UNKNOWN
Unknown.
@ CTS_REF_TIME_SRC_RADIO_TIME_SIGNAL
Radio Time Signal.
@ CTS_REF_TIME_SRC_CELLUAR_NET
Cellular Network.
uint8_t local_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt)
Handle Local Time Information conversion.
@ CTS_EVT_CUR_TIME_NOTIFICATION_DISABLED
Current Time Notification is disabled.
@ CTS_DST_OFFSET_DAYLIGHT_TIME
Daylight Time (+1h).
uint8_t conn_idx
The index of the connection.
uint8_t updata_time_flag
1 minute time flag bit.
@ CTS_EVT_INVALID
Invalid event.
const uint8_t * p_data
Pointer to event data.
prf_date_time_t date_time
Date Time.
uint8_t current_time_sec
The second of the current time.
uint8_t fractions_256
1/256th of a second.
cts_loc_time_info_t loc_time_info
Local Time information.
cts_evt_type_t
Current Time Service event type.
cts_dst_offset_t
Local time information:Daylight Saving Time Offset.
@ CTS_REF_TIME_SRC_GPS
GPS.
sdk_err_t cts_service_init(cts_init_t *p_cts_init)
Initialize a Current Time Service instance and add in the DB.
uint8_t expected_time_1min_adapt
Minutes of the expected update time.
cts_ref_time_source_t stage_update_source
Minutes of the expected update time.
cts_ref_time_info_t ref_time_info
Reference Time information.
uint8_t current_time_min
Minutes of the current time.
sdk_err_t cts_cur_time_send(uint8_t conn_idx, cts_cur_time_t *p_cur_time)
Send Current Time if its notification has been enabled.
CTS Local Time Information.
void cts_exact_time_get(cts_init_t *p_exact_time)
Get exact time for user.
uint16_t sdk_err_t
SDK API result type.
@ CTS_REF_TIME_SRC_NET_TIME_PROTOCOL
Network Time Protocol.
cts_cur_time_t cur_time
Current Time.
The date and time structure.
@ CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED
Current Time Notification is enabled.
void(* cts_evt_handler_t)(cts_evt_t *p_evt)
Current Time Service event handler type.
cts_exact_time_256_t day_date_time
Exact Time 256.
@ CTS_WEEK_TUSEDAY
Tuesday.
Current Time Service init structure.
cts_ref_time_source_t
Reference time information:Time Source.
int16_t time_zone
Time Zone, Offset from UTC in number of 15-minute increments.
uint8_t hours_since_update
Hours Since Update.
cts_ref_time_source_t source
Time Source.
void cts_c_data_parse(uint8_t *p_data, uint16_t length)
Data accepts data and processing functions.
@ CTS_WEEK_SATURDAY
Saturday.
cts_cur_time_t cur_time
Curren time set by peer.
@ CTS_DST_OFFSET_DOUB_UNKNOWED_TIME
Unknown time.
void cts_cur_time_adjust(cts_adj_info_t *p_adj_info)
Adjust current time.
@ CTS_WEEK_THURSDAT
Thursday.
cts_week_day_t
Current Time Day of week.
uint16_t char_mask
Initial mask of supported characteristics, and configured with Characteristics Mask.
uint8_t accuracy
Accuracy of time information.
Profile/Service Utilities API.
uint8_t adjust_reason
Adjust Reason.
cts_exact_time_256_t day_date_time
Exact Time 256.
void local_time_encode(uint8_t *p_data, uint8_t length)
Serial port data is converted into local time.
cts_loc_time_info_t loc_time_info
Local time information set by peer.
uint8_t adjust_reason
Adjust Reason.
Current Time Service event.