P22B1: Add support as Moyoung-based device

This commit is contained in:
aptitudepi
2026-06-23 22:28:18 +01:00
committed by José Rebelo
parent 15fc96385d
commit a7eed9efd7
6 changed files with 79 additions and 0 deletions
@@ -37,6 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpec
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.MoyoungBloodPressureSampleProvider;
import nodomain.freeyourgadget.gadgetbridge.devices.MoyoungSpo2SampleProvider;
import nodomain.freeyourgadget.gadgetbridge.devices.MoyoungStressSampleProvider;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@@ -64,6 +65,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.MoyoungStressSampleDao;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
import nodomain.freeyourgadget.gadgetbridge.model.BloodPressureSample;
import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample;
import nodomain.freeyourgadget.gadgetbridge.model.StressSample;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
@@ -126,6 +128,11 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
return new MoyoungSpo2SampleProvider(device, session);
}
@Override
public TimeSampleProvider<? extends BloodPressureSample> getBloodPressureSampleProvider(final GBDevice device, final DaoSession session) {
return new MoyoungBloodPressureSampleProvider(device, session);
}
@Override
public TimeSampleProvider<? extends StressSample> getStressSampleProvider(GBDevice device, DaoSession session) {
return new MoyoungStressSampleProvider(device, session);
@@ -0,0 +1,46 @@
/* Copyright (C) 2025 Gadgetbridge Contributors
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 <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.moyoung;
import androidx.annotation.DrawableRes;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
public class P22B1Coordinator extends AbstractMoyoungDeviceCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("^P22B1", Pattern.CASE_INSENSITIVE);
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_p22b1;
}
@Override
@DrawableRes
public int getDefaultIconResource() {
return R.drawable.ic_device_p22;
}
@Override
public String getManufacturer() {
return "Mo Young / Da Fit";
}
}
@@ -378,6 +378,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.R50ProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.RainbuvvyT97Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.ViranC29Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.ZL02DCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.P22B1Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.no1f1.No1F1Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.nothing.CmfBuds2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.nothing.CmfBuds2aCoordinator;
@@ -634,6 +635,7 @@ public enum DeviceType {
Q8(Q8Coordinator.class),
SG2(SG2Coordinator.class),
NO1F1(No1F1Coordinator.class),
P22B1(P22B1Coordinator.class),
TECLASTH30(TeclastH30Coordinator.class),
Y5(Y5Coordinator.class),
XWATCH(XWatchCoordinator.class),
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:fillColor="?attr/deviceIconLight"
android:pathData="M3.871 3.877h20.925a0.947 0.947 0 0 1 0.948 0.947v20.01a0.947 0.947 0 0 1-0.948 0.948H3.871a0.947 0.947 0 0 1-0.947-0.948V4.824a0.947 0.947 0 0 1 0.947-0.947z"
android:strokeWidth="3.57115" />
<path
android:fillColor="?attr/deviceIconDark"
android:pathData="M3.879 3.035h20.925a0.947 0.947 0 0 1 0.947 0.947v20.01a0.947 0.947 0 0 1-0.947 0.948H3.88a0.947 0.947 0 0 1-0.947-0.948V3.982A0.947 0.947 0 0 1 3.88 3.035z"
android:strokeWidth="3.57115" />
<path
android:fillColor="?attr/deviceIconPrimary"
android:pathData="M3.871 3.413h20.925a0.947 0.947 0 0 1 0.948 0.947v20.01a0.947 0.947 0 0 1-0.948 0.948H3.871a0.947 0.947 0 0 1-0.947-0.948V4.36A0.947 0.947 0 0 1 3.87 3.413z"
android:strokeWidth="3.57115" />
<path
android:fillColor="?attr/deviceIconOnPrimary"
android:pathData="m16.822,6.557c-1.802,0.093 -3.48,1.006 -4.864,2.151 -2.034,1.673 -3.661,3.931 -4.462,6.492 -0.373,1.411 -0.603,3.061 0.246,4.345 0.832,1.273 2.524,1.476 3.854,1.052 2.34,-0.623 4.276,-2.305 5.808,-4.17 1.25,-1.606 2.256,-3.504 2.551,-5.56C20.091,9.587 19.974,8.058 18.895,7.217 18.311,6.74 17.557,6.552 16.822,6.557ZM16.562,6.807c1.111,-0.028 2.247,0.608 2.64,1.718 0.608,1.847 -0.088,3.815 -0.94,5.454 -1.266,2.356 -3.202,4.374 -5.555,5.571 -1.208,0.523 -2.658,1.011 -3.903,0.327 -1.192,-0.602 -1.611,-2.118 -1.402,-3.39 0.235,-2.183 1.391,-4.139 2.723,-5.802 1.574,-1.834 3.591,-3.481 6.005,-3.852 0.143,-0.018 0.287,-0.027 0.431,-0.027zM16.478,7.151c-2.089,0.145 -3.864,1.488 -5.336,2.921 -1.703,1.735 -3.072,3.953 -3.408,6.43 -0.124,1.064 0.068,2.31 1.003,2.943 0.056,-0.444 0.021,-1.19 0.144,-1.742 0.506,-2.767 2.122,-5.23 4.145,-7.077 1.549,-1.347 3.391,-2.532 5.467,-2.662 -0.48,-0.614 -1.28,-0.819 -2.015,-0.813zM20.07,8.265c0.22,0.778 0.373,1.666 0.23,2.502 -0.314,2.48 -1.628,4.709 -3.215,6.551 -1.628,1.831 -3.733,3.37 -6.157,3.76 -0.484,0.125 -1.407,-0.058 -1.619,0.002 0.68,0.587 1.331,1.29 2.243,1.466 1.36,0.301 2.764,-0.19 3.983,-0.789 3.143,-1.75 5.634,-4.861 6.431,-8.476C22.234,11.795 22.109,9.979 20.867,8.974 20.601,8.74 20.348,8.479 20.07,8.265Z"
android:strokeWidth="0.25"/>
</vector>
+1
View File
@@ -3970,6 +3970,7 @@
<string name="info_menu_structure_contents">Menu structure: %s</string>
<string name="info_fossil_rebuild_watchface_custom_menu">Please rebuild your watchface for custom menu</string>
<string name="devicetype_miband2_hrx" translatable="false">Mi Band HRX</string>
<string name="devicetype_p22b1" translatable="false">P22B1</string>
<string name="prefs_home_icon_left_item">Left</string>
<string name="prefs_home_icon_center_item">Center</string>
@@ -89,6 +89,7 @@ public class BluetoothNameTest 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("P22B1", DeviceType.P22B1);
put("SBM67", DeviceType.SILVERCREST_SBM_67);
put("BPM Smart", DeviceType.SANITAS_SBM_67);
put("Sinilink-APP", DeviceType.SINILINK); // #6040