mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a4a2bed80c
@ -52,7 +52,7 @@ public final class WatchXPlusConstants extends LenovoWatchConstants {
|
||||
|
||||
public static final String PREF_LONGSIT_START = "pref_longsit_start";
|
||||
public static final String PREF_LONGSIT_END = "pref_longsit_end";
|
||||
|
||||
public static final String PREF_SHOW_RAW_GRAPH = "show_raw_graph";
|
||||
// moved to gear icon (per device settings)
|
||||
public static final String PREF_LANGUAGE = "language";
|
||||
|
||||
|
@ -258,8 +258,8 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator {
|
||||
LOG.info(" Long sit reminder is disabled ");
|
||||
return false;
|
||||
} else {
|
||||
String end = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_START, "06:00");
|
||||
String start = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_END, "23:00");
|
||||
String start = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_START, "06:00");
|
||||
String end = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_END, "23:00");
|
||||
|
||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
||||
|
||||
|
@ -3,18 +3,31 @@ package nodomain.freeyourgadget.gadgetbridge.devices.lenovo.watchxplus;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.WatchXPlusActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.WatchXPlusActivitySampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||
|
||||
public class WatchXPlusSampleProvider extends AbstractSampleProvider<WatchXPlusActivitySample> {
|
||||
private GBDevice mDevice;
|
||||
private DaoSession mSession;
|
||||
|
||||
private final float movementDivisor = 1500.0f;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WatchXPlusSampleProvider.class);
|
||||
|
||||
public WatchXPlusSampleProvider(GBDevice device, DaoSession session) {
|
||||
super(device, session);
|
||||
mSession = session;
|
||||
@ -28,12 +41,22 @@ public class WatchXPlusSampleProvider extends AbstractSampleProvider<WatchXPlusA
|
||||
|
||||
@Override
|
||||
public int toRawActivityKind(int activityKind) {
|
||||
LOG.info(" toRawActivityKind: " + activityKind);
|
||||
return activityKind;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float normalizeIntensity(int rawIntensity) {
|
||||
return rawIntensity;
|
||||
float newIntensity = 0;
|
||||
if (rawIntensity <= 0) {
|
||||
//newIntensity = (rawIntensity * 0.5f) + 0.7f;
|
||||
newIntensity = rawIntensity;
|
||||
} else {
|
||||
newIntensity = rawIntensity / movementDivisor;
|
||||
}
|
||||
//LOG.info(" normalizeIntensity: " + rawIntensity + " to " + newIntensity);
|
||||
return newIntensity;
|
||||
//return rawIntensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,4 +86,335 @@ public class WatchXPlusSampleProvider extends AbstractSampleProvider<WatchXPlusA
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return WatchXPlusActivitySampleDao.Properties.DeviceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WatchXPlusActivitySample> getAllActivitySamples(int timestamp_from, int timestamp_to) {
|
||||
boolean showRawData = GBApplication.getDeviceSpecificSharedPrefs(mDevice.getAddress()).getBoolean(WatchXPlusConstants.PREF_SHOW_RAW_GRAPH, false);
|
||||
if (showRawData) {
|
||||
return getGBActivitySamples(timestamp_from, timestamp_to, ActivityKind.TYPE_ALL);
|
||||
}
|
||||
List<WatchXPlusActivitySample> samples = getGBActivitySamples(timestamp_from, timestamp_to, ActivityKind.TYPE_ALL);
|
||||
int numEntries = samples.size();
|
||||
if (numEntries < 2) {
|
||||
return getGBActivitySamples(timestamp_from, timestamp_to, ActivityKind.TYPE_ALL);
|
||||
}
|
||||
|
||||
// LOG.info(" testing: ts_from:" + timestamp_from + " ts_to: " + timestamp_to);
|
||||
|
||||
/*
|
||||
LOG.info(" testing: samples: ");
|
||||
for (int i = 0; i < numEntries; i++) {
|
||||
LOG.info(" s: " + i + " : " + samples.get(i).toString());
|
||||
}
|
||||
*/
|
||||
List<WatchXPlusActivitySample> resultList = new ArrayList<>(numEntries);
|
||||
|
||||
// how many elements to scan for sleep sate before and after sleep block
|
||||
int seekAhead = 10;
|
||||
boolean secondBlock = false;
|
||||
|
||||
// find sleep start and sleep stop index based on ActivityKind.TYPE_DEEP_SLEEP BLOCK 1
|
||||
int sleepStartIndex_1 = 0;
|
||||
int sleepStopIndex_1 = numEntries;
|
||||
int countNextSleepStart_1 = 0;
|
||||
int countNextSleepStop_1 = 0;
|
||||
|
||||
for (int i = 0; i < numEntries; i++) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_DEEP_SLEEP) {
|
||||
// normalize RawIntensity
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
// find sleep start index
|
||||
if (sleepStartIndex_1 == 0) {
|
||||
sleepStartIndex_1 = i;
|
||||
sleepStopIndex_1 = sleepStartIndex_1;
|
||||
countNextSleepStop_1 = sleepStopIndex_1;
|
||||
} else {
|
||||
if (countNextSleepStart_1 == 0) {
|
||||
countNextSleepStart_1 = i;
|
||||
// reset start index if next index is far ahead
|
||||
if ((countNextSleepStart_1 - sleepStartIndex_1) > seekAhead * 2) {
|
||||
sleepStartIndex_1 = countNextSleepStart_1;
|
||||
sleepStopIndex_1 = sleepStartIndex_1;
|
||||
countNextSleepStop_1 = sleepStopIndex_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((i - sleepStopIndex_1) < (seekAhead * 3)) {
|
||||
sleepStopIndex_1 = i;
|
||||
}
|
||||
countNextSleepStop_1 = i;
|
||||
}
|
||||
}
|
||||
|
||||
// find sleep start and sleep stop index based on ActivityKind.TYPE_DEEP_SLEEP BLOCK 2
|
||||
int sleepStartIndex_2 = 0;
|
||||
int sleepStopIndex_2 = numEntries;
|
||||
int countNextSleepStart_2 = 0;
|
||||
int countNextSleepStop_2 = 0;
|
||||
int next_block = numEntries;
|
||||
|
||||
for (int i = sleepStopIndex_1 + 1; i < numEntries; i++) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_DEEP_SLEEP) {
|
||||
// find sleep start index
|
||||
if (sleepStartIndex_2 == 0) {
|
||||
sleepStartIndex_2 = i;
|
||||
sleepStopIndex_2 = sleepStartIndex_2;
|
||||
countNextSleepStop_2 = sleepStopIndex_2;
|
||||
} else {
|
||||
if (countNextSleepStart_2 == 0) {
|
||||
countNextSleepStart_2 = i;
|
||||
// reset start index if next index is far ahead
|
||||
if ((countNextSleepStart_2 - sleepStartIndex_2) > seekAhead * 2) {
|
||||
sleepStartIndex_2 = countNextSleepStart_2;
|
||||
sleepStopIndex_2 = sleepStartIndex_2;
|
||||
countNextSleepStop_2 = sleepStopIndex_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((i - sleepStopIndex_2) < (seekAhead * 3)) {
|
||||
sleepStopIndex_2 = i;
|
||||
}
|
||||
countNextSleepStop_2 = i;
|
||||
}
|
||||
}
|
||||
if (sleepStartIndex_2 != 0) {
|
||||
secondBlock = true;
|
||||
LOG.info(" second block ");
|
||||
}
|
||||
|
||||
LOG.info(" sleep_1 begin index:" + sleepStartIndex_1 + " next index: " + countNextSleepStart_1 + " sleep end index: " + sleepStopIndex_1 + " sleep end: " + countNextSleepStop_1);
|
||||
if (secondBlock) {
|
||||
LOG.info(" sleep_2 begin index:" + sleepStartIndex_2 + " next index: " + countNextSleepStart_2 + " sleep end index: " + sleepStopIndex_2 + " sleep end: " + countNextSleepStop_2);
|
||||
}
|
||||
|
||||
// SLEEP BLOCK 1
|
||||
// add all activity before sleep start
|
||||
if (secondBlock) {
|
||||
next_block = sleepStartIndex_2;
|
||||
}
|
||||
int newSleepStartIndex_1 = 0;
|
||||
if (sleepStartIndex_1 >= seekAhead) {
|
||||
newSleepStartIndex_1 = sleepStartIndex_1 - seekAhead;
|
||||
} else {
|
||||
newSleepStartIndex_1 = 0;
|
||||
}
|
||||
for (int i = 0; i < newSleepStartIndex_1; i++) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
if (samples.get(i).getRawIntensity() <= 300) {
|
||||
samples.get(i).setRawIntensity(200);
|
||||
} else if ((samples.get(i).getRawIntensity() <= 1000) && (samples.get(i).getRawIntensity() > 100)) {
|
||||
samples.get(i).setRawIntensity(400);
|
||||
} if (samples.get(i).getRawIntensity() > 1000) {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
}
|
||||
samples.get(i).setRawKind(1);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_ACTIVITY) {
|
||||
if (i < (newSleepStartIndex_1 - 3)) {
|
||||
if ((samples.get(i + 1).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 2).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 3).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP)) {
|
||||
samples.get(i).setRawKind(1);
|
||||
//samples.get(i).setRawIntensity(700);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
}
|
||||
//samples.get(i).setRawIntensity(1000);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// add sleep activity
|
||||
int newSleepStopIndex_1;
|
||||
|
||||
if ((sleepStopIndex_1 + seekAhead) < next_block) {
|
||||
newSleepStopIndex_1 = sleepStopIndex_1 + seekAhead * 2;
|
||||
} else {
|
||||
newSleepStopIndex_1 = next_block;
|
||||
}
|
||||
|
||||
boolean replaceActivity_1 = false;
|
||||
for (int i = newSleepStartIndex_1; i < newSleepStopIndex_1; i++) {
|
||||
ActivitySample sample = samples.get(i);
|
||||
if (i < sleepStartIndex_1) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
replaceActivity_1 = true;
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
if (replaceActivity_1) {
|
||||
samples.get(i).setRawKind(2);
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((samples.get(i).getRawKind() == ActivityKind.TYPE_DEEP_SLEEP) || (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP)) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
if (i > 0) {
|
||||
if (samples.get(i - 1).getHeartRate() > 0) {
|
||||
samples.get(i).setHeartRate(samples.get(i - 1).getHeartRate());
|
||||
}
|
||||
} else {
|
||||
if (samples.get(i + 1).getHeartRate() > 0) {
|
||||
samples.get(i).setHeartRate(samples.get(i + 1).getHeartRate());
|
||||
}
|
||||
}
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if ((samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) && (i > sleepStopIndex_1)) {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add remaining activity
|
||||
if (newSleepStopIndex_1 < next_block) {
|
||||
for (int i = newSleepStopIndex_1; i < (next_block-1); i++) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
if (samples.get(i).getRawIntensity() <= 300) {
|
||||
samples.get(i).setRawIntensity(200);
|
||||
} else if ((samples.get(i).getRawIntensity() <= 1000) && (samples.get(i).getRawIntensity() > 100)) {
|
||||
samples.get(i).setRawIntensity(400);
|
||||
} if (samples.get(i).getRawIntensity() > 1000) {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
}
|
||||
samples.get(i).setRawKind(1);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_ACTIVITY) {
|
||||
if (i < (next_block - 3)) {
|
||||
if ((samples.get(i + 1).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 2).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 3).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP)) {
|
||||
samples.get(i).setRawKind(1);
|
||||
//samples.get(i).setRawIntensity(700);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
}
|
||||
//samples.get(i).setRawIntensity(1000);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!secondBlock) {
|
||||
samples.get(next_block-1).setRawIntensity(100);
|
||||
samples.get(next_block-1).setRawKind(-1);
|
||||
resultList.add(samples.get(next_block-1));
|
||||
return resultList;
|
||||
}
|
||||
|
||||
// SLEEP BLOCK 2
|
||||
// add sleep activity
|
||||
int newSleepStopIndex_2;
|
||||
int newSleepStartIndex_2 = 0;
|
||||
boolean replaceActivity_2 = false;
|
||||
if (sleepStartIndex_2 >= next_block + seekAhead) {
|
||||
newSleepStartIndex_2 = sleepStartIndex_2 - seekAhead;
|
||||
} else {
|
||||
newSleepStartIndex_2 = next_block;
|
||||
}
|
||||
if ((sleepStopIndex_2 + seekAhead) < numEntries) {
|
||||
newSleepStopIndex_2 = sleepStopIndex_2 + seekAhead;
|
||||
} else {
|
||||
newSleepStopIndex_2 = numEntries;
|
||||
}
|
||||
for (int i = newSleepStartIndex_2; i < newSleepStopIndex_2; i++) {
|
||||
ActivitySample sample = samples.get(i);
|
||||
if (i < sleepStartIndex_2) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
replaceActivity_2 = true;
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
if (replaceActivity_2) {
|
||||
samples.get(i).setRawKind(2);
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((samples.get(i).getRawKind() == ActivityKind.TYPE_DEEP_SLEEP) || (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP)) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
if (i > 0) {
|
||||
if (samples.get(i - 1).getHeartRate() > 0) {
|
||||
samples.get(i).setHeartRate(samples.get(i - 1).getHeartRate());
|
||||
}
|
||||
} else {
|
||||
if (samples.get(i + 1).getHeartRate() > 0) {
|
||||
samples.get(i).setHeartRate(samples.get(i + 1).getHeartRate());
|
||||
}
|
||||
}
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
if ((samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) && (i > sleepStopIndex_2)) {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// add remaining activity
|
||||
if (newSleepStopIndex_2 < numEntries) {
|
||||
for (int i = newSleepStopIndex_2; i < (numEntries-1); i++) {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) {
|
||||
if (samples.get(i).getRawIntensity() <= 300) {
|
||||
samples.get(i).setRawIntensity(200);
|
||||
} else if ((samples.get(i).getRawIntensity() <= 1000) && (samples.get(i).getRawIntensity() > 100)) {
|
||||
samples.get(i).setRawIntensity(400);
|
||||
} if (samples.get(i).getRawIntensity() > 1000) {
|
||||
samples.get(i).setRawIntensity(600);
|
||||
}
|
||||
samples.get(i).setRawKind(1);
|
||||
resultList.add(samples.get(i));
|
||||
} else {
|
||||
if (samples.get(i).getRawKind() == ActivityKind.TYPE_ACTIVITY) {
|
||||
if (i < (numEntries - 3)) {
|
||||
if ((samples.get(i + 1).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 2).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP) || (samples.get(i + 3).getRawKind() == ActivityKind.TYPE_LIGHT_SLEEP)) {
|
||||
samples.get(i).setRawKind(1);
|
||||
//samples.get(i).setRawIntensity(700);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
}
|
||||
//samples.get(i).setRawIntensity(1000);
|
||||
} else {
|
||||
samples.get(i).setRawIntensity(1000);
|
||||
}
|
||||
resultList.add(samples.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
samples.get(numEntries-1).setRawIntensity(-1);
|
||||
samples.get(numEntries-1).setRawKind(-1);
|
||||
resultList.add(samples.get(numEntries-1));
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
@ -90,9 +90,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.GBApplication.getContext;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_LANGUAGE;
|
||||
|
||||
public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
private static final Prefs prefs = GBApplication.getPrefs();
|
||||
|
||||
@ -1018,15 +1015,17 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
*/
|
||||
private void setLongSitHours(TransactionBuilder builder, boolean enable, int hourStart, int minuteStart, int hourEnd, int minuteEnd, int period) {
|
||||
LOG.info(" Setting Long sit reminder... Enabled:"+enable+" Period:"+period);
|
||||
LOG.info(" Setting Long sit time... Hs:"+hourEnd+" Ms:"+minuteEnd+" He:"+hourStart+" Me:"+minuteStart);
|
||||
LOG.info(" Setting Long sit time... Hs:"+hourStart+" Ms:"+minuteStart+" He:"+hourEnd+" Me:"+minuteEnd);
|
||||
// set Long Sit reminder time
|
||||
byte[] command = WatchXPlusConstants.CMD_INACTIVITY_REMINDER_SET;
|
||||
|
||||
byte[] bArr = new byte[10];
|
||||
// do not remind
|
||||
bArr[0] = (byte) hourEnd; // byte[08]
|
||||
bArr[1] = (byte) minuteEnd; // byte[09]
|
||||
bArr[2] = (byte) hourStart; // byte[10]
|
||||
bArr[3] = (byte) minuteStart; // byte[11]
|
||||
// remind
|
||||
bArr[4] = (byte) hourStart; // byte[12]
|
||||
bArr[5] = (byte) minuteStart; // byte[13]
|
||||
bArr[6] = (byte) hourEnd; // byte[14]
|
||||
@ -1506,13 +1505,13 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
} else if (ArrayUtils.equals(value, WatchXPlusConstants.RESP_DAY_STEPS_INDICATOR, 5)) {
|
||||
handleStepsInfo(value);
|
||||
} else if (ArrayUtils.equals(value, WatchXPlusConstants.RESP_DATA_COUNT, 5)) {
|
||||
LOG.info(" Received data count ");
|
||||
LOG.info(" Received data count: " + value);
|
||||
handleDataCount(value);
|
||||
} else if (ArrayUtils.equals(value, WatchXPlusConstants.RESP_DATA_DETAILS, 5)) {
|
||||
LOG.info(" Received data details ");
|
||||
LOG.info(" Received data details: " + value);
|
||||
handleDataDetails(value);
|
||||
} else if (ArrayUtils.equals(value, WatchXPlusConstants.RESP_DATA_CONTENT, 5)) {
|
||||
LOG.info(" Received data content ");
|
||||
LOG.info(" Received data content: " + value);
|
||||
handleDataContentAck(value);
|
||||
} else if (ArrayUtils.equals(value, WatchXPlusConstants.RESP_BP_MEASURE_STARTED, 5)) {
|
||||
handleBpMeasureResult(value);
|
||||
@ -1707,7 +1706,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
}
|
||||
|
||||
int tsWithOffset = requestedDataTimestamp + (((((chunkNo * 16) / 2) + ((i - 4) / 2)) *5) * 60) - timezoneOffset;
|
||||
LOG.debug(" requested timestamp " + requestedDataTimestamp + " chunkNo " + chunkNo + " Got data: " + new Date((long) tsWithOffset * 1000) + ", value: " + val);
|
||||
LOG.debug(" SLEEP requested timestamp " + requestedDataTimestamp + " chunkNo " + chunkNo + " Got data: " + new Date((long) tsWithOffset * 1000) + ", rawIntensity: " + val);
|
||||
WatchXPlusActivitySample sample = createSample(dbHandler, tsWithOffset);
|
||||
sample.setTimestamp(tsWithOffset);
|
||||
sample.setProvider(provider);
|
||||
@ -1729,7 +1728,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
break;
|
||||
}
|
||||
int tsWithOffset = requestedDataTimestamp + (((((chunkNo * 16) + i) - 4) * 2) * 60) - timezoneOffset;
|
||||
// LOG.debug(" requested timestamp " + requestedDataTimestamp + " chunkNo " + chunkNo + " Got data: " + new Date((long) tsWithOffset * 1000) + ", value: " + val);
|
||||
LOG.debug(" HEART RATE requested timestamp " + requestedDataTimestamp + " chunkNo " + chunkNo + " Got data: " + new Date((long) tsWithOffset * 1000) + ", value: " + val);
|
||||
WatchXPlusActivitySample sample = createSample(dbHandler, tsWithOffset);
|
||||
sample.setTimestamp(tsWithOffset);
|
||||
sample.setHeartRate(val);
|
||||
@ -1742,6 +1741,16 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
handleEndOfDataChunks(chunkNo, type);
|
||||
} else {
|
||||
LOG.warn(" Got unsupported data package type: " + type);
|
||||
|
||||
for (int i = 4; i < value.length; i++) {
|
||||
int val = Conversion.fromByteArr16(value[i], value[i+1]);
|
||||
if (65535 == val) {
|
||||
break;
|
||||
}
|
||||
int tsWithOffset = requestedDataTimestamp + (((((chunkNo * 16) / 2) + ((i - 4) / 2)) *5) * 60) - timezoneOffset;
|
||||
LOG.debug(" UNSUPPORTED requested timestamp for type: " + type + " " + requestedDataTimestamp + " chunkNo " + chunkNo + " Got data: " + new Date((long) tsWithOffset * 1000) + ", rawIntensity: " + val);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.warn((ex.getMessage()));
|
||||
|
@ -302,6 +302,7 @@
|
||||
<string name="pref_header_device_spec_settings">Настройки на устройството</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">Принудително синхронизирай часа</string>
|
||||
<string name="pref_summary_device_spec_settings_title_force_time">Принудително синхронизирай дата и час при свързване. Стрелките може да показват грешно време.</string>
|
||||
<string name="pref_title_device_spec_settings_show_raw_graph">Покажи графика в суров вид</string>
|
||||
<!-- Device Settings - Calibration - Used in devicesettings_watchxplus.xml -->
|
||||
<string name="pref_header_sensors_calibration">Калибриране на сензорите</string>
|
||||
<string name="pref_title_sensors_altitude">Калибриране на височината</string>
|
||||
@ -310,10 +311,6 @@
|
||||
<string name="pref_sensors_bp_calibration_high">Кръвно налягане SYSTOLIC (висока)</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Калибриране</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">Натисни тук за калибриране</string>
|
||||
<!-- Device Settings - Long Sit Reminder -->
|
||||
<string name="pref_summary_longsit">Напомни ако няма активност за повече от X минути</string>
|
||||
<string name="prefs_longsit_switch">Напомняне за бездействие</string>
|
||||
<string name="pref_title_longsit">Период на неактивност (минути)</string>
|
||||
<!-- Device Settings - Power Mode -->
|
||||
<string name="power_mode_title">Режим на часовника</string>
|
||||
<string name="power_mode_normal">Нормален</string>
|
||||
@ -556,6 +553,9 @@
|
||||
<string name="mi2_prefs_do_not_disturb_end">Край</string>
|
||||
<string name="mi2_prefs_do_not_disturb_start">Начало</string>
|
||||
<string name="mi2_prefs_do_not_disturb">Не безпокой</string>
|
||||
<string name="mi2_prefs_inactivity_warnings">Предупреждение за бездействие</string>
|
||||
<string name="mi2_prefs_inactivity_warnings_summary">Устройството ще вибрира ако бездействате за известно време</string>
|
||||
<string name="mi2_prefs_inactivity_warnings_threshold">Период на бездействие (в минути)</string>
|
||||
<string name="you_slept">Вие спахте от %1$s до %2$s</string>
|
||||
<string name="widget_steps_label">Стъпки: %1$02d</string>
|
||||
<string name="widget_sleep_label">Сън: %1$s</string>
|
||||
|
@ -850,4 +850,32 @@
|
||||
<string name="devicetype_amazfit_bips">Amazfit Bip S</string>
|
||||
<string name="pref_title_vibration_strength">Intensitat de vibració</string>
|
||||
<string name="pref_header_auto_fetch">Recollida automàtica</string>
|
||||
<string name="menuitem_workout">Entrenament</string>
|
||||
<string name="menuitem_eventreminder">Recordatori d\'esdeveniment</string>
|
||||
<string name="menuitem_hr">Ritme cardíac</string>
|
||||
<string name="devicetype_watchxplus">Watch X Plus</string>
|
||||
<string name="devicetype_watchx">Watch X</string>
|
||||
<string name="power_mode_watch">Només rellotge</string>
|
||||
<string name="power_mode_saving">Estalvi d\'energia</string>
|
||||
<string name="power_mode_normal">Normal</string>
|
||||
<string name="pref_title_longsit">Període d\'inactivitat (minuts)</string>
|
||||
<string name="prefs_longsit_switch">Recordatori d\'inactivitat</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">Prem aquí per començar la calibració</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Calibració</string>
|
||||
<string name="pref_sensors_bp_calibration">Calibració de la pressió sanguínia</string>
|
||||
<string name="pref_title_sensors_altitude">Calibració d\'altitud</string>
|
||||
<string name="pref_header_sensors_calibration">Calibració de sensors</string>
|
||||
<string name="pref_header_device_spec_settings">Configuració de l\'aparell</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_shake_reject">Duplica l\'acció del botó del rellotge</string>
|
||||
<string name="prefs_notifications_and_calls_shake_reject">Sacseja el canell per a ignorar/rebutjar la trucada</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_reject">Off - ignora, On - rebutja</string>
|
||||
<string name="prefs_notifications_and_calls_reject">Botó d\'ignorar/rebutjar trucada</string>
|
||||
<string name="pref_header_notifications_and_calls_callhandling">Gestió de trucades</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_misscall">Repetex durant X minuts</string>
|
||||
<string name="pref_summary_notifications_and_calls_enable_misscall">Es repeteix a cada minut</string>
|
||||
<string name="pref_notifications_and_calls_enable_misscall">Notifica les trucades perdudes</string>
|
||||
<string name="prefs_notifications_and_calls_continious_ring">Notificació durant el to de trucada</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_call">Repeteix la notificació de trucada</string>
|
||||
<string name="pref_header_notifications_and_calls">Notificacions i trucades</string>
|
||||
<string name="title_activity_LenovoWatch_calibration">Calibració del Watch X Plus</string>
|
||||
</resources>
|
@ -863,4 +863,17 @@
|
||||
<string name="pref_qhybrid_title_widget_draw_circles">Widget-Kreise zeichnen</string>
|
||||
<string name="pref_header_auto_fetch">Automatischer Abruf</string>
|
||||
<string name="pref_qhybrid_save_raw_activity_files">Raw Activity Dateien speichern</string>
|
||||
<string name="menuitem_workout">Training</string>
|
||||
<string name="menuitem_hr">Herzfrequenz</string>
|
||||
<string name="devicetype_watchxplus">Watch X Plus</string>
|
||||
<string name="devicetype_watchx">Watch X</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Kalibrierung</string>
|
||||
<string name="pref_sensors_bp_calibration_high">Blutdruck SYSTOLISCH (hoch)</string>
|
||||
<string name="pref_sensors_bp_calibration_low">Blutdruck DIASTOLISCH (niedrig)</string>
|
||||
<string name="pref_sensors_bp_calibration">Blutdruckkalibrierung</string>
|
||||
<string name="pref_title_sensors_altitude">Höhenkalibrierung</string>
|
||||
<string name="pref_header_sensors_calibration">Sensorkalibrierung</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">Synchronisierungszeit erzwingen</string>
|
||||
<string name="pref_header_device_spec_settings">Geräteeinstellungen</string>
|
||||
<string name="pref_header_notifications_and_calls">Benachrichtigungen und Anrufe</string>
|
||||
</resources>
|
@ -860,4 +860,35 @@
|
||||
<string name="menuitem_eventreminder">תזכורת אירועים</string>
|
||||
<string name="menuitem_hr">דופק</string>
|
||||
<string name="menuitem_pai">בינת פעילות</string>
|
||||
<string name="devicetype_watchxplus">Watch X Plus</string>
|
||||
<string name="devicetype_watchx">Watch X</string>
|
||||
<string name="power_mode_title">צריכת חשמל בשעון</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_shake_reject">כפיל של פעולת כפתור השעון</string>
|
||||
<string name="power_mode_watch">שעון בלבד</string>
|
||||
<string name="power_mode_saving">חיסכון בחשמל</string>
|
||||
<string name="power_mode_normal">רגיל</string>
|
||||
<string name="pref_title_longsit">משך חוסר פעילות (דקות)</string>
|
||||
<string name="prefs_longsit_switch">תזכורת חוסר פעילות</string>
|
||||
<string name="pref_summary_longsit">להזכיר לי במקרה של חוסר פעילות למשך X דקות</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">יש ללחוץ כאן כדי להתחיל כיול</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">כיול</string>
|
||||
<string name="pref_sensors_bp_calibration_high">לחץ דם סיסטולי (גבוה)</string>
|
||||
<string name="pref_sensors_bp_calibration_low">לחץ דם דיאסטולי (נמוך)</string>
|
||||
<string name="pref_sensors_bp_calibration">כיוון לחץ דם</string>
|
||||
<string name="pref_title_sensors_altitude">כיוון גובה</string>
|
||||
<string name="pref_summary_device_spec_settings_title_force_time">אילוץ סנכרון השעון בעת התחברות מחדש. מחוגים אנלוגיים עשויים להציג שעה שגויה!</string>
|
||||
<string name="pref_header_sensors_calibration">כיול חיישנים</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">אילוץ סנכרון השעון</string>
|
||||
<string name="pref_header_device_spec_settings">הגדרות התקן</string>
|
||||
<string name="prefs_notifications_and_calls_shake_reject">ניעור פרק כף היד כדי להתעלם/לדחות שיחות</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_reject">כבוי - התעלמות, פעיל - דחייה</string>
|
||||
<string name="prefs_notifications_and_calls_reject">התעלמות/דחייה עם כפתור</string>
|
||||
<string name="pref_header_notifications_and_calls_callhandling">טיפול בשיחות</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_misscall">חזרה למשך X דקות</string>
|
||||
<string name="pref_summary_notifications_and_calls_enable_misscall">חוזרת כל דקה</string>
|
||||
<string name="pref_notifications_and_calls_enable_misscall">התראה על שיחה שהוחמצה</string>
|
||||
<string name="pref_header_notifications_and_calls">התראות ושיחות</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_call">חזרה על התראות על שיחות</string>
|
||||
<string name="prefs_notifications_and_calls_continious_ring">התראה במהלך צלצול טלפון</string>
|
||||
<string name="title_activity_LenovoWatch_calibration">כיול Watch X Plus</string>
|
||||
</resources>
|
@ -859,4 +859,7 @@
|
||||
<string name="menuitem_eventreminder">Hendelsespåminnelse</string>
|
||||
<string name="menuitem_hr">Puls</string>
|
||||
<string name="pref_qhybrid_save_raw_activity_files">Lagre råfiler fra aktivitet</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">Trykk her for å starte kalibrering</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Kalibrering</string>
|
||||
<string name="pref_header_device_spec_settings">Enhetsinnstillinger</string>
|
||||
</resources>
|
@ -853,4 +853,40 @@
|
||||
<string name="pref_summary_relax_firmware_checks">Ontspannen firmwarecontroles</string>
|
||||
<string name="pref_header_auto_fetch">Automatisch ophalen</string>
|
||||
<string name="pref_qhybrid_title_widget_draw_circles">Teken widget cirkels</string>
|
||||
<string name="pref_qhybrid_save_raw_activity_files">Bewaar onbewerkte activiteitsbestanden</string>
|
||||
<string name="menuitem_workout">Training</string>
|
||||
<string name="menuitem_eventreminder">Gebeurtenis herinnering</string>
|
||||
<string name="menuitem_hr">Hartslag</string>
|
||||
<string name="menuitem_pai">PAI</string>
|
||||
<string name="devicetype_watchxplus">Watch X Plus</string>
|
||||
<string name="devicetype_watchx">Watch X</string>
|
||||
<string name="power_mode_watch">Alleen horloge</string>
|
||||
<string name="power_mode_saving">Energiebesparing</string>
|
||||
<string name="power_mode_normal">Normaal</string>
|
||||
<string name="power_mode_title">Horloge energie mode</string>
|
||||
<string name="pref_title_longsit">Inactiviteitsperiode (minuten)</string>
|
||||
<string name="prefs_longsit_switch">Inactiviteit herinnering</string>
|
||||
<string name="pref_summary_longsit">Herinneren als er X minuten inactiviteit is</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">Druk hier om te beginnen met kalibreren</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Kalibratie</string>
|
||||
<string name="pref_sensors_bp_calibration_high">Bloeddruk SYSTOLISCH (hoog)</string>
|
||||
<string name="pref_sensors_bp_calibration_low">Bloeddruk DIASTOLISCH (laag)</string>
|
||||
<string name="pref_sensors_bp_calibration">Bloeddruk kalibratie</string>
|
||||
<string name="pref_title_sensors_altitude">Hoogte kalibratie</string>
|
||||
<string name="pref_header_sensors_calibration">Sensoren Kalibratie</string>
|
||||
<string name="pref_summary_device_spec_settings_title_force_time">Forceer automatische tijd synchronisatie bij opnieuw verbinden. Analoge wijzers kunnen een onjuiste tijd aangeven!</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">Forceer tijdsynchronisatie</string>
|
||||
<string name="pref_header_device_spec_settings">Apparaat instellingen</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_shake_reject">Dupliceert horlogeknop actie</string>
|
||||
<string name="prefs_notifications_and_calls_shake_reject">"Schud pols: negeer / weiger oproep"</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_reject">Uit - negeren, Aan - weigeren</string>
|
||||
<string name="prefs_notifications_and_calls_reject">Knop oproep negeren / weigeren</string>
|
||||
<string name="pref_header_notifications_and_calls_callhandling">Gespreksafhandeling</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_misscall">Herhaal gedurende X minuten</string>
|
||||
<string name="pref_summary_notifications_and_calls_enable_misscall">Herhaalt elke minuut</string>
|
||||
<string name="pref_notifications_and_calls_enable_misscall">Melding voor een gemist gesprek</string>
|
||||
<string name="prefs_notifications_and_calls_continious_ring">Melding tijdens het bellen</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_call">Herhaal oproepmelding</string>
|
||||
<string name="pref_header_notifications_and_calls">Meldingen en oproepen</string>
|
||||
<string name="title_activity_LenovoWatch_calibration">Watch X Plus-kalibratie</string>
|
||||
</resources>
|
@ -858,4 +858,18 @@
|
||||
<string name="menuitem_eventreminder">事件提醒</string>
|
||||
<string name="menuitem_hr">心率</string>
|
||||
<string name="menuitem_pai">PAI</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">强制时间同步</string>
|
||||
<string name="pref_header_device_spec_settings">设备设置</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_shake_reject">重复手表按钮操作</string>
|
||||
<string name="prefs_notifications_and_calls_shake_reject">晃动手腕以忽略/拒接来电</string>
|
||||
<string name="pref_summary_notifications_and_calls_title_reject">关 - 忽略,开 - 拒接</string>
|
||||
<string name="prefs_notifications_and_calls_reject">按钮忽略或拒接来电</string>
|
||||
<string name="pref_header_notifications_and_calls_callhandling">来电处理</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_misscall">X 分钟重复一次</string>
|
||||
<string name="pref_summary_notifications_and_calls_enable_misscall">每分钟重复</string>
|
||||
<string name="pref_notifications_and_calls_enable_misscall">通知未接来电</string>
|
||||
<string name="prefs_notifications_and_calls_continious_ring">响铃时通知</string>
|
||||
<string name="pref_title_notifications_and_calls_repeat_on_call">重复来电通知</string>
|
||||
<string name="pref_header_notifications_and_calls">通知和来电</string>
|
||||
<string name="title_activity_LenovoWatch_calibration">WatchXPlus 首选项</string>
|
||||
</resources>
|
@ -216,6 +216,7 @@
|
||||
<string name="pref_header_device_spec_settings">Device settings</string>
|
||||
<string name="pref_title_device_spec_settings_force_time">Force synchronize time</string>
|
||||
<string name="pref_summary_device_spec_settings_title_force_time">Force auto synchronize time on reconnect. Analog hands may show incorrect time!</string>
|
||||
<string name="pref_title_device_spec_settings_show_raw_graph">Show RAW data on activity graph</string>
|
||||
<!-- Device Settings - Calibration - Used in devicesettings_watchxplus.xml -->
|
||||
<string name="pref_header_sensors_calibration">Sensors Calibration</string>
|
||||
<string name="pref_title_sensors_altitude">Altitude calibration</string>
|
||||
@ -224,10 +225,6 @@
|
||||
<string name="pref_sensors_bp_calibration_high">Blood Pressure SYSTOLIC (high)</string>
|
||||
<string name="prefs_sensors_button_bp_calibration">Calibration</string>
|
||||
<string name="prefs_sensors_button_bp_calibration_sum">Press here to begin calibration</string>
|
||||
<!-- Device Settings - Long Sit Reminder -->
|
||||
<string name="pref_summary_longsit">Remind if there are inactivity for X minutes</string>
|
||||
<string name="prefs_longsit_switch">Inactivity reminder</string>
|
||||
<string name="pref_title_longsit">Inactivity period (minutes)</string>
|
||||
<!-- Device Settings - Power Mode -->
|
||||
<string name="power_mode_title">Watch power mode</string>
|
||||
<string name="power_mode_normal">Normal</string>
|
||||
|
@ -4,21 +4,21 @@
|
||||
android:icon="@drawable/ic_activity_sleep"
|
||||
android:key="screen_longsit"
|
||||
android:persistent="false"
|
||||
android:summary="@string/pref_summary_longsit"
|
||||
android:title="@string/prefs_longsit_switch">
|
||||
android:summary="@string/mi2_prefs_inactivity_warnings_summary"
|
||||
android:title="@string/mi2_prefs_inactivity_warnings">
|
||||
|
||||
<!-- workaround for missing toolbar -->
|
||||
<PreferenceCategory android:title="@string/pref_summary_longsit" />
|
||||
<PreferenceCategory android:title="@string/mi2_prefs_inactivity_warnings_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_longsit_switch"
|
||||
android:title="@string/prefs_longsit_switch" />
|
||||
android:title="@string/mi2_prefs_inactivity_warnings" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="60"
|
||||
android:key="pref_longsit_period"
|
||||
android:summary="@string/pref_summary_longsit"
|
||||
android:title="@string/pref_title_longsit"/>
|
||||
android:summary="@string/mi2_prefs_inactivity_warnings_summary"
|
||||
android:title="@string/mi2_prefs_inactivity_warnings_threshold"/>
|
||||
<nodomain.freeyourgadget.gadgetbridge.util.XTimePreference
|
||||
android:defaultValue="06:00"
|
||||
android:key="pref_longsit_start"
|
||||
|
@ -65,6 +65,10 @@
|
||||
android:key="pref_device_spec_settings_force_time"
|
||||
android:summary="@string/pref_summary_device_spec_settings_title_force_time"
|
||||
android:title="@string/pref_title_device_spec_settings_force_time" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="show_raw_graph"
|
||||
android:title="@string/pref_title_device_spec_settings_show_raw_graph" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/ic_activity_unknown"
|
||||
|
Loading…
Reference in New Issue
Block a user