uds.h File Reference

User Data Service API. More...

#include "gr_includes.h"
#include "custom_config.h"
#include "ble_prf_utils.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  birth_date_t
 UDS Characteristic - birthdate's structure. More...
 
struct  uds_chars_flag_t
 UDS Characteristics Flags structure. More...
 
struct  uds_chars_val_t
 UDS Characteristics value structure. More...
 
struct  uds_regi_user_data_flag_t
 Registered User Data Flags structure. More...
 
struct  uds_evt_t
 User Data Service event. More...
 
struct  uds_regi_user_data_stream_t
 UDS Registered User Data stream. More...
 
struct  uds_init_t
 User Data Service init structure. This contains all option and data needed for initialization of the service. More...
 

Macros

#define UDS_CONNECTION_MAX   10
 
#define UDS_AGE_VAL_LEN_MAX   2
 
#define UDS_DATE_OF_BIRTH_VAL_LEN_MAX   4
 
#define UDS_FIRST_NAME_VAL_LEN_MAX   50
 
#define UDS_HEIGHT_VAL_LEN_MAX   2
 
#define UDS_GENDER_VAL_LEN_MAX   2
 
#define UDS_DB_CHANGE_INCR_VAL_LEN_MAX   4
 
#define UDS_USER_INDEX_VAL_LEN_MAX   1
 
#define UDS_CTRL_PT_RSP_LEN_MIN   3
 
#define UDS_CTRL_PT_RSP_LEN_MAX   20
 
#define UDS_CTRL_PT_VAL_LEN_MAX   19
 
#define UDS_REGI_USER_DATA_LEN_MAX   19
 
#define UDS_REGI_USER_VAL_LEN_MAX   20
 
#define UDS_ERROR_UD_ACCESS_NOT_PERMIT   0x80
 
#define UDS_ERROR_PROC_IN_PROGRESS   0xFE
 
#define UDS_ERROR_CCCD_INVALID   0xFD
 
#define UDS_DB_CHANGE_INCR_DEFAULT_VAL   0x00
 
#define UDS_UNKNOWN_USER   0xFF
 
#define UDS_CONSENT_CODE_VAL_MAX   0x270F
 
#define UDS_CONSENT_TRY_NUM_MAX   0x04
 
#define UDS_MIDDLE_REGI_USER_SEGM   0x00
 
#define UDS_FIRST_REGI_USER_SEGM   0x01
 
#define UDS_LAST_REGI_USER_SEGM   0x02
 
#define UDS_ONLY_REGI_USER_SEGM   0x03
 
#define UDS_MEAS_FLAG_DEFAULT   0x3E
 
#define UDS_CHAR_MANDATORY   0x000001FF
 
#define UDS_CHAR_AGE_SUP   0x00000600
 
#define UDS_CHAR_DATE_OF_BIRTH_SUP   0x00001800
 
#define UDS_CHAR_FIRST_NAME_SUP   0x00006000
 
#define UDS_CHAR_HEIGHT_SUP   0x00018000
 
#define UDS_CHAR_GENDER_SUP   0x00060000
 
#define UDS_CHAR_REGIST_USER_SUP   0x00380000
 
#define UDS_CHAR_FULL   0x003FFFFF
 

Typedefs

typedef void(* uds_evt_handler_t) (uds_evt_t *p_evt)
 User Data Service event handler type. More...
 

Enumerations

enum  uds_ctrl_pt_op_code_t {
  UDS_CTRL_PT_OP_RESERVED,
  UDS_CTRL_PT_OP_REGIST_NEW_USER,
  UDS_CTRL_PT_OP_CONSENT,
  UDS_CTRL_PT_OP_DEL_USER_DATA,
  UDS_CTRL_PT_OP_LIST_ALL_USERS,
  UDS_CTRL_PT_OP_DEL_USERS,
  UDS_CTRL_PT_OP_RSP_CODE = 0x20
}
 User Data Service Control Point Operation Code. More...
 
enum  uds_ctrl_pt_rsp_t {
  UDS_CTRL_PT_RSP_RESERVED,
  UDS_CTRL_PT_RSP_SUCCESS,
  UDS_CTRL_PT_RSP_NOT_SUP,
  UDS_CTRL_PT_RSP_INVALID_PARAM,
  UDS_CTRL_PT_RSP_FAILED,
  UDS_CTRL_PT_RSP_USER_NOT_AUTH
}
 User Data Service Control Point Response value. More...
 
enum  uds_evt_type_t {
  UDS_EVT_INVALID = 0x00,
  UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE,
  UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_DISABLE,
  UDS_EVT_CTRL_POINT_INDICATION_ENABLE,
  UDS_EVT_CTRL_POINT_INDICATION_DISABLE,
  UDS_EVT_REGIST_USER_INDICATION_ENABLE,
  UDS_EVT_REGIST_USER_INDICATION_DISABLE,
  UDS_EVT_DB_CHANGE_INCR_SEND_CPLT,
  UDS_EVT_CTRL_POINT_RSP_CPLT,
  UDS_EVT_REGIST_USER_RSP_CPLT,
  UDS_EVT_AGE_SET_BY_PEER,
  UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER,
  UDS_EVT_FIRST_NAME_SET_BY_PEER,
  UDS_EVT_HEIGHT_SET_BY_PEER,
  UDS_EVT_GENDER_SET_BY_PEER,
  UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER,
  UDS_EVT_CTRL_POINT_SET_BY_PEER,
  UDS_EVT_USER_GRANT_ACCESS,
  UDS_EVT_REGIST_NEW_USER,
  UDS_EVT_DEL_USER_DATA,
  UDS_EVT_DEL_USERS
}
 User Data Service event type. More...
 
enum  uds_chars_flag_bits {
  UDS_CHARS_WEIGHT_PRESENT = 0x01,
  UDS_CHARS_AGE_PRESENT = 0x02,
  UDS_CHARS_BIRTH_DATE_PRESENT = 0x04,
  UDS_CHARS_FIRST_NAME_PRESENT = 0x08,
  UDS_CHARS_HEIGHT_PRESENT = 0x10,
  UDS_CHARS_GENDER_PRESENT = 0X20
}
 UDS Characteristics Flags. More...
 
enum  uds_regi_user_data_flag_bits {
  UDS_REGI_USER_NAME_PRESENT = 0x01,
  UDS_USER_NAME_TRUNCATED = 0x02
}
 Registered User Data Flags. More...
 

Functions

sdk_err_t uds_service_init (uds_init_t *p_uds_init)
 Initialize a User Data Service instance and add in the DB. More...
 
sdk_err_t uds_regi_user_val_send (uint8_t conn_idx)
 Send Registered User Characteristic value. More...
 
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. More...
 
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. More...
 
uint8_t uds_get_cur_user_index (uint8_t conn_idx)
 Get current user index. More...
 
void uds_set_cur_user_index (uint8_t conn_idx, uint8_t user_index)
 Set current user index. More...
 

Detailed Description

User Data Service API.

Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file uds.h.