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