Some cleanup
This commit is contained in:
parent
a7792f6b72
commit
92caed5af4
|
@ -325,20 +325,13 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
@Override
|
@Override
|
||||||
public void onReboot() {
|
public void onReboot() {
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("send command");
|
TransactionBuilder builder = performInitialized("fetch activity data");
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), fetch);
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), fetch);
|
||||||
builder.queue(getQueue());
|
builder.queue(getQueue());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LOG.error("Unable to fetch MI", ex);
|
LOG.error("Unable to fetch MI activity data", ex);
|
||||||
}
|
}
|
||||||
// try {
|
}
|
||||||
// TransactionBuilder builder = performInitialized("Read Activity data");
|
|
||||||
// BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_ACTIVITY_DATA);
|
|
||||||
// builder.read(characteristic).queue(getQueue());
|
|
||||||
// } catch (IOException ex) {
|
|
||||||
// LOG.error("Unable to read activity data from MI", ex);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAppInfoReq() {
|
public void onAppInfoReq() {
|
||||||
|
@ -362,7 +355,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCharacteristicChanged(BluetoothGatt gatt,
|
public void onCharacteristicChanged(BluetoothGatt gatt,
|
||||||
BluetoothGattCharacteristic characteristic) {
|
BluetoothGattCharacteristic characteristic) {
|
||||||
super.onCharacteristicChanged(gatt, characteristic);
|
super.onCharacteristicChanged(gatt, characteristic);
|
||||||
|
|
||||||
UUID characteristicUUID = characteristic.getUuid();
|
UUID characteristicUUID = characteristic.getUuid();
|
||||||
|
@ -459,9 +452,9 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
|
|
||||||
private void handleControlPointResult(byte[] value, int status) {
|
private void handleControlPointResult(byte[] value, int status) {
|
||||||
if (status == BluetoothGatt.GATT_SUCCESS) {
|
if (status == BluetoothGatt.GATT_SUCCESS) {
|
||||||
for (byte b: value){
|
for (byte b: value){
|
||||||
LOG.info("3GOT DATA:" + String.format("0x%20x", b));
|
LOG.info("3GOT DATA:" + String.format("0x%20x", b));
|
||||||
}
|
}
|
||||||
handleActivityData(value, status);
|
handleActivityData(value, status);
|
||||||
} else {
|
} else {
|
||||||
LOG.info("BOOOOOOOOO");
|
LOG.info("BOOOOOOOOO");
|
||||||
|
@ -480,7 +473,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
(byte) (unknown_code & 0xff),
|
(byte) (unknown_code & 0xff),
|
||||||
(byte) (0xff & (unknown_code >> 8))
|
(byte) (0xff & (unknown_code >> 8))
|
||||||
};
|
};
|
||||||
LOG.info("WRITING: " + DateFormat.getDateTimeInstance().format(time.getTime()).toString());
|
LOG.info("WRITING: " + DateFormat.getDateTimeInstance().format(time.getTime()).toString());
|
||||||
try {
|
try {
|
||||||
TransactionBuilder builder = performInitialized("send acknowledge");
|
TransactionBuilder builder = performInitialized("send acknowledge");
|
||||||
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), ack);
|
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), ack);
|
||||||
|
|
Loading…
Reference in New Issue