From 7e2545f9b4e8a5e3f735a293bc3270748926edd4 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Thu, 21 May 2015 18:19:07 +0200 Subject: [PATCH] Use constants instead of hardcoded values --- .../gadgetbridge/miband/MiBandService.java | 12 ++++++------ .../gadgetbridge/miband/MiBandSupport.java | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandService.java index eb9ef10ec..6a3cee96d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandService.java @@ -120,6 +120,12 @@ public class MiBandService { public static final byte MSG_BATTERY_STATUS_CHANGED = 0x7; + public static final byte COMMAND_REBOOT = 0xc; + + public static final byte COMMAND_SEND_NOTIFICATION = 0x8; + + public static final byte COMMAND_STOP_MOTOR_VIBRATE = 0x13; + /* public static final COMMAND_CONFIRM_ACTIVITY_DATA_TRANSFER_COMPLETE = 0xat; @@ -130,12 +136,8 @@ public class MiBandService { public static final byte COMMAND_GET_SENSOR_DATA = 0x12t - public static final byte COMMAND_REBOOT = 0xct - public static final byte COMMAND_SEND_FIRMWARE_INFO = 0x7t - public static final COMMAND_SEND_NOTIFICATION = 0x8t - public static final int COMMAND_SET_COLOR_THEME = et; public static final COMMAND_SET_FITNESS_GOAL = 0x5t @@ -148,8 +150,6 @@ public class MiBandService { public static final COMMAND_SET_WEAR_LOCATION = 0xft - public static final COMMAND_STOP_MOTOR_VIBRATE = 0x13t - public static final COMMAND_STOP_SYNC_DATA = 0x11t public static final COMMAND_SYNC = 0xbt diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java index ad317bc3a..007d88fe5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java @@ -98,12 +98,12 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport { builder.queue(getQueue()); } - private static final byte[] startVibrate = new byte[]{8, 1}; - private static final byte[] stopVibrate = new byte[]{19}; - private static final byte[] reboot = new byte[]{12}; + private static final byte[] startVibrate = new byte[]{MiBandService.COMMAND_SEND_NOTIFICATION, 1}; + private static final byte[] stopVibrate = new byte[]{MiBandService.COMMAND_STOP_MOTOR_VIBRATE}; + private static final byte[] reboot = new byte[]{MiBandService.COMMAND_REBOOT}; private byte[] getNotification(long vibrateDuration, int vibrateTimes, int flashTimes, int flashColour, int originalColour, long flashDuration) { - byte[] vibrate = new byte[]{(byte) 8, (byte) 1}; + byte[] vibrate = new byte[]{MiBandService.COMMAND_SEND_NOTIFICATION, (byte) 1}; byte r = 6; byte g = 0; byte b = 6;