1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Merge branch 'master' into background-javascript

This commit is contained in:
Andreas Shimokawa 2017-09-05 10:21:45 +02:00
commit f0a9c57937
3 changed files with 14 additions and 7 deletions

View File

@ -140,15 +140,18 @@ public class AmazfitBipSupport extends MiBand2Support {
@Override @Override
public void onSendWeather(WeatherSpec weatherSpec) { public void onSendWeather(WeatherSpec weatherSpec) {
if (gbDevice.getFirmwareVersion() == null) {
LOG.warn("Device not initialized yet, so not sending weather info");
return;
}
try { try {
TransactionBuilder builder = performInitialized("Sending weather forecast"); TransactionBuilder builder = performInitialized("Sending weather forecast");
boolean supportsConditionString = false; boolean supportsConditionString = false;
if (gbDevice.getFirmwareVersion() != null) { Version version = new Version(gbDevice.getFirmwareVersion());
Version version = new Version(gbDevice.getFirmwareVersion()); if (version.compareTo(new Version("0.0.8.74")) >= 0) {
if (version.compareTo(new Version("0.0.8.74")) >= 0) { supportsConditionString = true;
supportsConditionString = true;
}
} }
final byte NR_DAYS = 2; final byte NR_DAYS = 2;

View File

@ -1064,7 +1064,6 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
queueAlarm(alarm, builder, characteristic); queueAlarm(alarm, builder, characteristic);
iteration++; iteration++;
} }
builder.queue(getQueue());
} }
return this; return this;
} }
@ -1309,8 +1308,11 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
public void phase2Initialize(TransactionBuilder builder) { public void phase2Initialize(TransactionBuilder builder) {
LOG.info("phase2Initialize..."); LOG.info("phase2Initialize...");
enableFurtherNotifications(builder, true);
requestBatteryInfo(builder); requestBatteryInfo(builder);
}
public void phase3Initialize(TransactionBuilder builder) {
LOG.info("phase3Initialize...");
setDateDisplay(builder); setDateDisplay(builder);
setTimeFormat(builder); setTimeFormat(builder);
setWearLocation(builder); setWearLocation(builder);

View File

@ -117,7 +117,9 @@ public class InitOperation extends AbstractBTLEOperation<MiBand2Support> {
TransactionBuilder builder = createTransactionBuilder("Authenticated, now initialize phase 2"); TransactionBuilder builder = createTransactionBuilder("Authenticated, now initialize phase 2");
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext())); builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
getSupport().requestDeviceInfo(builder); getSupport().requestDeviceInfo(builder);
getSupport().enableFurtherNotifications(builder, true);
getSupport().phase2Initialize(builder); getSupport().phase2Initialize(builder);
getSupport().phase3Initialize(builder);
getSupport().setInitialized(builder); getSupport().setInitialized(builder);
getSupport().performImmediately(builder); getSupport().performImmediately(builder);
} else { } else {