SpO2 spot measurement
With a spot measurement your app saves an SpO₂ value that was measured on the patient with an external device, for example a pulse oximeter. The SDK stores the value with a precise start and end time and sends it to the bracelet. This gives accurate time-based tracking and makes it possible to compare the measurements.
The SDK does not measure the value: your app supplies it.
Requirements
Only available for B2 (287-2B) from FW 7.33
From SDK 1.1.20
- The bracelet is connected and its bracelet initialization has finished.
- A valid licence. While the SDK is locked,
initSpotMeasurementfails withSdkLicenceException. See Licence Key.
The SDK reads the firmware version at each call and refuses a firmware below 7.33.
Implementation
The Sample App contains directions and example code for the SpO₂ spot measurement. Follow these steps to integrate the feature:

Both calls are suspend functions of the spot measurement manager. There is no listener: the result of each call is its return value.
val manager = DataSdk.getInstance().getManager()
val spotManager = manager.getSpotMeasurementManager()
val bleDevice = BleSdk.getInstance().getDevice(address) // address: the bracelet's BLE MAC address
SDK call 1: start of the measurement
Call it when the user starts the measurement with the external device:
val result = spotManager.initSpotMeasurement(bleDevice, Date().time) // Result<SpotMeasurementDB?>
It starts the spot measurement mode on the bracelet and creates a measurement without an end in the database. The second parameter is the start time, in epoch milliseconds.
A failed Result means that nothing was started:
| Cause | What to do |
|---|---|
The SDK is locked by the licence check (SdkLicenceException) | Retrying does not help. See Licence Key |
| The firmware version could not be read, or the bracelet did not accept the command | Check the connection and the initialization, then call it again |
| The firmware is below 7.33 | Update the firmware (DFU) |
| The measurement could not be stored | Check manager.currentDatabaseState |
SDK call 2: save measurement
Call it when the user has entered the value:
val result = spotManager.save(bleDevice, spo2Value, now, externalDevice) // Result<SpotMeasurementDB?>
| Parameter | Type | Value |
|---|---|---|
bleDevice | BleDevice | The bracelet |
value | Float | The SpO₂ value, in percent |
endTimestamp | Long | End of the measurement, epoch milliseconds |
externalDeviceName | String | Name of the device the value was measured with |
save completes the newest measurement without an end (the one initSpotMeasurement created), then sends the value to the bracelet. The bracelet receives a whole number: the decimals of value are dropped for the bracelet, not in the database.
| Result | Meaning | What to do |
|---|---|---|
Success, synced == true | The value is stored and the bracelet accepted it | Nothing |
Success, synced == false | The value is stored, but the bracelet did not accept it | Nothing: the SDK does not send the value again later |
| Failure, "no ongoing measurement" | initSpotMeasurement was not called, or it failed | Call initSpotMeasurement first |
Failure with an SdkLicenceException | The value is stored with synced == false; it was not sent to the bracelet | See Licence Key |
| Other failure | The firmware version could not be read, or the firmware is below 7.33: the value is stored with synced == false. Or the value could not be stored | Check the connection and the firmware version, or manager.currentDatabaseState |
Sample code available in the classes
DataOthersFragment
DataOthersSpotFragment2
Function return structure
Since 3.0.0 SpotMeasurementDB is a plain class, and every model the SDK returns is a copy.
open class SpotMeasurementDB {
var startTimestamp: Long = 0L
var endTimestamp: Long? = null
var startDate: String = ""
var endDate: String? = null
var value: Float? = null
var deviceName: String? = null
var synced: Boolean = false
}
| Field | Value |
|---|---|
startTimestamp / endTimestamp | Start and end of the measurement, epoch milliseconds. endTimestamp is null until save |
startDate / endDate | The same as yyyy-MM-dd'T'HH:mm:ss, local time |
value | The SpO₂ value, in percent; null until save |
deviceName | Name of the external device; null until save |
synced | true once the bracelet accepted the value |
Reading stored measurements
Read and delete the measurements with manager.spotMeasurementRepository (a SpotMeasurementRepository; since 3.0.0 you cannot construct one yourself). Its functions are suspend and return a Result. deleteAll also has a callback variant, deleteAll(onSuccess, onError).
| Function | Returns |
|---|---|
getAll() | Every measurement, oldest first |
getLastOngoingMeasurement() | The newest measurement without an end, or null |
deleteByTimestampRange(startTimestamp, endTimestamp) | Deletes the measurements that start in the range, both ends included. Before 3.0.0 this call always failed |
deleteAll() | Deletes every measurement |
A measurement that was started and never saved stays in the database without an end. Delete it if you do not want it in getAll().