Wake lock with around 10 second timeout is a quick and dirty solution,
however as the time sync should happen once per several days the 10
second wake time should not be an issue.
Ensure TimeChangeReceiver alarm is scheduled when enabling
datetime_synconconnect and registering TimeChangeReceiver broadcast
receiver.
It is important to re-schedule the alarm after registering broadcast
receiver, because:
1. if broadcast receiver was unregistered while previous alarm arrived,
there is no alarm scheduled;
2. re-scheduling the alarm resets the periodic time sync timer when
first device is connected (which is desired).
It is important to re-schedule the alarm when datetime_synconconnect
gets enabled, because there might be no alarm scheduled.
Call onSetTime() when enabling datetime_synconconnect.
Sync time every 43 hours, 53 minutes and 23 seconds.
Interval is a bit smaller than 2 days.
Interval is a prime (in seconds) so time of sync will slide over time.
If next DST change is less than 48 hours in future, wait for it.
Fixes a typo in the weather forecast characteristic writer that causes
Gadgetbridge to send the current weather twice rather than sending the
forecast.
Zepp OS 3 firmware upgrades are big (200MB+). Gadgetbridge was crashing,
since the entire firmware file would be pulled into memory.
This commit unifies all the logic for Zepp OS firmware handling.
However, since the needed refactor was big, this commit duplicates some
of the code from Huami classes, namely:
- ZeppOsFirmwareUpdateOperation clones UpdateFirmwareOperation2020
- ZeppOsFwInstallHandler clones AbstractMiBandFWInstallHandler
This avoids changes to older device logic and introducing regressions.
Lost functionality:
- Repackaging firmwares as UIHH (does not seem to be needed, and was not
used anyway). Code can be recovered from this commit if needed in the
future
- Whitelisted firmwares by checksum (we do not have a lot of them at
this point anyway)
Other misc changes:
- Rename ZipFile to GBZipFile not to clash with the java class
Tested by updating the Amazfit GTR 4 to Zepp OS 3.