mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
SBM67: Split Sanitas and SilverCrest devices
This commit is contained in:
+9
-25
@@ -17,53 +17,37 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.sbm_67;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.generic_bp.GenericBloodPressureSupport;
|
||||
|
||||
public class SBM67Coordinator extends AbstractBLEDeviceCoordinator {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("^(SBM67|BPM Smart)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getManufacturer() {
|
||||
return "Sanitas";
|
||||
}
|
||||
|
||||
/**
|
||||
* SBM67 devices seem to be sold under multiple brands, with slightly different bluetooth names and bonding behaviors.
|
||||
*/
|
||||
public abstract class AbstractSBM67Coordinator extends AbstractBLEDeviceCoordinator {
|
||||
@NonNull
|
||||
@Override
|
||||
public Class<? extends DeviceSupport> getDeviceSupportClass(GBDevice device) {
|
||||
return GenericBloodPressureSupport.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_sanitas_sbm_67;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceKind getDeviceKind(@NonNull GBDevice device) {
|
||||
return DeviceKind.BLOOD_PRESSURE_METER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBondingStyle() {
|
||||
return BONDING_STYLE_BOND;
|
||||
public int getBatteryCount(GBDevice device) {
|
||||
return 0; // it does not report battery %
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBatteryCount(GBDevice device) {
|
||||
return 0; // it does not report battery %
|
||||
public boolean suggestUnbindBeforePair() {
|
||||
// Works just fine if already paired
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/* Copyright (C) 2023 Daniele Gobbetti
|
||||
|
||||
This file is part of Gadgetbridge.
|
||||
|
||||
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Gadgetbridge is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.sbm_67;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class SanitasSBM67Coordinator extends AbstractSBM67Coordinator {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("^BPM Smart$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getManufacturer() {
|
||||
return "Sanitas";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_sanitas_sbm_67;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBondingStyle() {
|
||||
// Sanitas one does not show a pin, and would pair with 0000, but it's not needed
|
||||
return BONDING_STYLE_NONE;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/* Copyright (C) 2023 Daniele Gobbetti
|
||||
|
||||
This file is part of Gadgetbridge.
|
||||
|
||||
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Gadgetbridge is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.sbm_67;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class SilverCrestSBM67Coordinator extends AbstractSBM67Coordinator {
|
||||
@Nullable
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("^SBM67$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getManufacturer() {
|
||||
return "SilverCrest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_silvercrest_sbm_67;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBondingStyle() {
|
||||
// SilverCrest one shows a 6-digit pin in the screen
|
||||
return BONDING_STYLE_BOND;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,8 @@ import nodomain.freeyourgadget.gadgetbridge.devices.redmibuds.RedmiBuds6ActiveCo
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.redmibuds.RedmiBuds6ProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi1Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.Roidmi3Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.sbm_67.SBM67Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.sbm_67.SanitasSBM67Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.sbm_67.SilverCrestSBM67Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.scannable.ScannableDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.shokz.ShokzOpenSwimProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.smaq2oss.SMAQ2OSSCoordinator;
|
||||
@@ -882,7 +883,8 @@ public enum DeviceType {
|
||||
COOSPO_H9Z(CoospoH9ZCoordinator.class),
|
||||
GENERIC_WEIGHT_SCALE(GenericWeightScaleCoordinator.class),
|
||||
SOLARFLOW(SolarFlowDeviceCoordinator.class),
|
||||
SBM_67(SBM67Coordinator.class),
|
||||
SANITAS_SBM_67(SanitasSBM67Coordinator.class),
|
||||
SILVERCREST_SBM_67(SilverCrestSBM67Coordinator.class),
|
||||
TEST(TestDeviceCoordinator.class);
|
||||
|
||||
private DeviceCoordinator coordinator;
|
||||
|
||||
@@ -3060,7 +3060,8 @@
|
||||
<string name="devicetype_galaxybuds_2" translatable="false">Galaxy Buds2</string>
|
||||
<string name="devicetype_galaxybuds_2_pro" translatable="false">Galaxy Buds2 Pro</string>
|
||||
<string name="devicetype_galaxybuds_3_pro" translatable="false">Galaxy Buds3 Pro</string>
|
||||
<string name="devicetype_sanitas_sbm_67" translatable="false">Sanitas SBM 67</string>
|
||||
<string name="devicetype_sanitas_sbm_67" translatable="false">Sanitas SBM67</string>
|
||||
<string name="devicetype_silvercrest_sbm_67" translatable="false">SilverCrest SBM67</string>
|
||||
<string name="nothing_prefs_inear_summary">Play/pause the music depending if you wear the earbuds</string>
|
||||
<string name="nothing_prefs_inear_title">In-Ear detection</string>
|
||||
<string name="prefs_in_ear_detection_summary">Play calls through your earbuds when they are in your ears</string>
|
||||
|
||||
+2
-2
@@ -75,8 +75,8 @@ public class AbstractDeviceCoordinatorTest extends TestBase {
|
||||
put("fenix 6X Sapphire", DeviceType.GARMIN_FENIX_6X_SAPPHIRE); // #5496
|
||||
put("fenix 6S Pro Solar", DeviceType.GARMIN_FENIX_6S_PRO_SOLAR); // #5568
|
||||
put("R50Pro", DeviceType.R50PRO);
|
||||
put("SBM67", DeviceType.SBM_67);
|
||||
put("BPM Smart", DeviceType.SBM_67);
|
||||
put("SBM67", DeviceType.SILVERCREST_SBM_67);
|
||||
put("BPM Smart", DeviceType.SANITAS_SBM_67);
|
||||
put("R11_0500", DeviceType.YAWELL_R11); // #4711
|
||||
put("Edge 130", DeviceType.GARMIN_EDGE_130); // matrix
|
||||
put("Edge 840", DeviceType.GARMIN_EDGE_840); // matrix
|
||||
|
||||
Reference in New Issue
Block a user