User Data Service

[中文]

The User Data Service (UDS) exposes user-related data in a sports and fitness, home, or healthcare environment. This allows remote access and update of user data by a client as well as the synchronization of user data between a server and a client.

Examples

bluetooth/ble_services/ble_uds.

API Reference

Header File

Functions

esp_err_t esp_ble_uds_get_db_incre(esp_ble_uds_db_t *out_val)

Read the value of Database Change Increment characteristic.

Parameters

out_val[in] The pointer to store the Database Change Increment.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong parameter

esp_err_t esp_ble_uds_set_db_incre(esp_ble_uds_db_t *in_val, bool need_send)

Set the Database Change Increment characteristic value.

Parameters
  • in_val[in] The pointer to store the Database Change Increment Information.

  • need_send[in] If set to true, the User Data Info will send to remote client.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_uds_get_user_ctrl(esp_ble_uds_user_ctrl_t *out_val)

Read the value of User Control characteristic.

Parameters

out_val[in] The pointer to store the User Control value.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong parameter

esp_err_t esp_ble_uds_set_user_ctrl(esp_ble_uds_user_ctrl_t *in_val, bool need_send)

Set the User Control Point characteristic value.

Parameters
  • in_val[in] The pointer to store the User Control Value.

  • need_send[in] If set to true, the User Control Value will send to remote client.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_uds_get_reg_user(esp_ble_uds_reg_user_t *out_val)

Read the value of Register User characteristic.

Parameters

out_val[in] The pointer to store the Register User value.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong parameter

esp_err_t esp_ble_uds_set_reg_user(esp_ble_uds_reg_user_t *in_val, bool need_send)

Set the Register User characteristic value.

Parameters
  • in_val[in] The pointer to store the Register User Value.

  • need_send[in] If set to true, the Register User Value will send to remote client.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_uds_init(void)

Initialization User Data Service.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

Structures

struct esp_ble_uds_db_t

Database Change Increment.

Public Members

uint8_t len

Database buffer length

uint8_t db_buf[BLE_UDS_ATT_VAL_LEN]

Database buffer

struct esp_ble_uds_reg_user_t

Register User Characteristic.

Public Members

uint8_t first_segment

0: False, 1: True

uint8_t last_segment

0: False, 1: True

uint8_t rolling_segment_number

When the Rolling segment number is equal to 63, the value is reset to 0 the next time it is incremented

struct esp_ble_uds_reg_user_t::[anonymous] header

The structure of the Segmentation Header field

uint8_t user_name_present

0: False, 1: True

uint8_t user_name_truncated

0: False, 1: True

struct esp_ble_uds_reg_user_t::[anonymous] flag

Defines the value of the flags field that a server shall use when the register user characteristic is indicate

uint8_t user_index

User ID Index

uint8_t user_name[BLE_UDS_ATT_VAL_LEN]

User name

struct esp_ble_uds_user_ctrl_t

User Control Point.

Public Members

uint8_t op_code

User control point opcode

uint8_t param_len

Parameter buffer length

uint8_t parameter[BLE_UDS_USER_CTRL_POINT_PARAM_LEN]

Parameter depend on opcode

Macros

BLE_UDS_ATT_VAL_LEN

Attribute value length

BLE_UDS_USER_CTRL_POINT_PARAM_LEN

User control point param length

BLE_UDS_UUID16
BLE_UDS_CHR_UUID16_DATABASH_CHG
BLE_UDS_CHR_UUID16_USER_INDEX
BLE_UDS_CHR_UUID16_USER_CTRL
BLE_UDS_CHR_UUID16_REG_USER
BLE_UDS_USER_CTRL_REG_NEW_OP
BLE_UDS_USER_CTRL_DEL_DATA_OP
BLE_UDS_USER_CTRL_LIST_ALL_OP
BLE_UDS_USER_CTRL_DEL_USER_OP
BLE_UDS_USER_CTRL_RSP_OP