From 3da539be2318a10204b4143941d6024fa59b50f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sun, 9 Jul 2023 13:37:18 +0100 Subject: [PATCH] Bohemic Smart Bracelet: Initial support --- README.md | 2 + ...BohemicSmartBraceletDeviceCoordinator.java | 60 +++++++++++++++++++ .../gadgetbridge/model/DeviceType.java | 1 + .../service/DeviceSupportFactory.java | 2 + .../gadgetbridge/util/DeviceHelper.java | 2 + app/src/main/res/values/strings.xml | 1 + 6 files changed, 68 insertions(+) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/BohemicSmartBraceletDeviceCoordinator.java diff --git a/README.md b/README.md index 876e91823..2fef8477a 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ vendor's servers. - [iTag](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/iTag) - JYou Y5 - Lefun + - Lefun ID115 Plus + - Other clones: bohemic smart bracelet - Lenovo - Watch 9 - [Watch X (Plus)](https://codeberg.org/mamutcho/Gadgetbridge/wiki) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/BohemicSmartBraceletDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/BohemicSmartBraceletDeviceCoordinator.java new file mode 100644 index 000000000..e8b4df2fd --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/BohemicSmartBraceletDeviceCoordinator.java @@ -0,0 +1,60 @@ +/* Copyright (C) 2016-2021 Andreas Shimokawa, Carsten Pfeiffer, Daniele + Gobbetti, José Rebelo, Petr Kadlec, protomors, Yukai Li + + 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 . */ +package nodomain.freeyourgadget.gadgetbridge.devices.lefun; + +import androidx.annotation.NonNull; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; +import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; +import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; + +public class BohemicSmartBraceletDeviceCoordinator extends LefunDeviceCoordinator { + @NonNull + @Override + public DeviceType getSupportedType(final GBDeviceCandidate candidate) { + if (".bohemic".equals(candidate.getName())) { + return DeviceType.BOHEMIC_SMART_BRACELET; + } + + return DeviceType.UNKNOWN; + } + + @Override + public DeviceType getDeviceType() { + return DeviceType.BOHEMIC_SMART_BRACELET; + } + + @Override + public int[] getSupportedDeviceSpecificSettings(GBDevice device) { + return new int[]{ + R.xml.devicesettings_liftwrist_display_noshed, + R.xml.devicesettings_timeformat, + // R.xml.devicesettings_antilost, not supported + R.xml.devicesettings_inactivity, + R.xml.devicesettings_hydration_reminder, + R.xml.devicesettings_lefun_interface_language, + R.xml.devicesettings_transliteration + }; + } + + @Override + public boolean supportsRealtimeData() { + return false; // not supported + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java index a7a32614c..c459c712e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -101,6 +101,7 @@ public enum DeviceType { PINETIME_JF(190, R.drawable.ic_device_pinetime, R.drawable.ic_device_pinetime_disabled, R.string.devicetype_pinetime_jf), MIJIA_LYWSD02(200, R.drawable.ic_device_pebble, R.drawable.ic_device_pebble_disabled, R.string.devicetype_mijia_lywsd02), LEFUN(210, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_lefun), + BOHEMIC_SMART_BRACELET(211, R.drawable.ic_device_h30_h10, R.drawable.ic_device_h30_h10_disabled, R.string.devicetype_bohemic_smart_bracelet), SMAQ2OSS(220, R.drawable.ic_device_default, R.drawable.ic_device_default, R.string.devicetype_smaq2oss), FITPRO(230, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_fitpro), ITAG(250, R.drawable.ic_device_itag, R.drawable.ic_device_itag_disabled, R.string.devicetype_itag), diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java index d5ba1829b..60f554068 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceSupportFactory.java @@ -317,6 +317,8 @@ public class DeviceSupportFactory { return new ServiceDeviceSupport(new HPlusSupport(DeviceType.SG2)); case LEFUN: return new ServiceDeviceSupport(new LefunDeviceSupport()); + case BOHEMIC_SMART_BRACELET: + return new ServiceDeviceSupport(new LefunDeviceSupport()); case SONY_SWR12: return new ServiceDeviceSupport(new SonySWR12DeviceSupport()); case WASPOS: diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java index 23304b2ce..adae99dfe 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/DeviceHelper.java @@ -48,6 +48,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro.Amazfit import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4.AmazfitGTS4Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini.AmazfitGTS4MiniCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfittrex2.AmazfitTRex2Coordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.lefun.BohemicSmartBraceletDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyLinkBudsSCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.soflow.SoFlowCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWH1000XM5Coordinator; @@ -344,6 +345,7 @@ public class DeviceHelper { result.add(new PineTimeJFCoordinator()); result.add(new SG2Coordinator()); result.add(new LefunDeviceCoordinator()); + result.add(new BohemicSmartBraceletDeviceCoordinator()); result.add(new SonySWR12DeviceCoordinator()); result.add(new WaspOSCoordinator()); result.add(new SMAQ2OSSCoordinator()); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9ba87658d..e689897da 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1324,6 +1324,7 @@ Amazfit Verge Lite Lemfo SG2 Lefun + Bohemic Smart Bracelet Nothing Status