Add first support of SG2 HPlus watch

This commit is contained in:
frederic lesur LESUR Frederic 2020-08-25 11:24:07 +09:00 committed by Gitea
parent 168719011d
commit 997504c01a
6 changed files with 62 additions and 0 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ fw.dirs
**/.project
**/.settings
**/.classpath
app/release/output-metadata.json

View File

@ -0,0 +1,54 @@
/* Copyright (C) 2017-2020 Daniele Gobbetti, João Paulo Barraca, tiparega
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.hplus;
/*
* @author Alejandro Ladera Chamorro &lt;11555126+tiparega@users.noreply.github.com&gt;
*/
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
/**
* Pseudo Coordinator for the SG2, a sub type of the HPLUS devices
*/
public class SG2Coordinator extends HPlusCoordinator {
@NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
String name = candidate.getDevice().getName();
if(name != null && name.startsWith("SG2")){
return DeviceType.SG2;
}
return DeviceType.UNKNOWN;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.SG2;
}
@Override
public String getManufacturer() {
return "Lemfo";
}
}

View File

@ -74,6 +74,7 @@ public enum DeviceType {
MIJIA_LYWSD02(200, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_mijia_lywsd02),
ITAG(250, R.drawable.ic_device_itag, R.drawable.ic_device_itag_disabled, R.string.devicetype_itag),
VIBRATISSIMO(300, R.drawable.ic_device_lovetoy, R.drawable.ic_device_lovetoy_disabled, R.string.devicetype_vibratissimo),
SG2(310, R.drawable.ic_device_hplus, R.drawable.ic_device_hplus_disabled, R.string.devicetype_sg2),
TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_test);
private final int key;
@DrawableRes

View File

@ -257,6 +257,9 @@ public class DeviceSupportFactory {
case PINETIME_JF:
deviceSupport = new ServiceDeviceSupport(new PineTimeJFSupport(), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
break;
case SG2:
deviceSupport = new ServiceDeviceSupport(new HPlusSupport(DeviceType.SG2), EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING));
break;
}
if (deviceSupport != null) {
deviceSupport.setContext(gbDevice, mBtAdapter, mContext);

View File

@ -48,6 +48,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.hplus.EXRIZUK8Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.HPlusCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.MakibesF68Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.Q8Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.hplus.SG2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipLiteCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbips.AmazfitBipSCoordinator;
@ -254,6 +255,7 @@ public class DeviceHelper {
result.add(new BangleJSCoordinator());
result.add(new TLW64Coordinator());
result.add(new PineTimeJFCoordinator());
result.add(new SG2Coordinator());
return result;
}

View File

@ -770,6 +770,7 @@
<string name="notification_channel_name">Gadgetbridge notifications</string>
<string name="notification_channel_high_priority_name">Gadgetbridge notifications high priority</string>
<string name="devicetype_amazfit_gts">Amazfit GTS</string>
<string name="devicetype_sg2">SG2</string>
<!-- Menus on the smart device -->
<string name="menuitem_shortcut_alipay">Alipay (Shortcut)</string>
<string name="menuitem_shortcut_weather">Weather (Shortcut)</string>