diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java index 0ae391629..17312ca89 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/QHybridSupport.java @@ -63,6 +63,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Req import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.SetCountdownSettings; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.SetCurrentTimeServiceRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.SetStepGoalRequest; +import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.SetTimeRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.SetVibrationStrengthRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.UploadFileRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.VibrateRequest; @@ -268,7 +269,7 @@ public class QHybridSupport extends QHybridBaseSupport { public void onSetTime() { long millis = System.currentTimeMillis(); TimeZone zone = new GregorianCalendar().getTimeZone(); - SetCurrentTimeServiceRequest request = new SetCurrentTimeServiceRequest( + SetTimeRequest request = new SetTimeRequest( (int) (millis / 1000 + timeOffset * 60), (short) (millis % 1000), (short) ((zone.getRawOffset() + zone.getDSTSavings()) / 60000)); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/SetTimeRequest.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/SetTimeRequest.java new file mode 100644 index 000000000..5b816a456 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/qhybrid/requests/SetTimeRequest.java @@ -0,0 +1,24 @@ +package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests; + +import java.nio.ByteBuffer; + +public class SetTimeRequest extends Request { + public SetTimeRequest(int epochSeconds, short millis, short minutesOffset) { + ByteBuffer buffer = createBuffer(); + buffer.putInt(epochSeconds); + buffer.putShort(millis); + buffer.putShort(minutesOffset); + + this.data = buffer.array(); + } + + @Override + public byte[] getStartSequence() { + return new byte[]{2, 4}; + } + + @Override + public int getPayloadLength() { + return 10; + } +}