mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-10-18 09:19:34 +02:00
Zepp OS: Parse SPO2 sleep data
Matched against the Zepp spo2 database
This commit is contained in:
parent
1ac6983cd3
commit
43d02b9661
@ -63,19 +63,28 @@ public class FetchSpo2SleepOperation extends AbstractRepeatingFetchOperation {
|
|||||||
// this doesn't match the spo2 value returned by FetchSpo2NormalOperation.. it's often 100 when the other is 99, but not always
|
// this doesn't match the spo2 value returned by FetchSpo2NormalOperation.. it's often 100 when the other is 99, but not always
|
||||||
final int spo2 = buf.get() & 0xff;
|
final int spo2 = buf.get() & 0xff;
|
||||||
|
|
||||||
// Not sure what the nextg 25 bytes mean:
|
final int duration = buf.get() & 0xff;
|
||||||
// 40646464646464636363636363000000000000400000000000
|
final byte[] spo2High = new byte[6];
|
||||||
// an unknown byte, always 0x40 (64)
|
final byte[] spo2Low = new byte[6];
|
||||||
// 6 bytes with max values?
|
final byte[] signalQuality = new byte[8];
|
||||||
// 6 bytes with min values?
|
final byte[] extend = new byte[4];
|
||||||
// 12 unknown bytes, always ending with 4 zeroes?
|
buf.get(spo2High);
|
||||||
final byte[] unknown = new byte[25];
|
buf.get(spo2Low);
|
||||||
|
buf.get(signalQuality);
|
||||||
buf.get(unknown);
|
buf.get(extend);
|
||||||
|
|
||||||
timestamp.setTimeInMillis(timestampSeconds * 1000L);
|
timestamp.setTimeInMillis(timestampSeconds * 1000L);
|
||||||
|
|
||||||
LOG.debug("SPO2 (sleep) at {}: {} unknown={}", timestamp.getTime(), spo2, GB.hexdump(unknown));
|
LOG.debug(
|
||||||
|
"SPO2 (sleep) at {}: {} duration={} high={} low={} signalQuality={}, extend={}",
|
||||||
|
timestamp.getTime(),
|
||||||
|
spo2,
|
||||||
|
duration,
|
||||||
|
spo2High,
|
||||||
|
spo2Low,
|
||||||
|
signalQuality,
|
||||||
|
extend
|
||||||
|
);
|
||||||
// TODO save
|
// TODO save
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user