cts_c.h
Go to the documentation of this file.
1 /**
2 *****************************************************************************************
3 *
4 * @file cts_c.h
5 *
6 * @brief Current Time Service Client 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 */
42
43 /**
44 * @defgroup BLE_SDK_CTS_C Current Time Service Client (CTS_C)
45 * @{
46 * @brief Current Time Service Client module.
47 *
48 * @details The Current Time Service Client contains the APIs and types, which can be used
49 * by the application to discover Current Time Service of peer and interact with it.
50 *
51 * The application must provide an event handler to be register, then call \ref cts_client_init().
52 * After Current Time Service Client discovers peer Current Time Service, application can
53 * receive current time value notification from peer, and also call \ref cts_c_cur_time_read()
54 * to get current time from peer. This module provides functions: \ref cts_c_loc_time_info_read()
55 * and \ref cts_c_ref_time_info_read() to read local time information and reference time informarion
56 * on peer.
57 */
58
59 #ifndef __CTS_C_H__
60 #define __CTS_C_H__
61
62 #include "gr55xx_sys.h"
63 #include "custom_config.h"
64 #include "ble_prf_utils.h"
65 #include <stdint.h>
66 #include <stdbool.h>
67
68 /**
69 * @defgroup CTS_C_MACRO Defines
70 * @{
71 */
72 #define CTS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
73 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */
74
75 #define CTS_C_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */
76 #define CTS_C_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */
77 #define CTS_C_TIME_Y_M_D_UNKNOWN 0 /**< Year or Month or Day is not known. */
78 #define CTS_C_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */
79 #define CTS_C_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */
80 #define CTS_C_TIME_ZONE_OFFSET_MIN -48 /**< Minimum Value of Offset from UTC. */
81 #define CTS_C_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */
82 #define CTS_C_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */
83 #define CTS_C_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */
84 #define CTS_C_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */
85
86 /**
87 * @defgroup CTS_C_ADJ_REASON Current Time Adjust Reason
88 * @{
89 * @brief Current Time Service Adjust Reason.
90 */
91 #define CTS_C_AR_NO_CHANGE (0x00 << 0) /**< No change for current time. */
92 #define CTS_C_AR_MAUAL_TIME_UPDATE (0x01 << 0) /**< Manual time update. */
93 #define CTS_C_AR_EXT_REF_TIME_UPDATE (0x01 << 1) /**< External reference time update. */
94 #define CTS_C_AR_TIME_ZONE_CHANGE (0x01 << 2) /**< Change of time zone. */
95 #define CTS_C_AR_DST_CHANGE (0x01 << 3) /**< Change of DST (daylight savings time). */
96 /** @} */
97 /** @} */
98
99 /**
100 * @defgroup CTS_C_ENUM Enumerations
101 * @{
102 */
103 /**@brief Current Time Day of week. */
104 typedef enum
105 {
106 CTS_C_WEEK_UNKNOWN_DAY, /**< Day of week is not known. */
107 CTS_C_WEEK_MONDAY, /**< Monday. */
108 CTS_C_WEEK_TUSEDAY, /**< Tuesday. */
109 CTS_C_WEEK_WEDNESDAY, /**< Wednesday. */
110 CTS_C_WEEK_THURSDAT, /**< Thursday. */
111 CTS_C_WEEK_FRIDAY, /**< Friday. */
112 CTS_C_WEEK_SATURDAY, /**< Saturday. */
113 CTS_C_WEEK_SUNDAY /**< Sunday. */
114 } cts_c_week_day_t;
115
116 /**@brief Local time information:Daylight Saving Time Offset. */
117 typedef enum
118 {
119 CTS_C_DST_OFFSET_STANDAR_TIME = 0x00, /**< Standard Time. */
120 CTS_C_DST_OFFSET_HALF_HOUR = 0x02, /**< Half An Hour Daylight Time (+0.5h). */
121 CTS_C_DST_OFFSET_DAYLIGHT_TIME = 0x04, /**< Daylight Time (+1h). */
122 CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME = 0x08, /**< Double Daylight Time (+2h). */
123 } cts_c_dst_offset_t;
124
125 /**@brief Reference time information:Time Source. */
126 typedef enum
127 {
128 CTS_C_REF_TIME_SRC_UNKNOWN, /**< Unknown. */
129 CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL, /**< Network Time Protocol. */
130 CTS_C_REF_TIME_SRC_GPS, /**< GPS. */
131 CTS_C_REF_TIME_SRC_RADIO_TIME_SIGNAL, /**< Radio Time Signal. */
132 CTS_C_REF_TIME_SRC_MANUAL, /**< Manual. */
133 CTS_C_REF_TIME_SRC_ATOMIC_CLOCK, /**< Atomic Clock. */
134 CTS_C_REF_TIME_SRC_CELLUAR_NET, /**< Cellular Network. */
135 } cts_c_ref_time_source_t;
136
137 /**@brief Current Time Service Client event type. */
138 typedef enum
139 {
140 CTS_C_EVT_INVALID, /**< CTS Client invalid event. */
141 CTS_C_EVT_DISCOVERY_COMPLETE, /**< CTS Client has found CTS service and its characteristics. */
142 CTS_C_EVT_DISCOVERY_FAIL, /**< CTS Client found CTS service failed because of invalid operation or no found at the peer. */
143 CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS, /**< CTS Client has set Notification of Current Time characteristic. */
144 CTS_C_EVT_VALID_CUR_TIME_REC, /**< CTS Client has received valid Current Time value (Read or Notification from peer). */
145 CTS_C_EVT_INVALID_CUR_TIME_REC, /**< CTS Client has received invalid Current Time value (Read or Notification from peer). */
146 CTS_C_EVT_VALID_LOC_TIME_INFO_REC, /**< CTS Client has received valid Local Time Information value (Read from peer). */
147 CTS_C_EVT_INVALID_LOC_TIME_INFO_REC, /**< CTS Client has received invalid Local Time Information value (Read from peer). */
148 CTS_C_EVT_VALID_REF_TIME_INFO_REC, /**< CTS Client has received valid Reference Time Information Value (Read from peer). */
149 CTS_C_EVT_INVALID_REF_TIME_INFO_REC, /**< CTS Client has received invalid Reference Time Information Value (Read from peer). */
150 CTS_C_EVT_CUR_TIME_SET_SUCCESS, /**< CTS Client has writen Current Time completely. */
151 CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS, /**< CTS Client has writen Local Time Information completely. */
152 CTS_C_EVT_WRITE_OP_ERR, /**< Error occured when CTS Client writen to peer. */
153 } cts_c_evt_type_t;
154 /** @} */
155
156 /**
157 * @defgroup CTS_C_STRUCT Structures
158 * @{
159 */
160 /**@brief Handles on the connected peer device needed to interact with it. */
161 typedef struct
162 {
163 uint16_t cts_srvc_start_handle; /**< CTS Service start handle. */
164 uint16_t cts_srvc_end_handle; /**< CTS Service end handle. */
165 uint16_t cts_cur_time_handle; /**< CTS Current Time characteristic Value handle which has been got from peer. */
166 uint16_t cts_cur_time_cccd_handle; /**< CTS CCCD handle of Current Time characteristic which has been got from peer. */
167 uint16_t cts_loc_time_info_handle; /**< CTS Local Time Information characteristic Value handle which has been got from peer. */
168 uint16_t cts_ref_time_info_handle; /**< CTS Reference Time Information characteristic Value handle which has been got from peer. */
169 } cts_c_handles_t;
170
171 /**@brief Exact Time 256. */
172 typedef struct
173 {
174 prf_date_time_t date_time; /**< Date Time. */
175 uint8_t day_of_week; /**< Day of Week. */
176 uint8_t fractions_256; /**< 1/256th of a second. */
177 } cts_c_exact_time_256_t;
178
179 /**@brief Current Time value. */
180 typedef struct
181 {
182 cts_c_exact_time_256_t day_date_time; /**< Exact Time 256. */
183 uint8_t adjust_reason; /**< Adjust Reason. */
184 } cts_c_cur_time_t;
185
186 /**@brief Local Time Information. */
187 typedef struct
188 {
189 int8_t time_zone; /**< Time Zone, Offset from UTC in number of 15 minutes increments. */
190 cts_c_dst_offset_t dst_offset; /**< Daylight Saving Time Offset. */
191 } cts_c_loc_time_info_t;
192
193 /**@brief Reference Time Information. */
194 typedef struct
195 {
196 cts_c_ref_time_source_t source; /**< Time Source. */
197 uint8_t accuracy; /**< Accuracy of time information. */
198 uint8_t days_since_update; /**< Days Since Update. */
199 uint8_t hours_since_update; /**< Hours Since Update. */
200 } cts_c_ref_time_info_t;
201
202 /**@brief Current Time Service Client event. */
203 typedef struct
204 {
205 uint8_t conn_idx; /**< The index of the connection. */
206 cts_c_evt_type_t evt_type; /**< The CTS client event type. */
207 union
208 {
209 cts_c_cur_time_t cur_time; /**< Curren time received. */
210 cts_c_loc_time_info_t loc_time_info; /**< Local time information received. */
211 cts_c_ref_time_info_t ref_time_info; /**< Referen time information received. */
212 } value; /**< Decoded result of value received. */
213 } cts_c_evt_t;
214 /** @} */
215
216 /**
217 * @defgroup CTS_C_TYPEDEF Typedefs
218 * @{
219 */
220 /**@brief Current Time Service Client event handler type. */
221 typedef void (*cts_c_evt_handler_t)(cts_c_evt_t *p_evt);
222 /** @} */
223
224 /**
225 * @defgroup CTS_C_FUNCTION Functions
226 * @{
227 */
228 /**
229 *****************************************************************************************
230 * @brief Register CTS Client event handler.
231 *
232 * @param[in] evt_handler: Current Time Service Client event handler.
233 *
234 * @return Result of initialization.
235 *****************************************************************************************
236 */
237 sdk_err_t cts_client_init(cts_c_evt_handler_t evt_handler);
238
239 /**
240 *****************************************************************************************
241 * @brief Discovery Current Time Service on peer.
242 *
243 * @param[in] conn_idx: Index of connection.
244 *
245 * @return Operation result.
246 *****************************************************************************************
247 */
248 sdk_err_t cts_c_disc_srvc_start(uint8_t conn_idx);
249
250 /**
251 *****************************************************************************************
252 * @brief Enable or disable peer Current Time characteristic notify.
253 *
254 * @param[in] conn_idx: Index of connection.
255 * @param[in] is_enable: True or false.
256 *
257 * @return Operation result.
258 *****************************************************************************************
259 */
260 sdk_err_t cts_c_cur_time_notify_set(uint8_t conn_idx, bool is_enable);
261
262 /**
263 *****************************************************************************************
264 * @brief Read Current Time characteristic value.
265 *
266 * @param[in] conn_idx: Index of connection.
267 *
268 * @return Operation result.
269 *****************************************************************************************
270 */
271 sdk_err_t cts_c_cur_time_read(uint8_t conn_idx);
272
273 /**
274 *****************************************************************************************
275 * @brief Read Local Time Information characteristic value.
276 *
277 * @param[in] conn_idx: Index of connection.
278 *
279 * @return Operation result.
280 *****************************************************************************************
281 */
282 sdk_err_t cts_c_loc_time_info_read(uint8_t conn_idx);
283
284 /**
285 *****************************************************************************************
286 * @brief Read Reference Time Information characteristic value.
287 *
288 * @param[in] conn_idx: Index of connection.
289 *
290 * @return Operation result.
291 *****************************************************************************************
292 */
293 sdk_err_t cts_c_ref_time_info_read(uint8_t conn_idx);
294
295 /**
296 *****************************************************************************************
297 * @brief Set Current Time characteristic value.
298 *
299 * @param[in] conn_idx: Index of connection.
300 * @param[in] p_cur_time: Pointer to current time value set.
301 *
302 * @return Operation result.
303 *****************************************************************************************
304 */
305 sdk_err_t cts_c_cur_time_set(uint8_t conn_idx, cts_c_cur_time_t *p_cur_time);
306
307 /**
308 *****************************************************************************************
309 * @brief Set Local Time Information characteristic value.
310 *
311 * @param[in] conn_idx: Index of connection.
312 * @param[in] p_loc_time_info: Pointer to local time information value set.
313 *
314 * @return Operation result.
315 *****************************************************************************************
316 */
317 sdk_err_t cts_c_loc_time_info_set(uint8_t conn_idx, cts_c_loc_time_info_t *p_loc_time_info);
318 /** @} */
319
320 #endif
321 /** @} */
322 /** @} */
323
CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL
@ CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL
Network Time Protocol.
Definition: cts_c.h:129
cts_c_loc_time_info_t
Local Time Information.
Definition: cts_c.h:188
cts_c_ref_time_info_t::hours_since_update
uint8_t hours_since_update
Hours Since Update.
Definition: cts_c.h:199
CTS_C_WEEK_THURSDAT
@ CTS_C_WEEK_THURSDAT
Thursday.
Definition: cts_c.h:110
cts_c_handles_t::cts_cur_time_handle
uint16_t cts_cur_time_handle
CTS Current Time characteristic Value handle which has been got from peer.
Definition: cts_c.h:165
CTS_C_EVT_INVALID_CUR_TIME_REC
@ CTS_C_EVT_INVALID_CUR_TIME_REC
CTS Client has received invalid Current Time value (Read or Notification from peer).
Definition: cts_c.h:145
CTS_C_EVT_CUR_TIME_SET_SUCCESS
@ CTS_C_EVT_CUR_TIME_SET_SUCCESS
CTS Client has writen Current Time completely.
Definition: cts_c.h:150
cts_c_ref_time_source_t
cts_c_ref_time_source_t
Reference time information:Time Source.
Definition: cts_c.h:127
CTS_C_WEEK_UNKNOWN_DAY
@ CTS_C_WEEK_UNKNOWN_DAY
Day of week is not known.
Definition: cts_c.h:106
CTS_C_REF_TIME_SRC_UNKNOWN
@ CTS_C_REF_TIME_SRC_UNKNOWN
Unknown.
Definition: cts_c.h:128
cts_c_evt_t::cur_time
cts_c_cur_time_t cur_time
Curren time received.
Definition: cts_c.h:209
CTS_C_EVT_VALID_REF_TIME_INFO_REC
@ CTS_C_EVT_VALID_REF_TIME_INFO_REC
CTS Client has received valid Reference Time Information Value (Read from peer).
Definition: cts_c.h:148
cts_c_ref_time_info_t::source
cts_c_ref_time_source_t source
Time Source.
Definition: cts_c.h:196
cts_c_cur_time_t::day_date_time
cts_c_exact_time_256_t day_date_time
Exact Time 256.
Definition: cts_c.h:182
cts_c_loc_time_info_read
sdk_err_t cts_c_loc_time_info_read(uint8_t conn_idx)
Read Local Time Information characteristic value.
cts_c_exact_time_256_t::date_time
prf_date_time_t date_time
Date Time.
Definition: cts_c.h:174
cts_c_ref_time_info_t::accuracy
uint8_t accuracy
Accuracy of time information.
Definition: cts_c.h:197
CTS_C_EVT_INVALID_LOC_TIME_INFO_REC
@ CTS_C_EVT_INVALID_LOC_TIME_INFO_REC
CTS Client has received invalid Local Time Information value (Read from peer).
Definition: cts_c.h:147
cts_c_exact_time_256_t
Exact Time 256.
Definition: cts_c.h:173
CTS_C_WEEK_WEDNESDAY
@ CTS_C_WEEK_WEDNESDAY
Wednesday.
Definition: cts_c.h:109
CTS_C_DST_OFFSET_HALF_HOUR
@ CTS_C_DST_OFFSET_HALF_HOUR
Half An Hour Daylight Time (+0.5h).
Definition: cts_c.h:120
cts_c_loc_time_info_t::time_zone
int8_t time_zone
Time Zone, Offset from UTC in number of 15 minutes increments.
Definition: cts_c.h:189
CTS_C_EVT_INVALID_REF_TIME_INFO_REC
@ CTS_C_EVT_INVALID_REF_TIME_INFO_REC
CTS Client has received invalid Reference Time Information Value (Read from peer).
Definition: cts_c.h:149
CTS_C_EVT_INVALID
@ CTS_C_EVT_INVALID
CTS Client invalid event.
Definition: cts_c.h:140
gr55xx_sys.h
GR55XX System API.
cts_c_handles_t::cts_cur_time_cccd_handle
uint16_t cts_cur_time_cccd_handle
CTS CCCD handle of Current Time characteristic which has been got from peer.
Definition: cts_c.h:166
cts_c_handles_t::cts_ref_time_info_handle
uint16_t cts_ref_time_info_handle
CTS Reference Time Information characteristic Value handle which has been got from peer.
Definition: cts_c.h:168
CTS_C_EVT_VALID_LOC_TIME_INFO_REC
@ CTS_C_EVT_VALID_LOC_TIME_INFO_REC
CTS Client has received valid Local Time Information value (Read from peer).
Definition: cts_c.h:146
CTS_C_REF_TIME_SRC_RADIO_TIME_SIGNAL
@ CTS_C_REF_TIME_SRC_RADIO_TIME_SIGNAL
Radio Time Signal.
Definition: cts_c.h:131
cts_c_handles_t
Handles on the connected peer device needed to interact with it.
Definition: cts_c.h:162
CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME
@ CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME
Double Daylight Time (+2h).
Definition: cts_c.h:122
cts_c_handles_t::cts_loc_time_info_handle
uint16_t cts_loc_time_info_handle
CTS Local Time Information characteristic Value handle which has been got from peer.
Definition: cts_c.h:167
cts_c_evt_t
Current Time Service Client event.
Definition: cts_c.h:204
cts_c_disc_srvc_start
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_C_EVT_CUR_TIME_NTF_SET_SUCCESS
CTS Client has set Notification of Current Time characteristic.
Definition: cts_c.h:143
cts_c_cur_time_t::adjust_reason
uint8_t adjust_reason
Adjust Reason.
Definition: cts_c.h:183
cts_c_dst_offset_t
cts_c_dst_offset_t
Local time information:Daylight Saving Time Offset.
Definition: cts_c.h:118
CTS_C_REF_TIME_SRC_MANUAL
@ CTS_C_REF_TIME_SRC_MANUAL
Manual.
Definition: cts_c.h:132
cts_c_ref_time_info_t
Reference Time Information.
Definition: cts_c.h:195
cts_c_evt_t::loc_time_info
cts_c_loc_time_info_t loc_time_info
Local time information received.
Definition: cts_c.h:210
cts_c_handles_t::cts_srvc_end_handle
uint16_t cts_srvc_end_handle
CTS Service end handle.
Definition: cts_c.h:164
cts_c_evt_t::ref_time_info
cts_c_ref_time_info_t ref_time_info
Referen time information received.
Definition: cts_c.h:211
cts_c_cur_time_set
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
@ CTS_C_REF_TIME_SRC_ATOMIC_CLOCK
Atomic Clock.
Definition: cts_c.h:133
cts_c_loc_time_info_set
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.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
CTS_C_WEEK_MONDAY
@ CTS_C_WEEK_MONDAY
Monday.
Definition: cts_c.h:107
prf_date_time_t
The date and time structure.
Definition: ble_prf_types.h:101
cts_client_init
sdk_err_t cts_client_init(cts_c_evt_handler_t evt_handler)
Register CTS Client event handler.
cts_c_ref_time_info_read
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
@ CTS_C_DST_OFFSET_STANDAR_TIME
Standard Time.
Definition: cts_c.h:119
cts_c_exact_time_256_t::fractions_256
uint8_t fractions_256
1/256th of a second.
Definition: cts_c.h:176
cts_c_evt_type_t
cts_c_evt_type_t
Current Time Service Client event type.
Definition: cts_c.h:139
cts_c_handles_t::cts_srvc_start_handle
uint16_t cts_srvc_start_handle
CTS Service start handle.
Definition: cts_c.h:163
cts_c_loc_time_info_t::dst_offset
cts_c_dst_offset_t dst_offset
Daylight Saving Time Offset.
Definition: cts_c.h:190
cts_c_cur_time_read
sdk_err_t cts_c_cur_time_read(uint8_t conn_idx)
Read Current Time characteristic value.
CTS_C_REF_TIME_SRC_GPS
@ CTS_C_REF_TIME_SRC_GPS
GPS.
Definition: cts_c.h:130
CTS_C_WEEK_FRIDAY
@ CTS_C_WEEK_FRIDAY
Friday.
Definition: cts_c.h:111
cts_c_exact_time_256_t::day_of_week
uint8_t day_of_week
Day of Week.
Definition: cts_c.h:175
cts_c_evt_t::evt_type
cts_c_evt_type_t evt_type
The CTS client event type.
Definition: cts_c.h:206
CTS_C_EVT_DISCOVERY_FAIL
@ CTS_C_EVT_DISCOVERY_FAIL
CTS Client found CTS service failed because of invalid operation or no found at the peer.
Definition: cts_c.h:142
CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS
@ CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS
CTS Client has writen Local Time Information completely.
Definition: cts_c.h:151
cts_c_cur_time_t
Current Time value.
Definition: cts_c.h:181
cts_c_evt_t::conn_idx
uint8_t conn_idx
The index of the connection.
Definition: cts_c.h:205
CTS_C_WEEK_TUSEDAY
@ CTS_C_WEEK_TUSEDAY
Tuesday.
Definition: cts_c.h:108
cts_c_evt_handler_t
void(* cts_c_evt_handler_t)(cts_c_evt_t *p_evt)
Current Time Service Client event handler type.
Definition: cts_c.h:221
ble_prf_utils.h
Profile/Service Utilities API.
CTS_C_WEEK_SATURDAY
@ CTS_C_WEEK_SATURDAY
Saturday.
Definition: cts_c.h:112
cts_c_week_day_t
cts_c_week_day_t
Current Time Day of week.
Definition: cts_c.h:105
CTS_C_WEEK_SUNDAY
@ CTS_C_WEEK_SUNDAY
Sunday.
Definition: cts_c.h:113
CTS_C_DST_OFFSET_DAYLIGHT_TIME
@ CTS_C_DST_OFFSET_DAYLIGHT_TIME
Daylight Time (+1h).
Definition: cts_c.h:121
CTS_C_EVT_DISCOVERY_COMPLETE
@ CTS_C_EVT_DISCOVERY_COMPLETE
CTS Client has found CTS service and its characteristics.
Definition: cts_c.h:141
CTS_C_EVT_WRITE_OP_ERR
@ CTS_C_EVT_WRITE_OP_ERR
Error occured when CTS Client writen to peer.
Definition: cts_c.h:152
CTS_C_EVT_VALID_CUR_TIME_REC
@ CTS_C_EVT_VALID_CUR_TIME_REC
CTS Client has received valid Current Time value (Read or Notification from peer).
Definition: cts_c.h:144
CTS_C_REF_TIME_SRC_CELLUAR_NET
@ CTS_C_REF_TIME_SRC_CELLUAR_NET
Cellular Network.
Definition: cts_c.h:134
cts_c_cur_time_notify_set
sdk_err_t cts_c_cur_time_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer Current Time characteristic notify.
cts_c_ref_time_info_t::days_since_update
uint8_t days_since_update
Days Since Update.
Definition: cts_c.h:198