cts.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file cts.h
5 *
6 * @brief Current Time Service API.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 /**
39 * @addtogroup BLE_SRV BLE Services
40 * @{
41 * @brief Definitions and prototypes for the BLE Service interface.
42 */
43
44 /**
45 * @defgroup BLE_SDK_CTS Current Time Service (CTS)
46 * @{
47 * @brief Current Time Service module.
48 *
49 * @details The Current Time Service exposes Current Time characteristic. It optionally exposes
50 * Local Time Information characteristic and Reference Time Information characteristic.
51 *
52 * After \ref cts_init_t variable is intialized, the application must call \ref cts_service_init()
53 * to add Current Time Service and Current Time, Local Time Information and Reference Time
54 * Information characteristics to the BLE Stack database according to \ref cts_init_t.char_mask.
55 */
56
57 #ifndef __CTS_H__
58 #define __CTS_H__
59
60 #include "gr_includes.h"
61 #include "custom_config.h"
62 #include "ble_prf_utils.h"
63 #include <stdint.h>
64 #include <stdbool.h>
65
66 /**
67 * @defgroup CTS_MACRO Defines
68 * @{
69 */
70 #define CTS_CONNECTION_MAX 10 /**< Maximum number of CTS connections. */
71 #define CTS_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */
72 #define TOTAL_CTS_CUR_TIME_VAL_LEN 27 /**< TOTAL length of current time value. */
73 #define CTS_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */
74 #define TOTAL_CTS_LOC_TIME_INFO_VAL_LEN 6 /**< TOTAL length local time information value. */
75 #define CTS_REF_TIME_INFO_VAL_LEN 4 /**< Length of reference time information value. */
76 #define CTS_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */
77 #define CTS_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */
78 #define CTS_TIME_ZONE_OFFSET_MIN -48 /**< Minimum Value of Offset from UTC. */
79 #define CTS_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */
80 #define CTS_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */
81 #define CTS_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */
82 #define CTS_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */
83
84 /**
85 * @defgroup CTS_CHAR_MASK Characteristics Mask
86 * @{
87 * @brief Bit masks for the initialization of \ref cts_init_t.char_mask.
88 */
89 #define CTS_CHAR_MANDATORY 0x0f /**< Bit mask for mandatory characteristic in CTS. */
90 #define CTS_CHAR_LOC_TIME_INFO_SUP 0x30 /**< Bit mask for Local Time Information characteristic that is optional. */
91 #define CTS_CHAR_REF_TIME_INFO_SUP 0xc0 /**< Bit mask for Reference Time Information characteristic that is optional. */
92 #define CTS_CHAR_FULL 0xff /**< Bit mask of the full characteristic. */
93 /** @} */
94
95 /**
96 * @defgroup CTS_ADJ_REASON Current Time Adjust Reason
97 * @{
98 * @brief Current Time Service Adjust Reason.
99 */
100 #define CTS_AR_NO_CHANGE (0x00 << 0) /**< No change for current time. */
101 #define CTS_AR_MAUAL_TIME_UPDATE (0x01 << 0) /**< Manual time update. */
102 #define CTS_AR_EXT_REF_TIME_UPDATE (0x01 << 1) /**< External reference time update. */
103 #define CTS_AR_TIME_ZONE_CHANGE (0x01 << 2) /**< Change of time zone. */
104 #define CTS_AR_DST_CHANGE (0x01 << 3) /**< Change of DST (daylight savings time). */
105
106 /** @} */
107 /** @} */
108
109 /**
110 * @defgroup CTS_ENUM Enumerations
111 * @{
112 */
113 /**@brief Current Time Day of week. */
114 typedef enum
115 {
116 CTS_WEEK_UNKNOWN_DAY, /**< Day of week is not known. */
117 CTS_WEEK_MONDAY, /**< Monday. */
118 CTS_WEEK_TUSEDAY, /**< Tuesday. */
119 CTS_WEEK_WEDNESDAY, /**< Wednesday. */
120 CTS_WEEK_THURSDAT, /**< Thursday. */
121 CTS_WEEK_FRIDAY, /**< Friday. */
122 CTS_WEEK_SATURDAY, /**< Saturday. */
123 CTS_WEEK_SUNDAY /**< Sunday. */
124 } cts_week_day_t;
125
126 /**@brief Local time information:Daylight Saving Time Offset. */
127 typedef enum
128 {
129 CTS_DST_OFFSET_STANDAR_TIME = 0x00, /**< Standard Time. */
130 CTS_DST_OFFSET_HALF_HOUR = 0x02, /**< Half An Hour Daylight Time (+0.5h). */
131 CTS_DST_OFFSET_DAYLIGHT_TIME = 0x04, /**< Daylight Time (+1h). */
132 CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME = 0x08, /**< Double Daylight Time (+2h). */
133 CTS_DST_OFFSET_DOUB_UNKNOWED_TIME = 0xff, /**< Unknown time. */
134 } cts_dst_offset_t;
135
136 /**@brief Reference time information:Time Source. */
137 typedef enum
138 {
139 CTS_REF_TIME_SRC_UNKNOWN, /**< Unknown. */
140 CTS_REF_TIME_SRC_NET_TIME_PROTOCOL, /**< Network Time Protocol. */
141 CTS_REF_TIME_SRC_GPS, /**< GPS. */
142 CTS_REF_TIME_SRC_RADIO_TIME_SIGNAL, /**< Radio Time Signal. */
143 CTS_REF_TIME_SRC_MANUAL, /**< Manual. */
144 CTS_REF_TIME_SRC_ATOMIC_CLOCK, /**< Atomic Clock. */
145 CTS_REF_TIME_SRC_CELLUAR_NET, /**< Cellular Network. */
146 } cts_ref_time_source_t;
147
148 /**@brief Current Time Service event type. */
149 typedef enum
150 {
151 CTS_EVT_INVALID = 0x00, /**< Invalid event. */
152 CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED, /**< Current Time Notification is enabled. */
153 CTS_EVT_CUR_TIME_NOTIFICATION_DISABLED, /**< Current Time Notification is disabled. */
154 CTS_EVT_CUR_TIME_SET_BY_PEER, /**< Current Time has been set by peer. */
155 CTS_EVT_LOC_TIME_INFO_SET_BY_PEER, /**< Local Time information has been set by peer. */
156 } cts_evt_type_t;
157 /** @} */
158
159 /**
160 * @defgroup CTS_STRUCT Structures
161 * @{
162 */
163 /**@brief CTS Exact Time 256. */
164 typedef struct
165 {
166 prf_date_time_t date_time; /**< Date Time. */
167 uint8_t day_of_week; /**< Day of Week. */
168 uint8_t fractions_256; /**< 1/256th of a second. */
169 } cts_exact_time_256_t;
170
171 /**@brief CTS Current Time value. */
172 typedef struct
173 {
174 cts_exact_time_256_t day_date_time; /**< Exact Time 256. */
175 uint8_t adjust_reason; /**< Adjust Reason. */
176 } cts_cur_time_t;
177
178 /**@brief CTS Local Time Information. */
179 typedef struct
180 {
181 int16_t time_zone; /**< Time Zone, Offset from UTC in number of 15-minute increments. */
182 cts_dst_offset_t dst_offset; /**< Daylight Saving Time Offset. */
183 } cts_loc_time_info_t;
184
185 /**@brief CTS Reference Time Information. */
186 typedef struct
187 {
188 cts_ref_time_source_t source; /**< Time Source. */
189 uint8_t accuracy; /**< Accuracy of time information. */
190 uint8_t days_since_update; /**< Days Since Update. */
191 uint8_t hours_since_update; /**< Hours Since Update. */
192 } cts_ref_time_info_t;
193
194 /**@brief CTS Reference Time Updata Information. */
195 typedef struct
196 {
197 uint8_t before_updata_sec ; /**< The second before the update. */
198 uint8_t current_time_min; /**< Minutes of the current time. */
199 uint8_t current_time_sec; /**< The second of the current time. */
200 uint8_t expected_time_1min_adapt; /**< Minutes of the expected update time. */
201 cts_ref_time_source_t stage_update_source; /**< Minutes of the expected update time. */
202 uint8_t updata_time_flag; /**< 1 minute time flag bit. */
203 } cts_updata_ref_time_info_t;
204
205 /**@brief CTS Adjust information. */
206 typedef struct
207 {
208 uint8_t adjust_reason; /**< Adjust Reason. */
209 cts_exact_time_256_t day_date_time; /**< Exact Time 256. */
210 cts_loc_time_info_t loc_time_info; /**< Local Time information. */
211 cts_ref_time_info_t ref_time_info; /**< Reference Time information. */
212 } cts_adj_info_t;
213
214 /**@brief Current Time Service event. */
215 typedef struct
216 {
217 uint8_t conn_idx; /**< The index of the connection. */
218 cts_evt_type_t evt_type; /**< The CTS event type. */
219 const uint8_t *p_data; /**< Pointer to event data. */
220 uint16_t length; /**< Length of event data. */
221 cts_cur_time_t cur_time; /**< Curren time set by peer. */
222 cts_loc_time_info_t loc_time_info; /**< Local time information set by peer. */
223 } cts_evt_t;
224 /** @} */
225
226 /**
227 * @defgroup CTS_TYPEDEF Typedefs
228 * @{
229 */
230 /**@brief Current Time Service event handler type. */
231 typedef void (*cts_evt_handler_t)(cts_evt_t *p_evt);
232 /** @} */
233
234 /**
235 * @defgroup CTS_STRUCT Structures
236 * @{
237 */
238 /**@brief Current Time Service init structure. This contains all option and data needed for initialization of the service. */
239 typedef struct
240 {
241 cts_evt_handler_t evt_handler; /**< Current Time Service event handler. */
242 uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref CTS_CHAR_MASK. */
243 cts_cur_time_t cur_time; /**< Current Time. */
244 cts_loc_time_info_t loc_time_info; /**< Local Time information. */
245 cts_ref_time_info_t ref_time_info; /**< Reference Time information. */
246 } cts_init_t;
247 /** @} */
248
249 /**
250 * @defgroup CTS_FUNCTION Functions
251 * @{
252 */
253 /**
254 *****************************************************************************************
255 * @brief Initialize a Current Time Service instance and add in the DB.
256 *
257 * @param[in] p_cts_init: Pointer to CTS Service initialization variable.
258 *
259 * @return Result of service initialization.
260 *****************************************************************************************
261 */
262 sdk_err_t cts_service_init(cts_init_t *p_cts_init);
263
264 /**
265 *****************************************************************************************
266 * @brief Get exact time for user.
267 *
268 * @param[out] p_exact_time: Pointer to exact time.
269 *****************************************************************************************
270 */
271 void cts_exact_time_get(cts_init_t *p_exact_time);
272
273 /**
274 *****************************************************************************************
275 * @brief Update exact time.
276 *
277 * @param[in] p_cts_exact_time: Pointer to exact time.
278 *****************************************************************************************
279 */
280 void cts_exact_time_update(cts_init_t *p_cts_exact_time) ;
281
282 /**
283 *****************************************************************************************
284 * @brief Adjust current time.
285 *
286 * @param[in] p_adj_info: Pointer to adjust information.
287 *****************************************************************************************
288 */
289 void cts_cur_time_adjust(cts_adj_info_t *p_adj_info);
290
291 /**
292 *****************************************************************************************
293 * @brief Send Current Time if its notification has been enabled.
294 *
295 * @param[in] conn_idx: Connnection index.
296 * @param[in] p_cur_time: Pointer to current time.
297 *
298 * @return Result of notify value
299 *****************************************************************************************
300 */
301 sdk_err_t cts_cur_time_send(uint8_t conn_idx, cts_cur_time_t *p_cur_time);
302 /** @} */
303
304 /**
305 *****************************************************************************************
306 * @brief Data accepts data and processing functions.
307 *
308 * @param[in] p_data: Serial port data.
309 * @param[in] length: Data length.
310 *****************************************************************************************
311 */
312 void cts_c_data_parse(uint8_t *p_data, uint16_t length);
313
314 /**
315 *****************************************************************************************
316 * @brief Serial port data is converted into reference time.
317 *
318 * @param[in] p_data: Serial port data.
319 * @param[in] length: Data length.
320 *****************************************************************************************
321 */
322 void reference_time_encode(uint8_t *p_data, uint16_t length);
323
324 /**
325 *****************************************************************************************
326 * @brief Serial port data is converted into local time.
327 *
328 * @param[in] p_data: Serial port data.
329 * @param[in] length: Data length.
330 *****************************************************************************************
331 */
332 void local_time_encode(uint8_t *p_data, uint8_t length);
333
334 /**
335 *****************************************************************************************
336 * @brief Serial port data is converted into current time.
337 *
338 * @param[in] p_data: Serial port data.
339 * @param[in] length: Data length.
340 *****************************************************************************************
341 */
342 void current_time_encode(uint8_t *p_data, uint16_t length);
343
344 /**
345 *****************************************************************************************
346 * @brief Handle Local Time Information conversion.
347 *
348 * @param[in] p_cfm: Pointer to GATT write attribute result description.
349 * @param[in] p_evt: Pointer to CTS event.
350 *
351 * @return Result of data lenth.
352 *****************************************************************************************
353 */
354 uint8_t local_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) ;
355
356 /**
357 *****************************************************************************************
358 * @brief Decode for a Current Time.
359 *
360 * @param[in] p_cfm: Pointer to GATT write attribute result description.
361 * @param[in] p_evt: Pointer to CTS event.
362 *
363 * @return Result of data lenth.
364 *****************************************************************************************
365 */
366 uint8_t current_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt);
367
368 #endif
369 /** @} */
370 /** @} */
371
cts_evt_t::evt_type
cts_evt_type_t evt_type
The CTS event type.
Definition: cts.h:218
cts_ref_time_info_t::days_since_update
uint8_t days_since_update
Days Since Update.
Definition: cts.h:190
CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME
@ CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME
Double Daylight Time (+2h).
Definition: cts.h:132
cts_adj_info_t::ref_time_info
cts_ref_time_info_t ref_time_info
Reference Time information.
Definition: cts.h:211
cts_cur_time_t
CTS Current Time value.
Definition: cts.h:173
cts_adj_info_t::loc_time_info
cts_loc_time_info_t loc_time_info
Local Time information.
Definition: cts.h:210
CTS_EVT_CUR_TIME_SET_BY_PEER
@ CTS_EVT_CUR_TIME_SET_BY_PEER
Current Time has been set by peer.
Definition: cts.h:154
CTS_REF_TIME_SRC_MANUAL
@ CTS_REF_TIME_SRC_MANUAL
Manual.
Definition: cts.h:143
cts_exact_time_256_t::day_of_week
uint8_t day_of_week
Day of Week.
Definition: cts.h:167
cts_evt_t::length
uint16_t length
Length of event data.
Definition: cts.h:220
CTS_WEEK_UNKNOWN_DAY
@ CTS_WEEK_UNKNOWN_DAY
Day of week is not known.
Definition: cts.h:116
cts_exact_time_update
void cts_exact_time_update(cts_init_t *p_cts_exact_time)
Update exact time.
cts_loc_time_info_t::dst_offset
cts_dst_offset_t dst_offset
Daylight Saving Time Offset.
Definition: cts.h:182
cts_updata_ref_time_info_t::before_updata_sec
uint8_t before_updata_sec
The second before the update.
Definition: cts.h:197
CTS_EVT_LOC_TIME_INFO_SET_BY_PEER
@ CTS_EVT_LOC_TIME_INFO_SET_BY_PEER
Local Time information has been set by peer.
Definition: cts.h:155
cts_updata_ref_time_info_t
CTS Reference Time Updata Information.
Definition: cts.h:196
current_time_universal_decode
uint8_t current_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt)
Decode for a Current Time.
ble_gatts_write_cfm_t
GATT write attribute result description.
Definition: ble_gatts.h:319
cts_init_t::evt_handler
cts_evt_handler_t evt_handler
Current Time Service event handler.
Definition: cts.h:241
CTS_DST_OFFSET_HALF_HOUR
@ CTS_DST_OFFSET_HALF_HOUR
Half An Hour Daylight Time (+0.5h).
Definition: cts.h:130
CTS_WEEK_SUNDAY
@ CTS_WEEK_SUNDAY
Sunday.
Definition: cts.h:123
CTS_REF_TIME_SRC_ATOMIC_CLOCK
@ CTS_REF_TIME_SRC_ATOMIC_CLOCK
Atomic Clock.
Definition: cts.h:144
gr_includes.h
Include Files API.
CTS_DST_OFFSET_STANDAR_TIME
@ CTS_DST_OFFSET_STANDAR_TIME
Standard Time.
Definition: cts.h:129
cts_ref_time_info_t
CTS Reference Time Information.
Definition: cts.h:187
reference_time_encode
void reference_time_encode(uint8_t *p_data, uint16_t length)
Serial port data is converted into reference time.
CTS_WEEK_WEDNESDAY
@ CTS_WEEK_WEDNESDAY
Wednesday.
Definition: cts.h:119
current_time_encode
void current_time_encode(uint8_t *p_data, uint16_t length)
Serial port data is converted into current time.
CTS_REF_TIME_SRC_UNKNOWN
@ CTS_REF_TIME_SRC_UNKNOWN
Unknown.
Definition: cts.h:139
CTS_REF_TIME_SRC_RADIO_TIME_SIGNAL
@ CTS_REF_TIME_SRC_RADIO_TIME_SIGNAL
Radio Time Signal.
Definition: cts.h:142
CTS_REF_TIME_SRC_CELLUAR_NET
@ CTS_REF_TIME_SRC_CELLUAR_NET
Cellular Network.
Definition: cts.h:145
local_time_universal_decode
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
@ CTS_EVT_CUR_TIME_NOTIFICATION_DISABLED
Current Time Notification is disabled.
Definition: cts.h:153
CTS_DST_OFFSET_DAYLIGHT_TIME
@ CTS_DST_OFFSET_DAYLIGHT_TIME
Daylight Time (+1h).
Definition: cts.h:131
cts_evt_t::conn_idx
uint8_t conn_idx
The index of the connection.
Definition: cts.h:217
cts_updata_ref_time_info_t::updata_time_flag
uint8_t updata_time_flag
1 minute time flag bit.
Definition: cts.h:202
CTS_EVT_INVALID
@ CTS_EVT_INVALID
Invalid event.
Definition: cts.h:151
cts_evt_t::p_data
const uint8_t * p_data
Pointer to event data.
Definition: cts.h:219
cts_exact_time_256_t::date_time
prf_date_time_t date_time
Date Time.
Definition: cts.h:166
cts_exact_time_256_t
CTS Exact Time 256.
Definition: cts.h:165
cts_updata_ref_time_info_t::current_time_sec
uint8_t current_time_sec
The second of the current time.
Definition: cts.h:199
cts_exact_time_256_t::fractions_256
uint8_t fractions_256
1/256th of a second.
Definition: cts.h:168
cts_init_t::loc_time_info
cts_loc_time_info_t loc_time_info
Local Time information.
Definition: cts.h:244
cts_evt_type_t
cts_evt_type_t
Current Time Service event type.
Definition: cts.h:150
cts_dst_offset_t
cts_dst_offset_t
Local time information:Daylight Saving Time Offset.
Definition: cts.h:128
CTS_REF_TIME_SRC_GPS
@ CTS_REF_TIME_SRC_GPS
GPS.
Definition: cts.h:141
cts_service_init
sdk_err_t cts_service_init(cts_init_t *p_cts_init)
Initialize a Current Time Service instance and add in the DB.
cts_updata_ref_time_info_t::expected_time_1min_adapt
uint8_t expected_time_1min_adapt
Minutes of the expected update time.
Definition: cts.h:200
cts_updata_ref_time_info_t::stage_update_source
cts_ref_time_source_t stage_update_source
Minutes of the expected update time.
Definition: cts.h:201
cts_init_t::ref_time_info
cts_ref_time_info_t ref_time_info
Reference Time information.
Definition: cts.h:245
cts_updata_ref_time_info_t::current_time_min
uint8_t current_time_min
Minutes of the current time.
Definition: cts.h:198
cts_cur_time_send
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_loc_time_info_t
CTS Local Time Information.
Definition: cts.h:180
cts_exact_time_get
void cts_exact_time_get(cts_init_t *p_exact_time)
Get exact time for user.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:273
CTS_REF_TIME_SRC_NET_TIME_PROTOCOL
@ CTS_REF_TIME_SRC_NET_TIME_PROTOCOL
Network Time Protocol.
Definition: cts.h:140
cts_init_t::cur_time
cts_cur_time_t cur_time
Current Time.
Definition: cts.h:243
prf_date_time_t
The date and time structure.
Definition: ble_prf_types.h:101
CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED
@ CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED
Current Time Notification is enabled.
Definition: cts.h:152
cts_evt_handler_t
void(* cts_evt_handler_t)(cts_evt_t *p_evt)
Current Time Service event handler type.
Definition: cts.h:231
cts_adj_info_t::day_date_time
cts_exact_time_256_t day_date_time
Exact Time 256.
Definition: cts.h:209
CTS_WEEK_TUSEDAY
@ CTS_WEEK_TUSEDAY
Tuesday.
Definition: cts.h:118
cts_init_t
Current Time Service init structure.
Definition: cts.h:240
cts_ref_time_source_t
cts_ref_time_source_t
Reference time information:Time Source.
Definition: cts.h:138
cts_loc_time_info_t::time_zone
int16_t time_zone
Time Zone, Offset from UTC in number of 15-minute increments.
Definition: cts.h:181
cts_ref_time_info_t::hours_since_update
uint8_t hours_since_update
Hours Since Update.
Definition: cts.h:191
cts_ref_time_info_t::source
cts_ref_time_source_t source
Time Source.
Definition: cts.h:188
cts_c_data_parse
void cts_c_data_parse(uint8_t *p_data, uint16_t length)
Data accepts data and processing functions.
CTS_WEEK_SATURDAY
@ CTS_WEEK_SATURDAY
Saturday.
Definition: cts.h:122
cts_evt_t::cur_time
cts_cur_time_t cur_time
Curren time set by peer.
Definition: cts.h:221
CTS_DST_OFFSET_DOUB_UNKNOWED_TIME
@ CTS_DST_OFFSET_DOUB_UNKNOWED_TIME
Unknown time.
Definition: cts.h:133
cts_cur_time_adjust
void cts_cur_time_adjust(cts_adj_info_t *p_adj_info)
Adjust current time.
CTS_WEEK_THURSDAT
@ CTS_WEEK_THURSDAT
Thursday.
Definition: cts.h:120
cts_week_day_t
cts_week_day_t
Current Time Day of week.
Definition: cts.h:115
cts_init_t::char_mask
uint16_t char_mask
Initial mask of supported characteristics, and configured with Characteristics Mask.
Definition: cts.h:242
cts_ref_time_info_t::accuracy
uint8_t accuracy
Accuracy of time information.
Definition: cts.h:189
CTS_WEEK_FRIDAY
@ CTS_WEEK_FRIDAY
Friday.
Definition: cts.h:121
ble_prf_utils.h
Profile/Service Utilities API.
cts_cur_time_t::adjust_reason
uint8_t adjust_reason
Adjust Reason.
Definition: cts.h:175
cts_cur_time_t::day_date_time
cts_exact_time_256_t day_date_time
Exact Time 256.
Definition: cts.h:174
local_time_encode
void local_time_encode(uint8_t *p_data, uint8_t length)
Serial port data is converted into local time.
cts_adj_info_t
CTS Adjust information.
Definition: cts.h:207
cts_evt_t::loc_time_info
cts_loc_time_info_t loc_time_info
Local time information set by peer.
Definition: cts.h:222
cts_adj_info_t::adjust_reason
uint8_t adjust_reason
Adjust Reason.
Definition: cts.h:208
cts_evt_t
Current Time Service event.
Definition: cts.h:216
CTS_WEEK_MONDAY
@ CTS_WEEK_MONDAY
Monday.
Definition: cts.h:117