1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-23 16:17:32 +01:00

Casio GMW-B5000: separate DeviceType, but still using the CasioGWB5600DeviceSupport

This commit is contained in:
Johannes Krude 2023-07-22 11:33:04 +02:00 committed by José Rebelo
parent 685ccfd1c9
commit 9700fef111
6 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,47 @@
/* Copyright (C) 2023 Johannes Krude
based on code from BlueWatcher, https://github.com/masterjc/bluewatcher
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.casio.gwb5600;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGWB5600DeviceCoordinator;
public class CasioGMWB5000DeviceCoordinator extends CasioGWB5600DeviceCoordinator {
@NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
String name = candidate.getDevice().getName();
if (name != null) {
if (name.equals("CASIO GMW-B5000")) {
return DeviceType.CASIOGMWB5000;
}
}
return DeviceType.UNKNOWN;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.CASIOGMWB5000;
}
}

View File

@ -49,8 +49,7 @@ public class CasioGWB5600DeviceCoordinator extends CasioDeviceCoordinator {
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
String name = candidate.getDevice().getName();
if (name != null) {
if (name.equals("CASIO GW-B5600") ||
name.equals("CASIO GMW-B5000")) {
if (name.equals("CASIO GW-B5600")) {
return DeviceType.CASIOGWB5600;
}
}

View File

@ -93,7 +93,8 @@ public enum DeviceType {
ROIDMI3(112, R.drawable.ic_device_roidmi, R.drawable.ic_device_roidmi_disabled, R.string.devicetype_roidmi3),
CASIOGB6900(120, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogb6900),
CASIOGBX100(121, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogbx100),
CASIOGWB5600(122, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogbx100),
CASIOGWB5600(122, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogwb5600),
CASIOGMWB5000(123, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_casiogmwb5000),
MISCALE2(131, R.drawable.ic_device_miscale2, R.drawable.ic_device_miscale2_disabled, R.string.devicetype_miscale2),
BFH16(140, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_bfh16),
MAKIBESHR3(150, R.drawable.ic_device_default, R.drawable.ic_device_hplus_disabled, R.string.devicetype_makibes_hr3),

View File

@ -296,6 +296,8 @@ public class DeviceSupportFactory {
return new ServiceDeviceSupport(new CasioGBX100DeviceSupport());
case CASIOGWB5600:
return new ServiceDeviceSupport(new CasioGWB5600DeviceSupport());
case CASIOGMWB5000:
return new ServiceDeviceSupport(new CasioGWB5600DeviceSupport());
case MISCALE2:
return new ServiceDeviceSupport(new MiScale2DeviceSupport());
case BFH16:

View File

@ -60,6 +60,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.banglejs.BangleJSCoordinator
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gb6900.CasioGB6900DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gbx100.CasioGBX100DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGWB5600DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGMWB5000DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.domyos.DomyosT540Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.galaxy_buds.GalaxyBuds2DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.flipper.zero.FlipperZeroCoordinator;
@ -338,6 +339,7 @@ public class DeviceHelper {
result.add(new CasioGB6900DeviceCoordinator());
result.add(new CasioGBX100DeviceCoordinator());
result.add(new CasioGWB5600DeviceCoordinator());
result.add(new CasioGMWB5000DeviceCoordinator());
result.add(new BFH16DeviceCoordinator());
result.add(new MijiaLywsd02Coordinator());
result.add(new ITagCoordinator());

View File

@ -1292,6 +1292,7 @@
<string name="devicetype_casiogb6900">Casio GB-6900</string>
<string name="devicetype_casiogbx100">Casio GBX-100</string>
<string name="devicetype_casiogwb5600">Casio GW-B5600</string>
<string name="devicetype_casiogmwb5000">Casio GMW-B5000</string>
<string name="devicetype_miscale2">Mi Scale 2</string>
<string name="devicetype_itag">iTag</string>
<string name="devicetype_bfh16">BFH-16</string>