Reorder the lines in the MiBandService class.

No functional changes, just clarity enhanchement.
This commit is contained in:
Daniele Gobbetti 2015-08-05 17:32:02 +02:00
parent 65fc6f6866
commit 495a8cc650
1 changed files with 92 additions and 71 deletions

View File

@ -43,63 +43,7 @@ public class MiBandService {
public static final UUID UUID_CHARACTERISTIC_PAIR = UUID.fromString(String.format(BASE_UUID, "FF0F"));
public static final UUID UUID_DESCRIPTOR_CHARACTERISTIC_USER_CONFIGURATION = UUID.fromString(String.format(BASE_UUID, "2901"));
public static final UUID UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION = UUID.fromString(String.format(BASE_UUID, "2902"));
public static final byte ALIAS_LEN = 0xa;
public static final byte NOTIFY_AUTHENTICATION_FAILED = 0x6;
public static final byte NOTIFY_AUTHENTICATION_SUCCESS = 0x5;
public static final byte NOTIFY_CONN_PARAM_UPDATE_FAILED = 0x3;
public static final byte NOTIFY_CONN_PARAM_UPDATE_SUCCESS = 0x4;
public static final int NOTIFY_DEVICE_MALFUNCTION = 0xff;
public static final byte NOTIFY_FIRMWARE_UPDATE_FAILED = 0x1;
public static final byte NOTIFY_FIRMWARE_UPDATE_SUCCESS = 0x2;
public static final byte NOTIFY_FITNESS_GOAL_ACHIEVED = 0x7;
public static final byte NOTIFY_FW_CHECK_FAILED = 0xb;
public static final byte NOTIFY_FW_CHECK_SUCCESS = 0xc;
public static final byte NOTIFY_NORMAL = 0x0;
public static final int NOTIFY_PAIR_CANCEL = 0xef;
public static final byte NOTIFY_RESET_AUTHENTICATION_FAILED = 0x9;
public static final byte NOTIFY_RESET_AUTHENTICATION_SUCCESS = 0xa;
public static final byte NOTIFY_SET_LATENCY_SUCCESS = 0x8;
public static final byte NOTIFY_STATUS_MOTOR_ALARM = 0x11;
public static final byte NOTIFY_STATUS_MOTOR_AUTH = 0x13;
public static final byte NOTIFY_STATUS_MOTOR_AUTH_SUCCESS = 0x15;
public static final byte NOTIFY_STATUS_MOTOR_CALL = 0xe;
public static final byte NOTIFY_STATUS_MOTOR_DISCONNECT = 0xf;
public static final byte NOTIFY_STATUS_MOTOR_GOAL = 0x12;
public static final byte NOTIFY_STATUS_MOTOR_NOTIFY = 0xd;
public static final byte NOTIFY_STATUS_MOTOR_SHUTDOWN = 0x14;
public static final byte NOTIFY_STATUS_MOTOR_SMART_ALARM = 0x10;
public static final byte NOTIFY_STATUS_MOTOR_TEST = 0x16;
public static final byte NOTIFY_UNKNOWN = -0x1;
/* FURTHER UUIDS that were mixed with the other params below. The base UUID for these is unknown */
public static final String UUID_CHARACTERISTIC_FEATURE = "2A9E";
@ -109,6 +53,69 @@ public class MiBandService {
public static final String UUID_SERVICE_WEIGHT_SERVICE = "00001530-0000-3512-2118-0009af100700";
public static final UUID UUID_DESCRIPTOR_CHARACTERISTIC_USER_CONFIGURATION = UUID.fromString(String.format(BASE_UUID, "2901"));
public static final UUID UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION = UUID.fromString(String.format(BASE_UUID, "2902"));
public static final byte ALIAS_LEN = 0xa;
/*NOTIFICATIONS: usually received on the UUID_CHARACTERISTIC_NOTIFICATION characteristic */
public static final byte NOTIFY_NORMAL = 0x0;
public static final byte NOTIFY_FIRMWARE_UPDATE_FAILED = 0x1;
public static final byte NOTIFY_FIRMWARE_UPDATE_SUCCESS = 0x2;
public static final byte NOTIFY_CONN_PARAM_UPDATE_FAILED = 0x3;
public static final byte NOTIFY_CONN_PARAM_UPDATE_SUCCESS = 0x4;
public static final byte NOTIFY_AUTHENTICATION_SUCCESS = 0x5;
public static final byte NOTIFY_AUTHENTICATION_FAILED = 0x6;
public static final byte NOTIFY_FITNESS_GOAL_ACHIEVED = 0x7;
public static final byte NOTIFY_SET_LATENCY_SUCCESS = 0x8;
public static final byte NOTIFY_RESET_AUTHENTICATION_FAILED = 0x9;
public static final byte NOTIFY_RESET_AUTHENTICATION_SUCCESS = 0xa;
public static final byte NOTIFY_FW_CHECK_FAILED = 0xb;
public static final byte NOTIFY_FW_CHECK_SUCCESS = 0xc;
public static final byte NOTIFY_STATUS_MOTOR_NOTIFY = 0xd;
public static final byte NOTIFY_STATUS_MOTOR_CALL = 0xe;
public static final byte NOTIFY_STATUS_MOTOR_DISCONNECT = 0xf;
public static final byte NOTIFY_STATUS_MOTOR_SMART_ALARM = 0x10;
public static final byte NOTIFY_STATUS_MOTOR_ALARM = 0x11;
public static final byte NOTIFY_STATUS_MOTOR_GOAL = 0x12;
public static final byte NOTIFY_STATUS_MOTOR_AUTH = 0x13;
public static final byte NOTIFY_STATUS_MOTOR_SHUTDOWN = 0x14;
public static final byte NOTIFY_STATUS_MOTOR_AUTH_SUCCESS = 0x15;
public static final byte NOTIFY_STATUS_MOTOR_TEST = 0x16;
public static final byte NOTIFY_UNKNOWN = -0x1;
public static final int NOTIFY_PAIR_CANCEL = 0xef;
public static final int NOTIFY_DEVICE_MALFUNCTION = 0xff;
/* MESSAGES: unknown */
public static final byte MSG_CONNECTED = 0x0;
public static final byte MSG_DISCONNECTED = 0x1;
@ -125,6 +132,8 @@ public class MiBandService {
public static final byte MSG_BATTERY_STATUS_CHANGED = 0x7;
/* COMMANDS: usually sent to UUID_CHARACTERISTIC_CONTROL_POINT characteristic */
public static final byte COMMAND_SET_TIMER = 0x4;
public static final byte COMMAND_SET_FITNESS_GOAL = 0x5;
@ -145,42 +154,54 @@ public class MiBandService {
public static final byte COMMAND_STOP_MOTOR_VIBRATE = 0x13;
/*
/* FURTHER COMMANDS: unchecked therefore left commented
public static final COMMAND_SET_REALTIME_STEPS_NOTIFICATION = 0x3t
public static final byte COMMAND_FACTORY_RESET = 0x9t;
public static final byte COMMAND_GET_SENSOR_DATA = 0x12t
public static final int COMMAND_SET_COLOR_THEME = et;
public static final COMMAND_SET_REALTIME_STEP = 0x10t
public static final COMMAND_SET_REALTIME_STEPS_NOTIFICATION = 0x3t
public static final COMMAND_SET_WEAR_LOCATION = 0xft
public static final COMMAND_STOP_SYNC_DATA = 0x11t
public static final CONNECTION_LATENCY_LEVEL_HIGH = 0x2t;
public static final byte COMMAND_GET_SENSOR_DATA = 0x12t
*/
/* CONNECTION: unknown
public static final CONNECTION_LATENCY_LEVEL_LOW = 0x0t;
public static final CONNECTION_LATENCY_LEVEL_MEDIUM = 0x1t;
public static final CONNECTION_LATENCY_LEVEL_HIGH = 0x2t;
*/
/* MODES: unknown
public static final MODE_REGULAR_DATA_LEN_BYTE = 0x0t;
public static final MODE_REGULAR_DATA_LEN_MINITE = 0x1t
*/
public static final PROFILE_STATE_AUTHENTICATION_FAILED:I = 0x4
/* PROFILE: unknown
public static final PROFILE_STATE_AUTHENTICATION_SUCCESS:I = 0x3
public static final PROFILE_STATE_INITIALIZATION_FAILED:I = 0x2
public static final PROFILE_STATE_UNKNOWN:I = 0x0
public static final PROFILE_STATE_INITIALIZATION_SUCCESS:I = 0x1
public static final PROFILE_STATE_UNKNOWN:I = 0x0
public static final PROFILE_STATE_INITIALIZATION_FAILED:I = 0x2
public static final PROFILE_STATE_AUTHENTICATION_SUCCESS:I = 0x3
public static final PROFILE_STATE_AUTHENTICATION_FAILED:I = 0x4
*/
/* TEST: unkown (maybe sent to UUID_CHARACTERISTIC_TEST characteristic?
public static final TEST_DISCONNECTED_REMINDER = 0x5t