mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Colmi R0x: Rename to Yawell Ring
As discussed in https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/4872, these rings and the app QRing are actually made by Yawell.
This commit is contained in:
committed by
Arjan Schrijver
parent
868bc0bd7e
commit
9fce6e1c8d
+11
-11
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -36,12 +36,12 @@ import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiHrvSummarySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiHrvValueSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiSpo2SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiStressSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiTemperatureSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiHrvSummarySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiHrvValueSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiSpo2SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiStressSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiTemperatureSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiActivitySampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHeartRateSampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHrvSummarySampleDao;
|
||||
@@ -60,10 +60,10 @@ import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.StressSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.colmi.ColmiR0xDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.yawell.ring.YawellRingDeviceSupport;
|
||||
|
||||
public abstract class AbstractColmiR0xCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractColmiR0xCoordinator.class);
|
||||
public abstract class AbstractYawellRingCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractYawellRingCoordinator.class);
|
||||
|
||||
@Override
|
||||
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
|
||||
@@ -95,7 +95,7 @@ public abstract class AbstractColmiR0xCoordinator extends AbstractBLEDeviceCoord
|
||||
@NonNull
|
||||
@Override
|
||||
public Class<? extends DeviceSupport> getDeviceSupportClass(final GBDevice device) {
|
||||
return ColmiR0xDeviceSupport.class;
|
||||
return YawellRingDeviceSupport.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class ColmiR02Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR02Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR02Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class ColmiR03Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR03Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR03Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class ColmiR06Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR06Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR06Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-7
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -22,14 +22,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiStressSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiTemperatureSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample;
|
||||
|
||||
public class ColmiR09Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR09Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR09Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class ColmiR10Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR10Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR10Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
|
||||
public class ColmiR12Coordinator extends AbstractColmiR0xCoordinator {
|
||||
public class ColmiR12Coordinator extends AbstractYawellRingCoordinator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR12Coordinator.class);
|
||||
|
||||
@Override
|
||||
+2
-2
@@ -14,11 +14,11 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ColmiR0xConstants {
|
||||
public class YawellRingConstants {
|
||||
public static final UUID CHARACTERISTIC_SERVICE_V1 = UUID.fromString("6e40fff0-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
public static final UUID CHARACTERISTIC_SERVICE_V2 = UUID.fromString("de5bf728-d711-4e47-af26-65e3012a5dc7");
|
||||
public static final UUID CHARACTERISTIC_WRITE = UUID.fromString("6e400002-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
+18
-2
@@ -1,8 +1,24 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.colmi;
|
||||
/* Copyright (C) 2024 Arjan Schrijver
|
||||
|
||||
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.devices.yawell.ring;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public class ColmiLiveActivityContext {
|
||||
public class YawellRingLiveActivityContext {
|
||||
private int bufferedSteps = 0;
|
||||
private int bufferedCalories = 0;
|
||||
private int bufferedDistance = 0;
|
||||
+21
-21
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -36,14 +36,14 @@ import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSett
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiHeartRateSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiHrvValueSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiSleepSessionSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiSleepStageSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiSpo2SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiStressSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiTemperatureSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiHeartRateSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiHrvValueSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiSleepSessionSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiSleepStageSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiSpo2SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiStressSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiTemperatureSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHeartRateSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHrvValueSample;
|
||||
@@ -59,15 +59,15 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.colmi.ColmiR0xDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.yawell.ring.YawellRingDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||
|
||||
public class ColmiR0xPacketHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR0xPacketHandler.class);
|
||||
public class YawellRingPacketHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(YawellRingPacketHandler.class);
|
||||
|
||||
public static void hrIntervalSettings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||
if (value[1] == ColmiR0xConstants.PREF_WRITE) return; // ignore empty response when writing setting
|
||||
public static void hrIntervalSettings(YawellRingDeviceSupport support, byte[] value) {
|
||||
if (value[1] == YawellRingConstants.PREF_WRITE) return; // ignore empty response when writing setting
|
||||
boolean enabled = value[2] == 0x01;
|
||||
int minutes = value[3];
|
||||
LOG.info("Received HR interval preference: {} minutes, enabled={}", minutes, enabled);
|
||||
@@ -79,7 +79,7 @@ public class ColmiR0xPacketHandler {
|
||||
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||
}
|
||||
|
||||
public static void spo2Settings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||
public static void spo2Settings(YawellRingDeviceSupport support, byte[] value) {
|
||||
boolean enabled = value[2] == 0x01;
|
||||
LOG.info("Received SpO2 preference: {}", enabled ? "enabled" : "disabled");
|
||||
GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||
@@ -90,7 +90,7 @@ public class ColmiR0xPacketHandler {
|
||||
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||
}
|
||||
|
||||
public static void stressSettings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||
public static void stressSettings(YawellRingDeviceSupport support, byte[] value) {
|
||||
boolean enabled = value[2] == 0x01;
|
||||
LOG.info("Received stress preference: {}", enabled ? "enabled" : "disabled");
|
||||
GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||
@@ -101,7 +101,7 @@ public class ColmiR0xPacketHandler {
|
||||
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||
}
|
||||
|
||||
public static void hrvSettings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||
public static void hrvSettings(YawellRingDeviceSupport support, byte[] value) {
|
||||
boolean enabled = value[2] == 0x01;
|
||||
LOG.info("Received HRV preference: {}", enabled ? "enabled" : "disabled");
|
||||
GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||
@@ -112,7 +112,7 @@ public class ColmiR0xPacketHandler {
|
||||
support.evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||
}
|
||||
|
||||
public static void tempSettings(ColmiR0xDeviceSupport support, byte[] value) {
|
||||
public static void tempSettings(YawellRingDeviceSupport support, byte[] value) {
|
||||
boolean enabled = value[3] == 0x01;
|
||||
LOG.info("Received temperature preference: {}", enabled ? "enabled" : "disabled");
|
||||
GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||
@@ -175,7 +175,7 @@ public class ColmiR0xPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void realtimeHeartRate(GBDevice device, Context context, ColmiLiveActivityContext hrmContext, byte[] value) {
|
||||
public static void realtimeHeartRate(GBDevice device, Context context, YawellRingLiveActivityContext hrmContext, byte[] value) {
|
||||
int hrResponse = value[1] & 0xff;
|
||||
LOG.info("Received realtime heart rate response: {} bpm", hrResponse);
|
||||
|
||||
@@ -217,7 +217,7 @@ public class ColmiR0xPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void liveActivity(GBDevice device, Context context, ColmiLiveActivityContext liveActivityContext, byte[] value) {
|
||||
public static void liveActivity(GBDevice device, Context context, YawellRingLiveActivityContext liveActivityContext, byte[] value) {
|
||||
// Live activity will report cumulative values over the day
|
||||
int steps = BLETypeConversions.toUint32(value[4], value[3], value[2], (byte) 0);
|
||||
int calories = BLETypeConversions.toUint32(value[7], value[6], value[5], (byte) 0) / 10;
|
||||
@@ -248,7 +248,7 @@ public class ColmiR0xPacketHandler {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Runnable liveActivityPulse(GBDevice device, Context context, ColmiLiveActivityContext liveActivityContext) {
|
||||
public static Runnable liveActivityPulse(GBDevice device, Context context, YawellRingLiveActivityContext liveActivityContext) {
|
||||
return () -> {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int sampleTimestamp = (int) (calendar.getTimeInMillis() / 1000);
|
||||
+6
-6
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR0xConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.YawellRingConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiActivitySampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHeartRateSample;
|
||||
@@ -176,13 +176,13 @@ public class ColmiActivitySampleProvider extends AbstractSampleProvider<ColmiAct
|
||||
|
||||
final ActivityKind sleepStageToActivityKind(final int sleepStage) {
|
||||
switch (sleepStage) {
|
||||
case ColmiR0xConstants.SLEEP_TYPE_LIGHT:
|
||||
case YawellRingConstants.SLEEP_TYPE_LIGHT:
|
||||
return ActivityKind.LIGHT_SLEEP;
|
||||
case ColmiR0xConstants.SLEEP_TYPE_DEEP:
|
||||
case YawellRingConstants.SLEEP_TYPE_DEEP:
|
||||
return ActivityKind.DEEP_SLEEP;
|
||||
case ColmiR0xConstants.SLEEP_TYPE_REM:
|
||||
case YawellRingConstants.SLEEP_TYPE_REM:
|
||||
return ActivityKind.REM_SLEEP;
|
||||
case ColmiR0xConstants.SLEEP_TYPE_AWAKE:
|
||||
case YawellRingConstants.SLEEP_TYPE_AWAKE:
|
||||
return ActivityKind.AWAKE_SLEEP;
|
||||
default:
|
||||
return ActivityKind.UNKNOWN;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
+1
-3
@@ -14,15 +14,13 @@
|
||||
|
||||
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.devices.colmi.samples;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractTimeSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHrvValueSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHrvValueSampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiTemperatureSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiTemperatureSampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
@@ -41,12 +41,12 @@ import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGMWB5000D
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600.CasioGWB5600DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cmfwatchpro.CmfWatchPro2Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cmfwatchpro.CmfWatchProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR02Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR03Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR06Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR09Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR10Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR12Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR02Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR03Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR06Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR09Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR10Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.ColmiR12Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.coordinator.CyclingSensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.divoom.PixooCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.domyos.DomyosT540Coordinator;
|
||||
|
||||
+96
-96
@@ -14,7 +14,7 @@
|
||||
|
||||
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.service.devices.colmi;
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.yawell.ring;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
@@ -47,10 +47,10 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiLiveActivityContext;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR0xConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.ColmiR0xPacketHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.colmi.samples.ColmiHeartRateSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.YawellRingLiveActivityContext;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.YawellRingConstants;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.YawellRingPacketHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.yawell.ring.samples.ColmiHeartRateSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.ColmiHeartRateSample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
|
||||
@@ -68,11 +68,11 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||
|
||||
public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ColmiR0xDeviceSupport.class);
|
||||
public class YawellRingDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(YawellRingDeviceSupport.class);
|
||||
private final Handler backgroundTasksHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private final DeviceInfoProfile<ColmiR0xDeviceSupport> deviceInfoProfile;
|
||||
private final DeviceInfoProfile<YawellRingDeviceSupport> deviceInfoProfile;
|
||||
private String cachedFirmwareVersion = null;
|
||||
|
||||
private int daysAgo;
|
||||
@@ -83,12 +83,12 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
private ByteBuffer bigDataPacket;
|
||||
|
||||
private static final int LIVE_ACTIVITY_BUFFER_INTERVAL = 2000;
|
||||
private final ColmiLiveActivityContext liveActivityContext = new ColmiLiveActivityContext();
|
||||
private final YawellRingLiveActivityContext liveActivityContext = new YawellRingLiveActivityContext();
|
||||
|
||||
public ColmiR0xDeviceSupport() {
|
||||
public YawellRingDeviceSupport() {
|
||||
super(LOG);
|
||||
addSupportedService(ColmiR0xConstants.CHARACTERISTIC_SERVICE_V1);
|
||||
addSupportedService(ColmiR0xConstants.CHARACTERISTIC_SERVICE_V2);
|
||||
addSupportedService(YawellRingConstants.CHARACTERISTIC_SERVICE_V1);
|
||||
addSupportedService(YawellRingConstants.CHARACTERISTIC_SERVICE_V2);
|
||||
addSupportedService(GattService.UUID_SERVICE_DEVICE_INFORMATION);
|
||||
|
||||
IntentListener mListener = intent -> {
|
||||
@@ -157,8 +157,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
builder.setUpdateState(getDevice(), GBDevice.State.INITIALIZED, getContext());
|
||||
|
||||
builder.notify(getCharacteristic(ColmiR0xConstants.CHARACTERISTIC_NOTIFY_V1), true);
|
||||
builder.notify(getCharacteristic(ColmiR0xConstants.CHARACTERISTIC_NOTIFY_V2), true);
|
||||
builder.notify(getCharacteristic(YawellRingConstants.CHARACTERISTIC_NOTIFY_V1), true);
|
||||
builder.notify(getCharacteristic(YawellRingConstants.CHARACTERISTIC_NOTIFY_V2), true);
|
||||
|
||||
// Delay initialization with 2 seconds to give the ring time to settle
|
||||
backgroundTasksHandler.removeCallbacksAndMessages(null);
|
||||
@@ -185,25 +185,25 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
LOG.debug("Characteristic {} changed, value: {}", characteristicUUID, StringUtils.bytesToHex(value));
|
||||
|
||||
if (characteristicUUID.equals(ColmiR0xConstants.CHARACTERISTIC_NOTIFY_V1)) {
|
||||
if (characteristicUUID.equals(YawellRingConstants.CHARACTERISTIC_NOTIFY_V1)) {
|
||||
switch (value[0]) {
|
||||
case ColmiR0xConstants.CMD_SET_DATE_TIME:
|
||||
case YawellRingConstants.CMD_SET_DATE_TIME:
|
||||
LOG.info("Received set date/time response: {}", StringUtils.bytesToHex(value));
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_BATTERY:
|
||||
case YawellRingConstants.CMD_BATTERY:
|
||||
int levelResponse = value[1];
|
||||
boolean charging = value[2] == 1;
|
||||
LOG.info("Received battery level response: {}% (charging: {})", levelResponse, charging);
|
||||
GBDeviceEventBatteryInfo batteryEvent = createDeviceBatteryInfoEvent(levelResponse, charging);
|
||||
evaluateGBDeviceEvent(batteryEvent);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_PHONE_NAME:
|
||||
case YawellRingConstants.CMD_PHONE_NAME:
|
||||
LOG.info("Received phone name response: {}", StringUtils.bytesToHex(value));
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_PREFERENCES:
|
||||
case YawellRingConstants.CMD_PREFERENCES:
|
||||
LOG.info("Received user preferences response: {}", StringUtils.bytesToHex(value));
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_SYNC_HEART_RATE:
|
||||
case YawellRingConstants.CMD_SYNC_HEART_RATE:
|
||||
LOG.info("Received HR history sync packet: {}", StringUtils.bytesToHex(value));
|
||||
int hrPacketNr = value[1] & 0xff;
|
||||
if (hrPacketNr == 0xff) {
|
||||
@@ -264,37 +264,37 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_AUTO_HR_PREF:
|
||||
ColmiR0xPacketHandler.hrIntervalSettings(this, value);
|
||||
case YawellRingConstants.CMD_AUTO_HR_PREF:
|
||||
YawellRingPacketHandler.hrIntervalSettings(this, value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_GOALS:
|
||||
ColmiR0xPacketHandler.goalsSettings(value);
|
||||
case YawellRingConstants.CMD_GOALS:
|
||||
YawellRingPacketHandler.goalsSettings(value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_AUTO_SPO2_PREF:
|
||||
ColmiR0xPacketHandler.spo2Settings(this, value);
|
||||
case YawellRingConstants.CMD_AUTO_SPO2_PREF:
|
||||
YawellRingPacketHandler.spo2Settings(this, value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_PACKET_SIZE:
|
||||
case YawellRingConstants.CMD_PACKET_SIZE:
|
||||
LOG.info("Received packet size indicator: {} bytes", value[1] & 0xff);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_AUTO_STRESS_PREF:
|
||||
ColmiR0xPacketHandler.stressSettings(this, value);
|
||||
case YawellRingConstants.CMD_AUTO_STRESS_PREF:
|
||||
YawellRingPacketHandler.stressSettings(this, value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_AUTO_HRV_PREF:
|
||||
ColmiR0xPacketHandler.hrvSettings(this, value);
|
||||
case YawellRingConstants.CMD_AUTO_HRV_PREF:
|
||||
YawellRingPacketHandler.hrvSettings(this, value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_AUTO_TEMP_PREF:
|
||||
case YawellRingConstants.CMD_AUTO_TEMP_PREF:
|
||||
if (value[1] == 0x03) { // so far always observed to be 0x03
|
||||
ColmiR0xPacketHandler.tempSettings(this, value);
|
||||
YawellRingPacketHandler.tempSettings(this, value);
|
||||
}
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_SYNC_STRESS:
|
||||
ColmiR0xPacketHandler.historicalStress(getDevice(), getContext(), value);
|
||||
case YawellRingConstants.CMD_SYNC_STRESS:
|
||||
YawellRingPacketHandler.historicalStress(getDevice(), getContext(), value);
|
||||
if (!getDevice().isBusy()) {
|
||||
fetchHistorySpo2();
|
||||
}
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_SYNC_ACTIVITY:
|
||||
ColmiR0xPacketHandler.historicalActivity(getDevice(), getContext(), value);
|
||||
case YawellRingConstants.CMD_SYNC_ACTIVITY:
|
||||
YawellRingPacketHandler.historicalActivity(getDevice(), getContext(), value);
|
||||
if (!getDevice().isBusy()) {
|
||||
if (daysAgo < 7) {
|
||||
daysAgo++;
|
||||
@@ -305,9 +305,9 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_SYNC_HRV:
|
||||
case YawellRingConstants.CMD_SYNC_HRV:
|
||||
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_hrv_data));
|
||||
ColmiR0xPacketHandler.historicalHRV(getDevice(), getContext(), value, daysAgo);
|
||||
YawellRingPacketHandler.historicalHRV(getDevice(), getContext(), value, daysAgo);
|
||||
if (!getDevice().isBusy()) {
|
||||
if (daysAgo < 6) {
|
||||
daysAgo++;
|
||||
@@ -321,46 +321,46 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_FIND_DEVICE:
|
||||
case YawellRingConstants.CMD_FIND_DEVICE:
|
||||
LOG.info("Received find device response: {}", StringUtils.bytesToHex(value));
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_MANUAL_HEART_RATE:
|
||||
ColmiR0xPacketHandler.liveHeartRate(getDevice(), getContext(), value);
|
||||
case YawellRingConstants.CMD_MANUAL_HEART_RATE:
|
||||
YawellRingPacketHandler.liveHeartRate(getDevice(), getContext(), value);
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_REALTIME_HEART_RATE:
|
||||
ColmiR0xPacketHandler.realtimeHeartRate(getDevice(), getContext(), liveActivityContext, value);
|
||||
case YawellRingConstants.CMD_REALTIME_HEART_RATE:
|
||||
YawellRingPacketHandler.realtimeHeartRate(getDevice(), getContext(), liveActivityContext, value);
|
||||
|
||||
// The realtime measurement has a timeout of 60 seconds.
|
||||
// Send a "continue" command every 30 packets (= every 30 seconds)
|
||||
liveActivityContext.setRealtimeHrmPacketCount((liveActivityContext.getRealtimeHrmPacketCount()+1) % 30);
|
||||
|
||||
if(liveActivityContext.isRealtimeHrm() && liveActivityContext.getRealtimeHrmPacketCount() == 0) {
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_REALTIME_HEART_RATE, 0x03});
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{YawellRingConstants.CMD_REALTIME_HEART_RATE, 0x03});
|
||||
LOG.info("Continue realtime HRM request sent: {}", StringUtils.bytesToHex(measureHeartRatePacket));
|
||||
sendWrite("continueRealtimeHRMRequest", measureHeartRatePacket);
|
||||
}
|
||||
|
||||
break;
|
||||
case ColmiR0xConstants.CMD_NOTIFICATION:
|
||||
case YawellRingConstants.CMD_NOTIFICATION:
|
||||
switch (value[1]) {
|
||||
case ColmiR0xConstants.NOTIFICATION_NEW_HR_DATA:
|
||||
case YawellRingConstants.NOTIFICATION_NEW_HR_DATA:
|
||||
LOG.info("Received notification from ring that new HR data is available to sync");
|
||||
break;
|
||||
case ColmiR0xConstants.NOTIFICATION_NEW_SPO2_DATA:
|
||||
case YawellRingConstants.NOTIFICATION_NEW_SPO2_DATA:
|
||||
LOG.info("Received notification from ring that new SpO2 data is available to sync");
|
||||
break;
|
||||
case ColmiR0xConstants.NOTIFICATION_NEW_STEPS_DATA:
|
||||
case YawellRingConstants.NOTIFICATION_NEW_STEPS_DATA:
|
||||
LOG.info("Received notification from ring that new steps data is available to sync");
|
||||
break;
|
||||
case ColmiR0xConstants.NOTIFICATION_BATTERY_LEVEL:
|
||||
case YawellRingConstants.NOTIFICATION_BATTERY_LEVEL:
|
||||
int levelNotif = value[2];
|
||||
charging = value[3] == 1;
|
||||
LOG.info("Received battery level notification: {}% (charging: {})", levelNotif, charging);
|
||||
GBDeviceEventBatteryInfo batteryNotifEvent = createDeviceBatteryInfoEvent(levelNotif, charging);
|
||||
evaluateGBDeviceEvent(batteryNotifEvent);
|
||||
break;
|
||||
case ColmiR0xConstants.NOTIFICATION_LIVE_ACTIVITY:
|
||||
ColmiR0xPacketHandler.liveActivity(getDevice(), getContext(), liveActivityContext, value);
|
||||
case YawellRingConstants.NOTIFICATION_LIVE_ACTIVITY:
|
||||
YawellRingPacketHandler.liveActivity(getDevice(), getContext(), liveActivityContext, value);
|
||||
break;
|
||||
default:
|
||||
LOG.info("Received unrecognized notification: {}", StringUtils.bytesToHex(value));
|
||||
@@ -372,7 +372,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (characteristicUUID.equals(ColmiR0xConstants.CHARACTERISTIC_NOTIFY_V2)) {
|
||||
if (characteristicUUID.equals(YawellRingConstants.CHARACTERISTIC_NOTIFY_V2)) {
|
||||
// Big data responses can arrive in multiple packets that need to be concatenated
|
||||
if (bigDataPacket != null) {
|
||||
LOG.debug("Received {} bytes on big data characteristic while waiting for follow-up data", value.length);
|
||||
@@ -394,7 +394,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
}
|
||||
switch (value[0]) {
|
||||
case ColmiR0xConstants.CMD_BIG_DATA_V2:
|
||||
case YawellRingConstants.CMD_BIG_DATA_V2:
|
||||
int packetLength = BLETypeConversions.toUint16(value[2], value[3]);
|
||||
if (value.length < packetLength + 6) {
|
||||
// If the received packet is smaller than the expected packet size (+ 6 bytes header),
|
||||
@@ -405,12 +405,12 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
return true;
|
||||
}
|
||||
switch (value[1]) {
|
||||
case ColmiR0xConstants.BIG_DATA_TYPE_TEMPERATURE:
|
||||
ColmiR0xPacketHandler.historicalTemperature(getDevice(), value);
|
||||
case YawellRingConstants.BIG_DATA_TYPE_TEMPERATURE:
|
||||
YawellRingPacketHandler.historicalTemperature(getDevice(), value);
|
||||
fetchRecordedDataFinished();
|
||||
break;
|
||||
case ColmiR0xConstants.BIG_DATA_TYPE_SLEEP:
|
||||
ColmiR0xPacketHandler.historicalSleep(getDevice(), getContext(), value);
|
||||
case YawellRingConstants.BIG_DATA_TYPE_SLEEP:
|
||||
YawellRingPacketHandler.historicalSleep(getDevice(), getContext(), value);
|
||||
|
||||
daysAgo = 0;
|
||||
fetchHistoryHRV();
|
||||
@@ -419,8 +419,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
// will not send anything back after requesting HRV history
|
||||
fetchRecordedDataFinished();
|
||||
break;
|
||||
case ColmiR0xConstants.BIG_DATA_TYPE_SPO2:
|
||||
ColmiR0xPacketHandler.historicalSpo2(getDevice(), value);
|
||||
case YawellRingConstants.BIG_DATA_TYPE_SPO2:
|
||||
YawellRingPacketHandler.historicalSpo2(getDevice(), value);
|
||||
fetchHistorySleep();
|
||||
break;
|
||||
default:
|
||||
@@ -463,7 +463,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
private void sendWrite(String taskName, byte[] contents) {
|
||||
TransactionBuilder builder = new TransactionBuilder(taskName);
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(ColmiR0xConstants.CHARACTERISTIC_WRITE);
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(YawellRingConstants.CHARACTERISTIC_WRITE);
|
||||
if (characteristic != null) {
|
||||
builder.write(characteristic, contents);
|
||||
builder.queue(getQueue());
|
||||
@@ -472,7 +472,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
private void sendCommand(String taskName, byte[] contents) {
|
||||
TransactionBuilder builder = new TransactionBuilder(taskName);
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(ColmiR0xConstants.CHARACTERISTIC_COMMAND);
|
||||
BluetoothGattCharacteristic characteristic = getCharacteristic(YawellRingConstants.CHARACTERISTIC_COMMAND);
|
||||
if (characteristic != null) {
|
||||
builder.write(characteristic, contents);
|
||||
builder.queue(getQueue());
|
||||
@@ -480,14 +480,14 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
|
||||
private void requestBatteryInfo() {
|
||||
byte[] batteryRequestPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_BATTERY});
|
||||
byte[] batteryRequestPacket = buildPacket(new byte[]{YawellRingConstants.CMD_BATTERY});
|
||||
LOG.info("Battery request sent: {}", StringUtils.bytesToHex(batteryRequestPacket));
|
||||
sendWrite("batteryRequest", batteryRequestPacket);
|
||||
}
|
||||
|
||||
private void setPhoneName() {
|
||||
byte[] setPhoneNamePacket = buildPacket(new byte[]{
|
||||
ColmiR0xConstants.CMD_PHONE_NAME,
|
||||
YawellRingConstants.CMD_PHONE_NAME,
|
||||
0x02, // Client major version
|
||||
0x0a, // Client minor version
|
||||
'G',
|
||||
@@ -500,7 +500,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
private void setDateTime() {
|
||||
Calendar now = GregorianCalendar.getInstance();
|
||||
byte[] setDateTimePacket = buildPacket(new byte[]{
|
||||
ColmiR0xConstants.CMD_SET_DATE_TIME,
|
||||
YawellRingConstants.CMD_SET_DATE_TIME,
|
||||
Byte.parseByte(String.valueOf(now.get(Calendar.YEAR) % 2000), 16),
|
||||
Byte.parseByte(String.valueOf(now.get(Calendar.MONTH) + 1), 16),
|
||||
Byte.parseByte(String.valueOf(now.get(Calendar.DAY_OF_MONTH)), 16),
|
||||
@@ -526,25 +526,25 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
break;
|
||||
case DeviceSettingsPreferenceConst.PREF_SPO2_ALL_DAY_MONITORING:
|
||||
final boolean spo2Enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_SPO2_ALL_DAY_MONITORING, false);
|
||||
byte[] spo2PrefsPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_SPO2_PREF, ColmiR0xConstants.PREF_WRITE, (byte) (spo2Enabled ? 0x01 : 0x00)});
|
||||
byte[] spo2PrefsPacket = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_SPO2_PREF, YawellRingConstants.PREF_WRITE, (byte) (spo2Enabled ? 0x01 : 0x00)});
|
||||
LOG.info("SpO2 preference request sent: {}", StringUtils.bytesToHex(spo2PrefsPacket));
|
||||
sendWrite("spo2PreferenceRequest", spo2PrefsPacket);
|
||||
break;
|
||||
case DeviceSettingsPreferenceConst.PREF_HEARTRATE_STRESS_MONITORING:
|
||||
final boolean stressEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HEARTRATE_STRESS_MONITORING, false);
|
||||
byte[] stressPrefsPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_STRESS_PREF, ColmiR0xConstants.PREF_WRITE, (byte) (stressEnabled ? 0x01 : 0x00)});
|
||||
byte[] stressPrefsPacket = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_STRESS_PREF, YawellRingConstants.PREF_WRITE, (byte) (stressEnabled ? 0x01 : 0x00)});
|
||||
LOG.info("Stress preference request sent: {}", StringUtils.bytesToHex(stressPrefsPacket));
|
||||
sendWrite("stressPreferenceRequest", stressPrefsPacket);
|
||||
break;
|
||||
case DeviceSettingsPreferenceConst.PREF_HRV_ALL_DAY_MONITORING:
|
||||
final boolean hrvEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HRV_ALL_DAY_MONITORING, false);
|
||||
byte[] hrvPrefsPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_HRV_PREF, ColmiR0xConstants.PREF_WRITE, (byte) (hrvEnabled ? 0x01 : 0x00)});
|
||||
byte[] hrvPrefsPacket = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_HRV_PREF, YawellRingConstants.PREF_WRITE, (byte) (hrvEnabled ? 0x01 : 0x00)});
|
||||
LOG.info("HRV preference request sent: {}", StringUtils.bytesToHex(hrvPrefsPacket));
|
||||
sendWrite("hrvPreferenceRequest", hrvPrefsPacket);
|
||||
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)});
|
||||
byte[] tempPrefsPacket = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_TEMP_PREF, 0x03, YawellRingConstants.PREF_WRITE, (byte) (tempEnabled ? 0x01 : 0x00)});
|
||||
LOG.info("Temperature preference request sent: {}", StringUtils.bytesToHex(tempPrefsPacket));
|
||||
sendWrite("tempPreferenceRequest", tempPrefsPacket);
|
||||
break;
|
||||
@@ -566,7 +566,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
final int displayOnEndHour = Integer.parseInt(displayOnEnd.split(":")[0]);
|
||||
final int displayOnEndMin = Integer.parseInt(displayOnEnd.split(":")[1]);
|
||||
byte[] displayPrefsPacket = buildPacket(new byte[]{
|
||||
ColmiR0xConstants.CMD_DISPLAY_PREF,
|
||||
YawellRingConstants.CMD_DISPLAY_PREF,
|
||||
0x04,
|
||||
(byte) (displayEnabled ? 0x01 : 0x02),
|
||||
(byte) (Objects.equals(wearLocation, "left") ? 0x01 : 0x02),
|
||||
@@ -589,8 +589,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
// Round to nearest 5 minutes and limit to 60 minutes due to device constraints
|
||||
long hrIntervalMins = Math.min(Math.round(seconds / 60.0 / 5.0) * 5, 60);
|
||||
byte[] hrIntervalPacket = buildPacket(new byte[]{
|
||||
ColmiR0xConstants.CMD_AUTO_HR_PREF,
|
||||
ColmiR0xConstants.PREF_WRITE,
|
||||
YawellRingConstants.CMD_AUTO_HR_PREF,
|
||||
YawellRingConstants.PREF_WRITE,
|
||||
hrIntervalMins > 0 ? (byte) 0x01 : (byte) 0x02,
|
||||
(byte) hrIntervalMins
|
||||
});
|
||||
@@ -615,8 +615,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
break;
|
||||
}
|
||||
byte[] userPrefsPacket = buildPacket(new byte[]{
|
||||
ColmiR0xConstants.CMD_PREFERENCES,
|
||||
ColmiR0xConstants.PREF_WRITE,
|
||||
YawellRingConstants.CMD_PREFERENCES,
|
||||
YawellRingConstants.PREF_WRITE,
|
||||
0x00, // 24h format, 0x01 is 12h format
|
||||
(byte) ("metric".equals(measurementSystem) ? 0x00 : 0x01),
|
||||
userGender,
|
||||
@@ -632,29 +632,29 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
}
|
||||
|
||||
private void requestSettingsFromRing() {
|
||||
byte[] request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_HR_PREF, ColmiR0xConstants.PREF_READ});
|
||||
byte[] request = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_HR_PREF, YawellRingConstants.PREF_READ});
|
||||
LOG.info("Request HR measurement interval from ring: {}", StringUtils.bytesToHex(request));
|
||||
sendWrite("hrIntervalRequest", request);
|
||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_STRESS_PREF, ColmiR0xConstants.PREF_READ});
|
||||
request = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_STRESS_PREF, YawellRingConstants.PREF_READ});
|
||||
LOG.info("Request stress measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
||||
sendWrite("stressSettingRequest", request);
|
||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_SPO2_PREF, ColmiR0xConstants.PREF_READ});
|
||||
request = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_SPO2_PREF, YawellRingConstants.PREF_READ});
|
||||
LOG.info("Request SpO2 measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
||||
sendWrite("spo2SettingRequest", request);
|
||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_HRV_PREF, ColmiR0xConstants.PREF_READ});
|
||||
request = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_HRV_PREF, YawellRingConstants.PREF_READ});
|
||||
LOG.info("Request HRV measurement setting from ring: {}", StringUtils.bytesToHex(request));
|
||||
sendWrite("hrvSettingRequest", request);
|
||||
request = buildPacket(new byte[]{ColmiR0xConstants.CMD_AUTO_TEMP_PREF, 0x03, ColmiR0xConstants.PREF_READ});
|
||||
request = buildPacket(new byte[]{YawellRingConstants.CMD_AUTO_TEMP_PREF, 0x03, YawellRingConstants.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[]{YawellRingConstants.CMD_GOALS, YawellRingConstants.PREF_READ});
|
||||
LOG.info("Request goals from ring: {}", StringUtils.bytesToHex(request));
|
||||
sendWrite("goalsSettingRequest", request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOff() {
|
||||
byte[] poweroffPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_POWER_OFF, 0x01});
|
||||
byte[] poweroffPacket = buildPacket(new byte[]{YawellRingConstants.CMD_POWER_OFF, 0x01});
|
||||
LOG.info("Poweroff request sent: {}", StringUtils.bytesToHex(poweroffPacket));
|
||||
sendWrite("poweroffRequest", poweroffPacket);
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
@Override
|
||||
public void onReset(int flags) {
|
||||
if ((flags & GBDeviceProtocol.RESET_FLAGS_FACTORY_RESET) != 0) {
|
||||
byte[] resetPacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_FACTORY_RESET, 0x66, 0x66});
|
||||
byte[] resetPacket = buildPacket(new byte[]{YawellRingConstants.CMD_FACTORY_RESET, 0x66, 0x66});
|
||||
LOG.info("Factory reset request sent: {}", StringUtils.bytesToHex(resetPacket));
|
||||
sendWrite("resetRequest", resetPacket);
|
||||
}
|
||||
@@ -672,14 +672,14 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
public void onFindDevice(boolean start) {
|
||||
if (!start) return;
|
||||
|
||||
byte[] findDevicePacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_FIND_DEVICE, 0x55, (byte) 0xAA});
|
||||
byte[] findDevicePacket = buildPacket(new byte[]{YawellRingConstants.CMD_FIND_DEVICE, 0x55, (byte) 0xAA});
|
||||
LOG.info("Find device request sent: {}", StringUtils.bytesToHex(findDevicePacket));
|
||||
sendWrite("findDeviceRequest", findDevicePacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeartRateTest() {
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_MANUAL_HEART_RATE, 0x01});
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{YawellRingConstants.CMD_MANUAL_HEART_RATE, 0x01});
|
||||
LOG.info("Measure HR request sent: {}", StringUtils.bytesToHex(measureHeartRatePacket));
|
||||
sendWrite("measureHRRequest", measureHeartRatePacket);
|
||||
}
|
||||
@@ -694,7 +694,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
if(enable) enableByte = 0x01;
|
||||
else enableByte = 0x02;
|
||||
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{ColmiR0xConstants.CMD_REALTIME_HEART_RATE, enableByte});
|
||||
byte[] measureHeartRatePacket = buildPacket(new byte[]{YawellRingConstants.CMD_REALTIME_HEART_RATE, enableByte});
|
||||
LOG.info("Enable realtime HRM request sent: {}", StringUtils.bytesToHex(measureHeartRatePacket));
|
||||
sendWrite("enableRealtimeHRMRequest", measureHeartRatePacket);
|
||||
}
|
||||
@@ -711,7 +711,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
LOG.info("Starting live activity timeout scheduler");
|
||||
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
|
||||
service.scheduleWithFixedDelay(ColmiR0xPacketHandler.liveActivityPulse(getDevice(), getContext(), liveActivityContext), 0, LIVE_ACTIVITY_BUFFER_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
service.scheduleWithFixedDelay(YawellRingPacketHandler.liveActivityPulse(getDevice(), getContext(), liveActivityContext), 0, LIVE_ACTIVITY_BUFFER_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
liveActivityContext.setRealtimeStepsScheduler(service);
|
||||
} else {
|
||||
LOG.info("Stopping live activity timeout scheduler");
|
||||
@@ -744,7 +744,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
syncingDay.set(Calendar.MINUTE, 0);
|
||||
syncingDay.set(Calendar.SECOND, 0);
|
||||
syncingDay.set(Calendar.MILLISECOND, 0);
|
||||
byte[] activityHistoryRequest = buildPacket(new byte[]{ColmiR0xConstants.CMD_SYNC_ACTIVITY, (byte) daysAgo, 0x0f, 0x00, 0x5f, 0x01});
|
||||
byte[] activityHistoryRequest = buildPacket(new byte[]{YawellRingConstants.CMD_SYNC_ACTIVITY, (byte) daysAgo, 0x0f, 0x00, 0x5f, 0x01});
|
||||
LOG.info("Fetch historical activity data request sent: {}", StringUtils.bytesToHex(activityHistoryRequest));
|
||||
sendWrite("activityHistoryRequest", activityHistoryRequest);
|
||||
}
|
||||
@@ -762,7 +762,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
syncingDay.set(Calendar.MILLISECOND, 0);
|
||||
ByteBuffer hrHistoryRequestBB = ByteBuffer.allocate(5);
|
||||
hrHistoryRequestBB.order(ByteOrder.LITTLE_ENDIAN);
|
||||
hrHistoryRequestBB.put(0, ColmiR0xConstants.CMD_SYNC_HEART_RATE);
|
||||
hrHistoryRequestBB.put(0, YawellRingConstants.CMD_SYNC_HEART_RATE);
|
||||
long requestTimestamp = syncingDay.getTimeInMillis() + syncingDay.get(Calendar.ZONE_OFFSET) + syncingDay.get(Calendar.DST_OFFSET);
|
||||
hrHistoryRequestBB.putInt(1, (int) (requestTimestamp / 1000));
|
||||
byte[] hrHistoryRequest = buildPacket(hrHistoryRequestBB.array());
|
||||
@@ -774,7 +774,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_stress_data));
|
||||
getDevice().sendDeviceUpdateIntent(getContext());
|
||||
syncingDay = Calendar.getInstance();
|
||||
byte[] stressHistoryRequest = buildPacket(new byte[]{ColmiR0xConstants.CMD_SYNC_STRESS});
|
||||
byte[] stressHistoryRequest = buildPacket(new byte[]{YawellRingConstants.CMD_SYNC_STRESS});
|
||||
LOG.info("Fetch historical stress data request sent: {}", StringUtils.bytesToHex(stressHistoryRequest));
|
||||
sendWrite("stressHistoryRequest", stressHistoryRequest);
|
||||
}
|
||||
@@ -783,8 +783,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_spo2_data));
|
||||
getDevice().sendDeviceUpdateIntent(getContext());
|
||||
byte[] spo2HistoryRequest = new byte[]{
|
||||
ColmiR0xConstants.CMD_BIG_DATA_V2,
|
||||
ColmiR0xConstants.BIG_DATA_TYPE_SPO2,
|
||||
YawellRingConstants.CMD_BIG_DATA_V2,
|
||||
YawellRingConstants.BIG_DATA_TYPE_SPO2,
|
||||
0x01,
|
||||
0x00,
|
||||
(byte) 0xff,
|
||||
@@ -799,8 +799,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_sleep_data));
|
||||
getDevice().sendDeviceUpdateIntent(getContext());
|
||||
byte[] sleepHistoryRequest = new byte[]{
|
||||
ColmiR0xConstants.CMD_BIG_DATA_V2,
|
||||
ColmiR0xConstants.BIG_DATA_TYPE_SLEEP,
|
||||
YawellRingConstants.CMD_BIG_DATA_V2,
|
||||
YawellRingConstants.BIG_DATA_TYPE_SLEEP,
|
||||
0x01,
|
||||
0x00,
|
||||
(byte) 0xff,
|
||||
@@ -823,7 +823,7 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
syncingDay.set(Calendar.MILLISECOND, 0);
|
||||
ByteBuffer hrvHistoryRequestBB = ByteBuffer.allocate(5);
|
||||
hrvHistoryRequestBB.order(ByteOrder.LITTLE_ENDIAN);
|
||||
hrvHistoryRequestBB.put(0, ColmiR0xConstants.CMD_SYNC_HRV);
|
||||
hrvHistoryRequestBB.put(0, YawellRingConstants.CMD_SYNC_HRV);
|
||||
hrvHistoryRequestBB.putInt(1, daysAgo);
|
||||
byte[] hrvHistoryRequest = buildPacket(hrvHistoryRequestBB.array());
|
||||
LOG.info("Fetch historical HRV data request sent ({}): {}", syncingDay.getTime(), StringUtils.bytesToHex(hrvHistoryRequest));
|
||||
@@ -834,8 +834,8 @@ public class ColmiR0xDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
getDevice().setBusyTask(getContext().getString(R.string.busy_task_fetch_temperature));
|
||||
getDevice().sendDeviceUpdateIntent(getContext());
|
||||
byte[] temperatureHistoryRequest = new byte[]{
|
||||
ColmiR0xConstants.CMD_BIG_DATA_V2,
|
||||
ColmiR0xConstants.BIG_DATA_TYPE_TEMPERATURE,
|
||||
YawellRingConstants.CMD_BIG_DATA_V2,
|
||||
YawellRingConstants.BIG_DATA_TYPE_TEMPERATURE,
|
||||
0x01,
|
||||
0x00,
|
||||
0x3e,
|
||||
Reference in New Issue
Block a user