mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-16 12:26:47 +01:00
Huawei : Change method to get device name
This commit is contained in:
parent
9bfe3dcd5f
commit
cb7121a32e
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband6;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -40,16 +42,8 @@ public class HuaweiBand6Coordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_BAND6_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_BAND6_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband7;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -40,16 +42,8 @@ public class HuaweiBand7Coordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_BAND7_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_BAND7_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiband8;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -40,16 +42,8 @@ public class HuaweiBand8Coordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_BAND8_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_BAND8_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweibandaw70;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiLECoordinator;
|
||||
@ -36,19 +38,8 @@ public class HuaweiBandAw70Coordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && (
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_BAND3E_NAME) ||
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_BAND4E_NAME)
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("(" + HuaweiConstants.HU_BAND3E_NAME + "|" + HuaweiConstants.HU_BAND4E_NAME + ").*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweitalkbandb6;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiBRCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -36,16 +38,8 @@ public class HuaweiTalkBandB6Coordinator extends HuaweiBRCoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_TALKBANDB6_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_TALKBANDB6_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -40,16 +42,8 @@ public class HuaweiWatchGTCoordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_WATCHGT_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiBRCoordinator;
|
||||
@ -44,19 +46,8 @@ public class HuaweiWatchGT2Coordinator extends HuaweiBRCoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && (
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT2_NAME) ||
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT2PRO_NAME)
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("(" + HuaweiConstants.HU_WATCHGT2_NAME + "|" + HuaweiConstants.HU_WATCHGT2PRO_NAME + ").*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt2e;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -44,16 +46,8 @@ public class HuaweiWatchGT2eCoordinator extends HuaweiLECoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT2E_NAME)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile(HuaweiConstants.HU_WATCHGT2E_NAME + ".*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.huawei.huaweiwatchgt3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiBRCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.HuaweiConstants;
|
||||
@ -40,19 +42,8 @@ public class HuaweiWatchGT3Coordinator extends HuaweiBRCoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
try {
|
||||
String name = candidate.getName();
|
||||
if (name != null && (
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT3_NAME) ||
|
||||
name.toLowerCase().startsWith(HuaweiConstants.HU_WATCHGT3PRO_NAME)
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.error("unable to check device support", ex);
|
||||
}
|
||||
return false;
|
||||
protected Pattern getSupportedDeviceName() {
|
||||
return Pattern.compile("(" + HuaweiConstants.HU_WATCHGT3_NAME + "|" + HuaweiConstants.HU_WATCHGT3PRO_NAME + ").*");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user