我正在开发一个应用,用于使用https://github.com/kshtj24/mi-band-2-connect中的代码来测量Mi Band 3的心率。我不知道如何从乐队那里获取心率。
我已经很难编辑BluetoothGattCharacteristic,UUID和授权的编码。但是什么都行不通。
getHeartRate:
private void getHeartRate() {
variableService = bluetoothGatt.getService(UUIDs.HEART_RATE_SERVICE);
BluetoothGattCharacteristic heartRateCharacteristic = variableService.getCharacteristic(UUIDs.HEART_RATE_MEASUREMENT_CHARACTERISTIC);
BluetoothGattDescriptor heartRateDescriptor = heartRateCharacteristic.getDescriptor(UUIDs.HEART_RATE_MEASURMENT_DESCRIPTOR);
bluetoothGatt.setCharacteristicNotification(heartRateCharacteristic, true);
heartRateDescriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
bluetoothGatt.writeDescriptor(heartRateDescriptor);
}
UUID:
static UUID HEART_RATE_SERVICE = UUID.fromString("0000180d-0000-1000-8000-00805f9b34fb");
static UUID HEART_RATE_MEASUREMENT_CHARACTERISTIC = UUID.fromString("00002a37-0000-1000-8000-00805f9b34fb");
static UUID HEART_RATE_MEASURMENT_DESCRIPTOR = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
static final String HEART_RATE_MEASUREMENT_CHARACTERISTIC_STRING = "00002a37-0000-1000-8000-00805f9b34fb";
我在移动应用程序上只能获得0个心率。希望有人能帮助我获得Mi乐队3的心率。谢谢。