Huawei: Add calories support

These devices provide calories instead of kcal, which are rounded
per-sample, resulting in a slight difference from what is shown on the
device itself.
This commit is contained in:
Martin.JM 2024-11-24 21:10:01 +01:00
parent b31832a72e
commit d807909b25
3 changed files with 11 additions and 1 deletions

View File

@ -1363,7 +1363,7 @@ public class GBDaoGenerator {
activitySample.addIntProperty("calories").notNull().codeBeforeGetter(
"@Override\n" +
" public int getActiveCalories() {\n" +
" return getCalories();\n" +
" return getCalories() == HuaweiActivitySample.NOT_MEASURED ? HuaweiActivitySample.NOT_MEASURED : Math.round(getCalories() / 1000f);\n" +
" }\n"
);
activitySample.addIntProperty("distance").notNull().codeBeforeGetter(

View File

@ -163,6 +163,11 @@ public abstract class HuaweiBRCoordinator extends AbstractBLClassicDeviceCoordin
return true;
}
@Override
public boolean supportsActiveCalories() {
return true;
}
@Override
public boolean supportsActivityTracking() {
return true;

View File

@ -172,6 +172,11 @@ public abstract class HuaweiLECoordinator extends AbstractBLEDeviceCoordinator i
return true;
}
@Override
public boolean supportsActiveCalories() {
return true;
}
@Override
public boolean supportsActivityTracking() {
return true;