1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 02:25:50 +01:00

Move MiBand3-ism to MiBand3Support

This commit is contained in:
cpfeiffer 2018-10-03 23:13:56 +02:00
parent 549dfce2e7
commit 435898ebc9
2 changed files with 14 additions and 4 deletions

View File

@ -211,10 +211,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
heartRateNotifyEnabled = false;
boolean authenticate = needsAuth;
needsAuth = false;
byte authFlags = HuamiService.AUTH_BYTE;
if (gbDevice.getType() == DeviceType.MIBAND3) {
authFlags = 0x00;
}
byte authFlags = getAuthFlags();
new InitOperation(authenticate, authFlags, this, builder).perform();
characteristicHRControlPoint = getCharacteristic(GattCharacteristic.UUID_CHARACTERISTIC_HEART_RATE_CONTROL_POINT);
characteristicChunked = getCharacteristic(HuamiService.UUID_CHARACTERISTIC_CHUNKEDTRANSFER);
@ -224,6 +221,10 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
return builder;
}
protected byte getAuthFlags() {
return HuamiService.AUTH_BYTE;
}
/**
* Returns the given date/time (calendar) as a byte sequence, suitable for sending to the
* Mi Band 2 (or derivative). The band appears to not handle DST offsets, so we simply add this

View File

@ -37,6 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordin
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3FWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Service;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
@ -46,6 +47,14 @@ public class MiBand3Support extends AmazfitBipSupport {
private static final Logger LOG = LoggerFactory.getLogger(MiBand3Support.class);
@Override
protected byte getAuthFlags() {
if (gbDevice.getType() == DeviceType.MIBAND3) {
return 0x00;
}
return super.getAuthFlags();
}
@Override
protected MiBand3Support setDisplayItems(TransactionBuilder builder) {
Prefs prefs = GBApplication.getPrefs();