SmartSnippets DA1459x SDK
Files | Data Structures | Enumerations | Functions
Weight Scale Service

Weight scale service sample implementation API. More...

Files

file  wss.h
 Weight Scale Service sample implementation API.
 

Data Structures

struct  wss_callbacks_t
 WSS application callbacks. More...
 
struct  wss_weight_measurement_t
 WSS weight measurement data. More...
 

Enumerations

enum  wss_unit_t { WSS_UNIT_SI, WSS_UNIT_IMPERIAL }
 WSS unit types. More...
 
enum  wss_feature_t {
  WSS_FEAT_TIME_STAMP_SUPPORTED = 0x0001, WSS_FEAT_MULTI_USER_SUPPORTED = 0x0002, WSS_FEAT_BMI_SUPPORTED = 0x0004, WSS_FEAT_WT_DISPLAY_500G_ACC = 0x0008,
  WSS_FEAT_WT_DISPLAY_200G_ACC = 0x0010, WSS_FEAT_WT_DISPLAY_100G_ACC = 0x0018, WSS_FEAT_WT_DISPLAY_50G_ACC = 0x0020, WSS_FEAT_WT_DISPLAY_20G_ACC = 0x0028,
  WSS_FEAT_WT_DISPLAY_10G_ACC = 0x0030, WSS_FEAT_WT_DISPLAY_5G_ACC = 0x0038, WSS_FEAT_HT_DISPLAY_10MM_ACC = 0x0080, WSS_FEAT_HT_DISPLAY_5MM_ACC = 0x0100,
  WSS_FEAT_HT_DISPLAY_1MM_ACC = 0x0180
}
 Weight Feature characteristic bit values. More...
 

Functions

ble_service_twss_init (const ble_service_config_t *config, wss_feature_t features, const wss_callbacks_t *cb)
 Register Weight Scale Service instance. More...
 
ble_error_t wss_indicate_weight (ble_service_t *svc, uint16_t conn_idx, const wss_weight_measurement_t *measurement)
 Send weight indication to client. More...
 
void wss_indicate_weight_all (ble_service_t *svc, const wss_weight_measurement_t *measurement)
 Send weight indication to all interested clients. More...
 
bool wss_is_indication_enabled (ble_service_t *svc, uint16_t conn_idx)
 Check if indication is enabled. More...
 

Detailed Description

Weight scale service sample implementation API.

Enumeration Type Documentation

◆ wss_feature_t

Weight Feature characteristic bit values.

Enumerator
WSS_FEAT_TIME_STAMP_SUPPORTED 

Time Stamp

WSS_FEAT_MULTI_USER_SUPPORTED 

Multiple Users

WSS_FEAT_BMI_SUPPORTED 

BMI supported

WSS_FEAT_WT_DISPLAY_500G_ACC 

Resolution of 0.5kg or 1lb

WSS_FEAT_WT_DISPLAY_200G_ACC 

Resolution of 0.2kg or 0.5lb

WSS_FEAT_WT_DISPLAY_100G_ACC 

Resolution of 0.1kg or 0.2lb

WSS_FEAT_WT_DISPLAY_50G_ACC 

Resolution of 0.05kg or 0.1lb

WSS_FEAT_WT_DISPLAY_20G_ACC 

Resolution of 0.02kg or 0.05lb

WSS_FEAT_WT_DISPLAY_10G_ACC 

Resolution of 0.01kg or 0.02lb

WSS_FEAT_WT_DISPLAY_5G_ACC 

Resolution of 0.005kg or 0.01lb

WSS_FEAT_HT_DISPLAY_10MM_ACC 

Resolution of 0.01m or 1in

WSS_FEAT_HT_DISPLAY_5MM_ACC 

Resolution of 0.005m or 0.5in

WSS_FEAT_HT_DISPLAY_1MM_ACC 

Resolution of 0.001m or 0.1in

◆ wss_unit_t

enum wss_unit_t

WSS unit types.

Enumerator
WSS_UNIT_SI 

Weight and mass in kilograms and height in meters

WSS_UNIT_IMPERIAL 

Weight and mass in pounds and height in inches

Function Documentation

◆ wss_indicate_weight()

ble_error_t wss_indicate_weight ( ble_service_t svc,
uint16_t  conn_idx,
const wss_weight_measurement_t measurement 
)

Send weight indication to client.

Function sends indication to selected client.

Parameters
[in]svcservice instance
[in]conn_idxconnection index to sent indication to
[in]measurementcharacteristic value to send
Returns
0 (BLE_STATUS_OK) if indication was sent successfully, ble_error_t if error occured

◆ wss_indicate_weight_all()

void wss_indicate_weight_all ( ble_service_t svc,
const wss_weight_measurement_t measurement 
)

Send weight indication to all interested clients.

Parameters
[in]svcservice instance
[in]measurementcharacteristic value to send
Returns
service instance

◆ wss_init()

ble_service_t* wss_init ( const ble_service_config_t config,
wss_feature_t  features,
const wss_callbacks_t cb 
)

Register Weight Scale Service instance.

Function registers Weight Scale Service with give set of features.

Parameters
[in]configservice configuration
[in]featuresbit mask of supported features
[in]cbapplication callbacks
Returns
service instance

◆ wss_is_indication_enabled()

bool wss_is_indication_enabled ( ble_service_t svc,
uint16_t  conn_idx 
)

Check if indication is enabled.

Parameters
[in]svcservice instance
[in]conn_idxconnection index to sent indication to
Returns
true if indication is enabled, false otherwise