1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Mi Watch Lite: fix unencrypted support after refactoring common Xiaomi code

This commit is contained in:
Andreas Shimokawa 2023-10-17 15:20:20 +02:00 committed by José Rebelo
parent 1920968fba
commit b103b4f3e4
2 changed files with 4 additions and 4 deletions

View File

@ -258,7 +258,7 @@ public class XiaomiCharacteristic {
buf.putShort((short) 0);
buf.put((byte) 0);
buf.put((byte) (isEncrypted ? 1 : 0));
buf.putShort((short) Math.round(currentSending.length / 247.0));
buf.putShort((short) Math.max(1,Math.round(currentSending.length / 247.0)));
final TransactionBuilder builder = mSupport.createTransactionBuilder("send chunked start");
builder.write(bluetoothGattCharacteristic, buf.array());

View File

@ -67,12 +67,12 @@ public class XiaomiPlaintextSupport extends XiaomiSupport {
this.characteristicCommandRead.setEncrypted(false);
this.characteristicCommandRead.setHandler(this::handleCommandBytes);
this.characteristicCommandWrite = new XiaomiCharacteristic(this, btCharacteristicCommandWrite, authService);
this.characteristicCommandRead.setEncrypted(false);
this.characteristicCommandWrite.setEncrypted(false);
this.characteristicActivityData = new XiaomiCharacteristic(this, btCharacteristicActivityData, authService);
this.characteristicActivityData.setHandler(healthService.getActivityFetcher()::addChunk);
this.characteristicCommandRead.setEncrypted(false);
this.characteristicActivityData.setEncrypted(false);
this.characteristicDataUpload = new XiaomiCharacteristic(this, btCharacteristicDataUpload, authService);
this.characteristicCommandRead.setEncrypted(false);
this.characteristicDataUpload.setEncrypted(false);
// FIXME why is this needed?
getDevice().setFirmwareVersion("...");