1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-09 22:57:54 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vivomovehr/messages/DownloadRequestResponseMessage.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

32 lines
1.3 KiB
Java

package nodomain.freeyourgadget.gadgetbridge.service.devices.vivomovehr.messages;
public class DownloadRequestResponseMessage {
public final int status;
public final int response;
public final int fileSize;
public static final byte RESPONSE_DOWNLOAD_REQUEST_OKAY = 0;
public static final byte RESPONSE_DATA_DOES_NOT_EXIST = 1;
public static final byte RESPONSE_DATA_EXISTS_BUT_IS_NOT_DOWNLOADABLE = 2;
public static final byte RESPONSE_NOT_READY_TO_DOWNLOAD = 3;
public static final byte RESPONSE_REQUEST_INVALID = 4;
public static final byte RESPONSE_CRC_INCORRECT = 5;
public static final byte RESPONSE_DATA_REQUESTED_EXCEEDS_FILE_SIZE = 6;
public DownloadRequestResponseMessage(int status, int response, int fileSize) {
this.status = status;
this.response = response;
this.fileSize = fileSize;
}
public static DownloadRequestResponseMessage parsePacket(byte[] packet) {
final MessageReader reader = new MessageReader(packet, 4);
final int requestID = reader.readShort();
final int status = reader.readByte();
final int response = reader.readByte();
final int fileSize = reader.readInt();
return new DownloadRequestResponseMessage(status, response, fileSize);
}
}