uds.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file uds.h
5 *
6 * @brief User Data 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_UDS User Data Service (UDS)
46 * @{
47 * @brief User Data Service module.
48 *
49 * @details The User Data Service (UDS) exposes user-related data in a sports and fitness, home, or healthcare
50 * environment. This allows remote access and update of user data by a client as well as the
51 * synchronization of user data between a server and a client.
52 *
53 * After \ref uds_init_t variable is intialized, the application must call \ref uds_service_init()
54 * to add User Data Service and UDS Characteristic, Database Change Increment, User Index, User
55 * Control Point and Registered User characteristics to the BLE Stack database according to
56 * \ref uds_init_t.char_mask.
57 */
58
59 #ifndef __UDS_H__
60 #define __UDS_H__
61
62 #include "gr_includes.h"
63 #include "custom_config.h"
64 #include "ble_prf_utils.h"
65 #include <stdint.h>
66 #include <stdbool.h>
67
68 /**
69 * @defgroup UDS_MACRO Defines
70 * @{
71 */
72 #define UDS_CONNECTION_MAX 10 /**< Maximum number of UDS connections. */
73 #define UDS_AGE_VAL_LEN_MAX 2 /**< Maximum length of Age Characteristic value. */
74 #define UDS_DATE_OF_BIRTH_VAL_LEN_MAX 4 /**< Maximum length of Date of Birth Characteristic value. */
75 #define UDS_FIRST_NAME_VAL_LEN_MAX 50 /**< Maximum length of First Name Characteristic value. */
76 #define UDS_HEIGHT_VAL_LEN_MAX 2 /**< Maximum length of Height Characteristic value. */
77 #define UDS_GENDER_VAL_LEN_MAX 2 /**< Maximum length of Gender Characteristic value. */
78 #define UDS_DB_CHANGE_INCR_VAL_LEN_MAX 4 /**< Maximum length of Database Change Increment value. */
79 #define UDS_USER_INDEX_VAL_LEN_MAX 1 /**< Maximum length of User Index value. */
80 #define UDS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of User Control Point response value. */
81 #define UDS_CTRL_PT_RSP_LEN_MAX 20 /**< Maximum length of User Control Point response value. */
82 #define UDS_CTRL_PT_VAL_LEN_MAX 19 /**< Maximum length of User Control Point value. */
83 #define UDS_REGI_USER_DATA_LEN_MAX 19 /**< Maximum length of Registered User Data value. */
84 #define UDS_REGI_USER_VAL_LEN_MAX 20 /**< Maximum length of Registered User Characteristic value. */
85
86 #define UDS_ERROR_UD_ACCESS_NOT_PERMIT 0x80 /**< Error code: The user data access is not permitted. */
87 #define UDS_ERROR_PROC_IN_PROGRESS 0xFE /**< Error code: A previously triggered User Control Point operation is still in progress. */
88 #define UDS_ERROR_CCCD_INVALID 0xFD /**< Error code: The Client Characteristic Configuration descriptor is not configured. */
89
90 #define UDS_DB_CHANGE_INCR_DEFAULT_VAL 0x00 /**< Database Change Increment default value. */
91 #define UDS_UNKNOWN_USER 0xFF /**< Unknown User. */
92 #define UDS_CONSENT_CODE_VAL_MAX 0x270F /**< Maximum value of Consent Code. */
93 #define UDS_CONSENT_TRY_NUM_MAX 0x04 /**< Maximum number of consent tries. */
94
95 #define UDS_MIDDLE_REGI_USER_SEGM 0x00 /**< The middle segment of Registered User Characterristic value. */
96 #define UDS_FIRST_REGI_USER_SEGM 0x01 /**< The first segment of Registered User Characterristic value. */
97 #define UDS_LAST_REGI_USER_SEGM 0x02 /**< The last segment of Registered User Characterristic value. */
98 #define UDS_ONLY_REGI_USER_SEGM 0x03 /**< The only segment of Registered User Characterristic value. */
99
100 #define UDS_MEAS_FLAG_DEFAULT 0x3E /**< The default flag of UDS MEAS */
101
102 /**
103 * @defgroup UDS_CHAR_MASK Characteristics Mask
104 * @{
105 * @brief Bit masks for the initialization of \ref uds_init_t.char_mask.
106 */
107 #define UDS_CHAR_MANDATORY 0x000001FF /**< Bit mask for mandatory characteristic in UDS. */
108 #define UDS_CHAR_AGE_SUP 0x00000600 /**< Bit mask for Age characteristic that is optional. */
109 #define UDS_CHAR_DATE_OF_BIRTH_SUP 0x00001800 /**< Bit mask for date of birth characteristic that is optional. */
110 #define UDS_CHAR_FIRST_NAME_SUP 0x00006000 /**< Bit mask for first name characteristic that is optional. */
111 #define UDS_CHAR_HEIGHT_SUP 0x00018000 /**< Bit mask for height characteristic that is optional. */
112 #define UDS_CHAR_GENDER_SUP 0x00060000 /**< Bit mask for gender characteristic that is optional. */
113 #define UDS_CHAR_REGIST_USER_SUP 0x00380000 /**< Bit mask for Registered User characteristic that is optional. */
114 #define UDS_CHAR_FULL 0x003FFFFF /**< Bit mask of the full characteristic. */
115 /** @} */
116 /** @} */
117
118 /**
119 * @defgroup UDS_ENUM Enumerations
120 * @{
121 */
122 /**@brief User Data Service Control Point Operation Code.*/
123 typedef enum
124 {
125 UDS_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */
126 UDS_CTRL_PT_OP_REGIST_NEW_USER, /**< Register New User Operation Code.*/
127 UDS_CTRL_PT_OP_CONSENT, /**< Consent Operation Code.*/
128 UDS_CTRL_PT_OP_DEL_USER_DATA, /**< Delete User Data Operation Code.*/
129 UDS_CTRL_PT_OP_LIST_ALL_USERS, /**< List All Users Operation Code.*/
130 UDS_CTRL_PT_OP_DEL_USERS, /**< Delete User(s) Operation code. */
131 UDS_CTRL_PT_OP_RSP_CODE = 0x20, /**< Response code. */
132 } uds_ctrl_pt_op_code_t;
133
134 /**@brief User Data Service Control Point Response value.*/
135 typedef enum
136 {
137 UDS_CTRL_PT_RSP_RESERVED, /**< Reserved value. */
138 UDS_CTRL_PT_RSP_SUCCESS, /**< Operation Success. */
139 UDS_CTRL_PT_RSP_NOT_SUP, /**< Operation Code Not Supported. */
140 UDS_CTRL_PT_RSP_INVALID_PARAM, /**< Invalid Parameter. */
141 UDS_CTRL_PT_RSP_FAILED, /**< Operation Failed. */
142 UDS_CTRL_PT_RSP_USER_NOT_AUTH, /**< User Not Authorized. */
143 } uds_ctrl_pt_rsp_t;
144
145 /**@brief User Data Service event type. */
146 typedef enum
147 {
148 UDS_EVT_INVALID = 0x00, /**< Invalid event. */
149 UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE, /**< Database Change Increment Notification is enabled. */
150 UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_DISABLE, /**< Database Change Increment Notification is disabled. */
151 UDS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that User Control Point indication has been enabled. */
152 UDS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that User Control Point indication has been disabled. */
153 UDS_EVT_REGIST_USER_INDICATION_ENABLE, /**< Indicate that Registered User indication has been enabled. */
154 UDS_EVT_REGIST_USER_INDICATION_DISABLE, /**< Indicate that Registered User indication has been disabled. */
155 UDS_EVT_DB_CHANGE_INCR_SEND_CPLT, /**< Indicate that Database Change Increment has been notified. */
156 UDS_EVT_CTRL_POINT_RSP_CPLT, /**< Indicate that User Control Point response has been indicated. */
157 UDS_EVT_REGIST_USER_RSP_CPLT, /**< Indicate that Registered User response has been indicated. */
158 UDS_EVT_AGE_SET_BY_PEER, /**< Age has been set by peer. */
159 UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER, /**< Date of Birth has been set by peer. */
160 UDS_EVT_FIRST_NAME_SET_BY_PEER, /**< First Name has been set by peer. */
161 UDS_EVT_HEIGHT_SET_BY_PEER, /**< Height has been set by peer. */
162 UDS_EVT_GENDER_SET_BY_PEER, /**< Gender has been set by peer. */
163 UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER, /**< Database Change Increment has been set by peer. */
164 UDS_EVT_CTRL_POINT_SET_BY_PEER, /**< User Control Point has been set by peer. */
165 UDS_EVT_USER_GRANT_ACCESS, /**< Indicate that User is waiting to be granted access. */
166 UDS_EVT_REGIST_NEW_USER, /**< Indicate that User is waiting to be granted access. */
167 UDS_EVT_DEL_USER_DATA,
168 UDS_EVT_DEL_USERS,
169 } uds_evt_type_t;
170
171 /**@brief UDS Characteristics Flags. */
172 enum uds_chars_flag_bits
173 {
174 UDS_CHARS_WEIGHT_PRESENT = 0x01, /**< Flag bit for Weight Present. */
175 UDS_CHARS_AGE_PRESENT = 0x02, /**< Flag bit for Age Present. */
176 UDS_CHARS_BIRTH_DATE_PRESENT = 0x04, /**< Flag bit for Date of Birth Present. */
177 UDS_CHARS_FIRST_NAME_PRESENT = 0x08, /**< Flag bit for First Name Present. */
178 UDS_CHARS_HEIGHT_PRESENT = 0x10, /**< Flag bit for Height Present. */
179 UDS_CHARS_GENDER_PRESENT = 0X20, /**< Flag bit for Gender Present. */
180 };
181
182 /**@brief Registered User Data Flags. */
183 enum uds_regi_user_data_flag_bits
184 {
185 UDS_REGI_USER_NAME_PRESENT = 0x01, /**< Flag bit for Registered User Name Present. */
186 UDS_USER_NAME_TRUNCATED = 0x02, /**< Flag bit for User Name is truncated. */
187 };
188 /** @} */
189
190 /**
191 * @defgroup UDS_STRUCT Structures
192 * @{
193 */
194 /**@brief UDS Characteristic - birthdate's structure. */
195 typedef struct
196 {
197 uint16_t year; /**< year time element of birth date. */
198 uint8_t month; /**< month time element of birth date. */
199 uint8_t day; /**< day time element of birth date. */
200 } birth_date_t;
201
202 /**@brief UDS Characteristics Flags structure. */
203 typedef struct
204 {
205 uint8_t weight_present :1; /**< Weight Present. */
206 uint8_t age_present :1; /**< Age Present. */
207 uint8_t birth_date_present :1; /**< Date of Birth Present. */
208 uint8_t first_name_present :1; /**< First Name Present. */
209 uint8_t height_present :1; /**< Height Present. */
210 uint8_t gender_present :1; /**< Gender Present. */
211 } uds_chars_flag_t;
212
213 /**@brief UDS Characteristics value structure. */
214 typedef struct
215 {
216 uint16_t weight; /**< User's weight. */
217 uint8_t age; /**< User's age. */
218 birth_date_t date_of_birth; /**< User's birth date. */
219 uint16_t height; /**< User's height. */
220 uint8_t gender; /**< User's gender. */
221 uint8_t *p_first_name; /**< User's first name. */
222 uint16_t name_length; /**< Length of User's first name. */
223 } uds_chars_val_t;
224
225 /**@brief Registered User Data Flags structure. */
226 typedef struct
227 {
228 uint8_t regi_user_name_present :1; /**< Registered User Name Present. */
229 uint8_t user_name_truncated :1; /**< User Name is truncated. */
230 uint8_t reserved :6; /**< Reserved for Future Use. */
231 } uds_regi_user_data_flag_t;
232
233 /**@brief User Data Service event. */
234 typedef struct
235 {
236 uint8_t conn_idx; /**< The index of the connection. */
237 uds_evt_type_t evt_type; /**< The UDS event type. */
238 const uint8_t *p_data; /**< Pointer to event data. */
239 uint16_t length; /**< Length of event data. */
240 uint16_t consent_code; /**< Consent Code data. */
241 uds_chars_val_t uds_chars_val; /**< UDS Characteristics value set by peer. */
242 uint32_t db_change_incr_val; /**< Database Change Increment value set by peer. */
243 } uds_evt_t;
244 /** @} */
245
246 /**
247 * @defgroup UDS_TYPEDEF Typedefs
248 * @{
249 */
250 /**@brief User Data Service event handler type. */
251 typedef void (*uds_evt_handler_t)(uds_evt_t *p_evt);
252 /** @} */
253
254 /**
255 * @defgroup UDS_STRUCT Structures
256 * @{
257 */
258 /**@brief UDS Registered User Data stream. */
259 typedef struct
260 {
261 uint8_t *p_data; /**< Pointer to Registered User Data stream. */
262 uint16_t length; /**< Length of Registered User Data stream. */
263 uint16_t offset; /**< Offset of Registered User Data stream. */
264 uint16_t *p_segm_length; /**< Pointer to each segmentation length of Registered User Data stream. */
265 uint16_t segm_num; /**< Registered User Data segmentations' number. */
266 uint16_t segm_offset; /**< Offset of Registered User Data segmentations' number. */
267 } uds_regi_user_data_stream_t;
268
269 /**@brief User Data Service init structure. This contains all option and data needed for initialization of the service. */
270 typedef struct
271 {
272 uds_evt_handler_t evt_handler; /**< User Data Service event handler. */
273 uint32_t char_mask; /**< Initialize the mask of supported characteristics, and configured with \ref UDS_CHAR_MASK. */
274 uint8_t user_index; /**< Initialize the user index. */
275 uint8_t db_change_incr_val; /**< Initialize the Database Change Increment value. */
276 uds_regi_user_data_flag_t uds_regi_user_data_flag; /**< Initialize the Registered User Data Flags structure. */
277 uds_chars_flag_t uds_chars_flag; /**< Initialize the UDS Characteristics Flags structure. */
278 } uds_init_t;
279 /** @} */
280
281 /**
282 * @defgroup UDS_FUNCTION Functions
283 * @{
284 */
285 /**
286 *****************************************************************************************
287 * @brief Initialize a User Data Service instance and add in the DB.
288 *
289 * @param[in] p_uds_init: Pointer to UDS Service initialization variable.
290 *
291 * @return Result of service initialization.
292 *****************************************************************************************
293 */
294 sdk_err_t uds_service_init(uds_init_t *p_uds_init);
295
296 /**
297 *****************************************************************************************
298 * @brief Send Registered User Characteristic value.
299 *
300 * @param[in] conn_idx: Connnection index.
301 *
302 * @return Result of sending Registered User Characteristic value.
303 *****************************************************************************************
304 */
305 sdk_err_t uds_regi_user_val_send(uint8_t conn_idx);
306
307 /**
308 *****************************************************************************************
309 * @brief Send Database Change Increment Characteristic value if UDS Characteristics value has been changed.
310 *
311 * @param[in] conn_idx: Connnection index.
312 * @param[in] user_idx: Current user index.
313 *
314 * @return Result of sending Database Change Increment Characteristic value.
315 *****************************************************************************************
316 */
317 sdk_err_t uds_db_change_incr_val_send(uint8_t conn_idx, uint8_t user_idx);
318
319 /**
320 *****************************************************************************************
321 * @brief Send User Control Point response if it's indication has been enabled.
322 *
323 * @param[in] conn_idx: Connnection index.
324 * @param[in] p_data: Pointer to data.
325 * @param[in] length: Length of data.
326 *
327 * @return Result of indicate value.
328 *****************************************************************************************
329 */
330 sdk_err_t uds_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
331
332 /**
333 *****************************************************************************************
334 * @brief Get current user index.
335 *
336 * @param[in] conn_idx: Connnection index.
337 *
338 * @return Result of current user index.
339 *****************************************************************************************
340 */
341 uint8_t uds_get_cur_user_index(uint8_t conn_idx);
342
343 /**
344 *****************************************************************************************
345 * @brief Set current user index.
346 *
347 * @param[in] conn_idx: Connnection index.
348 * @param[in] user_index: current user index.
349 *****************************************************************************************
350 */
351 void uds_set_cur_user_index(uint8_t conn_idx, uint8_t user_index);
352
353 #if defined(PTS_AUTO_TEST)
354 void uds_regist_new_user(uint8_t conn_idx);
355 #endif
356
357 /** @} */
358
359 #endif
360 /** @} */
361 /** @} */
362
UDS_CHARS_WEIGHT_PRESENT
@ UDS_CHARS_WEIGHT_PRESENT
Flag bit for Weight Present.
Definition: uds.h:174
UDS_EVT_CTRL_POINT_INDICATION_DISABLE
@ UDS_EVT_CTRL_POINT_INDICATION_DISABLE
Indicate that User Control Point indication has been disabled.
Definition: uds.h:152
UDS_CTRL_PT_RSP_RESERVED
@ UDS_CTRL_PT_RSP_RESERVED
Reserved value.
Definition: uds.h:137
uds_evt_t::length
uint16_t length
Length of event data.
Definition: uds.h:239
UDS_EVT_REGIST_NEW_USER
@ UDS_EVT_REGIST_NEW_USER
Indicate that User is waiting to be granted access.
Definition: uds.h:166
uds_chars_val_t::age
uint8_t age
User's age.
Definition: uds.h:217
uds_chars_val_t::height
uint16_t height
User's height.
Definition: uds.h:219
uds_evt_t::uds_chars_val
uds_chars_val_t uds_chars_val
UDS Characteristics value set by peer.
Definition: uds.h:241
UDS_CTRL_PT_RSP_INVALID_PARAM
@ UDS_CTRL_PT_RSP_INVALID_PARAM
Invalid Parameter.
Definition: uds.h:140
UDS_EVT_GENDER_SET_BY_PEER
@ UDS_EVT_GENDER_SET_BY_PEER
Gender has been set by peer.
Definition: uds.h:162
UDS_CTRL_PT_OP_REGIST_NEW_USER
@ UDS_CTRL_PT_OP_REGIST_NEW_USER
Register New User Operation Code.
Definition: uds.h:126
uds_init_t::user_index
uint8_t user_index
Initialize the user index.
Definition: uds.h:274
UDS_EVT_HEIGHT_SET_BY_PEER
@ UDS_EVT_HEIGHT_SET_BY_PEER
Height has been set by peer.
Definition: uds.h:161
UDS_CTRL_PT_OP_RSP_CODE
@ UDS_CTRL_PT_OP_RSP_CODE
Response code.
Definition: uds.h:131
uds_init_t::char_mask
uint32_t char_mask
Initialize the mask of supported characteristics, and configured with Characteristics Mask.
Definition: uds.h:273
uds_chars_flag_t::gender_present
uint8_t gender_present
Gender Present.
Definition: uds.h:210
uds_chars_flag_t::weight_present
uint8_t weight_present
Weight Present.
Definition: uds.h:205
UDS_CHARS_HEIGHT_PRESENT
@ UDS_CHARS_HEIGHT_PRESENT
Flag bit for Height Present.
Definition: uds.h:178
uds_regi_user_data_flag_t::regi_user_name_present
uint8_t regi_user_name_present
Registered User Name Present.
Definition: uds.h:228
gr_includes.h
Include Files API.
uds_regi_user_data_flag_t::user_name_truncated
uint8_t user_name_truncated
User Name is truncated.
Definition: uds.h:229
uds_chars_val_t::p_first_name
uint8_t * p_first_name
User's first name.
Definition: uds.h:221
UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_DISABLE
@ UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_DISABLE
Database Change Increment Notification is disabled.
Definition: uds.h:150
UDS_EVT_CTRL_POINT_INDICATION_ENABLE
@ UDS_EVT_CTRL_POINT_INDICATION_ENABLE
Indicate that User Control Point indication has been enabled.
Definition: uds.h:151
uds_chars_val_t::gender
uint8_t gender
User's gender.
Definition: uds.h:220
uds_chars_flag_t
UDS Characteristics Flags structure.
Definition: uds.h:204
uds_init_t::db_change_incr_val
uint8_t db_change_incr_val
Initialize the Database Change Increment value.
Definition: uds.h:275
uds_init_t::uds_regi_user_data_flag
uds_regi_user_data_flag_t uds_regi_user_data_flag
Initialize the Registered User Data Flags structure.
Definition: uds.h:276
uds_get_cur_user_index
uint8_t uds_get_cur_user_index(uint8_t conn_idx)
Get current user index.
UDS_CTRL_PT_RSP_SUCCESS
@ UDS_CTRL_PT_RSP_SUCCESS
Operation Success.
Definition: uds.h:138
uds_regi_user_data_stream_t::length
uint16_t length
Length of Registered User Data stream.
Definition: uds.h:262
uds_chars_flag_t::first_name_present
uint8_t first_name_present
First Name Present.
Definition: uds.h:208
UDS_CTRL_PT_OP_LIST_ALL_USERS
@ UDS_CTRL_PT_OP_LIST_ALL_USERS
List All Users Operation Code.
Definition: uds.h:129
uds_evt_t::conn_idx
uint8_t conn_idx
The index of the connection.
Definition: uds.h:236
UDS_CTRL_PT_OP_DEL_USERS
@ UDS_CTRL_PT_OP_DEL_USERS
Delete User(s) Operation code.
Definition: uds.h:130
UDS_EVT_DB_CHANGE_INCR_SEND_CPLT
@ UDS_EVT_DB_CHANGE_INCR_SEND_CPLT
Indicate that Database Change Increment has been notified.
Definition: uds.h:155
UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER
@ UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER
Date of Birth has been set by peer.
Definition: uds.h:159
uds_regi_user_data_stream_t
UDS Registered User Data stream.
Definition: uds.h:260
uds_regi_user_data_stream_t::segm_offset
uint16_t segm_offset
Offset of Registered User Data segmentations' number.
Definition: uds.h:266
uds_ctrl_pt_rsp_send
sdk_err_t uds_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Send User Control Point response if it's indication has been enabled.
uds_regi_user_data_stream_t::offset
uint16_t offset
Offset of Registered User Data stream.
Definition: uds.h:263
UDS_EVT_REGIST_USER_INDICATION_DISABLE
@ UDS_EVT_REGIST_USER_INDICATION_DISABLE
Indicate that Registered User indication has been disabled.
Definition: uds.h:154
uds_regi_user_data_flag_bits
uds_regi_user_data_flag_bits
Registered User Data Flags.
Definition: uds.h:184
uds_evt_handler_t
void(* uds_evt_handler_t)(uds_evt_t *p_evt)
User Data Service event handler type.
Definition: uds.h:251
uds_evt_t::p_data
const uint8_t * p_data
Pointer to event data.
Definition: uds.h:238
UDS_CTRL_PT_OP_DEL_USER_DATA
@ UDS_CTRL_PT_OP_DEL_USER_DATA
Delete User Data Operation Code.
Definition: uds.h:128
UDS_EVT_DEL_USERS
@ UDS_EVT_DEL_USERS
Definition: uds.h:168
UDS_CHARS_FIRST_NAME_PRESENT
@ UDS_CHARS_FIRST_NAME_PRESENT
Flag bit for First Name Present.
Definition: uds.h:177
UDS_CHARS_AGE_PRESENT
@ UDS_CHARS_AGE_PRESENT
Flag bit for Age Present.
Definition: uds.h:175
UDS_CTRL_PT_RSP_NOT_SUP
@ UDS_CTRL_PT_RSP_NOT_SUP
Operation Code Not Supported.
Definition: uds.h:139
uds_evt_type_t
uds_evt_type_t
User Data Service event type.
Definition: uds.h:147
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:274
UDS_CTRL_PT_RSP_FAILED
@ UDS_CTRL_PT_RSP_FAILED
Operation Failed.
Definition: uds.h:141
uds_regi_user_data_flag_t::reserved
uint8_t reserved
Reserved for Future Use.
Definition: uds.h:230
uds_evt_t::db_change_incr_val
uint32_t db_change_incr_val
Database Change Increment value set by peer.
Definition: uds.h:242
UDS_CHARS_BIRTH_DATE_PRESENT
@ UDS_CHARS_BIRTH_DATE_PRESENT
Flag bit for Date of Birth Present.
Definition: uds.h:176
uds_db_change_incr_val_send
sdk_err_t uds_db_change_incr_val_send(uint8_t conn_idx, uint8_t user_idx)
Send Database Change Increment Characteristic value if UDS Characteristics value has been changed.
UDS_EVT_REGIST_USER_RSP_CPLT
@ UDS_EVT_REGIST_USER_RSP_CPLT
Indicate that Registered User response has been indicated.
Definition: uds.h:157
uds_chars_val_t::name_length
uint16_t name_length
Length of User's first name.
Definition: uds.h:222
birth_date_t::year
uint16_t year
year time element of birth date.
Definition: uds.h:197
uds_chars_val_t::weight
uint16_t weight
User's weight.
Definition: uds.h:216
uds_evt_t::evt_type
uds_evt_type_t evt_type
The UDS event type.
Definition: uds.h:237
UDS_EVT_USER_GRANT_ACCESS
@ UDS_EVT_USER_GRANT_ACCESS
Indicate that User is waiting to be granted access.
Definition: uds.h:165
uds_regi_user_data_stream_t::p_data
uint8_t * p_data
Pointer to Registered User Data stream.
Definition: uds.h:261
UDS_EVT_DEL_USER_DATA
@ UDS_EVT_DEL_USER_DATA
Definition: uds.h:167
uds_chars_flag_t::age_present
uint8_t age_present
Age Present.
Definition: uds.h:206
uds_init_t::uds_chars_flag
uds_chars_flag_t uds_chars_flag
Initialize the UDS Characteristics Flags structure.
Definition: uds.h:277
UDS_CHARS_GENDER_PRESENT
@ UDS_CHARS_GENDER_PRESENT
Flag bit for Gender Present.
Definition: uds.h:179
UDS_EVT_AGE_SET_BY_PEER
@ UDS_EVT_AGE_SET_BY_PEER
Age has been set by peer.
Definition: uds.h:158
uds_regi_user_data_stream_t::segm_num
uint16_t segm_num
Registered User Data segmentations' number.
Definition: uds.h:265
uds_chars_val_t::date_of_birth
birth_date_t date_of_birth
User's birth date.
Definition: uds.h:218
UDS_EVT_REGIST_USER_INDICATION_ENABLE
@ UDS_EVT_REGIST_USER_INDICATION_ENABLE
Indicate that Registered User indication has been enabled.
Definition: uds.h:153
uds_service_init
sdk_err_t uds_service_init(uds_init_t *p_uds_init)
Initialize a User Data Service instance and add in the DB.
UDS_CTRL_PT_OP_CONSENT
@ UDS_CTRL_PT_OP_CONSENT
Consent Operation Code.
Definition: uds.h:127
UDS_EVT_FIRST_NAME_SET_BY_PEER
@ UDS_EVT_FIRST_NAME_SET_BY_PEER
First Name has been set by peer.
Definition: uds.h:160
uds_chars_flag_bits
uds_chars_flag_bits
UDS Characteristics Flags.
Definition: uds.h:173
UDS_EVT_CTRL_POINT_RSP_CPLT
@ UDS_EVT_CTRL_POINT_RSP_CPLT
Indicate that User Control Point response has been indicated.
Definition: uds.h:156
UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER
@ UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER
Database Change Increment has been set by peer.
Definition: uds.h:163
UDS_EVT_CTRL_POINT_SET_BY_PEER
@ UDS_EVT_CTRL_POINT_SET_BY_PEER
User Control Point has been set by peer.
Definition: uds.h:164
ble_prf_utils.h
Profile/Service Utilities API.
uds_evt_t
User Data Service event.
Definition: uds.h:235
UDS_CTRL_PT_OP_RESERVED
@ UDS_CTRL_PT_OP_RESERVED
Reserved for future use.
Definition: uds.h:125
uds_regi_user_val_send
sdk_err_t uds_regi_user_val_send(uint8_t conn_idx)
Send Registered User Characteristic value.
uds_chars_flag_t::height_present
uint8_t height_present
Height Present.
Definition: uds.h:209
UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE
@ UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE
Database Change Increment Notification is enabled.
Definition: uds.h:149
UDS_CTRL_PT_RSP_USER_NOT_AUTH
@ UDS_CTRL_PT_RSP_USER_NOT_AUTH
User Not Authorized.
Definition: uds.h:142
birth_date_t::day
uint8_t day
day time element of birth date.
Definition: uds.h:199
birth_date_t::month
uint8_t month
month time element of birth date.
Definition: uds.h:198
uds_evt_t::consent_code
uint16_t consent_code
Consent Code data.
Definition: uds.h:240
uds_ctrl_pt_op_code_t
uds_ctrl_pt_op_code_t
User Data Service Control Point Operation Code.
Definition: uds.h:124
uds_ctrl_pt_rsp_t
uds_ctrl_pt_rsp_t
User Data Service Control Point Response value.
Definition: uds.h:136
uds_init_t::evt_handler
uds_evt_handler_t evt_handler
User Data Service event handler.
Definition: uds.h:272
birth_date_t
UDS Characteristic - birthdate's structure.
Definition: uds.h:196
uds_regi_user_data_flag_t
Registered User Data Flags structure.
Definition: uds.h:227
UDS_REGI_USER_NAME_PRESENT
@ UDS_REGI_USER_NAME_PRESENT
Flag bit for Registered User Name Present.
Definition: uds.h:185
uds_regi_user_data_stream_t::p_segm_length
uint16_t * p_segm_length
Pointer to each segmentation length of Registered User Data stream.
Definition: uds.h:264
UDS_USER_NAME_TRUNCATED
@ UDS_USER_NAME_TRUNCATED
Flag bit for User Name is truncated.
Definition: uds.h:186
uds_chars_flag_t::birth_date_present
uint8_t birth_date_present
Date of Birth Present.
Definition: uds.h:207
uds_chars_val_t
UDS Characteristics value structure.
Definition: uds.h:215
uds_set_cur_user_index
void uds_set_cur_user_index(uint8_t conn_idx, uint8_t user_index)
Set current user index.
uds_init_t
User Data Service init structure.
Definition: uds.h:271
UDS_EVT_INVALID
@ UDS_EVT_INVALID
Invalid event.
Definition: uds.h:148