mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-02 03:16:07 +02:00
3a58314db6
- communication protocols - device support implementation - download FIT file storage Features: - basic connectivity: time sync, battery status, HW/FW version info - real-time activity tracking - fitness data sync - find the device, find the phone - factory reset Features implemented but not working: - notifications: fully implemented, seem to communicate correctly, but not shown on watch Features implemented partially (not expected to work now): - weather information (and in future possibly weather alerts) - music info - firmware update: only the initial file upload implemented, not used Things to improve/change: - Device name hardcoded in `VivomoveHrCoordinator.getSupportedType`, service UUIDs not available - Download FIT file storage: Should be store (and offer the user to export?) the FIT data forever? - Obviously, various code improvements, cleanup, etc.
55 lines
1.9 KiB
Java
55 lines
1.9 KiB
Java
package nodomain.freeyourgadget.gadgetbridge.service.devices.vivomovehr.fit;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.vivomovehr.VivomoveHrSampleProvider;
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import java.util.List;
|
|
|
|
public class FitDbImporter {
|
|
private static final Logger LOG = LoggerFactory.getLogger(FitDbImporter.class);
|
|
|
|
private final GBDevice gbDevice;
|
|
private final FitImporter fitImporter;
|
|
|
|
public FitDbImporter(GBDevice gbDevice) {
|
|
this.gbDevice = gbDevice;
|
|
fitImporter = new FitImporter();
|
|
}
|
|
|
|
public void processFitFile(List<FitMessage> messages) {
|
|
try {
|
|
fitImporter.importFitData(messages);
|
|
} catch (Exception e) {
|
|
LOG.error("Error importing FIT data", e);
|
|
}
|
|
}
|
|
|
|
public void processData() {
|
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
|
final DaoSession session = dbHandler.getDaoSession();
|
|
|
|
final Device device = DBHelper.getDevice(gbDevice, session);
|
|
final User user = DBHelper.getUser(session);
|
|
final VivomoveHrSampleProvider provider = new VivomoveHrSampleProvider(gbDevice, session);
|
|
|
|
fitImporter.processImportedData(sample -> {
|
|
sample.setDevice(device);
|
|
sample.setUser(user);
|
|
sample.setProvider(provider);
|
|
|
|
provider.addGBActivitySample(sample);
|
|
});
|
|
} catch (Exception e) {
|
|
LOG.error("Error importing FIT data", e);
|
|
}
|
|
}
|
|
}
|