mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Newer Zepp OS devices report sleep sessions separately, which include accurate sleep stages, and a sleep score. - Persist this data raw, since we don't know how to fully process it - Overlay (and prefer) this data over sleep samples Devices that do not support these such as the Mi Band 7 reply with an unsuccessful fetch response, which is fine.
30 lines
1.2 KiB
Java
30 lines
1.2 KiB
Java
/* Copyright (C) 2025 José Rebelo
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
package nodomain.freeyourgadget.gadgetbridge.entities;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.SleepScoreSample;
|
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
|
|
|
public abstract class AbstractHuamiSleepSessionSample extends AbstractTimeSample implements SleepScoreSample {
|
|
public abstract byte[] getData();
|
|
|
|
@Override
|
|
public int getSleepScore() {
|
|
return BLETypeConversions.toUnsigned(getData(), 0x16);
|
|
}
|
|
}
|