Use constants instead of hardcoded values

This commit is contained in:
Daniele Gobbetti 2015-05-21 18:19:07 +02:00
parent cb2a95398b
commit 7e2545f9b4
2 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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;