From bc20db44f449e559111b6df01155639ec4262e34 Mon Sep 17 00:00:00 2001 From: Sebastian Kranz Date: Mon, 17 Sep 2018 14:43:09 +0200 Subject: [PATCH] BUGFIX: use correct preference key to toggle wrist flick on and off. Add: fill function onFindDevice with test commands for the signaling of the watch, if watch is set to buzzer just the buzzer is used, ... and so on. --- .../devices/zetime/ZeTimeConstants.java | 1 + .../devices/zetime/ZeTimeDeviceSupport.java | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java index e746f44aa..a8de5d504 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java @@ -80,6 +80,7 @@ public class ZeTimeConstants { public static final byte CMD_REMINDERS = (byte) 0x97; public static final byte CMD_PUSH_CALENDAR_DAY = (byte) 0x99; public static final byte CMD_MUSIC_CONTROL = (byte) 0xD0; + public static final byte CMD_TEST_SIGNALING = (byte) 0xFA; // here are the action commands public static final byte CMD_REQUEST = (byte) 0x70; public static final byte CMD_SEND = (byte) 0x71; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java index bf4efb818..c46edf60e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java @@ -197,7 +197,22 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { @Override public void onFindDevice(boolean start) { - + try { + TransactionBuilder builder = performInitialized("onFindDevice"); + byte[] testSignaling = { + ZeTimeConstants.CMD_PREAMBLE, + ZeTimeConstants.CMD_TEST_SIGNALING, + ZeTimeConstants.CMD_SEND, + (byte)0x1, + (byte)0x0, + (byte)(start ? 1 : 0), + ZeTimeConstants.CMD_END + }; + sendMsgToWatch(builder, testSignaling); + builder.queue(getQueue()); + } catch (IOException e) { + GB.toast(getContext(), "Error on function onFindDevice: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR); + } } @Override @@ -1528,7 +1543,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { private void setDisplayOnMovement(TransactionBuilder builder) { Prefs prefs = GBApplication.getPrefs(); - boolean movement = prefs.getBoolean(ZeTimeConstants.PREF_ACTIVITY_TRACKING, false); + boolean movement = prefs.getBoolean(ZeTimeConstants.PREF_HANDMOVE_DISPLAY, false); byte[] handmove = {ZeTimeConstants.CMD_PREAMBLE, ZeTimeConstants.CMD_SWITCH_SETTINGS,