현재 Android Studio에서 제공하는 BLE예제소스 기반으로
Xiaomi scale(MI SCALE)의 체중계 값을 읽어오려 하는데요
특성값 00002a9d-0000-1000-8000-00805f9b34fb Weight Measurement
이 특성에서 getValue시 계속 null이 넘어옵니다
public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
boolean enabled) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
// This is specific to Heart Rate Measurement.
if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
}
if(UUID_Weight_Measurement.equals(characteristic.getUuid())){
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
UUID.fromString(SampleGattAttributes.Weight_Measurement2));
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
}
}
setCharacteristicNotification에서 이렇게 해주었는데도 data는 넘어오지 않네요...
어떻게해야 저 특성안에있는 값을 가져올수 있을까요