mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
+1
-1
@@ -31,7 +31,7 @@ public class MiBand2Service {
|
|||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC8 = UUID.fromString("00000008-0000-3512-2118-0009af100700");
|
public static final UUID UUID_UNKNOWN_CHARACTERISTIC8 = UUID.fromString("00000008-0000-3512-2118-0009af100700");
|
||||||
// service uuid fee1
|
// service uuid fee1
|
||||||
public static final UUID UUID_CHARACTERISTIC_AUTH = UUID.fromString("00000009-0000-3512-2118-0009af100700");
|
public static final UUID UUID_CHARACTERISTIC_AUTH = UUID.fromString("00000009-0000-3512-2118-0009af100700");
|
||||||
public static final UUID UUID_UNKNOWN_CHARACTERISTIC10 = UUID.fromString("00000010-0000-3512-2118-0009af100700");
|
public static final UUID UUID_CHARACTERISTIC_10_BUTTON = UUID.fromString("00000010-0000-3512-2118-0009af100700");
|
||||||
|
|
||||||
public static final int ALERT_LEVEL_NONE = 0;
|
public static final int ALERT_LEVEL_NONE = 0;
|
||||||
public static final int ALERT_LEVEL_MESSAGE = 1;
|
public static final int ALERT_LEVEL_MESSAGE = 1;
|
||||||
|
|||||||
+19
@@ -273,6 +273,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
// .notify(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_SENSOR_DATA), enable);
|
||||||
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), enable);
|
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), enable);
|
||||||
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_6_BATTERY_INFO), enable);
|
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_6_BATTERY_INFO), enable);
|
||||||
|
builder.notify(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_10_BUTTON), 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);
|
||||||
@@ -858,6 +859,9 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
LOG.info("AUTHENTICATION?? " + characteristicUUID);
|
LOG.info("AUTHENTICATION?? " + characteristicUUID);
|
||||||
logMessageContent(characteristic.getValue());
|
logMessageContent(characteristic.getValue());
|
||||||
return true;
|
return true;
|
||||||
|
} else if (MiBand2Service.UUID_CHARACTERISTIC_10_BUTTON.equals(characteristicUUID)) {
|
||||||
|
handleButtonPressed(characteristic.getValue());
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Unhandled characteristic changed: " + characteristicUUID);
|
LOG.info("Unhandled characteristic changed: " + characteristicUUID);
|
||||||
logMessageContent(characteristic.getValue());
|
logMessageContent(characteristic.getValue());
|
||||||
@@ -865,6 +869,11 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleButtonPressed(byte[] value) {
|
||||||
|
LOG.info("Button pressed: " + value);
|
||||||
|
logMessageContent(value);
|
||||||
|
}
|
||||||
|
|
||||||
private void handleUnknownCharacteristic(byte[] value) {
|
private void handleUnknownCharacteristic(byte[] value) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -887,6 +896,9 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
} else if (MiBandService.UUID_CHARACTERISTIC_DATE_TIME.equals(characteristicUUID)) {
|
} else if (MiBandService.UUID_CHARACTERISTIC_DATE_TIME.equals(characteristicUUID)) {
|
||||||
logDate(characteristic.getValue(), status);
|
logDate(characteristic.getValue(), status);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (MiBand2Service.UUID_CHARACTERISTIC_10_BUTTON.equals(characteristicUUID)) {
|
||||||
|
handleButtonPressed(characteristic.getValue());
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG.info("Unhandled characteristic read: " + characteristicUUID);
|
LOG.info("Unhandled characteristic read: " + characteristicUUID);
|
||||||
logMessageContent(characteristic.getValue());
|
logMessageContent(characteristic.getValue());
|
||||||
@@ -1260,6 +1272,13 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTestNewFunction() {
|
public void onTestNewFunction() {
|
||||||
|
try {
|
||||||
|
performInitialized("read characteristic 10")
|
||||||
|
.read(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_10_BUTTON))
|
||||||
|
.queue(getQueue());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user