-
Notifications
You must be signed in to change notification settings - Fork 32
05.Sync Data
The function of sync data refers to obtaining the data of each functional module from the device. This is also the main capability of the device.
Use FcDataFeature.syncData to sync data from device, like this:
val dataFeature = fcSDK.connector.dataFeature()
dataFeature.syncData().observeOn(Schedulers.io(), true).subscribe({
when (it.type) {
FcSyncDataType.STEP -> {
val data = it.toStep()//the step data
}
FcSyncDataType.OXYGEN -> {
val data = it.toOxygen()
}
FcSyncDataType.OXYGEN_MEASURE -> {
val data = it.toOxygenMeasure()
}
...
}
}, {
//error
})
After successful synchronization of each type of data, except for FcTodayTotalData, the data on the device will be deleted. If a certain type fails to synchronize data, the subsequent synchronization process will be interrupted.
Devices may contain multiple types of data, but not all devices support them. Use FcDeviceInfo.Feature to determine whether the device supports these types of data, as shown below:
| Name | Flag | Type | Class |
|---|---|---|---|
| Step | All supported | FcSyncDataType.STEP | FcStepData |
| Sleep | All supported | FcSyncDataType.SLEEP | FcSleepData |
| Heart Rate | Feature.HEART_RATE | FcSyncDataType.HEART_RATE | FcHeartRateData |
| Oxygen | Feature.OXYGEN | FcSyncDataType.OXYGEN | FcOxygenData |
| Blood Pressure | Feature.BLOOD_PRESSURE | FcSyncDataType.BLOOD_PRESSURE | FcBloodPressureData |
| Temperature | Feature.TEMPERATURE | FcSyncDataType.TEMPERATURE | FcTemperatureData |
| Pressure | Feature.PRESSURE | FcSyncDataType.PRESSURE | FcPressureData |
| Sport | Feature.SPORT | FcSyncDataType.SPORT | FcSportData |
| ECG | Feature.ECG | FcSyncDataType.ECG | FcEcgData |
| Game | Feature.GAME | FcSyncDataType.GAME | FcGameData |
| GPS | Feature.GPS | FcSyncDataType.GPS | FcGpsData |
Heart Rate, Oxygen, Blood Pressure, Temperature and Pressure are collectively referred to as Health data. These types of data are affected by FcHealthMonitorConfig, We call it monitor data.
APP can use FcDataFeature.openHealthRealTimeData to measure real-time data. Similarly, real-time data measurement can also be performed on the device.
The data generated by some devices can also be synchronized, We call it measure data, and their types are as follows:
| Name | Flag | Type | Class |
|---|---|---|---|
| Heart Rate measure | / | FcSyncDataType.HEART_RATE_MEASURE | FcHeartRateData |
| Oxygen measure | / | FcSyncDataType.OXYGEN_MEASURE | FcOxygenData |
| Blood Pressure measure | / | FcSyncDataType.BLOOD_PRESSURE_MEASURE | FcBloodPressureMeasureData |
| Temperature measure | / | FcSyncDataType.TEMPERATURE_MEASURE | FcTemperatureData |
| Pressure measure | / | FcSyncDataType.PRESSURE_MEASURE | FcPressureData |
- Only the data measured on the device will be synchronized. Data measured using
FcDataFeature.openHealthRealTimeDatafrom the app will not be synchronized. - Not all devices support measure data. You don't need to determine whether the device supports it, just process the data obtained in the
syncDataresults.
Due to some historical reasons and device functionality limitations, The FcStepData is not always real-time, it may be delayed by 5 minutes. So if you use the accumulated FcStepData of the day to obtain steps, it will be inconsistent with the steps on the device, At this point, FcTodayTotalDatacan be used.
| Name | Flag | Type | Class |
|---|---|---|---|
| Today total data | All supported | FcSyncDataType.TODAY_TOTAL_DATA | FcTodayTotalData |