1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-10 12:09:27 +01:00

When miband2 auth success, let application show miband status is connected

This commit is contained in:
JohnnySun 2016-09-13 23:50:35 +08:00
parent 08f2b0eb7c
commit 19fbe5719c

View File

@ -112,13 +112,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
byte[] response = intent.getExtras().getByteArray(DeviceService.EXTRA_MIBAND2_AUTH_BYTE); byte[] response = intent.getExtras().getByteArray(DeviceService.EXTRA_MIBAND2_AUTH_BYTE);
BluetoothGattCharacteristic temp = getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC9); BluetoothGattCharacteristic temp = getCharacteristic(MiBand2Service.UUID_UNKNOWN_CHARACTERISTIC9);
temp.setValue(response); temp.setValue(response);
if ((temp.getProperties() & (BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE)) != 0) { mBluetoothGatt.writeCharacteristic(temp);
Log.d("HELLO", "its looks ok");
}
if (!mBluetoothGatt.writeCharacteristic(temp)) {
Log.d("ERROR", "ERROR");
}
Log.d("HELLO", "HELLO");
} }
} }
@ -173,7 +167,8 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
// this is apparently not needed anymore, and actually causes problems when bonding is not used/does not work // this is apparently not needed anymore, and actually causes problems when bonding is not used/does not work
// so we simply not use the UUID_PAIR characteristic. // so we simply not use the UUID_PAIR characteristic.
// .pair(builder) // .pair(builder)
.testInit(builder); .testInit(builder)
.setInitialized(builder);
//.requestDeviceInfo(builder) //.requestDeviceInfo(builder)
//.requestBatteryInfo(builder); //.requestBatteryInfo(builder);
// .sendUserInfo(builder) // .sendUserInfo(builder)