Dialog Semiconductor DA14681 User Manual

User Manual
DA14681 Wearable Development
Kit API
UM-B-085
Abstract
This document describes the API specifications of software modules of the application running on the Dialog DA14681 Wearable Development Kit. This manual intends to assist software developers who implement applications using the DA14681 Wearable Development Kit.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
2 of 330
Contents
Abstract ................................................................................................................................................ 1
Contents ............................................................................................................................................... 2
Figures .................................................................................................................................................. 6
Tables ................................................................................................................................................... 7
1 Terms and Definitions ................................................................................................................... 7
2 References ..................................................................................................................................... 9
3 Introduction.................................................................................................................................. 10
4 Software Architecture Overview ................................................................................................ 10
5 Wearable Task ............................................................................................................................. 12
5.1 BLE...................................................................................................................................... 12
5.1.1 CTS ...................................................................................................................... 12
5.1.1.1 Functions ......................................................................................... 13
5.1.2 DWS ..................................................................................................................... 13
5.1.2.1 Functions ......................................................................................... 14
5.1.3 HCS ..................................................................................................................... 15
5.1.3.1 Functions ......................................................................................... 16
SUOTA................................................................................................................. 17
5.1.4 17
5.1.4.1 Functions ......................................................................................... 18
5.2 Interface .............................................................................................................................. 18
5.2.1 Touch Pad ........................................................................................................... 18
5.2.1.1 Data Structures and Types .............................................................. 18
5.2.1.2 Functions ......................................................................................... 19
5.2.1.3 Callback Functions .......................................................................... 19
5.2.2 Push Button ......................................................................................................... 19
5.2.2.1 Data Structures and Types .............................................................. 20
5.2.2.2 Functions ......................................................................................... 20
5.2.2.3 Callback Functions .......................................................................... 20
5.3 System ................................................................................................................................ 20
5.3.1 Application Data Storage in NVM ........................................................................ 20
5.3.1.1 Data Structures and Types .............................................................. 21
5.3.1.2 Functions ......................................................................................... 22
5.3.2 Battery.................................................................................................................. 25
5.3.2.1 Functions ......................................................................................... 25
5.3.3 Clock manager ..................................................................................................... 25
5.3.3.1 Functions ......................................................................................... 26
Real Time Clock .................................................................................................. 26
5.3.4 26
5.3.4.1 Data Structures and Types .............................................................. 26
5.3.4.2 Functions ......................................................................................... 27
5.3.4.3 Callback Functions .......................................................................... 27
5.4 Wearable Health Toolbox Control ....................................................................................... 27
5.4.1 Data Structures and Types .................................................................................. 28
5.4.2 Functions ............................................................................................................. 31
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
3 of 330
6 BLE Services ............................................................................................................................... 35
6.1 Dialog Wearable Service..................................................................................................... 35
6.1.1 DWS Data Structures and Types ........................................................................ 35
6.1.2 IoT Data Structures and Types ............................................................................ 36
6.1.3 Functions ............................................................................................................. 42
6.1.4 Callback Functions .............................................................................................. 43
6.2 Health Care Service ............................................................................................................ 44
6.2.1 Data Structures and Types .................................................................................. 44
6.2.2 Functions ............................................................................................................. 48
6.2.3 Callback Functions .............................................................................................. 50
6.3 SUOTA Service ................................................................................................................... 52
6.4 Current Time Service .......................................................................................................... 52
6.5 Heart Rate Service .............................................................................................................. 52
6.6 Battery Service .................................................................................................................... 52
7 User Interface .............................................................................................................................. 53
7.1 UI Task ................................................................................................................................ 53
7.1.1 Data Structures and Types .................................................................................. 54
7.1.2 Functions ............................................................................................................. 56
7.1.2.2 Callbacks ......................................................................................... 60
7.2 GUI ...................................................................................................................................... 60
7.2.1 GDI ....................................................................................................................... 60
7.2.1.1 Data Structures and Types .............................................................. 60
7.2.1.2 Functions ......................................................................................... 62
7.2.2 Widgets ................................................................................................................ 65
7.2.2.1 Data Structures and Types .............................................................. 66
7.2.2.2 Battery Widget Functions ................................................................ 68
7.2.2.3 Circle Progress Bar Functions ......................................................... 68
7.2.2.4 Common Functions.......................................................................... 69
7.2.2.5 Image Functions .............................................................................. 69
7.2.2.6 Screen Functions ............................................................................. 70
7.2.2.7 Static Label Functions ..................................................................... 71
7.2.2.8 Status Bar Functions ....................................................................... 71
7.2.2.9 Text Box Functions .......................................................................... 72
8 Health Toolbox ............................................................................................................................ 72
8.1 Health Toolbox Task ........................................................................................................... 74
8.1.1 Data Structures and Types .................................................................................. 76
8.1.2 Dependency Functions ........................................................................................ 87
8.1.3 Initialization and Control Functions ...................................................................... 90
8.1.3.2 Configuration Functions ................................................................... 92
8.1.3.3 State Functions ................................................................................ 96
8.1.3.4 Data Acquisition Functions ............................................................ 101
8.1.3.5 Data-Reset Functions .................................................................... 104
8.2 Health Toolbox Implementations ...................................................................................... 105
8.2.2 Inertial Sensors HT-Implementation – API Specification ................................... 106
8.2.2.1 Data Structures and Types ............................................................ 106
8.2.2.2 Dependency Functions .................................................................. 112
8.2.2.3 Functions ....................................................................................... 112
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
4 of 330
8.2.3 Environmental Sensors HT-Implementation – API Specification ...................... 117
8.2.3.1 Data Structures and Types ............................................................ 118
8.2.3.2 Dependency Functions .................................................................. 123
8.2.3.3 Functions ....................................................................................... 123
8.2.4 Health Care Sensors HT-Implementation – API Specification .......................... 129
8.2.4.1 Data Structures and Types ............................................................ 130
8.2.4.2 Dependency Functions .................................................................. 134
8.2.4.3 Functions ....................................................................................... 134
8.2.5 Sensor Fusion Service HT-Implementation – API Specification ....................... 139
8.2.5.1 Data Structures and Types ............................................................ 140
8.2.5.2 Dependency Functions .................................................................. 142
8.2.5.3 Functions ....................................................................................... 142
8.2.6 Heart Rate Estimation Service HT-Implementation – API Specification ........... 144
8.2.6.1 Data Structures and Types ............................................................ 144
8.2.6.2 Dependency Functions .................................................................. 146
8.2.6.3 Functions ....................................................................................... 146
8.2.7 Step Counting Service HT-Implementation – API Specification ........................ 149
8.2.7.1 Data Structures and Types ............................................................ 150
8.2.7.2 Dependency Functions .................................................................. 151
8.2.7.3 Functions ....................................................................................... 151
8.2.8 Calories Counting Service HT-Implementation – API Specification .................. 154
8.2.8.1 Data Structures and Types ............................................................ 155
8.2.8.2 Dependency Functions .................................................................. 157
8.2.8.3 Functions ....................................................................................... 157
8.2.9 Sleep Quality Monitoring Service HT-Implementation – API Specification ....... 159
8.2.9.1 Data Structures and Types ............................................................ 160
8.2.9.2 Dependency Functions .................................................................. 162
8.2.9.3 Functions ....................................................................................... 162
8.3 Timer Component ............................................................................................................. 165
8.3.1 Data Structures and Types ................................................................................ 166
8.3.2 Dependency Functions ...................................................................................... 167
8.3.3 Functions ........................................................................................................... 167
8.4 Sensor Control Component .............................................................................................. 170
8.4.1 Data Structures and Types ................................................................................ 171
8.4.2 Dependency Functions ...................................................................................... 180
8.4.3 Functions ........................................................................................................... 181
8.5 Health Care Services Task ............................................................................................... 191
8.5.1 Data Structures and Types ................................................................................ 192
8.5.2 Dependency Functions ...................................................................................... 200
8.5.3 Initialization and Control Functions .................................................................... 202
8.5.4 Configuration Functions ..................................................................................... 204
8.5.5 State Functions .................................................................................................. 205
8.5.6 Data Acquisition Functions ................................................................................ 206
8.5.7 Data Push Functions ......................................................................................... 207
8.6 KIWI Services Task ........................................................................................................... 210
8.6.1 Data Structures and Types ................................................................................ 211
8.6.2 Dependency Functions ...................................................................................... 218
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
5 of 330
8.6.3 Initialization and Control Functions .................................................................... 221
8.6.4 Configuration Functions ..................................................................................... 222
8.6.5 State Functions .................................................................................................. 223
8.6.6 Data Acquisition Functions ................................................................................ 225
8.6.7 Data Reset Functions ........................................................................................ 226
8.6.8 Data Push Functions ......................................................................................... 226
9 Health Toolbox Libraries .......................................................................................................... 228
9.1 Heart Rate Estimation Library ........................................................................................... 228
9.1.1 Initialization Functions ....................................................................................... 229
9.1.2 Main Process Functions .................................................................................... 229
9.1.3 Configuration Functions ..................................................................................... 229
9.2 Sleep Quality Monitoring Library ....................................................................................... 230
9.2.1 Data Structures and Types ................................................................................ 230
9.2.2 Dependency Functions ...................................................................................... 232
9.2.3 Initialization and Basic Configuration Functions ................................................ 233
9.2.4 Main Process Functions .................................................................................... 234
9.2.5 Service Data Acquisition Functions ................................................................... 234
9.2.6 State Functions .................................................................................................. 235
9.3 Calories Counting Library.................................................................................................. 235
9.3.1 Data Structures and Types ................................................................................ 236
9.3.2 Dependency Functions ...................................................................................... 238
9.3.3 Initialization and Basic Configuration Functions ................................................ 239
9.3.4 Main Process Functions .................................................................................... 239
9.3.5 Service Data Acquisition Functions ................................................................... 240
9.3.6 Command Functions .......................................................................................... 240
9.3.7 State Functions .................................................................................................. 240
9.4 KIWI Basic Activity Tracking ............................................................................................. 241
10 Peripheral Device Drivers ......................................................................................................... 244
10.1.1 BMI160 Sensor Driver ....................................................................................... 245
10.1.1.1 Data Structures and Types ............................................................ 248
10.1.1.2 Dependency Functions .................................................................. 248
10.1.1.3 Initialization and Basic Configuration Functions ............................ 249
10.1.1.4 Sensor Data Acquisition Functions ................................................ 250
10.1.1.5 Command Functions...................................................................... 252
10.1.1.6 State Functions .............................................................................. 253
10.1.1.7 Configuration Functions ................................................................. 256
10.1.1.8 Low Level Register Access Functions ........................................... 277
10.1.1.9 Magnetometer Control and Configuration Functions (Indirect
Access) .......................................................................................... 278
10.1.2 BMM150 Sensor Driver ..................................................................................... 280
10.1.2.1 Data Structures and Types ............................................................ 281
10.1.2.2 Dependency Functions .................................................................. 282
10.1.2.3 Initialization and Basic Configuration Functions ............................ 282
10.1.2.4 Sensor Data Acquisition Functions ................................................ 283
10.1.2.5 Command Functions...................................................................... 284
10.1.2.6 State Functions .............................................................................. 284
10.1.2.7 Configuration Functions ................................................................. 285
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
6 of 330
10.1.2.8 Low Level Register Access Functions ........................................... 289
10.1.3 BME280 Sensor Driver ...................................................................................... 290
10.1.3.1 Data Structures and Types ............................................................ 291
10.1.3.2 Dependency Functions .................................................................. 291
10.1.3.3 Initialization and Basic Configuration Functions ............................ 292
10.1.3.4 Sensor Data Acquisition Functions ................................................ 292
10.1.3.5 Command Functions...................................................................... 293
10.1.3.6 State Functions .............................................................................. 293
10.1.3.7 Configuration Functions ................................................................. 294
10.1.3.8 Low Level Register Access Functions ........................................... 296
10.1.4 DI5115 Sensor Driver ........................................................................................ 297
10.1.4.1 Data Structures and Types ............................................................ 298
10.1.4.2 Dependency Functions .................................................................. 299
10.1.4.3 Initialization and Basic Configuration Functions ............................ 300
10.1.4.4 Sensor Data Acquisition Functions ................................................ 301
10.1.4.5 Command Functions...................................................................... 301
10.1.4.6 Configuration Functions ................................................................. 301
10.1.5 SX9300 Sensor Driver ....................................................................................... 302
10.1.5.1 Data Structures and Types ............................................................ 302
10.1.5.2 Functions ....................................................................................... 306
10.1.5.3 Dependency Functions .................................................................. 308
10.1.6 AB08X5 Real Time Clock Driver ....................................................................... 310
10.1.6.1 Data Structures and Types ............................................................ 310
10.1.6.2 Functions ....................................................................................... 312
10.1.7 LS013B7DH03 Display Driver ........................................................................... 318
10.1.7.1 Functions ....................................................................................... 319
10.1.7.2 Callback Functions ........................................................................ 319
10.1.8 FXL6408 GPIO Expander Driver ....................................................................... 320
10.1.8.1 Data Structures and Types ............................................................ 321
10.1.8.2 Dependency Functions .................................................................. 322
10.1.8.3 Initialization and Basic Configuration Functions ............................ 323
10.1.8.4 Command Functions...................................................................... 324
10.1.8.5 State Functions .............................................................................. 324
10.1.8.6 Configuration Functions ................................................................. 325
10.1.8.7 Low Level Register Access Functions ........................................... 328
Revision History .............................................................................................................................. 329
Figures
Figure 1: The Wearable Development Kit ........................................................................................... 10
Figure 2: Software Architecture ........................................................................................................... 11
Figure 3: Main Application Components ............................................................................................. 12
Figure 4: UI Task Block Diagram ........................................................................................................ 53
Figure 5: Health Toolbox Component Software Architecture .............................................................. 73
Figure 6: Peripheral Device Driver Architecture ................................................................................ 244
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
7 of 330
Tables
Table 1: Wearable CTS API ................................................................................................................ 12
Table 2: Wearable DWS API ............................................................................................................... 13
Table 3: Wearable HCS API ................................................................................................................ 15
Table 4: Wearable SUOTA API ........................................................................................................... 17
Table 5: Wearable touch pad API ....................................................................................................... 18
Table 6: Wearable push button API .................................................................................................... 19
Table 7: Data Storage API................................................................................................................... 20
Table 8: Wearable battery API ............................................................................................................ 25
Table 9: Wearable clock manager API ................................................................................................ 25
Table 10: Wearable RTC API .............................................................................................................. 26
Table 11: Wearable Health Toolbox Control API ................................................................................ 28
Table 12: Calibration Control Flags (byte 1) ........................................................................................ 40
Table 13: Calibration control flags (byte 2) .......................................................................................... 40
Table 14: User Interface Task API ...................................................................................................... 54
Table 15: GDI API ............................................................................................................................... 60
Table 16: Widgets API ......................................................................................................................... 65
Table 17: Basic Health Toolbox API Sensors/Services Configuration Functions ............................... 74
Table 18: Health Toolbox Task API ..................................................................................................... 75
Table 19: Inertial Sensors HT-Implementation API ........................................................................... 106
Table 20: Environmental Sensors HT-Implementation API ............................................................... 118
Table 21: Health Care Sensors HT-Implementation API .................................................................. 129
Table 22: Sensor Fusion Service HT-Implementation API ................................................................ 139
Table 23: Heart Rate Estimation Service HT-Implementation API.................................................... 144
Table 24: Step Counting Service HT-Implementation API ................................................................ 149
Table 25: Calories Counting Service HT-Implementation API .......................................................... 154
Table 26: Sleep Quality Monitoring Service HT-Implementation API ............................................... 160
Table 27: Timer Component API ....................................................................................................... 165
Table 28: Sensor Control API ............................................................................................................ 170
Table 29: Health Care Services Task API ......................................................................................... 191
Table 30: KIWI Services Task API .................................................................................................... 210
Table 31: Heart Rate Estimation Library API .................................................................................... 228
Table 32: Sleep Quality Monitoring Library API ................................................................................ 230
Table 33: Calories Counting Library API ........................................................................................... 235
Table 34: BMI160 Driver API ............................................................................................................. 245
Table 35: BMM150 Driver API ........................................................................................................... 280
Table 36: BME280 Driver API ........................................................................................................... 290
Table 37: DI5115 Driver API.............................................................................................................. 297
Table 38: SX9300 Driver API ............................................................................................................ 302
Table 39: AB08X5 Driver API ............................................................................................................ 310
Table 40: LS013B7DH03 driver API .................................................................................................. 318
Table 41: FXL6408 Driver API........................................................................................................... 320
1 Terms and Definitions
AHRS Attitude and Heading Reference System API Application Programming Interface BAS Battery Service BD Bluetooth Device (address) BLE Bluetooth low energy BMR Basal Metabolic Rate CAS Custom Alarm Service CC Constant Current (charging) CIB Connection Interface Board CV Constant Voltage (charging)
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
8 of 330
DK Development Kit DWS Dialog Wearable Service epoch time slot of a constant duration (wearables: 1 min) FW Firmware GAP Generic Access Profile GATT Generic ATTribute profile GDI Graphical Device Interface GUI Graphical User Interface HCS Health Care Service HT Health Toolbox KBSCN Keyboard Scanner MEMS Micro Electro-Mechanical Systems MTU Maximum Transmission Unit NED North East Down (coordinate system) NVDS Non-Volatile Data Storage NVMS Non Volatile Memory Storage RAM Random Access Memory REM Rapid Eye Movement Report Notification of sensor data and control RTC Real Time Clock SF Sensor Fusion SFL Sensor Fusion Library SOC State Of Charge SUOTA Software Update Over The Air UI User Interface
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
9 of 330
2 References
[1] UM-B-076_DA14681 Wearable Development Kit Software Manual. [2] UM-B-044, DA1468x Software Platform reference, User Manual, Dialog Semiconductor. [3] UM-B-056, DA1468x Software Developer's guide, User Manual, Dialog Semiconductor. [4] AN-B-003, DA14580 Software Patching over the Air (SPotA), Application Note, Dialog
Semiconductor. [5] HRS_SPEC, HEART RATE SERVICE SPECIFICATION v1.0, Bluetooth SIG. [6] CTS_SPEC, CURRENT TIME SERVICE SPECIFICATION V1.1, Bluetooth SIG. [7] BAS_SPEC, BATTERY SERVICE SPECIFICATION V1.1, Bluetooth SIG. [8] LS013B7DH03, Datasheet, Sharp Microelectronics. [9] UM-B-077, DA14681 Wearable Development Kit Hardware Manual, User Manual, Dialog
Semiconductor. [10] BMI160, Datasheet, Bosch Sensortec. [11] BMM150, Datasheet, Bosch Sensortec. [12] BME280, Datasheet, Bosch Sensortec. [13] FXL6408, Datasheet, Fairchild Semiconductor.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
10 of 330
3 Introduction
The Wearable Development Kit is a platform for development of wearables applications using Dialog's DA14681 System on Chip solution combining an application processor, memories, cryptography engine, power management unit, digital and analog peripherals and a Bluetooth® Smart MAC engine and radio transceiver.
Figure 1: The Wearable Development Kit
The purpose of this user manual is to provide a brief overview of the architecture of the reference software for Wearable Development Kit, provide the specification of the software modules and the corresponding APIs.A more detailed description of the architecture, the set of necessary hardware and software components for development on Wearable Development Kit and guidelines to install and use the reference Smartphone/Tablet apps can be found in the user manual of the DA14681 wearable development kit [1].
4 Software Architecture Overview
The software architecture of the wearable application is outlined in the following image.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
11 of 330
Figure 2: Software Architecture
The application software is organized in FreeRTOS tasks running on the top of the DA1468x SDK. All the details of DA1468x SDK can be found in [2] and [3].
The main software modules and tasks of the wearable application are the following:
WRBL Task. This is the main task of the application and is responsible for the control and the
coordination of the other application tasks and transferring data from/to the BLE Services. It is also responsible for controlling and handling events coming from the RTC, capacitive touchpads and mechanical button. Finally, it is responsible for writing/reading application and configuration data to/from the Flash memory.
Health Toolbox. The health toolbox software module consists of two tasks.
Health Toolbox task. This task is responsible for controlling and accessing the peripheral
sensors for movement and HR monitoring. Health toolbox gets commands from WRBL task regarding the configuration of sensors and health care services, it accesses sensors via the Sensor Control software component, and provides the sensor data to WRBL task and Health Care Services task. Finally it processes the output of Health Care Services task to send the required health care data to Wearable task for further manipulation (storage in Flash memory, displayed on TFT Display or transmitted over BLE via the corresponding service)
Health Care Services task. This task consists of the algorithms for health care (Sleep
Quality Monitoring, Calories Counting and Heart Rate Monitoring), sensor fusion and magneto calibration. It gets input sensor and configuration data from the Health toolbox task and sends back the output of the algorithms.
UI Task. This task is responsible for the graphical user interface of the wearable device display. It
gets commands from the WRBL task regarding the screen and the data to be displayed, the status bar information, and other graphic effects such as blinking.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
12 of 330
Functions
wrbl_cts_init()
wrbl_cts_notify_time_all()
5 Wearable Task
Figure 3: Main Application Components
The wearable main task (WRBL) handles the data transfers between other tasks (e.g. step counter data generated in the Health Toolbox task transferred to the UI task to be displayed and/or to the BLE Manager task to be sent to a peer device). At a high level it controls the data flow to/from the Health Toolbox, User Interface and BLE Manager tasks by sending the appropriate messages using the corresponding API function calls.
It controls the data stored in the SPI Flash memory with the use of the data storage functions, which provide a structured storage of the required data. Data types that are stored are the heart rate, steps, calories and sleep quality, using minimum space in Flash memory. The lower level Flash operations are performed by the SDK's NVMS adapter, which handles all necessary signaling.
5.1 BLE
Wearable task is using BLE profiles to communicate the produced data and receive commands from a connected peer device. The task - profile interaction of the following profiles, due to their complexity, are implemented in separate files andtheir API is described below.
5.1.1 CTS
Table 1: Wearable CTS API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
13 of 330
Function Name
void wrbl_cts_init(void);
Function Description
Initialize the CTS component of the wearable task
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_cts_notify_time_all(bool update_time);
Function Description
Notifies all connected peer devices of the (current) time/date.
Parameters
update_time Set true to force the update of the current time
Return Values
None
Notes
Current time is received directly by the RTC module.
Functions
wrbl_dws_init() wrbl_dws_send_cmd_report()
wrbl_dws_send_data_report()
5.1.1.1 Functions
wrbl_cts_init()
wrbl_cts_notify_time_all()
5.1.2 DWS
Table 2: Wearable DWS API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
14 of 330
Function Name
void wrbl_dws_init(void);
Function Description
Initialize the DWS component of the wearable task.
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_dws_send_data_report(iot_report_id_t type, void * const data);
Function Description
Send data reports to the connected peer device.
Parameters
type Report type data Data to be included in the report
Return Values
None
Notes
Depending on the type the following data MUST be provided:
Type
Data type
IOT_ACCELEROMETER_REPORT_ID
ht_data_acc_t
IOT_GYROSCOPE_REPORT_ID
ht_data_gyr_t
IOT_MAGNETOMETER_REPORT_ID
ht_data_mag_t
IOT_PRESSURE_REPORT_ID
ht_data_env_t
IOT_HUMIDITY_REPORT_ID
ht_data_env_t
IOT_TEMPERATURE_REPORT_ID
ht_data_env_t
IOT_SENSOR_FUSION_REPORT_ID
ht_data_sfl_t
Function Name
void wrbl_dws_send_cmd_report(iot_control_byte_t type, void * const data);
Function Description
Send data reports to the connected peer device.
Parameters
type Report type data Data to be included in the report
Return Values
None
Notes
Depending on the type the following data MUST be provided:
Type
Data type
IOT_STOP_CMD
uint8_t
IOT_START_CMD
uint8_t
IOT_GET_RUNNING_STATUS_CMD
uint8_t
IOT_BASIC_CONFIG_RD_REQ
iot_basic_setup_t
IOT_SFL_COEFF_RD_REQ
iot_sfl_coeffs_t
IOT_CAL_COEFF_RD_REQ
iot_calibr_coeffs_t
IOT_CAL_CTRL_RD_REQ
iot_calibr_ctrl_t
IOT_START_ACC_ALLIGN
uint8_t
5.1.2.1 Functions
wrbl_dws_init()
wrbl_dws_send_data_report()
wrbl_dws_send_cmd_report()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
15 of 330
Functions
wrbl_hcs_init() hcs_update_remote_db() wrbl_hcs_send_epoch() handle_hcs_msg()
handle_connected_hcs() wrbl_hcs_send_acc_counter() wrbl_hcs_send_status()
5.1.3 HCS
Table 3: Wearable HCS API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
16 of 330
Function Name
void wrbl_hcs_init(void);
Function Description
Initialize the HCS component of the wearable task.
Parameters
None
Return Values
None
Notes
Function Name
void handle_connected_hcs(void);
Function Description
Function to inform the component of the new connection.
Parameters
None
Return Values
None
Notes
Function Name
bool hcs_update_remote_db(uint16_t conn_idx, uint32_t time,
hcs_op_code_t type);
Function Description
Function to initiate a database update to the peer device when there is an update in the stored values.
Parameters
conn_idx Connection index time Time of the oldest updated sample type Type of the samples the update occurred
Return Values
True if the update was performed successfully, false if the update is scheduled to be performed when the peer device connects and synchronizes database.
Notes
Function Name
void wrbl_hcs_send_acc_counter(hcs_op_code_t op_code, uint32_t value);
Function Description
Send accumulated counter to connected peer device
Parameters
op_code Type of the accumulated counter value Value of the accumulated counter
Return Values
None
Notes
Valid types (op_codes) are: HCS_OP_CODE_STEP
HCS_OP_CODE_LIGHT_SLEEP
HCS_OP_CODE_DEEP_SLEEP
HCS_OP_CODE_CALORIES
Function Name
void wrbl_hcs_send_epoch(hcs_op_code_t op_code, uint32_t value,
uint32_t timestamp);
Function Description
Send accumulated counter to connected peer device
5.1.3.1 Functions
wrbl_hcs_init()
handle_connected_hcs()
hcs_update_remote_db()
wrbl_hcs_send_acc_counter()
wrbl_hcs_send_epoch()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
17 of 330
Parameters
op_code Type of the accumulated counter value Value of the accumulated counter timestamp Timestamp of the epoch
Return Values
None
Notes
Valid types (op_codes) are: HCS_OP_CODE_STEP
HCS_OP_CODE_HEART_RATE HCS_OP_CODE_SLEEP_QUALITY HCS_OP_CODE_CALORIES
HCS_OP_CODE_BODY_STATE
Function Name
void wrbl_hcs_send_status(hcs_op_code_t op_code, bool status);
Function Description
Send service status to connected peer device
Parameters
op_code Type of the accumulated counter status Status of the service
Return Values
None
Notes
Valid types (op_codes) are:
HCS_OP_CODE_STEP HCS_OP_CODE_HEART_RATE HCS_OP_CODE_SLEEP_QUALITY HCS_OP_CODE_CALORIES
HCS_OP_CODE_BODY_STATE
Function Name
void handle_hcs_msg(msg *wrbl_msg);
Function Description
Function handles all the HCS messages
Parameters
type Report type wrbl_msg Message to be handled
Return Values
None
Notes
Functions
wrbl_suota_init()
wrbl_hcs_send_status()
handle_hcs_msg()
5.1.4 SUOTA
Table 4: Wearable SUOTA API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
18 of 330
Function Name
void wrbl_suota_init(void);
Function Description
Initialize the SUOTA module.
Parameters
None
Return Values
None
Notes
Structures
wrbl_touch_event_t
Functions
wrbl_touch_init() handle_touch_event()
wrbl_touch_set_enable()
Callback functions
wrbl_touch_event_callback()
Type Definition Name
Description
wrbl_touch_event_t
Touch event enumeration type defined as: WRBL_TOUCH_SWIPE_RIGHT,
WRBL_TOUCH_SWIPE_UP, WRBL_TOUCH_SWIPE_LEFT,
WRBL_TOUCH_SWIPE_DOWN,
5.1.4.1 Functions
wrbl_suota_init()
5.2 Interface
The wearable device's user inputs are the push button and two touch buttons. The two touch buttons are used together to create a slide detection mechanism. Depending on what is displayed on the screen the user can set time, date and alarm, and also control various states of the sensors and services.
5.2.1 Touch Pad
Table 5: Wearable touch pad API
5.2.1.1 Data Structures and Types
wrbl_touch_event_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
19 of 330
Function Name
void wrbl_touch_init(wrbl_touch_event_callback event_cb);
Function Description
Initialize the touch module.
Parameters
event_cb Callback function to be called when a touch event is detected
Return Values
None
Notes
Function Name
void wrbl_touch_set_enable(bool enable);
Function Description
Change the operation state of the touch sensor module.
Parameters
enable Enable/disable the touch module
Return Values
None
Notes
Function Name
void handle_touch_event(void);
Function Description
Function handles the touch events of the wearable task.
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_touch_event_callback(wrbl_touch_event_t evt);
Function Description
Callback function to be called when a new event is detected.
Parameters
evt Event type
Return Values
None
Notes
Structures
btn_press_t
Functions
wrbl_button_init()
handle_button_event()
Callback functions
handle_button_callback()
5.2.1.2 Functions
wrbl_touch_init()
wrbl_touch_set_enable()
handle_touch_event()
5.2.1.3 Callback Functions
wrbl_touch_event_callback()
5.2.2 Push Button
Table 6: Wearable push button API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
20 of 330
Type Definition Name
Description
btn_press_t
Button press enumeration type defined as: BTN_SHORT_PRESS,
BTN_LONG_PRESS,
Function Name
void wrbl_button_init(handle_button_callback cb);
Function Description
Initialize button component of the wearable task.
Parameters
cb Callback function to be called when an event is produced
Return Values
None
Notes
Function Name
void handle_button_event();
Function Description
Function that handles the button notifications.
Parameters
None
Return Values
None
Notes
Function Name
void handle_button_callback(btn_press_t press);
Function Description
Callback function to be called when a new event is detected.
Parameters
press Event type
Return Values
None
Notes
Structures
ds_sample_size_t ds_err_t
ds_data_type_t
5.2.2.1 Data Structures and Types
btn_press_t
5.2.2.2 Functions
wrbl_button_init()
handle_button_event()
5.2.2.3 Callback Functions
handle_button_callback()
5.3 System
5.3.1 Application Data Storage in NVM
Data Storage is an abstraction layer that provides the functionality for storing epoch data in Flash memory using the Non-Volatile Memory Storage (NVMS) adapter of the SDK. A more detailed description of the library can be found in the user manual of the DA14681 wearable development kit
[1].
Table 7: Data Storage API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
21 of 330
Functions
data_storage_init() data_storage_stop_record() data_storage_find_epoch_addr() data_storage_update_sample() data_storage_handle_exception()
data_storage_start_record() data_storage_add_new_epoch() data_storage_get_samples() data_storage_erase_hist()
Type Definition Name
Description
ds_sample_size_t
Sample size enumeration type defined as: DS_SAMPLE_8_BIT = 2,
DS_SAMPLE_4_BIT = 3,
DS_SAMPLE_MAX = 4
Type Definition Name
Description
ds_data_type_t
Data type enumeration type defined as: DS_HEART_RATE,
DS_STEP_COUNT, DS_CALORIES_BURNED, DS_SLEEP_QUALITY,
DS_DATA_TYPE_MAX
Type Definition Name
Description
ds_err_t
Error type enumeration type defined as:
DS_ERR_OK, DS_ERR_WRITE_NOT_STARTED, DS_ERR_TIMESTAMP_NOT_FOUND, DS_ERR_DATA_FOUND,
DS_ERR_FLASH_ERROR
5.3.1.1 Data Structures and Types
ds_sample_size_t
ds_data_type_t
ds_err_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
22 of 330
Function Name
data_storage_t* data_storage_init(uint16_t heart_rate_size,
uint16_t step_size, uint16_t calories_size, uint16_t sleep_size);
Function Description
Initializes the data storage module allocating required resources and initializes the NVMS adapter.
Parameters
heart_rate_size Heart rate region size step_size Step region size calories_size Calories region size sleep_size Sleep quality region size
Return Values
Pointer to the data storage object.
Notes
This function should be called only once (at system initialization) and if flash is not erased, parameters must not change, otherwise a data corruption is to be presumed.
Function Name
ds_err_t data_storage_start_record(data_storage_t *ds, uint32_t timestamp, ds_data_type_t data_type, ds_sample_size_t sample_size, uint32_t epoch_duration);
Function Description
Creates a new chunk of data (epochs) in the data storage: finds the chronologically last chunk and updates its length field (if needed), writes a new header and frees space (if needed) by erasing or shrinking the chunks that follow it in Flash memory.
Parameters
ds Pointer of the data storage object timestamp Initial timestap (timestamp of the first epoch) data_type Data type of the epochs in the specific chunk sample_size Size in bits of each epoch (valid: 2, 4, 8, 16 and 32 bits) epoch_duration Duration of each epoch (constant for every sample in the
chunk)
Return Values
Status of the operation
Notes
Function must be called before any data can be written into flash using data_storage_add_new_epoch().
Function Name
ds_err_t data_storage_stop_record(data_storage_t *ds, ds_data_type_t data_type);
Function Description
Closes the selected record by writing out the number of epochs in the chunk in the chunk's header or erasing the chunk header completely, if no epoch has been added.
Parameters
ds Pointer of the data storage object data_type Data type of the epochs in the specific chunk
Return Values
Status of the operation
Notes
Can be called by the application at any time it is decided that no more epochs are going to be written in the foreseeable future, e.g. when a sensor is turned off.
5.3.1.2 Functions
data_storage_init()
data_storage_start_record()
data_storage_stop_record()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
23 of 330
Function Name
ds_err_t data_storage_add_new_epoch(data_storage_t *ds, ds_data_type_t data_type, uint32_t data);
Function Description
Adds a new epoch in the chunk. Checks if there is space available and if not, creates space by erasing or shrinking the next chunk.
Parameters
ds Pointer of the data storage object data_type Data type of the epochs in the specific chunk data Value of the epoch
Return Values
Status of the operation. Function fails when there is no open record.
Notes
Function Name
ds_err_t data_storage_find_epoch_addr(data_storage_t *ds, ds_data_type_t data_type, uint32_t req_timestamp,
hcs_data_chunk_header_t *header, uint32_t *address);
Function Description
Takes a time reference (timestamp) and finds an epoch from that point onwards. Returns a calculated header with the number of epochs from the specific epoch to the chunk end.
Parameters
ds Pointer of the data storage object data_type Data type of the epoch req_timestamp Timestamp to search for header Pointer to be filled with calculated header address Pointer to be filled with address of the first epoch
Return Values
Status if an epoch with the provided parameters was found or not.
Notes
Function Name
uint16_t data_storage_get_samples(data_storage_t *ds, uint8_t *data, hcs_data_chunk_header_t *header, uint32_t address, uint16 cnt);
Function Description
Copies the referenced epochs from the specific address to the provided buffer. Uses the header for integrity checks and size calculations.
Parameters
ds Pointer of the data storage object data Pointer to put the epochs read from flash header Header of the chunk (as calculated by
data_storage_add_new_epoch()) address Address of the epoch (as calculated by
data_storage_add_new_epoch()) cnt Number of epochs to copy to the buffer
Return Values
Number of epochs copied by the function.
Notes
data_storage_add_new_epoch()
data_storage_find_epoch_addr()
data_storage_get_samples()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
24 of 330
Function Name
ds_err_t data_storage_update_sample(data_storage_t *ds, uint32_t timestamp, ds_data_type_t data_type,
uint8_t *new_data, uint16_t cnt);
Function Description
Updates the values of the referenced epochs with the ones provided. Epochs must be already written once and also must be contained in a single chunk.
Parameters
ds Pointer of the data storage object timestamp Timestamp of the first epoch to update data_type Data type of the epochs new_data Pointer to the buffer containing the new values cnt Number of epochs to update
Return Values
Status of the operation.
Notes
Function Name
ds_err_t data_storage_erase_hist(data_storage_t *ds, uint32_t timestamp, ds_data_type_t data_type);
Function Description
Finds and erases epochs of the specified data type from the provided timestamp onwards.
Parameters
ds Pointer of the data storage object timestamp Timestamp of the first epoch to erase data_type Data type of the epochs
Return Values
Status of the operation.
Notes
Function Name
void data_storage_handle_exception(data_storage_t *ds, ds_data_type_t data_type);
Function Description
Handles any data storage exception (unexpected states or data) and erases the corresponding section of the data storage Flash memory when in production mode.
Parameters
ds Pointer of the data storage object data_type Data type of the epochs
Return Values
Status of the operation.
Notes
data_storage_update_sample()
data_storage_erase_hist()
data_storage_handle_exception()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
25 of 330
Functions
wrbl_battery_init() handle_charging_msg()
wrbl_battery_status_update()
Function Name
void wrbl_battery_init(void);
Function Description
Initialize battery component of the wearable task
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_battery_status_update (void);
Function Description
Updates the battery and status of the component. Function reads the current battery voltage to determine the power saving state and also reads the state of charge of the system to update the value in the display and BAS profile.
Parameters
None
Return Values
None
Notes
Function Name
void handle_charging_msg(msg *wrbl_msg);
Function Description
Function handles messages of the wearable task about the charger state
Parameters
wrbl_msg Message to be handled
Return Values
None
Notes
Functions
wrbl_clk_mngr_init() wrbl_clk_mngr_lower_clk()
wrbl_clk_mngr_raise_clk()
5.3.2 Battery
State of Charge is a functionality of the wearable device that produces an estimation of the battery charge state as a percentage. To produce that estimation, the fuel gauge module is combined with the ADC module using a Vbat + Ibat method to calculate the remaining battery charge.
Table 8: Wearable battery API
5.3.2.1 Functions
wrbl_battery_init()
wrbl_battery_status_update()
handle_charging_msg()
5.3.3 Clock manager
Table 9: Wearable clock manager API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
26 of 330
Function Name
void wrbl_clk_mngr_init(void);
Function Description
Initialize wearable clock manager. Function creates required structures that need to run.
Parameters
None
Return Values
None
Notes
Function Name
bool wrbl_clk_mngr_raise_clk(void);
Function Description
Request wearable clock to increase frequency. Function checks if already called and set frequency to high value (96MHz).
Parameters
None
Return Values
True if the request had any effect or false if the clock was already high.
Notes
Function Name
bool wrbl_clk_mngr_lower_clk(void);
Function Description
Request wearable clock to decrease frequency. Function checks if no other request is active and restores frequency to initial value.
Parameters
None
Return Values
True if the request had any effect or false if the clock was already low.
Notes
Structures
rtc_callbacks_t
Functions
wrbl_rtc_init()
handle_rtc()
Callback Functions
minute_evt
alarm_evt
Field
Type
Description
minute_evt
rtc_event_callback
Minute change event callback function
alarm_evt
rtc_event_callback
Alarm event callback function
5.3.3.1 Functions
wrbl_clk_mngr_init()
wrbl_clk_mngr_raise_clk()
wrbl_clk_mngr_lower_clk()
5.3.4 Real Time Clock
Table 10: Wearable RTC API
5.3.4.1 Data Structures and Types
rtc_callbacks_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
27 of 330
Function Name
void wrbl_rtc_init(const rtc_callbacks_t *cb);
Function Description
Initialize the RTC module.
Parameters
cb Callback function to be called when an RTC event is detected
Return Values
None
Notes
Function Name
void handle_rtc(void);
Function Description
Function handles the RTC events of the wearable task.
Parameters
None
Return Values
None
Notes
Function Name
void minute_evt(void);
Function Description
Function is called at each minute change to indicate the event.
Parameters
None
Return Values
None
Notes
Function Name
void alarm_evt(void);
Function Description
Function is called when the alarm event is triggered.
Parameters
None
Return Values
None
Notes
5.3.4.2 Functions
wrbl_rtc_init()
handle_rtc()
5.3.4.3 Callback Functions
minute_evt
alarm_evt
5.4 Wearable Health Toolbox Control
The Wearable Health Toolbox Control is an abstraction layer that provides easy control to health toolbox functionality used by the wearable task and also combines the requirements of the various interfaces that need access to the health toolbox resources. It operates as a bridge between the DWS, HCS and UI control entry points and the health toolbox task.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
28 of 330
Data Structures and Types
srvc_iface_t ht_conf_type_t sens_config_t acc_values_t
srvc_sens_t ht_ctrl_state_t srvc_state_t epoch_timestamps
Functions
wrbl_ht_ctrl_init() wrbl_ht_ctrl_get_sens_state() wrbl_ht_ctrl_config_sens() wrbl_ht_ctrl_switch_iface() wrbl_ht_ctrl_reset_sens() wrbl_ht_ctrl_config_sfl_coeffs() wrbl_ht_ctrl_config_calibr_control() wrbl_ht_ctrl_reset_conf() wrbl_ht_ctrl_set_user_profile() handle_ht_config() wrbl_ht_ctrl_store_conf() wrbl_ht_ctrl_read_nv()
wrbl_ht_ctrl_stop() wrbl_ht_ctrl_get_iface_state() wrbl_ht_ctrl_switch_sens() wrbl_ht_ctrl_set_init() wrbl_ht_ctrl_config_basic_attrs() wrbl_ht_ctrl_config_calibr_coeffs() wrbl_ht_ctrl_get_config() wrbl_ht_ctrl_reset_cal_sfl_conf() wrbl_ht_ctrl_get_user_profile() handle_ht_data() wrbl_ht_ctrl_store_clbr()
Type Definition Name
Description
srvc_iface_t
Service interface enumeration type defined as:
SRVC_IFACE_DWS, SRVC_IFACE_HCS,
SRVC_IFACE_MAX
Type Definition Name
Description
srvc_sens_t
Service/sensor enumeration type defined as:
SRVC_SENS_ACC, SRVC_SENS_GYR, SRVC_SENS_MAG, SRVC_SENS_SF, SRVC_SENS_ENV, SRVC_SENS_SRVC_START, SRVC_SENS_SENS_END = SRVC_SENS_SRVC_START - 1, SRVC_SENS_STEP, SRVC_SENS_HRM, SRVC_SENS_SQ, SRVC_SENS_CAL, SRVC_SENS_BSC,
SRVC_SENS_MAX
Table 11: Wearable Health Toolbox Control API
5.4.1 Data Structures and Types
srvc_iface_t
srvc_sens_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
29 of 330
Type Definition Name
Description
ht_conf_type_t
Configuration type enumeration type defined as:
CONF_START_HT, CONF_STOP_HT, CONF_BASIC_SETUP, CONF_CONFIG_DONE, CONF_RESET_DONE, CONF_SFL_CLBR_COEFFS, CONF_MAG_CLBR_CTRL, CONF_MAG_CLBR_CTRL_STAT, CONF_MAG_CLBR_CTRL_BASIC, CONF_MAG_CLBR_CTRL_SMART, CONF_MAG_CLBR_CTRL_CMPLT, CONF_MAG_CLBR_COEFFS, CONF_MAG_CLBR_COEFFS_STAT, CONF_MAG_CLBR_COEFFS_BASIC, CONF_MAG_CLBR_COEFFS_SMART, CONF_MAG_CLBR_COEFFS_CMPLT, CONF_ACC_CLBR, CONF_USER_PROFILE, CONF_STEP_SETTING, CONF_HRM_SETTING, CONF_SQ_SETTING , CONF_CAL_SETTING, CONF_BSC_SETTING, CONF_MAX
Type Definition Name
Description
ht_ctrl_state_t
Service/sensor control state enumeration type defined as:
SRVC_SUSPEND = 0x00, SRVC_RESUME = 0x01, SRVC_DISABLE = 0x02,
SRVC_ENABLE = 0x03
Field
Type
Description
acc
ht_acc_config_t
Accelerometer configuration
gyr
ht_gyr_config_t
Gyroscope configuration
mag
ht_mag_config_t
Magnetometer configuration
env
ht_env_config_t
Environmental configuration
step
ht_step_config_t
Step counting configuration
sf
Sensor fusion library configuration
hr
ht_hr_config_t
Heart rate configuration
sq
ht_sq_config_t
Sleep quality configuration
cal
ht_cc_config_t
Calories counting configuration
bsc
ht_bs_config_t
Body state classification configuration
ht_conf_type_t
ht_ctrl_state_t
sens_config_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
30 of 330
Field
Type
Description
config
sens_config_t
Corresponding sensor/service configuration
ticks
uint8_t
Samples to drop in order to achieve required rate
Field
Type
Description
step
uint32_t
Steps accumulated value
cal
uint32_t
Calories accumulated value
sq_l
uint32_t
Sleep quality light accumulated value
sq_d
uint32_t
Sleep quality deep accumulated value
sq_r
uint32_t
Sleep quality REM accumulated value
Field
Type
Description
step
uint32_t
Epoch timestamp of the steps
hr
uint32_t
Epoch timestamp of the heart rate
cal
uint32_t
Epoch timestamp of the calories counting
sq
uint32_t
Epoch timestamp of the sleep quality
bsc
uint32_t
Epoch timestamp of the body state classification
srvc_state_t
acc_values_t
epoch_timestamps
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
31 of 330
Function Name
void wrbl_ht_ctrl_init(void);
Function Description
Stores DWS service handler and starts the Health Toolbox.
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_stop(void);
Function Description
Stop Health Toolbox
Parameters
None
Return Values
None
Notes
Function Name
bool wrbl_ht_ctrl_get_sens_state(srvc_iface_t iface, srvc_sens_t sens);
Function Description
Returns the state of the corresponding sensor/service of the specific interface.
Parameters
iface Interface sens Sensor/service
Return Values
True if sensor/service is configured as on, false otherwise.
Notes
Function Name
bool wrbl_ht_ctrl_get_iface_state(srvc_iface_t iface);
Function Description
Returns the state of the corresponding sensor/service of the specific interface.
Parameters
iface Interface
Return Values
True if sensor/service is configured as on, false otherwise.
Notes
Function Name
void wrbl_ht_ctrl_config_sens(srvc_iface_t iface, srvc_sens_t sens,
sens_config_t *config);
Function Description
Stores the configuration and if interface is enabled it configures the referenced sensor.
Parameters
iface Interface sens Sensor/service config Configuration to be applied
Return Values
None
Notes
5.4.2 Functions
wrbl_ht_ctrl_init()
wrbl_ht_ctrl_stop()
wrbl_ht_ctrl_get_sens_state()
wrbl_ht_ctrl_get_iface_state()
wrbl_ht_ctrl_config_sens()
wrbl_ht_ctrl_switch_sens()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
32 of 330
Function Name
void wrbl_ht_ctrl_switch_sens(srvc_iface_t iface, srvc_sens_t sens,
ht_ctrl_state_t sens_state);
Function Description
Enables or disables the referenced sensor/service without changing its settings. It stores the new state to be restored at startup when interface is enabled/disabled.
Parameters
iface Interface sens Sensor/service sens_state State of the sensor/service to be applied
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_switch_iface (srvc_iface_t iface, bool iface_state);
Function Description
Enables or disables the referenced interface and stores previous state to reapply it when turned on.
Parameters
iface Interface iface_state State of the interface to be applied
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_set_init(srvc_sens_t sens);
Function Description
Set data of the provided sensor/service to the initial value
Parameters
sens Sensor/service
Return Values
None
Notes
Valid sensors/services: SRVC_SENS_STEP
SRVC_SENS_SQ
SRVC_SENS_CAL
Function Name
void wrbl_ht_ctrl_reset_sens(srvc_sens_t sens);
Function Description
Reset data of the provided sensor/service
Parameters
sens Sensor/service
Return Values
None
Notes
Valid sensors/services: SRVC_SENS_STEP
SRVC_SENS_SQ
SRVC_SENS_CAL
Function Name
void wrbl_ht_ctrl_config_basic_attrs(iot_basic_setup_t
*iot_basic_setup);
Function Description
Configures the BLE interface configuration applied.
Parameters
iot_basic_setup Basic attributes configuration
Return Values
None
wrbl_ht_ctrl_switch_iface()
wrbl_ht_ctrl_set_init()
wrbl_ht_ctrl_reset_sens()
wrbl_ht_ctrl_config_basic_attrs()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
33 of 330
Notes
Function Name
void wrbl_ht_ctrl_config_sfl_coeffs(iot_sfl_coeffs_t *iot_sfl_coeffs);
Function Description
Configures the BLE interface configuration applied.
Parameters
iot_sfl_coeffs SFL coefficients
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_config_calibr_coeffs( iot_calibr_coeffs_t *iot_calibr_coeffs);
Function Description
Configures the BLE interface configuration applied.
Parameters
iot_calibr_coeffs Calibration coefficients
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_config_calibr_control(iot_calibr_ctrl_t
*iot_calibr_ctrl);
Function Description
Configures the BLE interface configuration applied.
Parameters
iot_calibr_ctrl Calibration control
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_get_config(ht_conf_type_t conf);
Function Description
Calls the appropriate get configuration from the Health Toolbox in order to be sent to peer device with the DWS profile.
Parameters
conf Reference of configuration type
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_reset_conf(void);
Function Description
Resets the BLE interface sensors/services settings to the default ones.
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_reset_cal_sfl_conf(void);
wrbl_ht_ctrl_config_sfl_coeffs()
wrbl_ht_ctrl_config_calibr_coeffs()
wrbl_ht_ctrl_config_calibr_control()
wrbl_ht_ctrl_get_config()
wrbl_ht_ctrl_reset_conf()
wrbl_ht_ctrl_reset_cal_sfl_conf()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
34 of 330
Function Description
Resets the BLE iface sensors/services calibration settings to the default ones
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_set_user_profile(hcs_user_profile_t *user_profile);
Function Description
Configures the HCS user profile and configures the Health Toolbox services.
Parameters
user_profile Reference to user profile
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_get_user_profile(hcs_user_profile_t *user_profile);
Function Description
Returns the configuration of the user profile stored in Flash memory if available or default values otherwise.
Parameters
user_profile Reference to user profile
Return Values
None
Notes
Function Name
bool handle_ht_config(msg *wrbl_msg);
Function Description
Handles the reception of configurations by the Health Toolbox and performs the appropriate actions.
Parameters
wrbl_msg The configuration message
Return Values
True if message type was handled, false otherwise.
Notes
Function Name
bool handle_ht_data(msg *wrbl_msg);
Function Description
Function handles the reception of data by the Health Toolbox and performs the appropriate actions.
Parameters
wrbl_msg The data message
Return Values
True if message type was handled, false otherwise.
Notes
Function Name
void wrbl_ht_ctrl_store_conf(void);
Function Description
Stores the current configuration of the Health Toolbox to Flash memory.
Parameters
None
Return Values
None
Notes
wrbl_ht_ctrl_set_user_profile()
wrbl_ht_ctrl_get_user_profile()
handle_ht_config()
handle_ht_data()
wrbl_ht_ctrl_store_conf()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
35 of 330
Function Name
void wrbl_ht_ctrl_store_clbr(void);
Function Description
Sores the current calibrations of the Health Toolbox to Flash memory.
Parameters
None
Return Values
None
Notes
Function Name
void wrbl_ht_ctrl_read_nv(void);
Function Description
Retrieves the configurations/calibrations of the Health Toolbox from Flash memory if available. If not available, it sets the default ones.
Parameters
None
Return Values
None
Notes
Type Definition Name
Description
dws_char_ref_t
DWS reference characteristic enumeration type defined as:
DWS_ACCEL_CHAR, DWS_GYRO_CHAR, DWS_MAG_CHAR, DWS_BARO_CHAR, DWS_HUM_CHAR, DWS_TEMP_CHAR, DWS_SENSF_CHAR, DWS_FEAT_CHAR, DWS_CONTROL_CHAR, DWS_CONTROL_REPLY_CHAR
wrbl_ht_ctrl_store_clbr()
wrbl_ht_ctrl_read_nv()
6 BLE Services
This section presents the standard and custom BLE services used by the Wearable application.
6.1 Dialog Wearable Service
The Dialog Wearable Service (DWS) is a Dialog proprietary GATT service providing a means to:
Transfer raw and calibrated sensor data.
Transfer sensor fusion data.
Configure the device, such as setting of operating parameters.
Control the device, such as start/stop and load/store to non-volatile memory.
The DWS API specification structures and types are divided into two parts: the strictly DWS profile (file dws.h, described in Section 6.1.1) and the IoT extension definitions (file IoT.h, described in Section 6.1.2).
6.1.1 DWS Data Structures and Types
dws_char_ref_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
36 of 330
Field
Type
Description
accelerometer_en
uint8_t
Determines active characteristics.
0: disabled
>0: enabled
gyro_en
uint8_t
magn_en
uint8_t
pressure_en
uint8_t
humidity_en
uint8_t
temp_en
uint8_t
s_fusion_en
uint8_t
version[16]
uint8_t
SW version, in BCD format.
device_type
uint8_t
Device type.
0: Wearable 58x
1: Wearable 68x
Type Definition Name
Description
iot_control_byte_t
IoT control command byte enumeration type defined as:
IOT_STOP_CMD = 0, IOT_START_CMD = 1, IOT_READ_NV_CMD = 2, IOT_RESET_CMD = 3, IOT_STORE_CONF_CMD = 4, IOT_STORE_CLBR_CMD = 5, IOT_GET_RUNNING_STATUS_CMD = 6, IOT_RESET_CAL_SF_DATA_CMD = 7, IOT_BASIC_CONFIG_WR_CMD = 10, IOT_BASIC_CONFIG_RD_REQ = 11, IOT_SFL_COEFF_WR_CMD = 12, IOT_SFL_COEFF_RD_REQ = 13, IOT_CAL_COEFF_WR_CMD = 14, IOT_CAL_COEFF_RD_REQ = 15, IOT_CAL_CTRL_WR_CMD = 16, IOT_CAL_CTRL_RD_REQ = 17,
IOT_START_ACC_ALLIGN = 18
Type Definition Name
Description
iot_report_id_t
IoT report ID enumeration type defined as:
IOT_ACCELEROMETER_REPORT_ID = 1, IOT_GYROSCOPE_REPORT_ID = 2, IOT_MAGNETOMETER_REPORT_ID = 3, IOT_PRESSURE_REPORT_ID = 4, IOT_HUMIDITY_REPORT_ID = 5, IOT_TEMPERATURE_REPORT_ID = 6, IOT_SENSOR_FUSION_REPORT_ID = 7,
IOT_COMMAND_REPLY_REPORT_ID = 8
dws_features_t
6.1.2 IoT Data Structures and Types
iot_control_byte_t
iot_report_id_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
37 of 330
Type Definition Name
Description
iot_sensor_type_t
IoT sensor type enumeration type defined as:
IOT_SENSOR_ACC, IOT_SENSOR_GYR, IOT_SENSOR_MAG,
IOT_SENSOR_MAX
Type Definition Name
Description
iot_flags_t
IoT sensor enable/combination enumeration type defined as:
IOT_ENABLE_ACC_FLAG = (1 << 0), IOT_ENABLE_GYR_FLAG = (1 << 1), IOT_ENABLE_MAG_FLAG = (1 << 2),
IOT_ENABLE_ENV_FLAG = (1 << 3)
Type Definition Name
Description
iot_sfl_comb_t
IoT SFL sensor combination enumeration type defined as:
IOT_SFL_COMB_G = IOT_ENABLE_GYR_FLAG, IOT_SFL_COMB_GA = IOT_ENABLE_ACC_FLAG | IOT_ENABLE_GYR_FLAG, IOT_SFL_COMB_AM = IOT_ENABLE_ACC_FLAG | IOT_ENABLE_MAG_FLAG, IOT_SFL_COMB_GAM = IOT_ENABLE_ACC_FLAG | IOT_ENABLE_GYR_FLAG |
IOT_ENABLE_MAG_FLAG
Type Definition Name
Description
iot_bmi160_accel_range_t
IoT BMI160 accelerometer range enumeration type defined as:
IOT_BMI160_ACCEL_RANGE_2G = 0X03, IOT_BMI160_ACCEL_RANGE_4G = 0X05, IOT_BMI160_ACCEL_RANGE_8G = 0X08,
IOT_BMI160_ACCEL_RANGE_16G = 0X0C
Type Definition Name
Description
iot_bmi160_accel_rate_t
IoT BMI160 accelerometer rate enumeration type defined as:
IOT_BMI160_ACCEL_RATE_0_78HZ = 0x01, IOT_BMI160_ACCEL_RATE_1_56HZ = 0x02, IOT_BMI160_ACCEL_RATE_3_12HZ = 0x03, IOT_BMI160_ACCEL_RATE_6_25HZ = 0x04, IOT_BMI160_ACCEL_RATE_12_5HZ = 0x05, IOT_BMI160_ACCEL_RATE_25HZ = 0x06, IOT_BMI160_ACCEL_RATE_50HZ = 0x07,
IOT_BMI160_ACCEL_RATE_100HZ = 0x08
iot_sensor_type_t
iot_flags_t
iot_sfl_comb_t
iot_bmi160_accel_range_t
iot_bmi160_accel_rate_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
38 of 330
Type Definition Name
Description
iot_bmi160_gyro_range_t
IoT BMI160 gyroscope range enumeration type defined as:
IOT_BMI160_GYRO_RANGE_2000_DEG_SEC = 0x00, IOT_BMI160_GYRO_RANGE_1000_DEG_SEC = 0x01, IOT_BMI160_GYRO_RANGE_500_DEG_SEC = 0x02,
IOT_BMI160_GYRO_RANGE_250_DEG_SEC = 0x03
Type Definition Name
Description
iot_bmi160_gyro_rate_t
IoT BMI160 gyroscope rate enumeration type defined as:
IOT_BMI160_GYRO_RATE_25HZ = 0x06, IOT_BMI160_GYRO_RATE_50HZ = 0x07,
IOT_BMI160_GYRO_RATE_100HZ = 0x08
Type Definition Name
Description
iot_bmm150_mag_rate_t
IoT BMM150 magneto rate enumeration type defined as:
IOT_BMM150_MAG_RATE_0_78HZ = 0x01, IOT_BMM150_MAG_RATE_1_56HZ = 0x02, IOT_BMM150_MAG_RATE_3_12HZ = 0x03, IOT_BMM150_MAG_RATE_6_25HZ = 0x04, IOT_BMM150_MAG_RATE_12_5HZ = 0x05, IOT_BMM150_MAG_RATE_25HZ = 0x06, IOT_BMM150_MAG_RATE_50HZ = 0x07,
IOT_BMM150_MAG_RATE_100HZ = 0x08
Type Definition Name
Description
iot_env_rate_t
IoT environmental rate enumeration type defined as:
IOT_ENV_RATE_0_5_HZ = 1, IOT_ENV_RATE_1HZ = 2,
IOT_ENV_RATE_2HZ = 4
Type Definition Name
Description
iot_sfl_rate_t
IoT SFL report rate enumeration type defined as:
IOT_SFL_REPORT_RATE_OFF = 0x00, IOT_SFL_REPORT_RATE_0_78 = 0x01, IOT_SFL_REPORT_RATE_1_56 = 0x02, IOT_SFL_REPORT_RATE_3_12 = 0x03, IOT_SFL_REPORT_RATE_6_25 = 0x04, IOT_SFL_REPORT_RATE_12_5 = 0x05, IOT_SFL_REPORT_RATE_25 = 0x06,
IOT_SFL_REPORT_RATE_50 = 0x07
iot_bmi160_gyro_range_t
iot_bmi160_gyro_rate_t
iot_bmm150_mag_rate_t
iot_env_rate_t
iot_sfl_rate_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
39 of 330
Type Definition Name
Description
iot_cal_mode_t
IoT calibration mode enumeration type defined as:
IOT_CAL_MODE_NONE = 0, IOT_CAL_MODE_STATIC = 1, IOT_CAL_MODE_AUTO_CONT = 2,
IOT_CAL_MODE_AUTO_ONE_SHOT = 3
Type Definition Name
Description
iot_auto_cal_mode_t
IoT auto calibration mode enumeration type defined as:
IOT_AUTO_CAL_BASIC = 0,
IOT_AUTO_CAL_SMART = 1
Type Definition Name
Description
iot_cal_state_t
IoT calibration state/status enumeration type defined as:
IOT_CAL_STATE_DISABLED = 0, IOT_CAL_STATE_INIT = 1, IOT_CAL_STATE_BAD = 2, IOT_CAL_STATE_OK = 3, IOT_CAL_STATE_GOOD = 4,
IOT_CAL_STATE_ERROR = 5
Type Definition Name
Description
iot_sfl_raw_t
IoT SFL raw data state enumeration type defined as:
IOT_SFL_RAW_EN = 0,
IOT_SFL_RAW_DIS = 1
Field
Type
Description
sensor_combination
uint8_t
Active sensor combination (iot_flags_t or iot_sfl_comb_t)
acc_rng
uint8_t
Accelerometer range (as in iot_bmi160_accel_range_t)
acc_rate
uint8_t
Accelerometer rate (as in iot_bmi160_accel_rate_t)
gyr_rng
uint8_t
Gyroscope range (as in iot_bmi160_gyro_range_t)
gyr_rate
uint8_t
Gyroscope rate (as in iot_bmi160_gyro_rate_t)
mag_rate
uint8_t
Magneto rate (as in iot_bmm150_mag_rate_t)
env_rate
uint8_t
Environmental sensors rate (as in iot_env_rate_t)
sfl_rate
uint8_t
Sensor fusion library report rate (as in iot_sfl_rate_t)
sfl_raw_en
uint8_t
Sensor fusion library raw enable (as in iot_sfl_raw_t)
cal_mode
uint8_t
Calibration mode (as in iot_cal_mode_t)
auto_cal_mode
uint8_t
Auto calibration mode (as in iot_auto_cal_mode_t)
iot_cal_mode_t
iot_auto_cal_mode_t
iot_cal_state_t
iot_sfl_raw_t
iot_basic_setup_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
40 of 330
Field
Type
Description
beta_a
uint16_t
Beta A SFL coefficient
beta_m
uint16_t
Beta M SFL coefficient
reserved[4]
uint8_t
Reserved
Field
Type
Description
sensor_type
uint8_t
Sensor type (as in iot_sensor_type_t)
q_format
uint8_t
Q format of matrix
offset_vector[3]
int16_t
Offset vectors for raw sensor data
matrix[3][3]
int16_t
Matrix of coefficients to apply to raw sensor data
Field
Type
Description
sensor_type
uint8_t
Sensor type (as in iot_sensor_type_t)
flags
uint16_t
Calibration control flags (as defined in Table 12 and Table 13)
ref_mag
uint16_t
Reference magnitude
mag_range
uint16_t
Magnitude range
mag_alpha
uint16_t
Magnitude filter coefficient
mag_delta_thresh
uint16_t
Magnitude gradient threshold
mu_offset
uint16_t
Offset update rate
mu_matrix
uint16_t
Matrix update rate
err_alpha
uint16_t
Overall error filter coefficient
err_thresh
uint16_t
Overall error threshold
Calibration Mode
Bit 0
Reserved
Bit 1
Reserved
Bit 2 Offset Apply
Bit 3 Matrix Apply
Bit 4 Offset
Update
Bit 5 Matrix
Update
Bit 7
Init.
from
Static
Bit 7 Offset
Post Apply
Static
X
X
1: Yes
1: Yes
0: No
0: No
0: No
1: Yes
Basic Auto
X
X
1: Yes
1: Yes
1: Yes
1: Yes
0: No
1: Yes
Smart Fusion Auto
X
X
1: Yes
1: Yes
1: Yes
1: Yes
1: Yes
1: Yes
Calibration mode
Bit 0
Reserved
Bit 1
Reserved
Bit 2
Reserved
Bit 3
Reserved
Bit 4
Reserved
Bit 5
Reserved
Bit 6 Converged (read only)
Bit 7
Settled
(read only)
Static
X X X X X X X
0: No
Basic Auto
X X X X X X 0: No
1: Yes
Smart Fusion Auto
X X X X X X 1: Yes
1: Yes
iot_sfl_coeffs_t
iot_calibr_coeffs_t
iot_calibr_ctrl_t
Table 12: Calibration Control Flags (byte 1)
Table 13: Calibration control flags (byte 2)
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
41 of 330
Field
Type
Description
sensor_status
uint8_t
Sensor state status
basic_setup
iot_basic_setup_t
Basic setup of the sensors
sfl_coefficients
iot_sfl_coeffs_t
Smart fusion library coefficients
calibr_coeffs
iot_calibr_coeffs_t
Calibration coefficients
calibr_ctrl
iot_calibr_ctrl_t
Calibration control configuration
Field
Type
Description
ctrl_cmd
uint8_t
Control command
ctrl_params
iot_ctrl_params_t
Control command parameters of the corresponding command type
Field
Type
Description
ucReportId
uint8_t
Report ID type (as in iot_report_id_t)
ctrl_cmd
uint8_t
Control command
ctrl_params
iot_ctrl_params_t
Control command parameters of the corresponding command type
Field
Type
Description
in_data_valid
bool:1
Input (pre calibration) data valid flag
out_data_valid
bool:1
Output (post calibration) data valid flag
cal_enabled
bool:1
Calibration enabled flag
cal_settled
bool:1
Calibration settled flag
cal_converged
bool:1
Calibration converged flag
cal_mode
bool:3
Calibration mode
Field
Type
Description
ucReportId
uint8_t
Report ID type (as in iot_report_id_t)
ucSensorState
iot_snsr_state_t
Sensor state
ucCalState
uint8_t
Calibration state (as in iot_cal_state_t)
val_x
int16_t
Sensor axis values of accelerometer/gyroscope/magneto
val_y
int16_t
val_z
int16_t
Field
Type
Description
ucReportId
uint8_t
Report ID type (as in iot_report_id_t)
iot_ctrl_params_t
iot_control_t
iot_control_reply_t
iot_snsr_state_t
iot_data_report_agm_t
iot_data_report_pht_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
42 of 330
Field
Type
Description
ucSensorState
uint8_t
Sensor state
ucSensorEvent
uint8_t
Sensor event (always 3, reserved FFU)
val32
int32_t
Sensor value of pressure/humidity/temperature
Field
Type
Description
ucReportId
uint8_t
Report ID type (as in iot_report_id_t)
ucSensorState
uint8_t
Sensor state
ucCalState
uint8_t
Calibration state
val_w
int16_t
Sensor fusion library values
val_x
int16_t
val_y
int16_t
val_z
int16_t
Function Name
ble_service_t *dws_init(const dws_callbacks_t * const cb, const dws_features_t * const dws_features);
Function Description
Registers Dialog wearable service instance.
Parameters
cb Application callbacks dws_features Application supported features
Return Values
Service instance
Notes
Function Name
void dws_notify_value(ble_service_t *svc, uint16_t conn_idx, dws_char_ref_t dws_char, uint8_t *data, uint16_t length);
Function Description
Sends notification to peer device.
Parameters
svc Instance of service conn_idx Connection index dws_char Reference to characteristic data Data to be notified length Length of data in bytes
Return Values
None
Notes
Upon transmission of data, service will call dws_ntf_cfm callback.
iot_data_report_sf_t
6.1.3 Functions
dws_init()
dws_notify_value()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
43 of 330
Function Name
att_error_t dws_control_val_wr_valid(ble_service_t *svc, uint16_t conn_idx, const uint8_t *msg, uint16_t length);
Function Description
Callback function to be called when a write control value is received in order to check validity of the command.
Parameters
svc Service instance conn_idx Connection index msg Command message length Length of command message in bytes
Return Values
Status of validity check.
Notes
Function Name
void dws_control_ind(ble_service_t *svc, uint16_t conn_idx, const uint8_t *msg, uint16_t length);
Function Description
Callback function to be called when a write control value is received
Parameters
svc Service instance conn_idx Connection index msg Command message length Length of command message in bytes
Return Values
None
Notes
It is called only after validation.
Function Name
void dws_notify_cfm(ble_service_t *svc, uint16_t conn_idx);
Function Description
Callback function to be called when a notification confirmation is received by BLE stack.
Parameters
svc Service instance conn_idx Connection index
Return Values
None
Notes
6.1.4 Callback Functions
dws_control_val_wr_valid()
dws_control_ind()
dws_notify_cfm()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
44 of 330
Type Definition Name
Description
hcs_features_t
HCS supported features enumeration type defined as:
HCS_FEAT_STEP = 1 << 0, HCS_FEAT_HEART_RATE = 1 << 1, HCS_FEAT_SLEEP_QUAL = 1 << 2, HCS_FEAT_CALORIES = 1 << 3, HCS_FEAT_BSC = 1 << 4
Type Definition Name
Description
hcs_sq_state_t
HCS sleep quality state enumeration type defined as:
HCS_SLEEP_AWAKE, HCS_SLEEP_LIGHT, HCS_SLEEP_DEEP, HCS_SLEEP_REM, HCS_SLEEP_NOT_ATTACHED,
HCS_SLEEP_ERROR
Type Definition Name
Description
hcs_bsc_state_t
HCS body state classification enumeration type defined as:
HCS_BSC_STATE_OTHER, HCS_BSC_STATE_WALK, HCS_BSC_STATE_RUN, HCS_BSC_STATE_SIT, HCS_BSC_STATE_STAND,
HCS_BSC_STATE_LAY_DOWN
6.2 Health Care Service
The Health Care Service (HCS) is a Dialog proprietary GATT service used to control, configure and reading output data from Health Care services running on the Wearable DK. By supporting the GATT client role a remote BLE central connected to the Wearable DK can perform the following operations:
Enable/disable a Health Care service.
Get/reset the current day's live counters of the Health Care services.
Get updates of the latest epoch values for all services, while it is connected to the Wearable DK.
Retrieve Health Care data stored in the Wearable DK Flash memory.
Set the user's biometric information in the Wearable DK.
6.2.1 Data Structures and Types
hcs_features_t
hcs_sq_state_t
hcs_bsc_state_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
45 of 330
Type Definition Name
Description
hcs_ctrl_cmd_t
HCS control command enumeration type defined as:
HCS_CTRL_STOP, HCS_CTRL_START, HCS_CTRL_RESET, HCS_HEART_RATE_MODE_ONE_SHOT, HCS_HEART_RATE_MODE_CONTINOUS, HCS_CALORIES_ACT_WALK_RUN, HCS_CALORIES_ACT_CYCLING, HCS_READ_HISTORICAL_DATA, HCS_READ_OPERATION_STATE,
HCS_READ_COUNTER
Type Definition Name
Description
hcs_op_code_t
HCS operation code enumeration type defined as:
HCS_OP_CODE_STEP = 0x01, HCS_OP_CODE_HEART_RATE, HCS_OP_CODE_SLEEP_QUALITY, HCS_OP_CODE_CALORIES, HCS_OP_CODE_BODY_STATE, HCS_OP_CODE_LIGHT_SLEEP = 0xE0, HCS_OP_CODE_DEEP_SLEEP, HCS_OP_CODE_REM_SLEEP, HCS_OP_CODE_CALORIES_WALKING = 0xF0,
HCS_OP_CODE_CALORIES_CYCLING
Type Definition Name
Description
hcs_sample_size_t
HCS sample size enumeration type defined as:
HCS_SAMPLE_2_BITS = 0x01, HCS_SAMPLE_4_BITS, HCS_SAMPLE_8_BITS,
HCS_SAMPLE_16_BITS
Type Definition Name
Description
hcs_status_t
HCS operation status enumeration type defined as:
HCS_STAT_SUCCESS, HCS_STAT_UNSUPPORTED_CMD, HCS_STAT_MISSING_DATA, HCS_STAT_INVALID_OP_CODE, HCS_STAT_TIMESTAMP_NOT_FOUND, HCS_STAT_CHUNK_HEADER,
HCS_STAT_OPERATION_STATE
Type Definition Name
Description
hcs_operation_state_t
HCS sensor operation state enumeration type defined as:
HCS_OPERATION_INACTIVE = 0x00,
HCS_OPERATION_ACTIVE
hcs_ctrl_cmd_t
hcs_op_code_t
hcs_sample_size_t
hcs_status_t
hcs_operation_state_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
46 of 330
Type Definition Name
Description
hcs_calories_mode_t
HCS burned calories mode enumeration type defined as:
HCS_CALORIES_WALKING = 0xF0,
HCS_CALORIES_CYCLING
Type Definition Name
Description
hcs_heart_rate_mode_t
HCS heart rate mode enumeration type defined as:
HCS_HR_ONE_SHOT = 0x00,
HCS_HR_CONTIN
Field
Type
Description
op_state
hcs_operation_state_t
Sensor operation state
cal_mode
hcs_calories_mode_t
Calories burned mode
hr_mode
hcs_heart_rate_mode_t
Heart rate mode
Field
Type
Description
age
uint8_t
Profile age
height
uint8_t
Profile height in cm
weight
uint8_t
Profile weight in kg
sex
uint8_t
Profile gender. Use 'M' for male (ASCII 0x4D) or 'F' for female (ASCII 0x46).
Field
Type
Description
timestamp
uint32_t
Step counting epoch timestamp in UNIX format
steps
uint32_t
Step counting epoch value
Field
Type
Description
timestamp
uint32_t
Heart rate epoch timestamp
rate
uint16_t
Heart rate value
Field
Type
Description
timestamp
uint32_t
Calories burned epoch timestamp
value
uint8_t
Calories burned epoch value
mode
uint8_t
Calories burned epoch mode
hcs_calories_mode_t
hcs_heart_rate_mode_t
hcs_operation_status_t
hcs_user_profile_t
hcs_step_t
hcs_heart_rate_t
hcs_calories_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
47 of 330
Field
Type
Description
timestamp
uint32_t
Sleep quality epoch timestamp
state
hcs_sq_state_t:8
Sleep quality epoch state
Field
Type
Description
timestamp
uint32_t
Historical data chunk header timestamp
epochs_cnt
uint16_t
Historical data chunk header epochs found
sample_size
uint8_t
Historical data chunk header sample size
data_type
uint8_t
Historical data chunk header data type
epoch_duration
uint32_t
Historical data chunk header epoch duration in ms
Field
Type
Description
user_profile
hcs_user_profile_t
Initial user profile
steps
hcs_step_t
Initial steps epoch
heart_rate
hcs_heart_rate_t
Initial heart rate epoch
calories
hcs_calories_t
Initial calories burned epoch
sleep_quality
hcs_sleep_quality_t
Initial sleep quality epoch
body_state
hcs_bsc_state_t
Initial body state classification value
hcs_sleep_quality_t
hcs_data_chunk_header_t
hcs_initial_values_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
48 of 330
Function Name
ble_service_t *hcs_init(const hcs_callbacks_t * const cb, const hcs_features_t features, const hcs_user_profile_t * const user_profile);
Function Description
Registers health care service instance.
Parameters
cb Application callbacks hcs_features Application supported features user_profile User profile settings
Return Values
Service instance
Notes
Function Name
void hcs_init_values(ble_service_t *svc, hcs_initial_values_t *initial_values);
Function Description
Initializes service values. Sets specific service values that can be read without prior notification sent by the server.
Parameters
svc Service instance initial_values Values to set
Return Values
None
Notes
Function Name
ble_error_t hcs_notify_status(ble_service_t *svc, uint16_t conn_idx, hcs_status_t status, const uint8_t *value, uint16_t length);
Function Description
Notifies client of the operation status.
Parameters
svc Service instance conn_idx Connection index status Operation status value value Status payload length Status payload length
Return Values
Status of the operation
Notes
6.2.2 Functions
hcs_init()
hcs_init_values()
hcs_notify_status()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
49 of 330
Function Name
ble_error_t hcs_notify_step(ble_service_t *svc, uint16_t conn_idx, hcs_step_t steps);
ble_error_t hcs_notify_heart_rate(ble_service_t *svc, uint16_t conn_idx, hcs_heart_rate_t heart_rate);
ble_error_t hcs_notify_calories(ble_service_t *svc, uint16_t conn_idx, hcs_calories_t calories);
ble_error_t hcs_notify_sleep_quality(ble_service_t *svc, uint16_t conn_idx, hcs_sleep_quality_t sleep_quality);
ble_error_t hcs_notify_body_state_class(ble_service_t *svc, uint16_t conn_idx, hcs_bsc_state_t bsc_state);
Function Description
Notifies client of the step/heart rate/calories burned/sleep quality/body state classification epoch.
Parameters
svc Service instance conn_idx Connection index
Corresponding value of
steps Steps epoch heart_rate Heart rate epoch calories Calories burned epoch sleep_quality Sleep quality epoch bsc_state Body state classification value
Return Values
Status of the operation
Notes
Function Name
ble_error_t hcs_notify_acc_counter(ble_service_t *svc, uint16_t conn_idx, hcs_op_code_t op_code, uint32_t value);
Function Description
Notifies client of the accumulated counter (daily total).
Parameters
svc Service instance conn_idx Connection index op_code Counter identification value Status payload
Return Values
Status of the operation
Notes
Function Name
ble_error_t hcs_notify_historical_data(ble_service_t *svc, uint16_t conn_idx, uint8_t num_of_epochs, const uint8_t *data, uint16_t length);
Function Description
Notifies client of the historical data.
Parameters
svc Service instance conn_idx Connection index num_of_epochs Number of epochs to notify data Historical data payload length Historical data payload length
Return Values
Status of the operation
Notes
hcs_notify_[service name]
hcs_notify_acc_counter()
hcs_notify_historical_data()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
50 of 330
Function Name
void user_profile_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_user_profile_t *user_profile);
Function Description
Callback function to be called when a user profile is received.
Parameters
svc Service instance conn_idx Connection index user_profile User profile settings
Return Values
None
Notes
Function Name
void step_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_ctrl_cmd_t cmd);
void heart_rate_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_ctrl_cmd_t cmd);
void sleep_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_ctrl_cmd_t cmd);
void calories_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_ctrl_cmd_t cmd);
void body_state_cfg(ble_service_t *svc, uint16_t conn_idx, hcs_ctrl_cmd_t cmd);
Function Description
Callback function to be called when a step counting/heart rate/sleep quality/calories burned/body state classification configuration command is received.
Parameters
svc Service instance conn_idx Connection index cmd Service command
Return Values
None
Notes
Function Name
hcs_operation_status_t operation_status(ble_service_t *svc, uint16_t conn_idx, hcs_op_code_t op_code);
Function Description
Callback function to be called when operation status of a service is requested.
Parameters
svc Service instance conn_idx Connection index op_code Service reference
Return Values
Requested status
Notes
6.2.3 Callback Functions
user_profile_cfg()
[sensor name]_cfg()
operation_status()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
51 of 330
Function Name
uint32_t get_acc_counter_val(ble_service_t *svc, uint16_t conn_idx, hcs_op_code_t op_code);
Function Description
Callback function to be called when a service's accumulated counter is requested.
Parameters
svc Service instance conn_idx Connection index op_code Value reference
Return Values
Requested value
Notes
Function Name
hcs_status_t read_historical_data(ble_service_t *svc, uint16_t conn_idx, hcs_op_code_t op_code, uint32_t timestamp, hcs_data_chunk_header_t *header);
Function Description
Callback function to be called when a service's historical data is requested.
Parameters
svc Service instance conn_idx Connection index op_code Service reference timestamp Timestamp to start searching from header Recovered header if data matching the criteria
was found
Return Values
Status of the operation
Notes
Upon return of the callback function, application has to send the corresponding data using the hcs_notify_historical_data() function.
Function Name
void historical_notify_cfm(ble_service_t *svc, uint16_t conn_idx);
Function Description
Callback function to be called when a confirmation of a historical data notification is received by BLE stack.
Parameters
svc Service instance conn_idx Connection index
Return Values
None
Notes
Function Name
void notif_en(ble_service_t *svc, uint16_t conn_idx, hcs_op_code_t op_code);
Function Description
Callback function to be called when a service's notifications configuration is enabled.
Parameters
svc Service instance conn_idx Connection index op_code Service reference
Return Values
None
Notes
get_acc_counter_val()
read_historical_data()
historical_notify_cfm()
notif_en()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
52 of 330
6.3 SUOTA Service
The SUOTA Service is a Dialog proprietary BLE service used for updating the firmware of BLE devices. Details and service specification can be found in [4].
A complete API specification of the SUOTA implementation can be found in the Doxygen generated files of the SDK and specifically in the file sdk_680/doc/html/dlg__suota_8h.html.
6.4 Current Time Service
The Current Time Service (CTS) is a standard BLE SIG service. It is used by the Wearable DK software to update the system time from the peer central device (smartphone). The specification of the service can be found in [6].
A complete API specification of the CTS implementation can be found in the Doxygen generated files of the SDK and specifically in the file sdk_680/doc/html/cts_8h.html.
6.5 Heart Rate Service
The Heart Rate Service (HRS) is a standard BLE SIG service. It is used by the Wearable DK software, as an alternative to the HCS service, for sending heart rate samples to the peer central device (smartphone). The specification of the service can be found in [5].
A complete API specification of the HRS implementation can be found in the Doxygen generated files of the SDK and specifically in the file sdk_680/doc/html/hrs_8h.html.
6.6 Battery Service
The Battery Service (BAS) is a standard BLE SIG service. It is used by the Wearable DK software to send the current battery status to the peer central device (smartphone). The specification of the service can be found in [7].
A complete API specification of the BAS implementation can be found in the Doxygen generated files of the SDK and specifically in the file sdk_680/doc/html/bas_8h.html.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
53 of 330
7 User Interface
7.1 UI Task
The UI task is the upper layer in communication with the LS013B7DH03 display. The UI task functions can be called from other tasks (e.g. the WRBL task) for specific operations on the LS013B7DH03 via the GUI and the display driver API.
Figure 4: UI Task Block Diagram
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
54 of 330
Structures
ui_screen_num_t ui_operation_mode_t ui_t
ui_change_mode_t ui_screen_element_t
Functions
ui_task_init() ui_task_register_screen_[change/updated]_cb() ui_task_swipe_screen_[left/right/up/down]() ui_task_blink_screen_elem() ui_task_change_opmode() ui_task_set_battery_level() ui_task_set_connection_state() ui_task_set_time_[hours/minutes]_val() ui_task_set_alarm_[hours/minutes]_val()
ui_task_[enable/disable]_display() ui_task_set_screen() ui_task_show_splash_screen() ui_task_set_change_mode() ui_task_set_vibration_state() ui_task_set_battery_state() ui_task_set_alarm_state() ui_task_set_date_[day/month/year]_val() ui_task_set_[sensor or service]_val()
Callbacks
screen_changed_cb()
screen_updated_cb()
Type Definition Name
Description
ui_screen_num_t
Screen number enumeration type defined as:
UI_TIME_SCREEN = 0, UI_DATE_SCREEN, UI_ALARM_SCREEN, UI_NFC_SCREEN, UI_HEART_RATE_SCREEN, UI_STEPS_SCREEN, UI_DISTANCE_SCREEN, UI_CALORIES_SCREEN, UI_LIGHT_SLEEP_SCREEN, UI_DEEP_SLEEP_SCREEN, UI_TEMPERATURE_SCREEN, UI_HUMIDITY_SCREEN, UI_PRESSURE_SCREEN, UI_MAX_SCREENS
Type Definition Name
Description
ui_change_mode_t
Time change mode enumeration type defined as:
UI_DISPLAY_MODE = 0, UI_TIME_HOURS_SETUP, UI_TIME_MINUTES_SETUP, UI_DATE_DAY_SETUP, UI_DATE_MONTH_SETUP, UI_DATE_YEAR_SETUP, UI_ALARM_SETUP, UI_ALARM_HOURS_SETUP, UI_ALARM_MINUTES_SETUP,
UI_ALARM_EVENT,
Table 14: User Interface Task API
7.1.1 Data Structures and Types
ui_screen_num_t
ui_change_mode_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
55 of 330
Type Definition Name
Description
ui_operation_mode_t
Operation mode enumeration type defined as:
UI_OPERATION_MODE_ON, UI_OPERATION_MODE_OFF,
UI_OPERATION_MODE_PWR_SAVE
Type Definition Name
Description
ui_screen_element_t
Screen element enumeration type defined as:
UI_ELEM_ICON,
UI_ELEM_LABEL
Field
Type
Description
handle
OS_TASK
Task handle of UI task
queue
OS_QUEUE
Queue handle of UI task
lock
OS_MUTEX
Mutex lock of UI task
active_screen
ui_screen_num_t
ID number of active screen
screen_changed_cb
screen_changed_cb_t
Callback for screen changed
screen_updated_cb
screen_changed_cb_t
Callback for screen updated
ui_operation_mode_t
ui_screen_element_t
ui_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
56 of 330
Function Name
OS_BASE_TYPE ui_task_init(void);
Function Description
Initializes UI task.
Parameters
Return Values
OS_OK if initialization completed successfully, OS_FAIL otherwise.
Notes
Function Name
void ui_task_enable_display();
void ui_task_disable_display();
Function Description
Enables\disables display.
Parameters
None
Return Values
Notes
Function Name
void ui_task_register_screen_change_cb(screen_changed_cb_t screen_changed_cb);
void ui_task_register_screen_updated_cb(screen_changed_cb_t
screen_updated_cb);
Function Description
Registers callback function which is called after screen changes/updates.
Parameters
screen_[changed/updated]_cb Pointer to the callback function
Return Values
Notes
Function Name
void ui_task_set_screen(ui_screen_num_t screen);
Function Description
Sets active screen.
Parameters
screen Screen number to set
Return Values
Notes
Valid types (screens) are:
UI_TIME_SCREEN UI_DATE_SCREEN UI_ALARM_SCREEN UI_NFC_SCREEN UI_HEART_RATE_SCREEN UI_STEPS_SCREEN UI_DISTANCE_SCREEN UI_CALORIES_SCREEN UI_LIGHT_SLEEP_SCREEN UI_DEEP_SLEEP_SCREEN UI_TEMPERATURE_SCREEN UI_HUMIDITY_SCREEN UI_PRESSURE_SCREEN
7.1.2 Functions
ui_task_init()
ui_task_[enable/disable]_display()
ui_task_register_screen_[change/updated]_cb()
ui_task_set_screen()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
57 of 330
Function Name
void ui_task_swipe_screen_left();
void ui_task_swipe_screen_right();
void ui_task_swipe_screen_up();
void ui_task_swipe_screen_down();
Function Description
Swipes to left/right/up/down screen.
Parameters
None
Return Values
Notes
Function Name
void ui_task_show_splash_screen();
Function Description
Shows splash screen with Dialog Semi logo.
Parameters
None
Return Values
Notes
Function Name
void ui_task_blink_screen_elem(ui_screen_num_t screen, ui_screen_element_t elem, uint8_t enable);
Function Description
Enables or disables selected screen element blinking.
Parameters
screen Screen number elem Element type enable true to blink element, false to stop blinking
Return Values
Notes
Valid types (screens) are:
UI_NFC_SCREEN UI_HEART_RATE_SCREEN UI_STEPS_SCREEN UI_DISTANCE_SCREEN UI_CALORIES_SCREEN UI_LIGHT_SLEEP_SCREEN UI_DEEP_SLEEP_SCREEN UI_TEMPERATURE_SCREEN UI_HUMIDITY_SCREEN UI_PRESSURE_SCREEN
Function Name
void ui_task_set_change_mode(uint8_t mode);
Function Description
Set change mode for time/date/alarm screen
Parameters
mode The mode of change (highlighted value)
Return Values
Notes
ui_task_swipe_screen_[left/right/up/down]()
ui_task_show_splash_screen()
ui_task_blink_screen_elem()
ui_task_set_change_mode()
ui_task_change_opmode()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
58 of 330
Function Name
void ui_task_change_opmode(ui_screen_num_t screen, ui_op_mode_t opmode);
Function Description
Changes operation mode for the selected screen.
Parameters
screen Screen number opmode Operation mode to set
Return Values
Notes
Valid types (screens) are:
UI_NFC_SCREEN UI_HEART_RATE_SCREEN UI_STEPS_SCREEN UI_DISTANCE_SCREEN UI_CALORIES_SCREEN UI_LIGHT_SLEEP_SCREEN UI_DEEP_SLEEP_SCREEN
Function Name
void ui_task_set_vibration_state (ui_op_mode_t opmode);
Function Description
Set the vibration state
Parameters
opmode Operation mode to set
Return Values
Notes
Valid types (opmode) are:
UI_OP_MODE_ON UI_OP_MODE_OFF
Function Name
void ui_task_set_battery_level(uint8_t level);
Function Description
Sets new value for battery level.
Parameters
level New value for battery level
Return Values
Notes
Function Name
void ui_task_set_battery_state(ui_battery_state_t state);
Function Description
Sets state of battery status.
Parameters
state Value of battery status
Return Values
Notes
Function Name
void ui_task_set_connection_state(uint8_t connected);
Function Description
Sets connection state.
Parameters
connected Connection state
Return Values
Notes
ui_task_set_vibration_state()
ui_task_set_battery_level()
ui_task_set_battery_state()
ui_task_set_connection_state()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
59 of 330
Function Name
void ui_task_set_alarm_state(bool value);
Function Description
Sets state of alarm.
Parameters
value Alarm state (true = ON, false = OFF)
Return Values
Notes
Function Name
void ui_task_set_time_hours_val(uint8_t value);
void ui_task_set_time_minutes_val(uint8_t value);
Function Description
Sets new value for hours/minutes.
Parameters
value New value for hours/minutes
Return Values
Notes
Function Name
void ui_task_set_date_day_val(uint8_t value); void ui_task_set_date_month_val(uint8_t value);
void ui_task_set_date_year_val(uint8_t value);
Function Description
Sets new value for date day/month/year.
Parameters
value New value for day/month/year
Return Values
Notes
Function Name
void ui_task_set_alarm_hours_val(uint8_t value);
void ui_task_set_alarm_minutes_val(uint8_t value);
Function Description
Sets new value for alarm hours/minutes.
Parameters
value New value for hours/minutes
Return Values
Notes
Function Name
void ui_task_set_heart_rate_val(uint8_t value); void ui_task_set_steps_val(uint16_t value); void ui_task_set_distance_val(uint16_t value); void ui_task_set_calories_val(uint16_t value); void ui_task_set_light_sleep_val(uint16_t value); void ui_task_set_deep_sleep_val(uint16_t value); void ui_task_set_temperature_val(uint16_t value); void ui_task_set_humidity_val(uint8_t value);
void ui_task_set_pressure_val(uint16_t value);
Function Description
Sets new value for heart rate / steps / distance / calories / light sleep / deep sleep / temperature / humidity / pressure screen.
Parameters
value New value for corresponding label
Return Values
ui_task_set_alarm_state()
ui_task_set_time_[hours/minutes]_val()
ui_task_set_date_[day/month/year]_val()
ui_task_set_alarm_[hours/minutes]_val()
ui_task_set_[sensor or service]_val()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
60 of 330
Notes
Function Name
void screen_changed_cb(ui_screen_num_t active_screen);
Function Description
Informs of change screen event.
Parameters
active_screen Number of active screen
Return Values
Notes
Function Name
void screen_updated_cb(ui_screen_num_t active_screen);
Function Description
Informs of refresh screen event.
Parameters
active_screen Number of active screen
Return Values
Notes
Structures
gdi_color_t
gdi_t
Functions
gdi_init() gdi_display_isenabled() gdi_display_clear() gdi_set_bg_color() gdi_set_next_frame_buffer() gdi_set_frame_buffer() gdi_draw_[fill_]circle() gdi_draw_image() gdi_draw_arc()
gdi_display_[enable/display]() gdi_update_display() gdi_swipe_[left/right/up/down]() gdi_flush_frame_buffers() gdi_get_current_frame_buffer() gdi_[set/clear]_dot() gdi_draw_line() gdi_draw_[fill_]rect()
Type Definition Name
Description
gdi_color_t
GDI color enumeration type defined as:
GDI_COLOR_BLACK = 0x00, GDI_COLOR_WHITE = 0xFF
7.1.2.2 Callbacks
screen_changed_cb()
screen_updated_cb()
7.2 GUI
The GUI module is the middle layer in communication with the LS013B7DH03 display. There is a set of Graphical Device Interface (GDI) functions, images and widgets that can be called from the upper layers (UI task) for specific operations on the LS013B7DH03 via the display driver API.
7.2.1 GDI
Table 15: GDI API
7.2.1.1 Data Structures and Types
gdi_color_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
61 of 330
Field
Type
Description
buffers[GDI_NUM_OF_BUFFERS]
uint8_t *
Frame buffers table
active_buffer
uint8_t *
Pointer to active frame buffer
buffer_num
uint8_t
Number of active frame buffer
bg_color
gdi_color_t
Display background color
display_enabled
bool
Display enabled state
gdi_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
62 of 330
Function Name
void gdi_init(void);
Function Description
Initializes the GDI instance – allocate memory and set default background color
Parameters
None
Return Values
None
Notes
Function Name
void gdi_display_enable(void); void gdi_display_disable(void);
Function Description
Enable / disable the display
Parameters
None
Return Values
None
Notes
Function Name
bool gdi_display_isenabled(void);
Function Description
Checks if display is enabled
Parameters
None
Return Values
True if display is enabled, false otherwise.
Notes
Function Name
void gdi_update_display(void);
Function Description
Moves data from active frame buffer to the display memory.
Parameters
None
Return Values
None
Notes
Function Name
void gdi_display_clear(void);
Function Description
Clears the display.
Parameters
None
Return Values
None
Notes
Function Name
void gdi_swipe_left(void); void gdi_swipe_right(void); void gdi_swipe_up(void); void gdi_swipe_down(void);
7.2.1.2 Functions
gdi_init()
gdi_display_[enable/display]()
gdi_display_isenabled()
gdi_update_display()
gdi_display_clear()
gdi_swipe_[left/right/up/down]()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
63 of 330
Function Description
Updates display in left/right/up/down direction using data from two frame buffers with swipe animation.
Parameters
None
Return Values
None
Notes
Function Name
void gdi_set_bg_color(gdi_color_t color);
Function Description
Sets the background color for all frame buffers. The existing frame buffer content will be erased.
Parameters
Color Background color: black or white
Return Values
None
Notes
Function Name
void gdi_flush_frame_buffers(void);
Function Description
Clears all frame buffers.
Parameters
None
Return Values
None
Notes
Function Name
void gdi_set_next_frame_buffer(void);
Function Description
Selects next available frame buffer.
Parameters
None
Return Values
None
Notes
Function Name
uint8_t gdi_get_current_frame_buffer(void);
Function Description
Gets number of current frame buffer.
Parameters
None
Return Values
Number of currently selected frame buffer
Notes
Function Name
void gdi_set_frame_buffer(uint8_t frame);
Function Description
Sets active frame buffer.
Parameters
Frame Number of frame buffer
Return Values
None
Notes
gdi_set_bg_color()
gdi_flush_frame_buffers()
gdi_set_next_frame_buffer()
gdi_get_current_frame_buffer()
gdi_set_frame_buffer()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
64 of 330
Function Name
void gdi_set_dot(uint8_t x, uint8_t y); void gdi_clear_dot(uint8_t x, uint8_t y);
Function Description
Draws/clears pixel.
Parameters
x Pixel x coordinate y Pixel y coordinate
Return Values
None
Notes
Function Name
void gdi_draw_circle(uint8_t x0, uint8_t y0, uint8_t radius); void gdi_draw_fill_circle(uint8_t x0, uint8_t y0, uint8_t radius);
Function Description
Draws circle/filled circle.
Parameters
x0 Circle center point x coordinate y0 Circle center point y coordinate radius Circle radius
Return Values
None
Notes
Function Name
void gdi_draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
Function Description
Draws line.
Parameters
x0 Start point x coordinate y0 Start point y coordinate x1 End point x coordinate y1 End point y coordinate
Return Values
None
Notes
Function Name
void gdi_draw_image(uint8_t x, uint8_t y, const uint8_t *image, uint8_t width, uint8_t height);
Function Description
Draw image
Parameters
x Upper left corner x coordinate y Upper left corner y coordinate image Pointer to image bitmap width Image width height Image height
Return Values
None
Notes
Function Name
void gdi_draw_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
void gdi_draw_fill_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
gdi_[set/clear]_dot()
gdi_draw_[fill_]circle()
gdi_draw_line()
gdi_draw_image()
gdi_draw_[fill_]rect()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
65 of 330
Function Description
Draw rectangle/filled rectangle.
Parameters
x Upper left corner x coordinate y Upper left corner y coordinate w Rectangle width h Rectangle height
Return Values
None
Notes
Function Name
void gdi_draw_arc(uint8_t x, uint8_t y, uint8_t r, uint8_t t, int start_angle, int end_angle);
Function Description
Informs of refresh screen event.
Parameters
x Arc center point x coordinate y Arc center point y coordinate r Arc radius t Line thickness start_angle Arc start angle end_angle Arc end angle
Return Values
None
Notes
Structures
ui_battery_state_t ui_align_t ui_screen_item_t ui_static_label_t ui_textbox_t
ui_battery_widget_t ui_item_type_t ui_screen_t ui_status_bar_t
Battery Widget Functions
ui_draw_battery() ui_battery_widget_set_state()
ui_battery_widget_set_level()
Circle Progress Bar Functions
ui_draw_circle_progress()
ui_circle_progress_set_value()
Common Functions
ui_measure_string()
ui_draw_string()
Image Functions
ui_draw_image()
Screen Functions
ui_set_active_screen() ui_prepare_next_screen() ui_set_item_[visibility/validity/blinking]() ui_toggle_item_visibility()
ui_draw_active_screen() ui_swipe_[left/right/up/down]() ui_get_item_[visibility/validity/blinking]()
gdi_draw_arc()
7.2.2 Widgets
Table 16: Widgets API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
66 of 330
Static Label Functions
ui_draw_static_label()
Status Bar Functions
ui_draw_status_bar() ui_register_status_bar()
ui_status_bar_redraw_needed() ui_unregister_status_bar()
Textbox Functions
ui_draw_textbox()
ui_textbox_set_text()
Type Definition Name
Description
ui_battery_state_t
Battery state enumeration type defined as:
UI_BATTERY_NOT_CHARGING, UI_BATTERY_CHARGING, UI_BATTERY_WARNING
Field
Type
Description
level
uint8_t
Battery level
state
ui_battery_state_t
Battery state
Type Definition Name
Description
ui_align_t
Text alignment enumeration type defined as:
UI_ALIGN_LEFT, UI_ALIGN_CENTER,
UI_ALIGN_RIGHT
Type Definition Name
Description
ui_item_type_t
Screen item type enumeration type defined as:
UI_STATIC_LABEL, UI_CIRCLE_PROGRESS_BAR, UI_TEXTBOX, UI_IMAGE,
UI_BATTERY_WIDGET
Field
Type
Description
x
const uint8_t
X coordinate of screen item
y
const uint8_t
Y coordinate of screen item
width
const uint8_t
Width of screen item
height
const uint8_t
Height of screen item
type
const ui_item_type_t
Item type
7.2.2.1 Data Structures and Types
ui_battery_state_t
ui_battery_widget_t
ui_align_t
ui_item_type_t
ui_screen_item_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
67 of 330
Field
Type
Description
properties
const void *
Can be used to store additional item parameters. Each widget has its own parameters.
status
void *
Can be used to handle item status. Currently used only by textbox widget to store initial text.
flags
uint8_t *
Flags used to define item state. These flags are used to determine whether the item should be redrawn or whether it should be visible or not.
Field
Type
Description
flags
uint8_t *
Flags used to define the screen state. These flags are used to determine whether the screen should be redrawn or whether it supports the status bar.
items
const ui_screen_item_t* const *
Array of ui_screen_item_t which contains all screen items.
param
void *
Can be used to store additional screen parameters. Currently not used
on_main
on_main_cb_t
Callback that will be called every time the screen is refreshed.
Field
Type
Description
text
const char *
Label text
align
const ui_align_t
Label text alignment.
font
const font_info_t *
Pointer to the font descriptor.
Field
Type
Description
height
uint8_t
Height of status bar widget
spacer
uint8_t
Defines the space in pixels between two items in the status bar.
items
const ui_screen_item_t* const *
Pointer to the screen item
Field
Type
Description
border
const bool
Display textbox border or not.
font
const font_info_t *
Pointer to the font descriptor.
align
const ui_align_t
Text alignment.
text
char *
Pointer to the textbox text.
ui_screen_t
ui_static_label_t
ui_status_bar_t
ui_textbox_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
68 of 330
Function Name
void ui_draw_battery(const ui_screen_item_t *item, uint8_t x, uint8_t y);
Function Description
Draws battery widget.
Parameters
item Pointer to suitable screen widget x X coordinate of the widget y Y coordinate of the widget
Return Values
None
Notes
Function Name
void ui_battery_widget_set_level(const ui_screen_item_t *item, uint8_t level);
Function Description
Sets battery level.
Parameters
item Pointer to suitable screen widget level Battery level from 0 to 100
Return Values
None
Notes
Function Name
void ui_battery_widget_set_state(const ui_screen_item_t *item, ui_battery_state_t state);
Function Description
Sets battery state.
Parameters
item Pointer to suitable screen widget level Battery state
Return Values
None
Notes
Function Name
void ui_draw_circle_progress(const ui_screen_item_t *item);
Function Description
Draws circle progress bar widget.
Parameters
item Pointer to suitable screen widget
Return Values
None
Notes
Function Name
void ui_circle_progress_set_value(const ui_screen_item_t *item, uint8_t value);
Function Description
Sets progress value.
Parameters
item Pointer to suitable screen widget value Progress bar value
7.2.2.2 Battery Widget Functions
ui_draw_battery()
ui_battery_widget_set_level()
ui_battery_widget_set_state()
7.2.2.3 Circle Progress Bar Functions
ui_draw_circle_progress()
ui_circle_progress_set_value()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
69 of 330
Return Values
None
Notes
Function Name
uint8_t ui_measure_string(const font_info_t * const font, const char * const str);
Function Description
Measures the string length.
Parameters
font Pointer to the font definition str Pointer to the string
Return Values
String length in pixels.
Notes
Function Name
void ui_draw_string(uint8_t x, uint8_t y, const font_info_t * const font, const char * const str);
Function Description
Draws string.
Parameters
x Upper left corner x coordinate y Upper left corner y coordinate font Pointer to the font definition str Pointer to the string
Return Values
None
Notes
Function Name
void ui_draw_image(const ui_screen_item_t *item);
Function Description
Draws image widget.
Parameters
item Pointer to suitable screen widget
Return Values
None
Notes
7.2.2.4 Common Functions
ui_measure_string()
ui_draw_string()
7.2.2.5 Image Functions
ui_draw_image()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
70 of 330
Function Name
void ui_set_active_screen(const ui_screen_t * const screen);
Function Description
Sets active screen.
Parameters
screen Pointer to suitable screen
Return Values
None
Notes
Function Name
uint8_t ui_draw_active_screen(bool force_redraw);
Function Description
Draws active screen.
Parameters
force_redraw True if screen should be redraw
Return Values
1 if screen was redrawn, 0 otherwise
Notes
Function Name
void ui_prepare_next_screen(const ui_screen_t * const screen);
Function Description
Draws next screen in next available frame buffer.
Parameters
screen Pointer to suitable screen
Return Values
None
Notes
Function Name
void ui_swipe_left(const ui_screen_t * const screen); void ui_swipe_right(const ui_screen_t * const screen); void ui_swipe_up(const ui_screen_t * const screen); void ui_swipe_down(const ui_screen_t * const screen);
Function Description
Switches to left/right/up/down screen using swipe animation.
Parameters
screen Pointer to suitable screen
Return Values
None
Notes
Function Name
void ui_set_item_visibility(const ui_screen_item_t * const item, bool visibility); void ui_set_item_validity(const ui_screen_item_t * const item, bool validity); void ui_set_item_blinking(const ui_screen_item_t * const item, bool blinking);
Function Description
Sets visibility / validity / blinking state of screen widget.
7.2.2.6 Screen Functions
ui_set_active_screen()
ui_draw_active_screen()
ui_prepare_next_screen()
ui_swipe_[left/right/up/down]()
ui_set_item_[visibility/validity/blinking]()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
71 of 330
Parameters
item Pointer to suitable screen widget Corresponding parameter visibility Visibility state of screen widget
validity Validity state of screen widget blinking Blinking state of screen widget
Return Values
None
Notes
Function Name
bool ui_get_item_visibility(const ui_screen_item_t * const item); bool ui_get_item_validity(const ui_screen_item_t * const item); bool ui_get_item_blinking(const ui_screen_item_t * const item);
Function Description
Gets current visibility /validity / blinking state of screen widget.
Parameters
item Pointer to suitable screen widget
Return Values
Current visibility / validity / blinking state of screen widget
Notes
Function Name
void ui_toggle_item_visibility(const ui_screen_item_t * const item);
Function Description
Toggles visibility state of screen widget.
Parameters
item Pointer to suitable screen widget
Return Values
None
Notes
Function Name
void ui_draw_static_label(const ui_screen_item_t *item);
Function Description
Draws static label widget.
Parameters
item Pointer to suitable screen widget
Return Values
None
Notes
Function Name
void ui_draw_status_bar(const ui_status_bar_t *status_bar);
Function Description
Draws status bar widget.
Parameters
status_bar Pointer to status bar widget
Return Values
None
Notes
Function Name
uint8_t ui_status_bar_redraw_needed(const ui_status_bar_t *status_bar);
ui_get_item_[visibility/validity/blinking]()
ui_toggle_item_visibility()
7.2.2.7 Static Label Functions
ui_draw_static_label()
7.2.2.8 Status Bar Functions
ui_draw_status_bar()
ui_status_bar_redraw_needed()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
72 of 330
Function Description
Checks if status bar widget should be redrawn.
Parameters
status_bar Pointer to status bar widget
Return Values
None
Notes
Function Name
void ui_register_status_bar(const ui_status_bar_t *bar);
Function Description
Registers status bar.
Parameters
bar Pointer to status bar
Return Values
None
Notes
Function Name
void ui_unregister_status_bar(void);
Function Description
Unregisters status bar.
Parameters
None
Return Values
None
Notes
Function Name
void ui_draw_textbox(const ui_screen_item_t *item);
Function Description
Draws textbox widget.
Parameters
item Pointer to suitable screen widget
Return Values
None
Notes
Function Name
void ui_textbox_set_text(const ui_screen_item_t *item, const char *format, ...);
Function Description
Sets textbox widget text.
Parameters
item Pointer to suitable screen widget format Format string
Return Values
None
Notes
ui_register_status_bar()
ui_unregister_status_bar()
7.2.2.9 Text Box Functions
ui_draw_textbox()
ui_textbox_set_text()
8 Health Toolbox
The main objective of the Health Toolbox software component is to implement all appropriate functionality for the control and data manipulation related to:
Sensor modules integrated in the Wearable DK device, targeting mainly environment, human
motion, and healthcare oriented applications.
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
73 of 330
Services/algorithms processing sensor data and producing human motion and healthcare related
metrics, which determine an estimate of human physical activity and health status.
Based on this basic classification of control and data flows determining the general execution flow inside the Health Toolbox component, three main types of functionality can be identified and corresponding software implementation parts, as shown in Figure 5:
The relatively low level control of sensor modules for the appropriate data acquisition, involving
register accesses and interrupt-handling processes and being implemented by:
Sensor Control component BMI160, BMM150 and BME280 sensor module drivers DI5115 sensor module driver
The processing of sensor data and their transformation to more sophisticated ones, involving the
execution of specialized algorithms and being implemented by:
Health Care Services Task, supporting the following services:
Heart Rate Estimation Sensor Fusion Calories Counting Sleep Quality Estimation
KIWI Services Task, supporting the following services:
Step Counting Calories Counting Sleep Quality Estimation Body State/Activity Classification
The core functionality of coordinating the control and data flows inside the Health Toolbox
component, so that a unified easy-to-use sensor services configuration and data acquisition framework can be offered to the upper application layers (i.e. Wearable Main Application). That functionality is implemented by the Health Toolbox Task.
Figure 5: Health Toolbox Component Software Architecture
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
74 of 330
Sensor or
Service Name
API
Configuration Parameters
Enable/ Disable
Mode
Rate
Other
Sensors
Accelerometer
ht_config_acc()
not available
0.78, 1.56, 3.12,
6.25, 12.5, 25, 50, 100 (Hz)
Range: ±2, ±4, ±8, ±16
(G)
Gyroscope
ht_config_gyr()
not available
25, 50, 100 (Hz)
Range: 125, 250, 500,
1000, 2000 (deg/s)
Magnetometer
ht_config_mag()
(calibration) mode: none, static, basic/smart, auto-continuous or one-shot
0.78, 1.56, 3.12,
6.25, 12.5, 25, 50, 100 (Hz)
not available
Environmental Sensors:
humidity, temperature, pressure
ht_config_env()
not available
no rate, 0.125,
0.25, 0.5, 1, 2, 4, 8 (Hz)
not available
Step Counting
ht_config_step()
not available
no rate, 0.125,
0.25, 0.5, 1, 2, 4, 8 (Hz)
not available
Services
Sensor Fusion
ht_config_sf()
sensor combination: Gyr, Gyr+Mag, Acc+Mag, Acc+Gyr+Mag
12.5, 25, 50 (Hz)
not available Heart Rate
ht_config_hr()
(operation) mode: regular (always on) intermittent
Interval duration: no rate, 1, 3, 5,
7, 15, 30, 60 (s)
not available
Sleep Quality
ht_config_sq()
not available
not available
not available
Calories Counting
ht_config_cc()
(operation) mode: regular robust
Interval duration: no rate, 10, 20,
30, 40, 50, 60, 120, 180, 240, 300 (s)
not available
Body State Classification (Note 1)
ht_config_bs()
not available
not available
not available
Table 17: Basic Health Toolbox API Sensors/Services Configuration Functions
Note 1 Only when KIWI Services component is enabled.
8.1 Health Toolbox Task
The API provided by the Health Toolbox Task includes functions for initializing and controlling its operation, configuring the supported/integrated sensors and services, and finally acquiring the sensors/services' configuration state and last data. All these functions and respective data structures/types being defined in the API are summarized below:
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
75 of 330
Data Structures and Types
ht_error_t ht_calibr_offsets_t ht_acc_config_t ht_env_config_t ht_hr_config_t ht_bs_config_t ht_acc_t ht_env_t ht_hr_t ht_bs_t ht_data_acc_t ht_data_env_t ht_data_hr_t ht_data_bs_t
ht_upf_config_t ht_calibr_coeffs_t ht_gyr_config_t ht_sc_config_t ht_sq_config_t ht_s1_config_t ht_gyr_t ht_sc_t ht_sq_t ht_s1_t ht_data_gyr_t ht_data_sc_t ht_data_sq_t ht_data_s1_t
ht_sf_coeffs_t ht_calibr_ctrl_t ht_mag_config_t ht_sf_config_t ht_cc_config_t ht_upf_t ht_mag_t ht_sf_t ht_cc_t ht_handle_t ht_data_mag_t ht_data_sf_t ht_data_cc_t
Dependency Functions
ht_handle_t -> ht_clear_done() ht_handle_t -> ht_stop_done() ht_handle_t -> ht_state_get_done() ht_handle_t -> ht_data_read_done() ht_handle_t -> ht_data_indication() ht_handle_t -> ht_get_rtc_notifs_config()
ht_handle_t -> ht_start_done() ht_handle_t -> ht_config_done() ht_handle_t -> ht_calibr_done() ht_handle_t -> ht_data_reset_done() ht_handle_t -> ht_error()
Initialization and Control Functions
ht_init() ht_clear() ht_stop()
ht_get_handle() ht_start() ht_rtc_send_notif()
Configuration Functions
ht_config_upf() ht_config_calibr_coeffs_mag() ht_config_calibr_offsets_acc() ht_config_acc() ht_config_mag() ht_config_sc() ht_config_hr() ht_config_cc() ht_config_s1()
ht_config_sf_coeffs() ht_config_calibr_control_mag() ht_config_calibr_offsets_acc_update() ht_config_gyr() ht_config_env() ht_config_sf() ht_config_sq() ht_config_bs()
State Functions
ht_isrunning() ht_state_get_upf() ht_state_get_calibr_coeffs_mag() ht_state_get_acc() ht_state_get_mag() ht_state_get_sc() ht_state_get_hr() ht_state_get_cc() ht_state_get_s1()
ht_time_get_now_ms() ht_state_get_sf_coeffs() ht_state_get_calibr_control_mag() ht_state_get_gyr() ht_state_get_env() ht_state_get_sf() ht_state_get_sq() ht_state_get_bs()
Table 18: Health Toolbox Task API
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
76 of 330
Data Acquisition Functions
ht_data_read_acc() ht_data_read_mag() ht_data_read_sc() ht_data_read_hr() ht_data_read_cc() ht_data_read_s1()
ht_data_read_gyr() ht_data_read_env() ht_data_read_sf() ht_data_read_sq() ht_data_read_bs()
Data-Reset Functions
ht_data_reset_sc() ht_data_reset_cc()
ht_data_reset_sq()
Type Definition Name
Description
ht_error_t
Execution status of a function: HT_SUCCESS, HT_FAIL
Data Structure Fields
Type
Description
gender
uint8_t
User's gender type (m/f): HT_UPF_GENDER_TYPE_FEMALE,
HT_UPF_GENDER_TYPE_MALE
age
uint8_t
User's age (in year).
height
uint8_t
User's height (in cm).
weight
uint8_t
User's weight (in kg).
mv_source
uint8_t
User's wrist as source of movement (right/left):
HT_UPF_MV_SOURCE_LEFT_WRIST,
HT_UPF_MV_SOURCE_RIGHT_WRIST
Data Structure Fields
Type
Description
beta_a
uint16_t
Parameter controlling relative weight of accelerometer data.
beta_m
uint16_t
Parameter controlling relative weight of magnetometer data.
Data Structure Fields
Type
Description
offset_x
int16_t
Applied x-axis offset to sensor data.
offset_y
int16_t
Applied y-axis offset to sensor data.
offset_z
int16_t
Applied z-axis offset to sensor data.
8.1.1 Data Structures and Types
ht_error_t
ht_upf_config_t
ht_sf_coeffs_t
ht_calibr_offsets_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
77 of 330
Data Structure Fields
Type
Description
cal_mode
uint8_t
Magnetometer calibration mode:
HT_MAG_CAL_MODE_NONE, HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
q_format
uint8_t
Calibration coefficients Q format.
offset_vector
int16_t[3]
Offset coefficients.
matrix
int16_t[3][3]
Matrix coefficients.
Data Structure Fields
Type
Description
cal_mode
uint8_t
Magnetometer calibration mode:
HT_MAG_CAL_MODE_NONE, HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
flags
uint16_t
Calibration control flags.
ref_mag
uint16_t
Calibration control param 1.
mag_range
uint16_t
Calibration control param 2.
mag_alpha
uint16_t
Calibration control param 3.
mag_delta_thresh
uint16_t
Calibration control param 4.
mu_offset
uint16_t
Calibration control param 5.
mu_matrix
uint16_t
Calibration control param 6.
err_alpha
uint16_t
Calibration control param 7.
err_thresh
uint16_t
Calibration control param 8.
Data Structure Fields
Type
Description
enable
bool
Enable/disable accelerometer sensor:
HT_DISABLE, HT_ENABLE
range
uint8_t
Accelerometer sensor data range:
HT_ACCEL_RANGE_2G, HT_ACCEL_RANGE_4G, HT_ACCEL_RANGE_8G,
HT_ACCEL_RANGE_16G
ht_calibr_coeffs_t
ht_calibr_ctrl_t
ht_acc_config_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
78 of 330
Data Structure Fields
Type
Description
Rate
uint8_t
Accelerometer sensor data rate:
HT_ACCEL_DATA_RATE_INVALID, HT_ACCEL_DATA_RATE_0_78HZ, HT_ACCEL_DATA_RATE_1_56HZ, HT_ACCEL_DATA_RATE_3_12HZ, HT_ACCEL_DATA_RATE_6_25HZ, HT_ACCEL_DATA_RATE_12_5HZ, HT_ACCEL_DATA_RATE_25HZ, HT_ACCEL_DATA_RATE_50HZ,
HT_ACCEL_DATA_RATE_100HZ
Data Structure Fields
Type
Description
enable
bool
Enable/disable gyroscope sensor: HT_DISABLE, HT_ENABLE
range
uint8_t
Gyroscope sensor data range:
HT_GYRO_RANGE_2000_DEG_SEC, HT_GYRO_RANGE_1000_DEG_SEC, HT_GYRO_RANGE_500_DEG_SEC, HT_GYRO_RANGE_250_DEG_SEC,
HT_GYRO_RANGE_125_DEG_SEC
rate
uint8_t
Gyroscope sensor data rate:
HT_GYRO_DATA_RATE_INVALID, HT_GYRO_DATA_RATE_25HZ, HT_GYRO_DATA_RATE_50HZ,
HT_GYRO_DATA_RATE_100HZ
Data Structure Fields
Type
Description
enable
bool
Enable/disable magnetometer sensor: HT_DISABLE, HT_ENABLE
rate
uint8_t
Magnetometer sensor data rate:
HT_MAG_DATA_RATE_INVALID, HT_MAG_DATA_RATE_0_78HZ, HT_MAG_DATA_RATE_1_56HZ, HT_MAG_DATA_RATE_3_12HZ, HT_MAG_DATA_RATE_6_25HZ, HT_MAG_DATA_RATE_12_5HZ, HT_MAG_DATA_RATE_25HZ, HT_MAG_DATA_RATE_50HZ,
HT_MAG_DATA_RATE_100HZ
cal_mode
uint8_t
Magnetometer sensor calibration mode:
HT_MAG_CAL_MODE_NONE, HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
ht_gyr_config_t
ht_mag_config_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
79 of 330
Data Structure Fields
Type
Description
enable
bool
Enable/disable environmental sensors: HT_DISABLE, HT_ENABLE
rate
uint32_t
Environmental sensors data rate:
HT_ENV_DATA_RATE_0_125HZ, HT_ENV_DATA_RATE_0_25HZ, HT_ENV_DATA_RATE_0_5HZ, HT_ENV_DATA_RATE_1HZ, HT_ENV_DATA_RATE_2HZ, HT_ENV_DATA_RATE_4HZ, HT_ENV_DATA_RATE_8HZ,
HT_ENV_DATA_RATE_DISABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable step counting service:
HT_DISABLE, HT_ENABLE
rate
uint32_t
Step counting service data rate:
HT_SC_DATA_RATE_0_125HZ, HT_SC_DATA_RATE_0_25HZ, HT_SC_DATA_RATE_0_5HZ, HT_SC_DATA_RATE_1HZ, HT_SC_DATA_RATE_2HZ, HT_SC_DATA_RATE_4HZ, HT_SC_DATA_RATE_8HZ,
HT_SC_DATA_RATE_DISABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable sensor fusion service:
HT_DISABLE, HT_ENABLE
mode
uint8_t
Sensor fusion mode:
HT_SF_MODE_GYR, HT_SF_MODE_ACC_GYR, HT_SF_MODE_ACC_MAG,
HT_SF_MODE_ACC_GYR_MAG
rate
uint8_t
Sensor fusion service data rate:
HT_SF_DATA_RATE_INVALID, HT_SF_DATA_RATE_0_78HZ, HT_SF_DATA_RATE_1_56HZ, HT_SF_DATA_RATE_3_12HZ, HT_SF_DATA_RATE_6_25HZ, HT_SF_DATA_RATE_12_5HZ, HT_SF_DATA_RATE_25HZ,
HT_SF_DATA_RATE_50HZ
coeffs
ht_sf_coeffs_t
Sensor fusion coefficients.
ht_env_config_t
ht_sc_config_t
ht_sf_config_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
80 of 330
Data Structure Fields
Type
Description
enable
bool
Enable/disable heart rate estimation service:
HT_DISABLE, HT_ENABLE
mode
uint8_t
Heart rate estimation mode:
HT_HR_MODE_REGULAR,
HT_HR_MODE_INTERMITTENT
rate
uint32_t
Heart rate estimation service data rate:
HT_HR_DATA_RATE_1_PER_60SEC_HZ, HT_HR_DATA_RATE_1_PER_30SEC_HZ, HT_HR_DATA_RATE_1_PER_15SEC_HZ, HT_HR_DATA_RATE_1_PER_7SEC_HZ, HT_HR_DATA_RATE_1_PER_3SEC_HZ, HT_HR_DATA_RATE_1_PER_1SEC_HZ,
HT_HR_DATA_RATE_DISABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable sleep quality monitoring service: HT_DISABLE, HT_ENABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable calories counting service:
HT_DISABLE, HT_ENABLE
mode
uint8_t
Calories counting mode:
HT_CC_MODE_REGULAR,
HT_CC_MODE_ROBUST
rate
uint8_t
Calories counting service data rate:
HT_CC_DATA_RATE_1_PER_5MIN_HZ, HT_CC_DATA_RATE_1_PER_4MIN_HZ, HT_CC_DATA_RATE_1_PER_3MIN_HZ, HT_CC_DATA_RATE_1_PER_2MIN_HZ, HT_CC_DATA_RATE_1_PER_1MIN_HZ, HT_CC_DATA_RATE_1_PER_50SEC_HZ, HT_CC_DATA_RATE_1_PER_40SEC_HZ, HT_CC_DATA_RATE_1_PER_30SEC_HZ, HT_CC_DATA_RATE_1_PER_20SEC_HZ, HT_CC_DATA_RATE_1_PER_10SEC_HZ,
HT_CC_DATA_RATE_DISABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable body state classification service: HT_DISABLE, HT_ENABLE
Data Structure Fields
Type
Description
enable
bool
Enable/disable (template) s1 service: HT_DISABLE, HT_ENABLE
ht_hr_config_t
ht_sq_config_t
ht_cc_config_t
ht_bs_config_t
ht_s1_config_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
81 of 330
Data Structure Fields
Type
Description
mode
uint8_t
(Template) s1 mode:
HT_S1_MODE_TYPE_MODE_1,
HT_S1_MODE_TYPE_MODE_2
rate
uint8_t
(Template) s1 service data rate:
HT_S1_DATA_RATE_INVALID, HT_S1_DATA_RATE_0_78HZ, HT_S1_DATA_RATE_1_56HZ, HT_S1_DATA_RATE_3_12HZ, HT_S1_DATA_RATE_6_25HZ, HT_S1_DATA_RATE_12_5HZ, HT_S1_DATA_RATE_25HZ, HT_S1_DATA_RATE_50HZ,
HT_S1_DATA_RATE_100HZ
acc_range
uint8_t
(Template) s1 accelerometer (as input) sensor data range:
HT_ACCEL_RANGE_2G, HT_ACCEL_RANGE_4G, HT_ACCEL_RANGE_8G,
HT_ACCEL_RANGE_16G
acc_rate
uint8_t
(Template) s1 accelerometer (as input) sensor data rate:
HT_ACCEL_DATA_RATE_INVALID, HT_ACCEL_DATA_RATE_0_78HZ, HT_ACCEL_DATA_RATE_1_56HZ, HT_ACCEL_DATA_RATE_3_12HZ, HT_ACCEL_DATA_RATE_6_25HZ, HT_ACCEL_DATA_RATE_12_5HZ, HT_ACCEL_DATA_RATE_25HZ, HT_ACCEL_DATA_RATE_50HZ,
HT_ACCEL_DATA_RATE_100HZ
gyr_range
uint8_t
(Template) s1 gyroscope (as input) sensor data range:
HT_GYRO_RANGE_2000_DEG_SEC, HT_GYRO_RANGE_1000_DEG_SEC, HT_GYRO_RANGE_500_DEG_SEC, HT_GYRO_RANGE_250_DEG_SEC,
HT_GYRO_RANGE_125_DEG_SEC
gyr_rate
uint8_t
(Template) s1 gyroscope (as input) sensor data rate:
HT_GYRO_DATA_RATE_INVALID, HT_GYRO_DATA_RATE_25HZ, HT_GYRO_DATA_RATE_50HZ,
HT_GYRO_DATA_RATE_100HZ
mag_rate
uint8_t
(Template) s1 magnetometer (as input) sensor data rate:
HT_MAG_DATA_RATE_INVALID, HT_MAG_DATA_RATE_0_78HZ, HT_MAG_DATA_RATE_1_56HZ, HT_MAG_DATA_RATE_3_12HZ, HT_MAG_DATA_RATE_6_25HZ, HT_MAG_DATA_RATE_12_5HZ, HT_MAG_DATA_RATE_25HZ, HT_MAG_DATA_RATE_50HZ,
HT_MAG_DATA_RATE_100HZ
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
82 of 330
Data Structure Fields
Type
Description
gender
uint8_t
Calories counting user's gender type (m/f):
HT_UPF_GENDER_TYPE_FEMALE,
HT_UPF_GENDER_TYPE_MALE
height
uint8_t
Calories counting user's height (in cm).
weight
uint8_t
Calories counting user's weight (in kg).
Type Definition Name
Description
ht_upf_t
Configuration state structure for user profile attributes: ht_upf_config_t
Type Definition Name
Description
ht_acc_t
Configuration state structure for accelerometer sensor: ht_acc_config_t
Type Definition Name
Description
ht_gyr_t
Configuration state structure for gyroscope sensor: ht_gyr_config_t
Type Definition Name
Description
ht_mag_t
Configuration state structure for magnetometer sensor: ht_mag_config_t
Type Definition Name
Description
ht_env_t
Configuration state structure for environmental sensors: ht_env_config_t
Type Definition Name
Description
ht_sc_t
Configuration state structure for step counting service: ht_sc_config_t
Type Definition Name
Description
ht_sf_t
Configuration state structure for sensor fusion setvice: ht_sf_config_t
ht_upf_t
ht_acc_t
ht_gyr_t
ht_mag_t
ht_env_t
ht_sc_t
ht_sf_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
83 of 330
Type Definition Name
Description
ht_hr_t
Configuration state structure for heart rate estimation service: ht_hr_config_t
Type Definition Name
Description
ht_sq_t
Configuration state structure for sleep quality monitoring service: ht_sq_config_t
Type Definition Name
Description
ht_cc_t
Configuration state structure for calories counting service: ht_cc_config_t
Type Definition Name
Description
ht_bs_t
Configuration state structure for body state classification service: ht_bs_config_t
Type Definition Name
Description
ht_s1_t
Configuration state structure for (template) s1 service: ht_s1_config_t
Data Structure Fields
Type
Description
ht_clear_done
Function pointer
Function for clear-done indication.
ht_start_done
Function pointer
Function for start-done indication.
ht_stop_done
Function pointer
Function for stop-done indication.
ht_config_done
Function pointer
Function for config-done indication.
ht_state_get_done
Function pointer
Function for state-get-done indication.
ht_calibr_done
Function pointer
Function for calibr-done-done indication.
ht_data_read_done
Function pointer
Function for data-read-done indication.
ht_data_reset_done
Function pointer
Function for data-reset-done indication.
ht_data_indication
Function pointer
Function for data indication.
ht_error
Function pointer
Function for error indication.
ht_get_rtc_notifs_config
Function pointer
Function for acquiring RTC availability and interval.
Data Structure Fields
Type
Description
xyz.x
int16_t
Accelerometer x-axis sensor data value.
ht_hr_t
ht_sq_t
ht_cc_t
ht_bs_t
ht_s1_t
ht_handle_t
ht_data_acc_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
84 of 330
Data Structure Fields
Type
Description
xyz.y
int16_t
Accelerometer y-axis sensor data value.
xyz.z
int16_t
Accelerometer z-axis sensor data value.
calibr_state. uncalibr_data_valid
uint8_t:1
Pre-calibrated data valid flag.
calibr_state. calibr_data_valid
uint8_t:1
Post-calibrated data valid flag.
calibr_state. cal_enabled
uint8_t:1
Calibration enabled flag.
calibr_state. cal_settled
uint8_t:1
Calibration settled flag.
calibr_state. reserved4
uint8_t:1
Reserved flag.
calibr_state. cal_mode
uint8_t:3
Calibration mode: 0 for NONE, 1 for STATIC
Data Structure Fields
Type
Description
xyz.x
int16_t
Gyroscope x-axis sensor data value.
xyz.y
int16_t
Gyroscope y-axis sensor data value.
xyz.z
int16_t
Gyroscope z-axis sensor data value.
Data Structure Fields
Type
Description
xyz.x
int16_t
Magnetometer x-axis sensor data value.
xyz.y
int16_t
Magnetometer y-axis sensor data value.
xyz.z
int16_t
Magnetometer z-axis sensor data value.
calibr_state.
uncalibr_data_valid
uint8_t:1
Pre-calibrated data valid flag.
calibr_state.
calibr_data_valid
uint8_t:1
Post-calibrated data valid flag.
calibr_state. cal_enabled
uint8_t:1
Calibration enabled flag.
calibr_state. cal_settled
uint8_t:1
Calibration settled flag.
calibr_state.
cal_converged
uint8_t:1
Calibration converged flag.
calibr_state. cal_mode
uint8_t:3
Calibration mode:
HT_MAG_CAL_MODE_NONE. HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
Data Structure Fields
Type
Description
temperature
int32_t
Temperature sensor data (in 0.01 degrees Celsius).
pressure
uint32_t
Pressure sensor data (in Pa).
ht_data_gyr_t
ht_data_mag_t
ht_data_env_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
85 of 330
Data Structure Fields
Type
Description
humidity
uint32_t
Humidity sensor data (in %RH as unsigned 32-bit integer in Q22.10 format (22 integer 10 fractional bits)).
Data Structure Fields
Type
Description
step_count
uint32_t
Number of steps counted.
Data Structure Fields
Type
Description
quaternion_w
int32_t
Sensor fusion service data quartenion w.
quaternion_x
int32_t
Sensor fusion service data quartenion x.
quaternion_y
int32_t
Sensor fusion service data quartenion y.
quaternion_z
int32_t
Sensor fusion service data quartenion z.
mag_calibr_state.
uncalibr_data_valid
uint8_t:1
Pre-calibrated data valid flag.
mag_calibr_state.
calibr_data_valid
uint8_t:1
Post-calibrated data valid flag.
mag_calibr_state.
cal_enabled
uint8_t:1
Calibration enabled flag.
mag_calibr_state.
cal_settled
uint8_t:1
Calibration settled flag.
mag_calibr_state.
cal_converged
uint8_t:1
Calibration converged flag.
calibr_state. cal_mode
uint8_t:3
Calibration mode:
HT_MAG_CAL_MODE_NONE. HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
Data Structure Fields
Type
Description
heart_rate
uint8_t
Heart rate (in bpm).
Data Structure Fields
Type
Description
invalid
int32_t
Number of consecutive epochs classified as INVALID.
awake
int32_t
Number of consecutive epochs classified as AWAKE.
light_sleep
int32_t
Number of consecutive epochs classified as LIGHT SLEEP.
deep_sleep
int32_t
Number of consecutive epochs classified as DEEP SLEEP.
rem
int32_t
Number of consecutive epochs classified as REM.
error
int32_t
Number of consecutive epochs classified as ERROR.
ht_data_sc_t
ht_data_sf_t
ht_data_hr_t
ht_data_sq_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
86 of 330
Data Structure Fields
Type
Description
epoch
uint32_t
First epoch number sleep quality monitoring data refer to.
Data Structure Fields
Type
Description
calories
int32_t
Amount of calories burned (in cal).
distance
int32_t
Distance covered (in cm).
num_of_epochs
int32_t
Number of epochs included.
epoch
uint32_t
First epoch number calories counting data refer to.
Data Structure Fields
Type
Description
body_state
uint8_t
Body state classification value:
HT_BODY_STATE_OTHER, HT_BODY_STATE_WALK, HT_BODY_STATE_RUN, HT_BODY_STATE_SIT, HT_BODY_STATE_STAND,
HT_BODY_STATE_LAYING_DOWN
Data Structure Fields
Type
Description
dataVal1
int16_t
(Template) s1 service dataVal1 value.
dataVal2
int16_t
(Template) s1 service dataVal2 value.
dataVal3
int32_t
(Template) s1 service dataVal3 value.
ht_data_cc_t
ht_data_bs_t
ht_data_s1_t
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
87 of 330
Function Name
void (*ht_clear_done)(ht_error_t error)
Function Description
(Optional) Handles indication that Health Toolbox Task has been cleared.
Parameters
error the execution status of clear operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_start_done)(ht_error_t error)
Function Description
(Optional) Handles indication that Health Toolbox Task has been started.
Parameters
error the execution status of start operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_stop_done)(ht_error_t error)
Function Description
(Optional) Handles indication that Health Toolbox Task has been stopped.
Parameters
error the execution status of stop operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_config_done)(uint8_t type, ht_error_t error)
Function Description
(Optional) Handles indication that Health Toolbox Task has been configured in terms of a specific sensor or service.
Parameters
type the sensor or service type
HT_CONFIG_UPF , HT_CONFIG_SF_COEFFS, HT_CONFIG_CALIBR_COEFFS_MAG , HT_CONFIG_CALIBR_CONTROL_MAG, HT_CONFIG_CALIBR_OFFSETS_ACC , HT_CONFIG_CALIBR_OFFSETS_ACC_UPDATE, HT_CONFIG_ACC , HT_CONFIG_GYR, HT_CONFIG_MAG , HT_CONFIG_ENV, HT_CONFIG_SC , HT_CONFIG_SF, HT_CONFIG_HR , HT_CONFIG_SQ, HT_CONFIG_CC , HT_CONFIG_BS, HT_CONFIG_S1
error the execution status of config operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
8.1.2 Dependency Functions
ht_handle_t -> ht_clear_done()
ht_handle_t -> ht_start_done()
ht_handle_t -> ht_stop_done()
ht_handle_t -> ht_config_done()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
88 of 330
Function Name
void (*ht_state_get_done)(uint8_t type, void* state, ht_error_t error)
Function Description
(Optional) Handles indication that the configuration state of a specific sensor or service in Health Toolbox component has been acquired.
Parameters
type the sensor or service type
HT_STATE_UPF , HT_STATE_BASIC_ATTRS, HT_STATE_SF_COEFFS , HT_STATE_CALIBR_COEFFS_MAG, HT_STATE_CALIBR_CONTROL_MAG, HT_STATE_CALIBR_OFFSETS_ACC, HT_STATE_ACC, HT_STATE_GYR , HT_STATE_MAG, HT_STATE_ENV, HT_STATE_SC , HT_STATE_SF, HT_STATE_HR , HT_STATE_SQ , HT_STATE_CC, HT_STATE_BS , HT_STATE_S1
state the configuration state of the sensor or service error the execution status of state-get operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_calibr_done)(uint8_t type, void* data, ht_error_t error)
Function Description
(Optional) Handles indication that the calibration process of a specific sensor in Health Toolbox component has been completed.
Parameters
type the sensor type
HT_CALIBR_OFFSETS_ACC, HT_CALIBR_CONTROL_MAG, HT_CALIBR_COEFFS_MAG
data the calibration data for the sensor error the execution status of calibration operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_data_read_done)(uint8_t type, void* data, ht_error_t error)
Function Description
(Optional) Handles indication that reading data of a specific sensor or service in Health Toolbox component has been completed.
Parameters
type the sensor or service type
HT_SENSOR_TYPE_ACC , HT_SENSOR_TYPE_GYR , HT_SENSOR_TYPE_MAG, HT_SENSOR_TYPE_ENV , HT_SERVICE_TYPE_SC , HT_SERVICE_TYPE_SF, HT_SERVICE_TYPE_HR , HT_SERVICE_TYPE_HRI, HT_SERVICE_TYPE_SQ , HT_SERVICE_TYPE_SQU, HT_SERVICE_TYPE_SQT, HT_SERVICE_TYPE_CC , HT_SERVICE_TYPE_CCT, HT_SERVICE_TYPE_BS , HT_SERVICE_TYPE_S1
data the acquired sensor or service data error the execution status of data-read operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
ht_handle_t -> ht_state_get_done()
ht_handle_t -> ht_calibr_done()
ht_handle_t -> ht_data_read_done()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
89 of 330
Function Name
void (*ht_data_reset_done)(uint8_t type, ht_error_t error)
Function Description
(Optional) Handles indication that resetting data of a specific sensor or service in Health Toolbox component has been completed.
Parameters
type the sensor or service type
HT_SERVICE_TYPE_SC, HT_SERVICE_TYPE_SQT, HT_SERVICE_TYPE_CCT
error the execution status of data-reset operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_data_indication)(uint8_t type, void* data, ht_error_t error)
Function Description
(Optional) Handles indication that new data of a specific sensor or service in Health Toolbox component have been produced.
Parameters
type the sensor or service type
HT_SENSOR_TYPE_ACC, HT_SENSOR_TYPE_GYR, HT_SENSOR_TYPE_MAG, HT_SENSOR_TYPE_ENV, HT_SERVICE_TYPE_SC, HT_SERVICE_TYPE_SF, HT_SERVICE_TYPE_HR, HT_SERVICE_TYPE_HRI, HT_SERVICE_TYPE_SQ, HT_SERVICE_TYPE_SQU, HT_SERVICE_TYPE_SQT, HT_SERVICE_TYPE_CC, HT_SERVICE_TYPE_CCT, HT_SERVICE_TYPE_BS, HT_SERVICE_TYPE_S1
data the produced/notified sensor or service data error the execution status of new data indication operation
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_error)(uint8_t type, ht_error_t error)
Function Description
(Optional) Handles indication of an error in Health Toolbox component being produced.
ht_handle_t -> ht_data_reset_done()
ht_handle_t -> ht_data_indication()
ht_handle_t -> ht_error()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
90 of 330
Parameters
type the error type
HT_ACQ_STATE_ERROR, HT_INIT_ERROR, HT_CONFIG_TYPE_ERROR, HT_STATE_GET_TYPE_ERROR, HT_CALIBR_TYPE_ERROR, HT_FORCE_READ_DATA_TYPE_ERROR, HT_RESET_DATA_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_SF_ERROR, HT_PROCESS_SERVICE_DATA_SF_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_HR_ERROR, HT_PROCESS_SERVICE_DATA_HR_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_SQ_ERROR, HT_PROCESS_SERVICE_DATA_SQ_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_CC_ERROR, HT_PROCESS_SERVICE_DATA_CC_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_BS_TYPE_ERROR, HT_PROCESS_SERVICE_DATA_S1_TYPE_ERROR, HT_CATCH_INTR_1_ERROR, HT_HEALTH_CARE_SERVICES_CONFIG_REQ_ERROR, HT_KIWI_SERVICES_CONFIG_REQ_ERROR, HT_OTHER_SERVICES_CONFIG_REQ_ERROR, HT_TASK_CONTEXT_REQ_ERROR, HT_OS_TASKNOTIFY_TASK_CONTEXT_REQ_ERROR, HT_OS_TASKNOTIFY_STATE_CHANGE_TIME_ERROR, HT_OS_TASKNOTIFY_STATE_GET_ERROR, HT_OS_TASKNOTIFY_CALIBR_ERROR, HT_OS_TASKNOTIFY_FORCE_READ_DATA_ERROR, HT_OS_TASKNOTIFY_RESET_DATA_ERROR, HT_OS_TASKNOTIFY_CONTROL_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_SF_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_HR_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_SQ_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_CC_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_BS_ERROR, HT_OS_TASKNOTIFY_PROCESS_SERVICE_DATA_S1_ERROR
error the execution status in Health Toolbox component
HT_SUCCESS, ≥ HT_FAIL
Return Values
None
Notes
Function Name
void (*ht_get_rtc_notifs_config)(bool* enable, uint32_t* interval)
Function Description
(Optional) Acquires RTC configuration, i.e. availability/status and interval.
Parameters
enable the status of RTC operation
HT_DISABLE, HT_ENABLE
interval the (periodic) interval of RTC ticks (in ms)
Return Values
None
Notes
Function Name
ht_error_t ht_init(ht_handle_t* handle)
ht_handle_t -> ht_get_rtc_notifs_config()
8.1.3 Initialization and Control Functions
ht_init()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
91 of 330
Function Description
Initializes Health Toolbox, setting initial values to the internal variables and structures, creating a FreeRTOS task for control coordination and data manipulation, and initializing services, sensors (putting to suspend mode) and other processes being supported. Function callbacks may be set to the ht_handle_t instance handle, so that control and data indications can be sent.
Parameters
handle the handle structure of Health Toolbox
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
All callback functions defined in ht_handle_t structure are optional.
Function Name
ht_handle_t* ht_get_handle(void)
Function Description
Gets the handle structure of Health Toolbox.
Parameters
None
Return Values
Pointer to the handle structure of Health Toolbox.
Notes
Function Name
ht_error_t ht_clear(void)
Function Description
Clears Health Toolbox, freeing previously allocated resources. If the respective function pointer is defined in ht_handle_t instance handle, a clear-done indication is sent via ht_clear_done() callback function.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_start(void)
Function Description
Starts Health Toolbox, configuring with default parameter values the services being supported. If the respective function pointer is defined in ht_handle_t instance handle, a start-done indication is sent via ht_start_done() callback function.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_stop(void)
Function Description
Stops Health Toolbox, disabling all services being supported. If the respective function pointer is defined in ht_handle_t instance handle, a stop-done indication is sent via ht_stop_done() callback function.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
ht_get_handle()
ht_clear()
ht_start()
ht_stop()
ht_rtc_send_notif()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
92 of 330
Function Name
ht_error_t ht_rtc_send_notif(void)
Function Description
Sends RTC tick notification to Health Toolbox. If RTC interval is not appropriate for Health Toolbox operation, RTC tick notification is ignored.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_upf(ht_upf_config_t* config)
Function Description
Configures user profile attributes. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_UPF.
Parameters
config the configuration structure of user profile attributes
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_sf_coeffs(ht_sf_coeffs_t* config)
Function Description
Configures sensor fusion coefficients. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_SF_COEFFS.
Parameters
config the configuration structure of sensor fusion coefficients
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_calibr_coeffs_mag(ht_calibr_coeffs_t* config)
Function Description
Configures magnetometer calibration coefficients. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via
ht_config_done() callback function, setting parameter type to HT_CONFIG_CALIBR_COEFFS_MAG.
Parameters
config the configuration structure of magnetometer calibration coefficients
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_calibr_control_mag(ht_calibr_ctrl_t* config)
8.1.3.2 Configuration Functions
ht_config_upf()
ht_config_sf_coeffs()
ht_config_calibr_coeffs_mag()
ht_config_calibr_control_mag()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
93 of 330
Function Description
Configures magnetometer calibration control. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via
ht_config_done() callback function, setting parameter type to HT_CONFIG_CALIBR_CONTROL_MAG.
A calibration-control-changed indication is sent via ht_calibr_done() callback function, setting parameter type to HT_CALIBR_CONTROL_MAG.
A calibration-done indication is sent via ht_calibr_done() callback function, setting parameter type to HT_CALIBR_COEFFS_MAG.
Parameters
config the configuration structure of magnetometer calibration control
Return Values
HT_SUCCESS for successful execution; HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_calibr_offsets_acc(ht_calibr_offsets_t* config)
Function Description
Configures accelerometer calibration offsets. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via
ht_config_done() callback function, setting parameter type to HT_CONFIG_CALIBR_OFFSETS_ACC.
Parameters
config the configuration structure of accelerometer calibration offsets
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_calibr_offsets_acc_update(void)
Function Description
Updates accelerometer calibration offsets. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via
ht_config_done() callback function, setting parameter type to HT_CONFIG_CALIBR_OFFSETS_ACC_UPDATE.
A calibration-done indication is sent via ht_calibr_done() callback function, setting parameter type to HT_CALIBR_OFFSETS_ACC.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_acc(ht_acc_config_t* config)
Function Description
Configures accelerometer sensor. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_ACC.
Accelerometer data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SENSOR_TYPE_ACC.
Parameters
config the configuration structure of accelerometer sensor
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
ht_config_calibr_offsets_acc()
ht_config_calibr_offsets_acc_update()
ht_config_acc()
ht_config_gyr()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
94 of 330
Function Name
ht_error_t ht_config_gyr(ht_gyr_config_t* config)
Function Description
Configures gyroscope sensor. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_GYR.
Gyroscope data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SENSOR_TYPE_GYR.
Parameters
config the configuration structure of gyroscope sensor
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_mag(ht_mag_config_t* config)
Function Description
Configures magnetometer sensor. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_MAG.
Magnetometer data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SENSOR_TYPE_MAG.
Parameters
config the configuration structure of magnetometer sensor
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_env(ht_env_config_t* config)
Function Description
Configures environmental sensors. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_ENV.
Environmental data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SENSOR_TYPE_ENV.
Parameters
config the configuration structure of environmental sensors
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_sc(ht_sc_config_t* config)
Function Description
Configures step counting service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_SC.
Step counting service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_SC.
Parameters
config the configuration structure of step counting service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_sf(ht_sf_config_t* config)
ht_config_mag()
ht_config_env()
ht_config_sc()
ht_config_sf()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
95 of 330
Function Description
Configures sensor fusion service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_SF.
Sensor fusion service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_SF.
Parameters
config the configuration structure of sensor fusion service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_hr(ht_hr_config_t* config)
Function Description
Configures heart rate estimation service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_HR.
Heart rate estimation service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_HR.
Parameters
config the configuration structure of heart rate estimation service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_sq(ht_sq_config_t* config)
Function Description
Configures sleep quality monitoring service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_SQ.
Sleep quality monitoring service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_SQ.
Parameters
config the configuration structure of slep quality monitoring service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_cc(ht_cc_config_t* config)
Function Description
Configures calories counting service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_CC.
Calories counting service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_CC.
Parameters
config the configuration structure of calories counting service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_bs(ht_bs_config_t* config)
ht_config_hr()
ht_config_sq()
ht_config_cc()
ht_config_bs()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
96 of 330
Function Description
Configures body state classification service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_BS.
Body state classification service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_BS.
Parameters
config the configuration structure of body state classification service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_config_s1(ht_s1_config_t* config)
Function Description
Configures (template) s1 service. If the respective function pointer is defined in ht_handle_t instance handle, a config-done indication is sent via ht_config_done() callback function, setting parameter type to HT_CONFIG_S1.
(Template) s1 service data indications are sent via ht_data_indication() callback function, setting parameter type to HT_SERVICE_TYPE_S1.
Parameters
config the configuration structure of (template) s1 service
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
bool ht_isrunning(void)
Function Description
Checks if Health Toolbox task is running.
Parameters
None
Return Values
true if running; false if not running
Notes
Function Name
ht_error_t ht_time_get_now_ms(uint32_t* now)
Function Description
Gets local time indicated by a sensor module clock in ms.
Parameters
now the address to store the local time
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_upf(void)
Function Description
Gets configuration status of user profile attributes. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_UPF.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
ht_config_s1()
8.1.3.3 State Functions
ht_isrunning()
ht_time_get_now_ms()
ht_state_get_upf()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
97 of 330
Notes
Function Name
ht_error_t ht_state_get_sf_coeffs(void)
Function Description
Gets configuration status of sensor fusion coefficients. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_SF_COEFFS.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_calibr_coeffs_mag(uint8_t cal_mode)
Function Description
Gets configuration status of magnetometer calibration coefficients for a specific calibration mode. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_CALIBR_COEFFS_MAG.
Parameters
cal_mode the calibration mode to which calibration coefficients refer
HT_MAG_CAL_MODE_NONE, HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART, HT_MAG_CAL_MODE_CONT_AUTO_SMART
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_calibr_control_mag(uint8_t cal_mode)
Function Description
Gets configuration status of magnetometer calibration control for a specific calibration mode. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_CALIBR_CONTROL_MAG.
Parameters
cal_mode the calibration mode to which calibration control refers
HT_MAG_CAL_MODE_NONE, HT_MAG_CAL_MODE_STATIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_BASIC, HT_MAG_CAL_MODE_CONT_AUTO_BASIC, HT_MAG_CAL_MODE_ONE_SHOT_AUTO_SMART,
HT_MAG_CAL_MODE_CONT_AUTO_SMART
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_acc(void)
ht_state_get_sf_coeffs()
ht_state_get_calibr_coeffs_mag()
ht_state_get_calibr_control_mag()
ht_state_get_acc()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
98 of 330
Function Description
Gets configuration status of accelerometer sensor. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_ACC.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_gyr(void)
Function Description
Gets configuration status of gyroscope sensor. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_GYR.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_mag(void)
Function Description
Gets configuration status of magnetometer sensor. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_MAG.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_env(void)
Function Description
Gets configuration status of environmental sensors. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_ENV.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_sc(void)
Function Description
Gets configuration status of step counting service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_SC.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
ht_state_get_gyr()
ht_state_get_mag()
ht_state_get_env()
ht_state_get_sc()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
99 of 330
Notes
Function Name
ht_error_t ht_state_get_sf(void)
Function Description
Gets configuration status of sensor fusion service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_SF.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_hr(void)
Function Description
Gets configuration status of heart rate estimation service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_HR.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_sq(void)
Function Description
Gets configuration status of sleep quality monitoring service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_SQ.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_cc(void)
Function Description
Gets configuration status of calories counting service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_CC.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_bs(void)
ht_state_get_sf()
ht_state_get_hr()
ht_state_get_sq()
ht_state_get_cc()
ht_state_get_bs()
UM-B-085
DA14681 Wearable Development Kit API
User Manual
Revision 1.0
CFR0012
100 of 330
Function Description
Gets configuration status of body state classification service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_BS.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
Function Name
ht_error_t ht_state_get_s1(void)
Function Description
Gets configuration status of (template) s1 service. If the respective function pointer is defined in ht_handle_t instance handle, a state-get-done indication is sent via ht_state_get_done() callback function, carrying the configuration status structure and setting parameter type to HT_STATE_S1.
Parameters
None
Return Values
HT_SUCCESS for successful execution; ≥ HT_FAIL for error
Notes
ht_state_get_s1()
Loading...