1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

added GetCountdownSettings Request

This commit is contained in:
dakhnod 2019-07-23 20:30:00 +02:00
parent c0eb1420b2
commit 8bda4790a9
2 changed files with 30 additions and 2 deletions

View File

@ -45,6 +45,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Bat
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.DownloadFileRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.DownloadFileRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.EraseFileRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.EraseFileRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.FileRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.FileRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetCountdownSettingsRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetCurrentStepCountRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetCurrentStepCountRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetStepGoalRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetStepGoalRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetVibrationStrengthRequest; import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.GetVibrationStrengthRequest;
@ -134,7 +135,8 @@ public class QHybridSupport extends QHybridBaseSupport {
GetCurrentStepCountRequest.class, GetCurrentStepCountRequest.class,
OTAEnterRequest.class, OTAEnterRequest.class,
GoalTrackingGetRequest.class, GoalTrackingGetRequest.class,
ActivityPointGetRequest.class ActivityPointGetRequest.class,
GetCountdownSettingsRequest.class
}; };
for (Class<? extends Request> c : classes) { for (Class<? extends Request> c : classes) {
try { try {
@ -302,7 +304,8 @@ public class QHybridSupport extends QHybridBaseSupport {
// queueWrite(new OTAEraseRequest(0)); // queueWrite(new OTAEraseRequest(0));
// queueWrite(new OTAResetRequest()); // queueWrite(new OTAResetRequest());
// new UploadFileRequest((short)00, new byte[]{0x01, 0x00, 0x08, 0x01, 0x01, 0x0C, 0x00, (byte)0xBD, 0x01, 0x30, 0x71, (byte)0xFF, 0x05, 0x00, 0x01, 0x00}); // new UploadFileRequest((short)00, new byte[]{0x01, 0x00, 0x08, 0x01, 0x01, 0x0C, 0x00, (byte)0xBD, 0x01, 0x30, 0x71, (byte)0xFF, 0x05, 0x00, 0x01, 0x00});
queueWrite(new ActivityPointGetRequest()); // queueWrite(new ActivityPointGetRequest());
queueWrite(new GetCountdownSettingsRequest());
} }
public void overwriteButtons() { public void overwriteButtons() {

View File

@ -0,0 +1,25 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests;
import android.bluetooth.BluetoothGattCharacteristic;
import java.nio.ByteBuffer;
public class GetCountdownSettingsRequest extends Request {
@Override
public byte[] getStartSequence() {
return new byte[]{1, 19, 1};
}
@Override
public void handleResponse(BluetoothGattCharacteristic characteristic) {
byte[] value = characteristic.getValue();
if(value.length != 14){
return;
}
ByteBuffer buffer = ByteBuffer.wrap(value);
int startTime = buffer.getInt(3);
int endTime = buffer.getInt(7);
short offset = buffer.getShort(11);
short progress = buffer.getShort(13);
}
}