Bluetooth LE Profile API document
Bluetooth LE Profile API document Rev.1.00 [May 22, 2020]
Weight Scale Service Client

This is the client for the Weight Scale Service. More...

Detailed Description

This is the client for the Weight Scale Service.

Data Structures

struct  st_ble_wsc_evt_data_t
 Weight Scale Service Client event data. More...
 
struct  st_ble_wsc_hdls_t
 Weight Scale Service attribute handles. More...
 
struct  st_ble_wsc_init_param_t
 Weight Scale Service initialization parameters. More...
 
struct  st_ble_wsc_connect_param_t
 Weight Scale Service Client connection parameters. More...
 
struct  st_ble_wsc_disconnect_param_t
 Weight Scale Service disconnection parameters. More...
 
struct  st_ble_wsc_weight_scale_feature_t
 Weight Scale Feature characteristic parameters. More...
 
struct  st_ble_wsc_weight_measurement_t
 Weight Measurement characteristic parameters. More...
 

Macros

#define BLE_WSC_WEIGHT_SCALE_FEATURE_LEN   (4)
 Weight Scale Feature characteristic value length. More...
 
#define BLE_WSC_WEIGHT_MEASUREMENT_LEN   (20)
 Weight Measurement characteristic value length. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_TIME_STAMP_SUPPORTED   (1 << 0)
 Time Stamp Supported bit. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_MULTIPLE_USERS_SUPPORTED   (1 << 1)
 Multiple Users Supported bit. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_BMI_SUPPORTED   (1 << 2)
 BMI Supported bit. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_WEIGHT_MEASUREMENT_RESOLUTION   (((1 << 4) - 1) << 3)
 Weight Measurement Resolution bits. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_HEIGHT_MEASUREMENT_RESOLUTION   (((1 << 3) - 1) << 7)
 Height Measurement Resolution bits. More...
 
#define BLE_WSC_WEIGHT_SCALE_FEATURE_RESERVED_FOR_FUTURE_USE   (((1 << 22) - 1) << 10)
 Reserved for future use bits. More...
 
#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_MEASUREMENT_UNITS   (1 << 0)
 Measurement Units bit. More...
 
#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_TIME_STAMP_PRESENT   (1 << 1)
 Time stamp present bit. More...
 
#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_USER_ID_PRESENT   (1 << 2)
 User ID present bit. More...
 
#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_BMI_AND_HEIGHT_PRESENT   (1 << 3)
 BMI and Height present bit. More...
 

Typedefs

typedef void(* ble_wsc_app_cb_t) (uint16_t type, ble_status_t result, st_ble_wsc_evt_data_t *p_data)
 Weight Scale Service Client event callback. More...
 

Enumerations

enum  e_ble_wsc_event_t {
  BLE_WSC_EVENT_WEIGHT_SCALE_FEATURE_READ_RSP,
  BLE_WSC_EVENT_WEIGHT_MEASUREMENT_HDL_VAL_IND,
  BLE_WSC_EVENT_CLI_CNFG_WRITE_RSP,
  BLE_WSC_EVENT_ERROR_RSP
}
 Weight Scale Service Client event type. More...
 
enum  e_ble_wsc_weight_measurement_t { BLE_WSC_WEIGHT_MEASUREMENT_USER_ID_UNKNOWN_USER = 255 }
 User ID enumeration. More...
 

Functions

ble_status_t R_BLE_WSC_Init (const st_ble_wsc_init_param_t *p_param)
 Initialize Weight Scale Service Client. More...
 
ble_status_t R_BLE_WSC_Connect (uint16_t conn_hdl, const st_ble_wsc_connect_param_t *p_param)
 Perform Weight Scale Service Client connection settings. More...
 
ble_status_t R_BLE_WSC_Disconnect (uint16_t conn_hdl, st_ble_wsc_disconnect_param_t *p_param)
 Retrieve Weight Scale Service Client connection specific settings before disconnection. More...
 
ble_status_t R_BLE_WSC_ReadWeightScaleFeature (uint16_t conn_hdl)
 Read Weight Scale Feature characteristic value from remote GATT database. More...
 
ble_status_t R_BLE_WSC_SetWeightMeasurementCliCnfg (uint16_t conn_hdl, uint16_t cli_cnfg)
 Set Weight Measurement characteristic cli cnfg. More...
 
void R_BLE_WSC_ServDiscCb (uint16_t conn_hdl, uint8_t idx, uint16_t type, void *p_param)
 Callback function for the Weight Scale Discovery events. More...
 
uint32_t R_BLE_WSC_GetVersion (void)
 Return version of the WSC service client. More...
 

Variables

const uint8_t BLE_WSC_UUID [BLE_GATT_16_BIT_UUID_SIZE]
 Weight Scale Service UUID. More...
 
const uint8_t BLE_WSC_WEIGHT_SCALE_FEATURE_UUID [BLE_GATT_16_BIT_UUID_SIZE]
 Weight Scale Feature characteristic UUID. More...
 
const uint8_t BLE_WSC_WEIGHT_MEASUREMENT_UUID [BLE_GATT_16_BIT_UUID_SIZE]
 Weight Measurement characteristic UUID. More...
 

Macro Definition Documentation

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_LEN

#define BLE_WSC_WEIGHT_SCALE_FEATURE_LEN   (4)

Weight Scale Feature characteristic value length.

◆ BLE_WSC_WEIGHT_MEASUREMENT_LEN

#define BLE_WSC_WEIGHT_MEASUREMENT_LEN   (20)

Weight Measurement characteristic value length.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_TIME_STAMP_SUPPORTED

#define BLE_WSC_WEIGHT_SCALE_FEATURE_TIME_STAMP_SUPPORTED   (1 << 0)

Time Stamp Supported bit.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_MULTIPLE_USERS_SUPPORTED

#define BLE_WSC_WEIGHT_SCALE_FEATURE_MULTIPLE_USERS_SUPPORTED   (1 << 1)

Multiple Users Supported bit.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_BMI_SUPPORTED

#define BLE_WSC_WEIGHT_SCALE_FEATURE_BMI_SUPPORTED   (1 << 2)

BMI Supported bit.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_WEIGHT_MEASUREMENT_RESOLUTION

#define BLE_WSC_WEIGHT_SCALE_FEATURE_WEIGHT_MEASUREMENT_RESOLUTION   (((1 << 4) - 1) << 3)

Weight Measurement Resolution bits.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_HEIGHT_MEASUREMENT_RESOLUTION

#define BLE_WSC_WEIGHT_SCALE_FEATURE_HEIGHT_MEASUREMENT_RESOLUTION   (((1 << 3) - 1) << 7)

Height Measurement Resolution bits.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_RESERVED_FOR_FUTURE_USE

#define BLE_WSC_WEIGHT_SCALE_FEATURE_RESERVED_FOR_FUTURE_USE   (((1 << 22) - 1) << 10)

Reserved for future use bits.

◆ BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_MEASUREMENT_UNITS

#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_MEASUREMENT_UNITS   (1 << 0)

Measurement Units bit.

◆ BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_TIME_STAMP_PRESENT

#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_TIME_STAMP_PRESENT   (1 << 1)

Time stamp present bit.

◆ BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_USER_ID_PRESENT

#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_USER_ID_PRESENT   (1 << 2)

User ID present bit.

◆ BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_BMI_AND_HEIGHT_PRESENT

#define BLE_WSC_WEIGHT_MEASUREMENT_FLAGS_BMI_AND_HEIGHT_PRESENT   (1 << 3)

BMI and Height present bit.

Typedef Documentation

◆ ble_wsc_app_cb_t

typedef void(* ble_wsc_app_cb_t) (uint16_t type, ble_status_t result, st_ble_wsc_evt_data_t *p_data)

Weight Scale Service Client event callback.

Enumeration Type Documentation

◆ e_ble_wsc_event_t

Weight Scale Service Client event type.

Enumerator
BLE_WSC_EVENT_WEIGHT_SCALE_FEATURE_READ_RSP 

Weight Scale Feature characteristic read response event

BLE_WSC_EVENT_WEIGHT_MEASUREMENT_HDL_VAL_IND 

Weight Measurement characteristic handle value indication event

BLE_WSC_EVENT_CLI_CNFG_WRITE_RSP 

Cli Cnfig write response

BLE_WSC_EVENT_ERROR_RSP 

error response

◆ e_ble_wsc_weight_measurement_t

User ID enumeration.

Enumerator
BLE_WSC_WEIGHT_MEASUREMENT_USER_ID_UNKNOWN_USER 

Unknown User

Function Documentation

◆ R_BLE_WSC_Init()

ble_status_t R_BLE_WSC_Init ( const st_ble_wsc_init_param_t p_param)

Initialize Weight Scale Service Client.

This function shall be called once at startup.

Parameters
[in]p_paramPointer to Weight Scale Service Client initialization parameters.
Returns
ble_status_t

◆ R_BLE_WSC_Connect()

ble_status_t R_BLE_WSC_Connect ( uint16_t  conn_hdl,
const st_ble_wsc_connect_param_t p_param 
)

Perform Weight Scale Service Client connection settings.

This function shall be called on each connection establishment.

Parameters
[in]conn_hdlConnection handle.
[in]p_paramPointer to Connection parameters.
Returns
ble_status_t

◆ R_BLE_WSC_Disconnect()

ble_status_t R_BLE_WSC_Disconnect ( uint16_t  conn_hdl,
st_ble_wsc_disconnect_param_t p_param 
)

Retrieve Weight Scale Service Client connection specific settings before disconnection.

This function shall be called on each disconnection.

Parameters
[in]conn_hdlConnection handle.
[in]p_paramPointer to Disconnection parameters.
Returns
ble_status_t

◆ R_BLE_WSC_ReadWeightScaleFeature()

ble_status_t R_BLE_WSC_ReadWeightScaleFeature ( uint16_t  conn_hdl)

Read Weight Scale Feature characteristic value from remote GATT database.

Parameters
[in]conn_hdlConnection handle.
Returns
ble_status_t

◆ R_BLE_WSC_SetWeightMeasurementCliCnfg()

ble_status_t R_BLE_WSC_SetWeightMeasurementCliCnfg ( uint16_t  conn_hdl,
uint16_t  cli_cnfg 
)

Set Weight Measurement characteristic cli cnfg.

Parameters
[in]conn_hdlConnection handle.
[in]cli_cnfgWeight Measurement characteristic cli cnfg to set.
Returns
ble_status_t

◆ R_BLE_WSC_ServDiscCb()

void R_BLE_WSC_ServDiscCb ( uint16_t  conn_hdl,
uint8_t  idx,
uint16_t  type,
void *  p_param 
)

Callback function for the Weight Scale Discovery events.

Parameters
[in]conn_hdlConnection handle.
[in]idxService index used to distiguish the multiple same UUID service.
[in]typeDiscovery event type
[out]p_paramPointer to GATTC event data.
Returns
none

◆ R_BLE_WSC_GetVersion()

uint32_t R_BLE_WSC_GetVersion ( void  )

Return version of the WSC service client.

Returns
version

Variable Documentation

◆ BLE_WSC_UUID

const uint8_t BLE_WSC_UUID[BLE_GATT_16_BIT_UUID_SIZE]

Weight Scale Service UUID.

◆ BLE_WSC_WEIGHT_SCALE_FEATURE_UUID

const uint8_t BLE_WSC_WEIGHT_SCALE_FEATURE_UUID[BLE_GATT_16_BIT_UUID_SIZE]

Weight Scale Feature characteristic UUID.

◆ BLE_WSC_WEIGHT_MEASUREMENT_UUID

const uint8_t BLE_WSC_WEIGHT_MEASUREMENT_UUID[BLE_GATT_16_BIT_UUID_SIZE]

Weight Measurement characteristic UUID.