1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Huami: Map UTC offset in HR and respiratory rate fetch operations

This commit is contained in:
José Rebelo 2023-05-23 00:05:03 +01:00
parent fd9efdcb72
commit 733e5dd290
3 changed files with 9 additions and 9 deletions

View File

@ -50,10 +50,10 @@ public class FetchManualHeartRateOperation extends AbstractRepeatingFetchOperati
final long currentTimestamp = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000; final long currentTimestamp = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000;
timestamp.setTimeInMillis(currentTimestamp); timestamp.setTimeInMillis(currentTimestamp);
final byte unknown1 = buffer.get(); // always 4? final byte utcOffsetInQuarterHours = buffer.get();
final int hr = buffer.get() & 0xff; final int hr = buffer.get() & 0xff;
LOG.info("Manual HR at {}: {}", timestamp.getTime(), hr); LOG.info("Manual HR at {} + {}: {}", timestamp.getTime(), utcOffsetInQuarterHours, hr);
// TODO: Save manual hr data // TODO: Save manual hr data
} }

View File

@ -49,12 +49,12 @@ public class FetchRestingHeartRateOperation extends AbstractRepeatingFetchOperat
while (buffer.position() < bytes.length) { while (buffer.position() < bytes.length) {
final long currentTimestamp = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000; final long currentTimestamp = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000;
timestamp.setTimeInMillis(currentTimestamp); timestamp.setTimeInMillis(currentTimestamp);
// Official app only shows this at day-level
final byte unknown1 = buffer.get(); // always 4? // Official app only shows this at day-level
final byte utcOffsetInQuarterHours = buffer.get();
final int hr = buffer.get() & 0xff; final int hr = buffer.get() & 0xff;
LOG.debug("Resting HR at {}: {}", timestamp.getTime(), hr); LOG.debug("Resting HR at {} + {}: {}", timestamp.getTime(), utcOffsetInQuarterHours, hr);
// TODO: Save resting hr data // TODO: Save resting hr data
} }

View File

@ -47,14 +47,14 @@ public class FetchSleepRespiratoryRateOperation extends AbstractRepeatingFetchOp
while (buf.position() < bytes.length) { while (buf.position() < bytes.length) {
final long timestampSeconds = buf.getInt(); final long timestampSeconds = buf.getInt();
final byte unknown1 = buf.get(); // always 4? final byte utcOffsetInQuarterHours = buf.get();
final int respiratoryRate = buf.get() & 0xff; final int respiratoryRate = buf.get() & 0xff;
final byte unknown2 = buf.get(); // always 0? final byte unknown1 = buf.get(); // always 0?
final byte unknown3 = buf.get(); // mostly 1, sometimes 2, 4 when waking up? final byte unknown2 = buf.get(); // mostly 1, sometimes 2, 4 when waking up?
timestamp.setTimeInMillis(timestampSeconds * 1000L); timestamp.setTimeInMillis(timestampSeconds * 1000L);
LOG.debug("Sleep Respiratory Rate at {}: respiratoryRate={} unknown1={} unknown2={} unknown3={}", timestamp.getTime(), respiratoryRate, unknown1, unknown2, unknown3); LOG.debug("Sleep Respiratory Rate at {} + {}: respiratoryRate={} unknown1={} unknown2={}", timestamp.getTime(), respiratoryRate, utcOffsetInQuarterHours, unknown1, unknown2);
// TODO save // TODO save
} }