Mi 2: rename characteristic 00000003 to "CONFIGURATION"
This commit is contained in:
parent
0e1287e382
commit
83ad2a9bd9
|
@ -16,7 +16,10 @@ public class MiBand2Service {
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC0 = UUID.fromString("00000000-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC0 = UUID.fromString("00000000-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC1 = UUID.fromString("00000001-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC1 = UUID.fromString("00000001-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC2 = UUID.fromString("00000002-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC2 = UUID.fromString("00000002-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC3 = UUID.fromString("00000003-0000-3512-2118-0009af100700"); // Alarm related
|
/**
|
||||||
|
* Alarms, Display and other configuration.
|
||||||
|
*/
|
||||||
|
public static final UUID UUID_CHARACTERISTIC_3_CONFIGURATION = UUID.fromString("00000003-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC4 = UUID.fromString("00000004-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC4 = UUID.fromString("00000004-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_CHARACTERISTIC_ACTIVITY_DATA = UUID.fromString("00000005-0000-3512-2118-0009af100700");
|
public static final UUID UUID_CHARACTERISTIC_ACTIVITY_DATA = UUID.fromString("00000005-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC6 = UUID.fromString("00000006-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC6 = UUID.fromString("00000006-0000-3512-2118-0009af100700");
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA), enable)
|
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA), enable)
|
||||||
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_BATTERY), enable)
|
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_BATTERY), enable)
|
||||||
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
||||||
builder.notify(getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3), enable);
|
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), enable);
|
||||||
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
BluetoothGattCharacteristic heartrateCharacteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_HEART_RATE_MEASUREMENT);
|
||||||
if (heartrateCharacteristic != null) {
|
if (heartrateCharacteristic != null) {
|
||||||
builder.notify(heartrateCharacteristic, enable);
|
builder.notify(heartrateCharacteristic, enable);
|
||||||
|
@ -553,7 +553,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
@Override
|
@Override
|
||||||
public void onSetAlarms(ArrayList<? extends Alarm> alarms) {
|
public void onSetAlarms(ArrayList<? extends Alarm> alarms) {
|
||||||
try {
|
try {
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION);
|
||||||
TransactionBuilder builder = performInitialized("Set alarm");
|
TransactionBuilder builder = performInitialized("Set alarm");
|
||||||
boolean anyAlarmEnabled = false;
|
boolean anyAlarmEnabled = false;
|
||||||
for (Alarm alarm : alarms) {
|
for (Alarm alarm : alarms) {
|
||||||
|
@ -1187,7 +1187,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
* @param builder
|
* @param builder
|
||||||
*/
|
*/
|
||||||
private MiBand2Support sendCalendarEvents(TransactionBuilder builder) {
|
private MiBand2Support sendCalendarEvents(TransactionBuilder builder) {
|
||||||
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3);
|
BluetoothGattCharacteristic characteristic = getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION);
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
int availableSlots = prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
|
int availableSlots = prefs.getInt(MiBandConst.PREF_MIBAND_RESERVE_ALARM_FOR_CALENDAR, 0);
|
||||||
|
@ -1244,10 +1244,10 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
LOG.info("Setting date display to " + dateTimeDisplay);
|
LOG.info("Setting date display to " + dateTimeDisplay);
|
||||||
switch (dateTimeDisplay) {
|
switch (dateTimeDisplay) {
|
||||||
case TIME:
|
case TIME:
|
||||||
builder.write(getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3), MiBand2Service.DATEFORMAT_TIME);
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.DATEFORMAT_TIME);
|
||||||
break;
|
break;
|
||||||
case DATE_TIME:
|
case DATE_TIME:
|
||||||
builder.write(getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3), MiBand2Service.DATEFORMAT_DATE_TIME);
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.DATEFORMAT_DATE_TIME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -1257,9 +1257,9 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
||||||
boolean enable = MiBand2Coordinator.getActivateDisplayOnLiftWrist();
|
boolean enable = MiBand2Coordinator.getActivateDisplayOnLiftWrist();
|
||||||
LOG.info("Setting activate display on lift wrist to " + enable);
|
LOG.info("Setting activate display on lift wrist to " + enable);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
builder.write(getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3), MiBand2Service.COMMAND_ENABLE_DISPLAY_ON_LIFT_WRIST);
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.COMMAND_ENABLE_DISPLAY_ON_LIFT_WRIST);
|
||||||
} else {
|
} else {
|
||||||
builder.write(getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC3), MiBand2Service.COMMAND_DISABLE_DISPLAY_ON_LIFT_WRIST);
|
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), MiBand2Service.COMMAND_DISABLE_DISPLAY_ON_LIFT_WRIST);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue