mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-08 20:33:06 +02:00
Cleanup.
This commit is contained in:
+12
-2
@@ -18,6 +18,7 @@ package de.dennisguse.opentracks.util;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothClass;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -27,9 +28,9 @@ import java.util.Set;
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class BluetoothDeviceUtils {
|
||||
public class BluetoothUtils {
|
||||
|
||||
private BluetoothDeviceUtils() {
|
||||
private BluetoothUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,4 +54,13 @@ public class BluetoothDeviceUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int parseHeartRate(BluetoothGattCharacteristic characteristic) {
|
||||
//DOCUMENTATION https://www.bluetooth.com/specifications/gatt/characteristics/
|
||||
byte[] raw = characteristic.getValue();
|
||||
int index = ((raw[0] & 0x1) == 1) ? 2 : 1;
|
||||
int format = (index == 1) ? BluetoothGattCharacteristic.FORMAT_UINT8 : BluetoothGattCharacteristic.FORMAT_UINT16;
|
||||
return characteristic.getIntValue(format, index);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user