Garmin: Only trigger ExploreSync after normal sync

This commit is contained in:
José Rebelo
2026-06-20 22:11:19 +02:00
committed by José Rebelo
parent bb23023b19
commit 08aebb1e51
2 changed files with 10 additions and 9 deletions
@@ -648,7 +648,7 @@ class ExploreSyncHandler {
* timestamp, plus per-point HR samples for indoor activities.
*/
private void flush() throws Exception {
if (points.isEmpty()) {
if (points.isEmpty() || alreadyImported(points.get(0).getTime().getTime() / 1000L)) {
// Upfront skip-check matched in absorb().
LOG.info("Historical line {}: skipped (already imported)", uuidHex);
return;
@@ -544,14 +544,6 @@ public class GarminSupport extends AbstractBTLESingleDeviceSupport implements IC
// otherwise we might get incomplete monitor files
sendOutgoingMessage("fetch recorded data", fileTransferHandler.initiateDownload());
if (getCoordinator().supports(getDevice(), GarminCapability.EXPLORE_SYNC)) {
// Re-arm the ExploreSync historical catalog walk so any activities
// recorded since the initial connect get picked up. Watches that
// don't support the service reject our StartSyncRequest and the
// handler tears the session down on its own.
protocolBufferHandler.getExploreSyncHandler().startSession();
}
//TODO: ask the watch to initiate the sync? Something like:
// sendOutgoingMessage("set sync ready", new SystemEventMessage(SystemEventMessage.GarminSystemEventType.SYNC_READY, 0));
// sendOutgoingMessage("set foreground", new SystemEventMessage(SystemEventMessage.GarminSystemEventType.HOST_DID_ENTER_FOREGROUND, 0));
@@ -956,8 +948,17 @@ public class GarminSupport extends AbstractBTLESingleDeviceSupport implements IC
}
isBusyFetching = false;
// FIXME: This should probably only happen after exploresync also finishes
sendOutgoingMessage("set sync complete", new SystemEventMessage(SystemEventMessage.GarminSystemEventType.SYNC_COMPLETE, 0));
if (getCoordinator().supports(getDevice(), GarminCapability.EXPLORE_SYNC)) {
// Re-arm the ExploreSync historical catalog walk so any activities
// recorded since the initial connect get picked up. Watches that
// don't support the service reject our StartSyncRequest and the
// handler tears the session down on its own.
protocolBufferHandler.getExploreSyncHandler().startSession();
}
return;
}