请帮助我!我正在尝试使用此方法将Miband2的心率传送到具有android studio的智能手机,但不起作用:
void startScanHeartRate() {
txtByte.setText("...");
BluetoothGattCharacteristic bchar = bluetoothGatt.getService(CustomBluetoothProfile.HeartRate.service)
.getCharacteristic(CustomBluetoothProfile.HeartRate.controlCharacteristic);
bchar.setValue(new byte[]{21, 2, 1});
txtByte.setText(bchar+" ");
Log.v("char",bchar+"" );
bluetoothGatt.writeCharacteristic(bchar);
}
public class CustomBluetoothProfile {
public static class Basic {
public static UUID service = UUID.fromString("0000fee0-0000-1000-8000-00805f9b34fb");
public static UUID batteryCharacteristic = UUID.fromString("00000006-0000-3512-2118-0009af100700");
}
public static class AlertNotification {
public static UUID service = UUID.fromString("00001802-0000-1000-8000-00805f9b34fb");
public static UUID alertCharacteristic = UUID.fromString("00002a06-0000-1000-8000-00805f9b34fb");
}
public static class HeartRate {
public static UUID service = UUID.fromString("0000180d-0000-1000-8000-00805f9b34fb");
public static UUID measurementCharacteristic = UUID.fromString("00002a37-0000-1000-8000-00805f9b34fb");
public static UUID descriptor = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
public static UUID controlCharacteristic = UUID.fromString("00002a39-0000-1000-8000-00805f9b34fb");
}
}
我正在使用以下代码: enter link description here