diff --git a/CHANGELOG.md b/CHANGELOG.md index c0a08f964..0e9ed1899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ### Changelog +#### NEXT +* Fossil Hybrid HR: Initial support for activity tracking (no sleep yet) +* Amazfit GTR/GTS: Fix flashing watchfaces and maybe firmware/res update (still untested) +* Implement transliteration for Korean + #### Version 0.43.2 * Fossil Hybrid HR: Allow choosing and cropping image to be set as watch background * Fossil Hybrid HR: Option to draw circles around widgets diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java index 1c244bd6a..9c8704185 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/amazfitgts/AmazfitGTSCoordinator.java @@ -88,7 +88,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ - R.xml.devicesettings_amazfitgtr, + R.xml.devicesettings_amazfitgts, R.xml.devicesettings_wearlocation, R.xml.devicesettings_timeformat, R.xml.devicesettings_liftwrist_display, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgts/AmazfitGTSSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgts/AmazfitGTSSupport.java index 4bd60387c..72256f0b9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgts/AmazfitGTSSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitgts/AmazfitGTSSupport.java @@ -19,9 +19,15 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts; import android.content.Context; import android.net.Uri; -import java.io.IOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.util.Set; + +import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; +import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts.AmazfitGTSFWHelper; import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -29,6 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew; public class AmazfitGTSSupport extends AmazfitBipSupport { + private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTSSupport.class); @Override public byte getCryptFlags() { @@ -58,8 +65,58 @@ public class AmazfitGTSSupport extends AmazfitBipSupport { @Override protected AmazfitGTSSupport setDisplayItems(TransactionBuilder builder) { - // not supported yet + if (gbDevice.getFirmwareVersion() == null) { + LOG.warn("Device not initialized yet, won't set menu items"); + return this; + } + + Set pages = HuamiCoordinator.getDisplayItems(gbDevice.getAddress()); + LOG.info("Setting display items to " + (pages == null ? "none" : pages)); + byte[] command = new byte[]{ + 0x00, (byte) 0xC2, 0x00, 0x1E, // looks like chunked, but 0x00 :O + 0x00, 0x00, (byte) 0xFF, 0x01, // Status + 0x01, 0x00, (byte) 0xFF, 0x19, // PAI + 0x02, 0x00, (byte) 0xFF, 0x02, // HR + 0x03, 0x00, (byte) 0xFF, 0x03, // Workout + 0x04, 0x00, (byte) 0xFF, 0x14, // Activities + 0x05, 0x00, (byte) 0xFF, 0x04, // Weather + 0x06, 0x00, (byte) 0xFF, 0x0B, // Music + 0x07, 0x00, (byte) 0xFF, 0x06, // Notifications + 0x08, 0x00, (byte) 0xFF, 0x09, // Alarm + 0x09, 0x00, (byte) 0xFF, 0x15, // Event reminder + 0x0A, 0x00, (byte) 0xFF, 0x07, // More + 0x0B, 0x00, (byte) 0xFF, 0x13 // Settings + }; + + String[] keys = {"status", "pai", "hr", "workout", "activity", "weather", "music", "notifications", "alarm", "eventreminder", "more", "settings"}; + byte[] ids = {1, 25, 2, 3, 20, 4, 11, 6, 9, 21, 7, 19}; + + if (pages != null) { + pages.add("settings"); + // it seem that we first have to put all ENABLED items into the array + int pos = 4; + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + byte id = ids[i]; + if (pages.contains(key)) { + command[pos + 1] = 0x00; + command[pos + 3] = id; + pos += 4; + } + } + // And then all DISABLED ones + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + byte id = ids[i]; + if (!pages.contains(key)) { + command[pos + 1] = 0x01; + command[pos + 3] = id; + pos += 4; + } + } + } + builder.write(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_CHUNKEDTRANSFER), command); + return this; } - } diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index a65758012..827796bc3 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -353,6 +353,47 @@ @string/p_menuitem_music + + @string/menuitem_status + @string/menuitem_pai + @string/menuitem_hr + @string/menuitem_workout + @string/menuitem_activity + @string/menuitem_weather + @string/menuitem_music + @string/menuitem_notifications + @string/menuitem_alarm + @string/menuitem_eventreminder + @string/menuitem_more + + + + @string/p_menuitem_status + @string/p_menuitem_pai + @string/p_menuitem_hr + @string/p_menuitem_workout + @string/p_menuitem_activity + @string/p_menuitem_weather + @string/p_menuitem_music + @string/p_menuitem_notifications + @string/p_menuitem_alarm + @string/p_menuitem_eventreminder + @string/p_menuitem_more + + + + @string/p_menuitem_status + @string/p_menuitem_pai + @string/p_menuitem_hr + @string/p_menuitem_workout + @string/p_menuitem_activity + @string/p_menuitem_weather + @string/p_menuitem_music + @string/p_menuitem_notifications + @string/p_menuitem_alarm + @string/p_menuitem_eventreminder + @string/p_menuitem_more + @string/unit_metric diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d1eeaf7f2..72c747659 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -726,6 +726,10 @@ Music More NFC + PAI + Heart Rate + Event Reminder + Workout Minutes: Hours: Seconds: diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index 6c8f51113..ca612c270 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -33,6 +33,10 @@ music more nfc + hr + pai + eventreminder + workout off on diff --git a/app/src/main/res/xml/devicesettings_amazfitgts.xml b/app/src/main/res/xml/devicesettings_amazfitgts.xml new file mode 100644 index 000000000..23e36c31f --- /dev/null +++ b/app/src/main/res/xml/devicesettings_amazfitgts.xml @@ -0,0 +1,20 @@ + + + + +