1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

adjusted initial sync

This commit is contained in:
dakhnod 2019-07-21 17:21:42 +02:00
parent 820bd62866
commit c0eb1420b2

View File

@ -22,8 +22,10 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Queue;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
@ -106,6 +108,8 @@ public class QHybridSupport extends QHybridBaseSupport {
private PendingIntent dumpIntent; private PendingIntent dumpIntent;
private PendingIntent stepIntent; private PendingIntent stepIntent;
Queue<Request> requestQueue = new ArrayDeque<>();
public QHybridSupport() { public QHybridSupport() {
super(logger); super(logger);
addSupportedService(UUID.fromString("3dda0001-957f-7d4a-34a6-74696673696d")); addSupportedService(UUID.fromString("3dda0001-957f-7d4a-34a6-74696673696d"));
@ -214,11 +218,11 @@ public class QHybridSupport extends QHybridBaseSupport {
super.onServicesDiscovered(gatt); super.onServicesDiscovered(gatt);
playAnimation(); playAnimation();
requestQueue.add(new GetStepGoalRequest());
requestQueue.add(new GetCurrentStepCountRequest());
requestQueue.add(new GetVibrationStrengthRequest());
requestQueue.add(new ActivityPointGetRequest());
queueWrite(new BatteryLevelRequest()); queueWrite(new BatteryLevelRequest());
queueWrite(new GetStepGoalRequest());
queueWrite(new GetCurrentStepCountRequest());
queueWrite(new GetVibrationStrengthRequest());
queueWrite(new ActivityPointGetRequest());
logger.debug("onServicesDiscovered"); logger.debug("onServicesDiscovered");
} }
@ -500,6 +504,10 @@ public class QHybridSupport extends QHybridBaseSupport {
} else if (request instanceof ActivityPointGetRequest) { } else if (request instanceof ActivityPointGetRequest) {
gbDevice.addDeviceInfo(new GenericItem(ITEM_ACTIVITY_POINT, String.valueOf(((ActivityPointGetRequest) request).activityPoint))); gbDevice.addDeviceInfo(new GenericItem(ITEM_ACTIVITY_POINT, String.valueOf(((ActivityPointGetRequest) request).activityPoint)));
} }
Request nextRequest;
if((nextRequest = requestQueue.remove()) != null){
queueWrite(nextRequest);
}
return true; return true;
} }