mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Coospo H6/HW9: Experimental support
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.coospo
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class CoospoH6Coordinator: CoospoHeartRateCoordinator() {
|
||||
override fun getSupportedDeviceName(): Pattern? {
|
||||
return Pattern.compile("^H6M [0-9]{5}$")
|
||||
}
|
||||
|
||||
override fun getDeviceNameResource(): Int {
|
||||
return R.string.devicetype_coospo_h6
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.coospo
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class CoospoHW9Coordinator: CoospoHeartRateCoordinator() {
|
||||
override fun getSupportedDeviceName(): Pattern? {
|
||||
return Pattern.compile("^HW9 [0-9]{5}$")
|
||||
}
|
||||
|
||||
override fun getDeviceNameResource(): Int {
|
||||
return R.string.devicetype_coospo_hw9
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.coospo
|
||||
|
||||
import de.greenrobot.dao.AbstractDao
|
||||
import de.greenrobot.dao.Property
|
||||
import nodomain.freeyourgadget.gadgetbridge.R
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.generic_hr.GenericHeartRateActivitySampleProvider
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.GenericHeartRateSampleDao
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.generic_hr.GenericHeartRateSupport
|
||||
|
||||
/**
|
||||
* This class pulls most of the logic from the
|
||||
* {@link nodomain.freeyourgadget.gadgetbridge.devices.generic_hr.GenericHeartRateCoordinator}.
|
||||
*/
|
||||
abstract class CoospoHeartRateCoordinator: AbstractBLEDeviceCoordinator() {
|
||||
override fun isExperimental(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getBondingStyle(): Int {
|
||||
return BONDING_STYLE_NONE
|
||||
}
|
||||
|
||||
override fun suggestUnbindBeforePair(): Boolean {
|
||||
// Not needed
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getManufacturer(): String {
|
||||
return "Coospo"
|
||||
}
|
||||
|
||||
override fun getDeviceSupportClass(device: GBDevice?): Class<out DeviceSupport> {
|
||||
return GenericHeartRateSupport::class.java
|
||||
}
|
||||
|
||||
override fun getDefaultIconResource(): Int {
|
||||
return R.drawable.ic_device_lovetoy
|
||||
}
|
||||
|
||||
override fun supportsHeartRateMeasurement(device: GBDevice): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun supportsActivityTracking(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun supportsActivityTabs(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun supportsSleepMeasurement(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun supportsStepCounter(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun supportsSpeedzones(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getSampleProvider(device: GBDevice, session: DaoSession): SampleProvider<out AbstractActivitySample>? {
|
||||
return GenericHeartRateActivitySampleProvider(device, session)
|
||||
}
|
||||
|
||||
override fun getAllDeviceDao(session: DaoSession): MutableMap<AbstractDao<*, *>, Property> {
|
||||
return object : HashMap<AbstractDao<*, *>, Property>() {
|
||||
init {
|
||||
put(session.genericHeartRateSampleDao, GenericHeartRateSampleDao.Properties.DeviceId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,8 @@ import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGMWB5000D
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGWB5600DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cmfwatchpro.CmfWatchPro2Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cmfwatchpro.CmfWatchProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.coospo.CoospoH6Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.coospo.CoospoHW9Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.coordinator.CyclingSensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.divoom.PixooCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.domyos.DomyosT540Coordinator;
|
||||
@@ -753,9 +755,11 @@ public enum DeviceType {
|
||||
GENERIC_HEADPHONES(GenericHeadphonesCoordinator.class),
|
||||
GENERIC_THERMAL_PRINTER(ThermalPrinterCoordinator.class),
|
||||
GENERIC_HEART_RATE(GenericHeartRateCoordinator.class),
|
||||
TEST(TestDeviceCoordinator.class),
|
||||
ULTRAHUMAN_RING_AIR(UltrahumanDeviceCoordinator.class),
|
||||
ATC_BLE_OEPL(ATCBLEOEPLCoordinator.class);
|
||||
ATC_BLE_OEPL(ATCBLEOEPLCoordinator.class),
|
||||
COOSPO_H6(CoospoH6Coordinator.class),
|
||||
COOSPO_HW9(CoospoHW9Coordinator.class),
|
||||
TEST(TestDeviceCoordinator.class);
|
||||
|
||||
private DeviceCoordinator coordinator;
|
||||
|
||||
|
||||
@@ -2105,6 +2105,8 @@
|
||||
<string name="devicetype_generic_thermal_printer">Thermal Printer</string>
|
||||
<string name="devicetype_generic_headphones">Headphones</string>
|
||||
<string name="devicetype_generic_heart_rate_sensor">Heart Rate Sensor</string>
|
||||
<string name="devicetype_coospo_h6">Coospo H6</string>
|
||||
<string name="devicetype_coospo_hw9">Coospo HW9</string>
|
||||
<!-- Menus on the smart device -->
|
||||
<string name="menuitem_nothing">Nothing</string>
|
||||
<string name="menuitem_status">Status</string>
|
||||
|
||||
Reference in New Issue
Block a user