BLE device (pulsometer) value in characteristic always the same. The signal goes to onCharacteristicChanged but the value does not change, tried to get the value in different ways.
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
super.onServicesDiscovered(gatt, status);
BluetoothGattCharacteristic characteristic3 = gatt.getService(UUID.fromString("0000180f-0000-1000-8000-00805f9b34fb"))
.getCharacteristic(UUID.fromString("00002a19-0000-1000-8000-00805f9b34fb"));
gatt.setCharacteristicNotification(characteristic3, true);
gatt.readCharacteristic(characteristic3);
}
@Override
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicRead(gatt, characteristic, status);
UUID uuid = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(uuid);
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
gatt.writeDescriptor(descriptor);
}
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
super.onCharacteristicChanged(gatt, characteristic);
Log.e(TAG, "pulse: " + characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 0));
}