用户数据服务
用户数据服务用于在体育健身、家庭或医疗环境中展示用户相关数据。这允许客户端远程访问和更新用户数据,以及服务器和客户端之间用户数据的同步。
示例
API 参考
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.
- 参数
out_val – [in] The pointer to store the Database Change Increment.
- 返回
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.
- 参数
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.
- 返回
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.
- 参数
out_val – [in] The pointer to store the User Control value.
- 返回
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.
- 参数
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.
- 返回
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.
- 参数
out_val – [in] The pointer to store the Register User value.
- 返回
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.
- 参数
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.
- 返回
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.
- 返回
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.
-
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
-
uint8_t first_segment
-
struct esp_ble_uds_user_ctrl_t
User Control Point.
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_CONSENT_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