ECG measurement
Only available for 287-2 bracelet
Available starting SDK version 2.3.0
The ECG measurement is 50 seconds.
During the 50 seconds there are 8 seconds of warm up and 42 seconds of effective ECG data.
The ECG has to be started and stopped by your application. Please follow the workflow in the sample app example in ECG folder ECGInstructions.swift
The ECG measurement will stop automatically at the end of the countdown or if the app loose the BLE signal during the measurement. You can stop it manually at any moment.
Start ECG measurement
Start ECG using the code bellow:
PeripheralViewModel.instance.startMeasurement(measurementType: .ecg)
The start ECG command will be sent to the bracelet, and a row will be created in the Measurement table
A blue light is visible on the bracelet when the ECG is running:

Stop ECG measurement
Stop ECG using the code bellow:
MetricLiveECGViewModel.instance.stopMonitoring()
let peripheralViewModel : PeripheralViewModel = PeripheralViewModel.instance
peripheralViewModel.stopMeasurement(measurementType: .ecg)
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
MetricECGViewModel.instance.forceStopped = true
peripheralViewModel.forceStopStreaming()
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
peripheralViewModel.forceStartSyncECG()
}
}
The stop ECG command will be sent to the bracelet, The app will immediately sync ECG raw data and create an ECG record
The blue light on the bracelet is turned off when the ECG is stopped.

Retrieve data of the ECG measurement
In order to retrieve the ECG data, please make sure the bracelet is syncing regularly.
If the ECG measurement has been successfuly parsed and considered as "good" measurement, the measurement will be automatically saved into the DB.
You can retrieve all measurement with "MetricECGViewModel.instance.ecgList". ecgList is an array of ECG measurements (type: MetricParsedECGSummary)
Follow the sample to see how to display all ECG measurements in a chart.
You can also decide if you want to use filtered ECG signal or the original signal. see getFilterECGSignal usage in the sample app
Live display of the measurement
The sample app provide a "live display" of the ECG signal during a measurement. The app use the class MetricLiveECGViewModel to manage this live signal