1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-09 14:48:24 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vivomovehr/messages/FileReadyMessage.java
Mormegil 3a58314db6 Garmin Vivomove HR support
- 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.
2023-07-20 20:30:14 +00:00

45 lines
1.8 KiB
Java

package nodomain.freeyourgadget.gadgetbridge.service.devices.vivomovehr.messages;
public class FileReadyMessage {
public static final int TRIGGER_MANUAL = 0;
public static final int TRIGGER_AUTOMATIC = 1;
public final int fileIndex;
public final int dataType;
public final int fileSubtype;
public final int fileNumber;
public final int specificFileFlags;
public final int generalFileFlags;
public final int fileSize;
public final int fileDate;
public final int triggerMethod;
public FileReadyMessage(int fileIndex, int dataType, int fileSubtype, int fileNumber, int specificFileFlags, int generalFileFlags, int fileSize, int fileDate, int triggerMethod) {
this.fileIndex = fileIndex;
this.dataType = dataType;
this.fileSubtype = fileSubtype;
this.fileNumber = fileNumber;
this.specificFileFlags = specificFileFlags;
this.generalFileFlags = generalFileFlags;
this.fileSize = fileSize;
this.fileDate = fileDate;
this.triggerMethod = triggerMethod;
}
public static FileReadyMessage parsePacket(byte[] packet) {
final MessageReader reader = new MessageReader(packet, 4);
final int fileIndex = reader.readShort();
final int dataType = reader.readByte();
final int fileSubtype = reader.readByte();
final int fileNumber = reader.readShort();
final int specificFileFlags = reader.readByte();
final int generalFileFlags = reader.readByte();
final int fileSize = reader.readInt();
final int fileDate = reader.readInt();
final int triggerMethod = reader.readByte();
return new FileReadyMessage(fileIndex, dataType, fileSubtype, fileNumber, specificFileFlags, generalFileFlags, fileSize, fileDate, triggerMethod);
}
}