mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Colmi R09: Add preference to toggle temperature measurements
This commit is contained in:
parent
603f9421d0
commit
43a1613f95
@ -206,6 +206,7 @@ public class DeviceSettingsPreferenceConst {
|
|||||||
public static final String PREF_SPO2_ALL_DAY_MONITORING = "spo2_all_day_monitoring_enabled";
|
public static final String PREF_SPO2_ALL_DAY_MONITORING = "spo2_all_day_monitoring_enabled";
|
||||||
public static final String PREF_SPO2_LOW_ALERT_THRESHOLD = "spo2_low_alert_threshold";
|
public static final String PREF_SPO2_LOW_ALERT_THRESHOLD = "spo2_low_alert_threshold";
|
||||||
public static final String PREF_HRV_ALL_DAY_MONITORING = "hrv_all_day_monitoring_enabled";
|
public static final String PREF_HRV_ALL_DAY_MONITORING = "hrv_all_day_monitoring_enabled";
|
||||||
|
public static final String PREF_TEMPERATURE_ALL_DAY_MONITORING = "continuous_skin_temperature_measurement";
|
||||||
|
|
||||||
public static final String PREF_AUTOHEARTRATE_SWITCH = "pref_autoheartrate_switch";
|
public static final String PREF_AUTOHEARTRATE_SWITCH = "pref_autoheartrate_switch";
|
||||||
public static final String PREF_AUTOHEARTRATE_SLEEP = "pref_autoheartrate_sleep";
|
public static final String PREF_AUTOHEARTRATE_SLEEP = "pref_autoheartrate_sleep";
|
||||||
|
@ -554,6 +554,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
|||||||
addPreferenceHandlerFor(PREF_SPO2_ALL_DAY_MONITORING);
|
addPreferenceHandlerFor(PREF_SPO2_ALL_DAY_MONITORING);
|
||||||
addPreferenceHandlerFor(PREF_SPO2_LOW_ALERT_THRESHOLD);
|
addPreferenceHandlerFor(PREF_SPO2_LOW_ALERT_THRESHOLD);
|
||||||
addPreferenceHandlerFor(PREF_HRV_ALL_DAY_MONITORING);
|
addPreferenceHandlerFor(PREF_HRV_ALL_DAY_MONITORING);
|
||||||
|
addPreferenceHandlerFor(PREF_TEMPERATURE_ALL_DAY_MONITORING);
|
||||||
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO);
|
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO);
|
||||||
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_START);
|
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_START);
|
||||||
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_END);
|
addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_END);
|
||||||
|
@ -235,6 +235,9 @@ public abstract class AbstractColmiR0xCoordinator extends AbstractBLEDeviceCoord
|
|||||||
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||||
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
|
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
|
||||||
health.add(R.xml.devicesettings_colmi_r0x);
|
health.add(R.xml.devicesettings_colmi_r0x);
|
||||||
|
if (supportsContinuousTemperature()) {
|
||||||
|
health.add(R.xml.devicesettings_temperature_automatic_enable);
|
||||||
|
}
|
||||||
return deviceSpecificSettings;
|
return deviceSpecificSettings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ public class ColmiR0xConstants {
|
|||||||
public static final byte CMD_SYNC_STRESS = 0x37;
|
public static final byte CMD_SYNC_STRESS = 0x37;
|
||||||
public static final byte CMD_AUTO_HRV_PREF = 0x38;
|
public static final byte CMD_AUTO_HRV_PREF = 0x38;
|
||||||
public static final byte CMD_SYNC_HRV = 0x39;
|
public static final byte CMD_SYNC_HRV = 0x39;
|
||||||
|
public static final byte CMD_AUTO_TEMP_PREF = 0x3a;
|
||||||
public static final byte CMD_SYNC_ACTIVITY = 0x43;
|
public static final byte CMD_SYNC_ACTIVITY = 0x43;
|
||||||
public static final byte CMD_FIND_DEVICE = 0x50;
|
public static final byte CMD_FIND_DEVICE = 0x50;
|
||||||
public static final byte CMD_MANUAL_HEART_RATE = 0x69;
|
public static final byte CMD_MANUAL_HEART_RATE = 0x69;
|
||||||
|
@ -111,6 +111,17 @@ public class ColmiR0xPacketHandler {
|
|||||||
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void tempSettings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||||
|
boolean enabled = value[3] == 0x01;
|
||||||
|
LOG.info("Received temperature preference: {}", enabled ? "enabled" : "disabled");
|
||||||
|
GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||||
|
eventUpdatePreferences.withPreference(
|
||||||
|
DeviceSettingsPreferenceConst.PREF_TEMPERATURE_ALL_DAY_MONITORING,
|
||||||
|
enabled
|
||||||
|
);
|
||||||
|
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||||
|
}
|
||||||
|
|
||||||
public static void goalsSettings(byte[] value) {
|
public static void goalsSettings(byte[] value) {
|
||||||
int steps = BLETypeConversions.toUint32(value[2], value[3], value[4], (byte) 0);
|
int steps = BLETypeConversions.toUint32(value[2], value[3], value[4], (byte) 0);
|
||||||
int calories = BLETypeConversions.toUint32(value[5], value[6], value[7], (byte) 0);
|
int calories = BLETypeConversions.toUint32(value[5], value[6], value[7], (byte) 0);
|
||||||
|
@ -270,6 +270,11 @@ public class ColmiR0xDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
case ColmiR0xConstants.CMD_AUTO_HRV_PREF:
|
case ColmiR0xConstants.CMD_AUTO_HRV_PREF:
|
||||||
ColmiR0xPacketHandler.hrvSettings(this, value);
|
ColmiR0xPacketHandler.hrvSettings(this, value);
|
||||||
break;
|
break;
|
||||||
|
case ColmiR0xConstants.CMD_AUTO_TEMP_PREF:
|
||||||
|
if (value[1] == 0x03) { // so far always observed to be 0x03
|
||||||
|
ColmiR0xPacketHandler.tempSettings(this, value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ColmiR0xConstants.CMD_SYNC_STRESS:
|
case ColmiR0xConstants.CMD_SYNC_STRESS:
|
||||||
ColmiR0xPacketHandler.historicalStress(getDevice(), getContext(), value);
|
ColmiR0xPacketHandler.historicalStress(getDevice(), getContext(), value);
|
||||||
if (!getDevice().isBusy()) {
|
if (!getDevice().isBusy()) {
|
||||||
@ -511,6 +516,12 @@ public class ColmiR0xDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
LOG.info("HRV preference request sent: {}", StringUtils.bytesToHex(hrvPrefsPacket));
|
LOG.info("HRV preference request sent: {}", StringUtils.bytesToHex(hrvPrefsPacket));
|
||||||
sendWrite("hrvPreferenceRequest", hrvPrefsPacket);
|
sendWrite("hrvPreferenceRequest", hrvPrefsPacket);
|
||||||
break;
|
break;
|
||||||
|
case DeviceSettingsPreferenceConst.PREF_TEMPERATURE_ALL_DAY_MONITORING:
|
||||||
|
final boolean tempEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_TEMPERATURE_ALL_DAY_MONITORING, false);
|
||||||
|
byte[] tempPrefsPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_TEMP_PREF, 0x03, ColmiR0xConstants.PREF_WRITE, (byte) (tempEnabled ? 0x01 : 0x00)});
|
||||||
|
LOG.info("Temperature preference request sent: {}", StringUtils.bytesToHex(tempPrefsPacket));
|
||||||
|
sendWrite("tempPreferenceRequest", tempPrefsPacket);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,6 +585,9 @@ public class ColmiR0xDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_HRV_PREF, ColmiR0xConstants.PREF_READ});
|
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_HRV_PREF, ColmiR0xConstants.PREF_READ});
|
||||||
LOG.info("Request HRV measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
LOG.info("Request HRV measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
||||||
sendWrite("hrvSettingRequest", request);
|
sendWrite("hrvSettingRequest", request);
|
||||||
|
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_TEMP_PREF, 0x03, ColmiR0xConstants.PREF_READ});
|
||||||
|
LOG.info("Request temperature measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
||||||
|
sendWrite("tempSettingRequest", request);
|
||||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_GOALS, ColmiR0xConstants.PREF_READ});
|
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_GOALS, ColmiR0xConstants.PREF_READ});
|
||||||
LOG.info("Request goals from ring: {}", StringUtils.bytesToHex(request));
|
LOG.info("Request goals from ring: {}", StringUtils.bytesToHex(request));
|
||||||
sendWrite("goalsSettingRequest", request);
|
sendWrite("goalsSettingRequest", request);
|
||||||
|
Loading…
Reference in New Issue
Block a user