mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin Venu 4: Initial support
This commit is contained in:
+25
@@ -1,6 +1,7 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.garmin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.app.Activity;
|
||||
|
||||
@@ -53,9 +54,11 @@ import nodomain.freeyourgadget.gadgetbridge.entities.GenericTrainingLoadChronicS
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.GenericTrainingLoadChronicSampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.PendingFileDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.BodyEnergySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.HrvSummarySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.HrvValueSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.PaiSample;
|
||||
@@ -69,6 +72,7 @@ import nodomain.freeyourgadget.gadgetbridge.model.WorkoutLoadSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.preferences.DevicePrefs;
|
||||
|
||||
public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
@Override
|
||||
@@ -76,6 +80,27 @@ public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GBDevice createDevice(final GBDeviceCandidate candidate, final DeviceType deviceType) {
|
||||
final GBDevice gbDevice = super.createDevice(candidate, deviceType);
|
||||
|
||||
if (defaultNewSyncProtocol()) {
|
||||
final DevicePrefs devicePreferences = GBApplication.getDevicePrefs(gbDevice);
|
||||
final SharedPreferences.Editor editor = devicePreferences.getPreferences().edit();
|
||||
|
||||
// #5021 - Some new devices like Venu X1 misses a lot of files without the new sync protocol
|
||||
editor.putBoolean("new_sync_protocol", true);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
return gbDevice;
|
||||
}
|
||||
|
||||
public boolean defaultNewSyncProtocol() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<AbstractDao<?, ?>, Property> getAllDeviceDao( @NonNull final DaoSession session) {
|
||||
return new HashMap<>() {{
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.GarminWatchCoordinator;
|
||||
|
||||
public class GarminVenu4Coordinator extends GarminWatchCoordinator {
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("^Venu 4 \\d+mm$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceNameResource() {
|
||||
return R.string.devicetype_garmin_venu_4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean defaultNewSyncProtocol() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+5
-27
@@ -1,38 +1,11 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.GarminWatchCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.preferences.DevicePrefs;
|
||||
|
||||
public class GarminVenuX1Coordinator extends GarminWatchCoordinator {
|
||||
@Override
|
||||
public GBDevice createDevice(final GBDeviceCandidate candidate, final DeviceType deviceType) {
|
||||
final GBDevice gbDevice = super.createDevice(candidate, deviceType);
|
||||
final DevicePrefs devicePreferences = GBApplication.getDevicePrefs(gbDevice);
|
||||
final SharedPreferences.Editor editor = devicePreferences.getPreferences().edit();
|
||||
|
||||
// #5021 - Venu X1 misses a lot of files without the new sync protocol
|
||||
editor.putBoolean("new_sync_protocol", true);
|
||||
|
||||
editor.apply();
|
||||
|
||||
return gbDevice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExperimental() {
|
||||
// #5021 - potential pairing issues
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("^Venu X1$");
|
||||
@@ -47,4 +20,9 @@ public class GarminVenuX1Coordinator extends GarminWatchCoordinator {
|
||||
public int getDefaultIconResource() {
|
||||
return R.drawable.ic_device_amazfit_bip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean defaultNewSyncProtocol() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVe
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenu2SCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenu3Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenu3SCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenu4Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenuCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenuSq2Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.venu.GarminVenuSqCoordinator;
|
||||
@@ -640,6 +641,7 @@ public enum DeviceType {
|
||||
GARMIN_VENU_2_PLUS(GarminVenu2PlusCoordinator.class),
|
||||
GARMIN_VENU_3(GarminVenu3Coordinator.class),
|
||||
GARMIN_VENU_3S(GarminVenu3SCoordinator.class),
|
||||
GARMIN_VENU_4(GarminVenu4Coordinator.class),
|
||||
GARMIN_VENU_X1(GarminVenuX1Coordinator.class),
|
||||
GARMIN_VIVOACTIVE_3(GarminVivoActive3Coordinator.class),
|
||||
GARMIN_VIVOACTIVE_4(GarminVivoActive4Coordinator.class),
|
||||
|
||||
@@ -1900,6 +1900,7 @@
|
||||
<string name="devicetype_garmin_venu_2s" translatable="false">Garmin Venu 2S</string>
|
||||
<string name="devicetype_garmin_venu_3" translatable="false">Garmin Venu 3</string>
|
||||
<string name="devicetype_garmin_venu_3s" translatable="false">Garmin Venu 3S</string>
|
||||
<string name="devicetype_garmin_venu_4" translatable="false">Garmin Venu 4</string>
|
||||
<string name="devicetype_garmin_venu_x1" translatable="false">Garmin Venu X1</string>
|
||||
<string name="devicetype_garmin_edge_130_plus" translatable="false">Garmin Edge 130 Plus</string>
|
||||
<string name="devicetype_garmin_edge_540" translatable="false">Garmin Edge 540</string>
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ public class AbstractDeviceCoordinatorTest extends TestBase {
|
||||
put("fenix 5", DeviceType.GARMIN_FENIX_5); // #3869
|
||||
put("Forerunner 255S", DeviceType.GARMIN_FORERUNNER_255S); // #3841
|
||||
put("Venu 2", DeviceType.GARMIN_VENU_2); // #3835
|
||||
put("Venu 4 45mm", DeviceType.GARMIN_VENU_4); // #5461
|
||||
put("Forerunner 265", DeviceType.GARMIN_FORERUNNER_265); // #3831
|
||||
put("EPIX PRO - 51mm", DeviceType.GARMIN_EPIX_PRO); // #3810
|
||||
put("Amazfit GTR", DeviceType.AMAZFITGTR); // #3809 / #2442
|
||||
|
||||
Reference in New Issue
Block a user