1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 17:27:24 +01:00

Huami devices: Minor refactoring

This commit is contained in:
Andreas Shimokawa 2018-06-14 16:30:43 +02:00
parent b1d721ca5f
commit 3dd1929436
3 changed files with 8 additions and 8 deletions

View File

@ -1,8 +1,8 @@
package nodomain.freeyourgadget.gadgetbridge.devices.miband2; package nodomain.freeyourgadget.gadgetbridge.devices.huami;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
public class MiBand2Const { public class HuamiConst {
// observed the following values so far: // observed the following values so far:
// 00 01 02 09 0a 0b 0c 10 11 // 00 01 02 09 0a 0b 0c 10 11

View File

@ -20,12 +20,12 @@ package nodomain.freeyourgadget.gadgetbridge.devices.miband;
import java.util.List; import java.util.List;
import de.greenrobot.dao.query.QueryBuilder; import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.devices.miband2.MiBand2Const; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySample; import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySample;
import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySampleDao; import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySampleDao;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband2.MiBand2Const.*; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.*;
public class MiBand2SampleProvider extends AbstractMiBandSampleProvider { public class MiBand2SampleProvider extends AbstractMiBandSampleProvider {
@ -88,11 +88,11 @@ public class MiBand2SampleProvider extends AbstractMiBandSampleProvider {
@Override @Override
public int normalizeType(int rawType) { public int normalizeType(int rawType) {
return MiBand2Const.toActivityKind(rawType); return HuamiConst.toActivityKind(rawType);
} }
@Override @Override
public int toRawActivityKind(int activityKind) { public int toRawActivityKind(int activityKind) {
return MiBand2Const.toRawActivityType(activityKind); return HuamiConst.toRawActivityType(activityKind);
} }
} }

View File

@ -69,7 +69,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile; import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile;
import nodomain.freeyourgadget.gadgetbridge.devices.miband2.MiBand2Const; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySample; import nodomain.freeyourgadget.gadgetbridge.entities.MiBandActivitySample;
@ -1200,7 +1200,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
sample.setHeartRate(getHeartrateBpm()); sample.setHeartRate(getHeartrateBpm());
sample.setSteps(getSteps()); sample.setSteps(getSteps());
sample.setRawIntensity(ActivitySample.NOT_MEASURED); sample.setRawIntensity(ActivitySample.NOT_MEASURED);
sample.setRawKind(MiBand2Const.TYPE_ACTIVITY); // to make it visible in the charts TODO: add a MANUAL kind for that? sample.setRawKind(HuamiConst.TYPE_ACTIVITY); // to make it visible in the charts TODO: add a MANUAL kind for that?
provider.addGBActivitySample(sample); provider.addGBActivitySample(sample);