-
Notifications
You must be signed in to change notification settings - Fork 32
06.RealTime data
sample project: Refer to HealthRealtimeFragment.kt
The device supports multiple real-time data measurement, but its effectiveness depends on whether the device has this functional module. Such as if FcDeviceInfo.Feature.HEART_RATE is supported, the device supports real-time heart rate measurement.
Use FcDataFeature.openHealthRealTimeData to start measure health data. You can enable multiple types of measurements simultaneously, like this:
val dataFeature = connector.dataFeature()
dataFeature.openHealthRealTimeData(FcHealthDataType.HEART_RATE or FcHealthDataType.OXYGEN, 1).subscribe {
//result
}
The measurement can't start when syncing data, and you should stop measure ASAP, such as stop when Fragment onPause.
Measurement results may contain invalid data values. If the heart rate measurement is started, the return value may be 0, so you need to filter out the invalid data.
Only FcHealthDataResult.hartRate greater than 0 are considered as a valid heart rate value.
Only FcHealthDataResult.oxygen greater than 0 are considered as a valid oxygen value.
When FcDeviceInfo.Feature.BLOOD_PRESSURE_AIR_PUMP is support, the measurement time is determined by the device, and you should not display the measurement time, which may result in inaccurate time. And the actual measurement value is only returned at the end, and only FcHealthDataResult.systolicPressure has a value in the measurement, representing the value of the air pump.
The actual temperature may be 0, but due to the limitation of the device, we still think that it is only valid when the temperature is not equal to 0. And FcHealthDataResult.temperatureBody only returns valid values after the measurement is completed, otherwise it is 0. And when measure the temperature, an additional FcTemperatureRealTimeException may be thrown
Only FcHealthDataResult.pressure greater than 0 are considered as a valid pressure value.
sample project: Refer to EcgRealtimeHelper.kt
When FcDeviceInfo.Feature.ECG is supported, use FcDataFeature.openEcgRealTimeData to start measure ecg data