-
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
})
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 |
|---|---|---|
| Step | All supported | FcSyncDataType.STEP |
| Sleep | All supported | FcSyncDataType.SLEEP |
| Heart Rate | Feature.HEART_RATE | FcSyncDataType.HEART_RATE |
| Oxygen | Feature.OXYGEN | FcSyncDataType.OXYGEN |
| Blood Pressure | Feature.BLOOD_PRESSURE | FcSyncDataType.BLOOD_PRESSURE |
| Temperature | Feature.TEMPERATURE | FcSyncDataType.TEMPERATURE |
| Pressure | Feature.PRESSURE | FcSyncDataType.PRESSURE |
| Sport | Feature.SPORT | FcSyncDataType.SPORT |
| ECG | Feature.ECG | FcSyncDataType.ECG |
| Game | Feature.GAME | FcSyncDataType.GAME |
| GPS | Feature.GPS | FcSyncDataType.GPS |
Among them, Heart Rate, Oxygen, Blood Pressure, Temperature and Pressure are collectively referred to as Health data. These types of data are affected by FcHealthMonitorConfig, and APP can use FcDataFeature.openHealthRealTimeData to measure real-time data. Similarly, real-time data measurement can also be performed on the device. These data generated one device are of the following types:
| Module | Flag | Type |
|---|---|---|
| Heart Rate | Feature.HEART_RATE | FcSyncDataType.HEART_RATE |
| Oxygen | Feature.OXYGEN | FcSyncDataType.OXYGEN |
| Blood Pressure | Feature.BLOOD_PRESSURE | FcSyncDataType.BLOOD_PRESSURE |
| Temperature | Feature.TEMPERATURE | FcSyncDataType.TEMPERATURE |
| Pressure | Feature.PRESSURE | FcSyncDataType.PRESSURE |
|Heart Rate|Feature.HEART_RATE|FcSyncDataType.HEART_RATE|
Sports SyncDataParser#TYPE_SPORT Total data for today SyncDataParser#TYPE_TOTAL_DATA ECG SyncDataParser#TYPE_ECG SyncDataParser#TYPE_TEMPERATURE