1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Mi Composition Scale: Add alternative bluetooth name

This commit is contained in:
José Rebelo 2024-08-29 09:18:39 +01:00 committed by José Rebelo
parent 7579ba11b1
commit 227f0a9d80
3 changed files with 3 additions and 10 deletions

View File

@ -51,7 +51,7 @@ public class MiCompositionScaleCoordinator extends AbstractBLEDeviceCoordinator
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("MIBCS", Pattern.CASE_INSENSITIVE);
return Pattern.compile("MIBCS|MIBFS", Pattern.CASE_INSENSITIVE);
}
@NonNull

View File

@ -19,18 +19,15 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.miscale;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Intent;
import android.os.Parcelable;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
@ -54,10 +51,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class MiCompositionScaleDeviceSupport extends AbstractBTLEDeviceSupport {
private static final Logger LOG = LoggerFactory.getLogger(MiCompositionScaleDeviceSupport.class);
private static final String UNIT_KG = "kg";
private static final String UNIT_LBS = "lb";
private static final String UNIT_JIN = "jīn";
private final DeviceInfoProfile<MiCompositionScaleDeviceSupport> deviceInfoProfile;
private final GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo();

View File

@ -38,6 +38,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -118,8 +119,7 @@ public class DeviceHelper {
private DeviceType[] getOrderedDeviceTypes(){
if(orderedDeviceTypes == null){
ArrayList<DeviceType> orderedDevices = new ArrayList<>(Arrays.asList(DeviceType.values()));
Collections.sort(orderedDevices, (dc1, dc2) -> dc1.getDeviceCoordinator().getOrderPriority() -
dc2.getDeviceCoordinator().getOrderPriority());
Collections.sort(orderedDevices, Comparator.comparingInt(dc -> dc.getDeviceCoordinator().getOrderPriority()));
orderedDeviceTypes = orderedDevices.toArray(new DeviceType[0]);
}