体重秤服务

[English]

体重秤服务用于从健康和体育健身的体重秤中获取体重相关数据。

示例

bluetooth/ble_services/ble_wss.

API 参考

Header File

Functions

esp_err_t esp_ble_wss_get_measurement(esp_ble_wss_measurement_t *out_val)

Read the weight measurement characteristic value.

参数

out_val[in] The pointer to store the weight measurement value.

返回

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong parameter

esp_err_t esp_ble_wss_set_measurement(esp_ble_wss_measurement_t *in_val, bool need_send)

Set the weight measurement characteristic value.

参数
  • in_val[in] The pointer to store the weight measurement.

  • need_send[in] send the weight measurement information to remote client.

返回

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_wss_init(void)

Initialization Weight Scale Service.

返回

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

Structures

struct esp_ble_wss_feature_t

Weight Scale Feature.

Public Members

uint32_t timestamp

0: Don’t Support, 1: Support

uint32_t user_id

0: Don’t Support, 1: Support

uint32_t bmi

0: Don’t Support, 1: Support

uint32_t weight

0: Don’t Support, 1: Support

uint32_t w_resolution

If weight support, this filed should present

uint32_t height

0: Don’t Support, 1: Support

uint32_t h_resolution

If height support, this filed should present

struct esp_ble_wss_measurement_t

weight Measurement

Public Members

uint32_t measurement_unit

0: Kg & meter, 1: reference to weight and height resolution

uint32_t time_present

0: Don’t contain time information, 1: time stamp present

uint32_t user_present

0: Don’t contain user index, 1: contain user index

uint32_t bmi_height_present

0: Don’t contain BMI and height, 1: contain BMI and height

struct esp_ble_wss_measurement_t::[anonymous] flag

Flag

uint16_t weight

weight

uint16_t year

Year as defined by the Gregorian calendar, Valid range 1582 to 9999

uint8_t month

Month of the year as defined by the Gregorian calendar, Valid range 1 (January) to 12 (December)

uint8_t day

Day of the month as defined by the Gregorian calendar, Valid range 1 to 31

uint8_t hours

Number of hours past midnight, Valid range 0 to 23

uint8_t minutes

Number of minutes since the start of the hour. Valid range 0 to 59

uint8_t seconds

Number of seconds since the start of the minute. Valid range 0 to 59

struct esp_ble_wss_measurement_t::[anonymous] timestamp

The date and time

uint8_t user_id

User index

uint8_t bmi

BMI

uint16_t height

Height

uint8_t weight_resolution

Weight resolution

uint8_t height_resolution

Height resolution

Macros

BLE_WSS_UUID16
BLE_WSS_CHR_UUID16_WEIGHT_FEATURE
BLE_WSS_CHR_UUID16_WEIGHT_MEASUREMENT
BLE_WSS_TIMESTAMP_MASK
BLE_WSS_MULTI_USER_MASK
BLE_WSS_BMI_MASK
BLE_WSS_WEIGHT_RESOLUTION_OFSET
BLE_WSS_WEIGHT_RESOLUTION_NONE
BLE_WSS_WEIGHT_RESOLUTION_0P5_KG
BLE_WSS_WEIGHT_RESOLUTION_0P2_KG
BLE_WSS_WEIGHT_RESOLUTION_0P1_KG
BLE_WSS_WEIGHT_RESOLUTION_0P05_KG
BLE_WSS_WEIGHT_RESOLUTION_0P02_KG
BLE_WSS_WEIGHT_RESOLUTION_0P01_KG
BLE_WSS_WEIGHT_RESOLUTION_0P005_KG
BLE_WSS_HEIGHT_RESOLUTION_OFSET
BLE_WSS_HEIGHT_RESOLUTION_NONE
BLE_WSS_HEIGHT_RESOLUTION_0P01_M
BLE_WSS_HEIGHT_RESOLUTION_0P005_M
BLE_WSS_HEIGHT_RESOLUTION_0P001_M
BLE_WSS_MEASUREMENT_UINTS_FLAG
BLE_WSS_TIME_STAMP_FLAG
BLE_WSS_USER_ID_FLAG
BLE_WSS_BMI_FLAG