1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-11 18:35:49 +01:00

Moyoung: Implement HR measurement interval setting

This commit is contained in:
Arjan Schrijver 2024-09-03 11:03:09 +02:00
parent f9e8462880
commit 4754ef2b70
4 changed files with 23 additions and 1 deletions

View File

@ -45,6 +45,7 @@ public class HeartRateCapability {
MINUTES_5(300, R.string.interval_five_minutes),
MINUTES_10(600, R.string.interval_ten_minutes),
MINUTES_15(900, R.string.interval_fifteen_minutes),
MINUTES_20(1200, R.string.interval_twenty_minutes),
MINUTES_30(1800, R.string.interval_thirty_minutes),
MINUTES_45(2700, R.string.interval_forty_five_minutes),
HOUR_1(3600, R.string.interval_one_hour),

View File

@ -241,7 +241,7 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.MINUTES_5,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_15,
HeartRateCapability.MeasurementInterval.MINUTES_20,
HeartRateCapability.MeasurementInterval.MINUTES_30
);
}

View File

@ -625,6 +625,26 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
}
}
@Override
public void onSetHeartRateMeasurementInterval(int seconds) {
switch (seconds) {
case 300:
sendSetting(getSetting("HR_AUTO_INTERVAL"), MoyoungConstants.HR_INTERVAL_5MIN);
break;
case 600:
sendSetting(getSetting("HR_AUTO_INTERVAL"), MoyoungConstants.HR_INTERVAL_10MIN);
break;
case 1200:
sendSetting(getSetting("HR_AUTO_INTERVAL"), MoyoungConstants.HR_INTERVAL_20MIN);
break;
case 1800:
sendSetting(getSetting("HR_AUTO_INTERVAL"), MoyoungConstants.HR_INTERVAL_30MIN);
break;
default:
sendSetting(getSetting("HR_AUTO_INTERVAL"), MoyoungConstants.HR_INTERVAL_OFF);
}
}
@Override
public void onFetchRecordedData(int dataTypes) {
if ((dataTypes & RecordedDataTypes.TYPE_ACTIVITY) != 0)

View File

@ -751,6 +751,7 @@
<string name="interval_five_minutes">every 5 minutes</string>
<string name="interval_ten_minutes">every 10 minutes</string>
<string name="interval_fifteen_minutes">every 15 minutes</string>
<string name="interval_twenty_minutes">every 20 minutes</string>
<string name="interval_thirty_minutes">every 30 minutes</string>
<string name="interval_forty_five_minutes">every 45 minutes</string>
<string name="heartrate_bpm_40">40 bpm</string>