mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
parent
08feaf30e1
commit
e19c3f7ea0
@ -171,6 +171,10 @@ public abstract class AbstractFetchOperation extends AbstractMiBand2Operation {
|
|||||||
this.startTimestamp = startTimestamp;
|
this.startTimestamp = startTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Calendar getLastStartTimestamp() {
|
||||||
|
return startTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
protected void saveLastSyncTimestamp(@NonNull GregorianCalendar timestamp) {
|
protected void saveLastSyncTimestamp(@NonNull GregorianCalendar timestamp) {
|
||||||
SharedPreferences.Editor editor = GBApplication.getPrefs().getPreferences().edit();
|
SharedPreferences.Editor editor = GBApplication.getPrefs().getPreferences().edit();
|
||||||
editor.putLong(getLastSyncTimeKey(), timestamp.getTimeInMillis());
|
editor.putLong(getLastSyncTimeKey(), timestamp.getTimeInMillis());
|
||||||
|
@ -68,6 +68,7 @@ public class FetchSportsDetailsOperation extends AbstractFetchOperation {
|
|||||||
LOG.info("start " + getName());
|
LOG.info("start " + getName());
|
||||||
buffer = new ByteArrayOutputStream(1024);
|
buffer = new ByteArrayOutputStream(1024);
|
||||||
GregorianCalendar sinceWhen = getLastSuccessfulSyncTime();
|
GregorianCalendar sinceWhen = getLastSuccessfulSyncTime();
|
||||||
|
|
||||||
builder.write(characteristicFetch, BLETypeConversions.join(new byte[] {
|
builder.write(characteristicFetch, BLETypeConversions.join(new byte[] {
|
||||||
MiBand2Service.COMMAND_ACTIVITY_DATA_START_DATE,
|
MiBand2Service.COMMAND_ACTIVITY_DATA_START_DATE,
|
||||||
AmazfitBipService.COMMAND_ACTIVITY_DATA_TYPE_SPORTS_DETAILS},
|
AmazfitBipService.COMMAND_ACTIVITY_DATA_TYPE_SPORTS_DETAILS},
|
||||||
|
@ -27,7 +27,6 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -184,9 +183,21 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
|
|||||||
LOG.error("Error mapping acivity kind: " + ex.getMessage(), ex);
|
LOG.error("Error mapping acivity kind: " + ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
summary.setActivityKind(activityKind);
|
summary.setActivityKind(activityKind);
|
||||||
// FIXME: should save timezone etc.
|
|
||||||
summary.setStartTime(new Date(BLETypeConversions.toUnsigned(buffer.getInt()) * 1000));
|
// FIXME: should honor timezone we were in at that time etc
|
||||||
summary.setEndTime(new Date(BLETypeConversions.toUnsigned(buffer.getInt()) * 1000));
|
long timestamp_start = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000;
|
||||||
|
long timestamp_end = BLETypeConversions.toUnsigned(buffer.getInt()) * 1000;
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: should be done like this but seems to return crap when in DST
|
||||||
|
//summary.setStartTime(new Date(timestamp_start));
|
||||||
|
//summary.setEndTime(new Date(timestamp_end));
|
||||||
|
|
||||||
|
// FIXME ... so do it like this
|
||||||
|
long duration = timestamp_end - timestamp_start;
|
||||||
|
summary.setStartTime(new Date(getLastStartTimestamp().getTimeInMillis()));
|
||||||
|
summary.setEndTime(new Date(getLastStartTimestamp().getTimeInMillis() + duration));
|
||||||
|
|
||||||
int baseLongitude = buffer.getInt();
|
int baseLongitude = buffer.getInt();
|
||||||
int baseLatitude = buffer.getInt();
|
int baseLatitude = buffer.getInt();
|
||||||
int baseAltitude = buffer.getInt();
|
int baseAltitude = buffer.getInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user