mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Fix world clock packet format.
Fix short city name in packet (used by Neo). Enable world clocks for Amazfit Neo.
This commit is contained in:
parent
82315b3281
commit
4675c7a344
@ -82,6 +82,16 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorldClocksSlotCount() {
|
||||
return 20; // max in Zepp app
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorldClocksLabelLength() {
|
||||
return 3; // neo has 3 letter city codes
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReminderSlotCount() {
|
||||
return 0; // Neo does not support reminders
|
||||
@ -95,6 +105,7 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_heartrate_sleep_activity,
|
||||
R.xml.devicesettings_goal_notification,
|
||||
R.xml.devicesettings_timeformat,
|
||||
R.xml.devicesettings_world_clocks,
|
||||
R.xml.devicesettings_liftwrist_display,
|
||||
R.xml.devicesettings_inactivity_dnd,
|
||||
R.xml.devicesettings_hourly_chime,
|
||||
|
@ -1109,9 +1109,10 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
||||
baos.write(0x03);
|
||||
|
||||
if (clocks.size() != 0) {
|
||||
int i = clocks.size();
|
||||
baos.write(clocks.size());
|
||||
int i = 0;
|
||||
for (final WorldClock clock : clocks) {
|
||||
baos.write(i--);
|
||||
baos.write(i++);
|
||||
baos.write(encodeWorldClock(clock));
|
||||
}
|
||||
} else {
|
||||
@ -1134,8 +1135,8 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
||||
final TimeZone timezone = TimeZone.getTimeZone(clock.getTimeZoneId());
|
||||
final ZoneId zoneId = ZoneId.of(clock.getTimeZoneId());
|
||||
|
||||
// Usually the 3-letter city code (eg. LIS for Lisbon), but doesn't seem to be used in the UI
|
||||
baos.write(" ".getBytes(StandardCharsets.UTF_8));
|
||||
// Usually the 3-letter city code (eg. LIS for Lisbon), but doesn't seem to be used in the UI (used in Amazfit Neo)
|
||||
baos.write(StringUtils.truncate(clock.getLabel(), 3).toUpperCase().getBytes(StandardCharsets.UTF_8));
|
||||
baos.write(0x00);
|
||||
|
||||
// Some other string? Seems to be empty
|
||||
|
Loading…
Reference in New Issue
Block a user