1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Garmin protocol: Introduce GarminCoordinator

This commit is contained in:
José Rebelo 2024-04-13 19:25:24 +01:00 committed by Daniele Gobbetti
parent 4c734e4717
commit 72de9bafe9
4 changed files with 51 additions and 102 deletions

View File

@ -0,0 +1,39 @@
package nodomain.freeyourgadget.gadgetbridge.devices.garmin;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminSupport;
public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
}
@Override
public String getManufacturer() {
return "Garmin";
}
@NonNull
@Override
public Class<? extends DeviceSupport> getDeviceSupportClass() {
return GarminSupport.class;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
public boolean supportsWeather() {
return true;
}
}

View File

@ -1,53 +1,18 @@
package nodomain.freeyourgadget.gadgetbridge.devices.garmin.instinct2s;
import androidx.annotation.NonNull;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminSupport;
public class GarminInstinct2SCoordinator extends AbstractBLEDeviceCoordinator {
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
}
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.GarminCoordinator;
public class GarminInstinct2SCoordinator extends GarminCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Instinct 2S");
}
@Override
public String getManufacturer() {
return "Garmin";
}
@NonNull
@Override
public Class<? extends DeviceSupport> getDeviceSupportClass() {
return GarminSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_garmin_instinct_2s;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
public boolean supportsWeather() {
return true;
}
}

View File

@ -1,42 +1,24 @@
package nodomain.freeyourgadget.gadgetbridge.devices.garmin.venu3;
import androidx.annotation.NonNull;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminSupport;
public class GarminVenu3Coordinator extends AbstractBLEDeviceCoordinator {
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
}
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.GarminCoordinator;
public class GarminVenu3Coordinator extends GarminCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Venu 3");
}
@Override
public String getManufacturer() {
return "Garmin";
}
@NonNull
@Override
public Class<? extends DeviceSupport> getDeviceSupportClass() {
return GarminSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_garmin_vivomove_style;
}
@Override
public boolean supportsWeather() {
// FIXME: It's not working
return false;
}
}

View File

@ -1,55 +1,18 @@
package nodomain.freeyourgadget.gadgetbridge.devices.garmin.vivomove;
import androidx.annotation.NonNull;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.GarminSupport;
public class GarminVivomoveStyleCoordinator extends AbstractBLEDeviceCoordinator {
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
}
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.GarminCoordinator;
public class GarminVivomoveStyleCoordinator extends GarminCoordinator {
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("vívomove Style");
}
@Override
public String getManufacturer() {
return "Garmin";
}
@NonNull
@Override
public Class<? extends DeviceSupport> getDeviceSupportClass() {
return GarminSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_garmin_vivomove_style;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
public boolean supportsWeather() {
return true;
}
}