From 0a36007892c1e648ff3b2b7fe007925288cb410d Mon Sep 17 00:00:00 2001 From: khushaliparmar <117936344+khushaliparmar@users.noreply.github.com> Date: Sat, 14 Oct 2023 21:04:36 -0400 Subject: [PATCH] Removed "getValue()" method; as it is deprecated. --- .../opentracks/sensors/BluetoothUtils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java b/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java index 37e8905e2..a71cab97f 100644 --- a/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java +++ b/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java @@ -115,7 +115,7 @@ public static boolean hasBluetooth(Context context) { public static BatteryLevel parseBatteryLevel(BluetoothGattCharacteristic characteristic) { // DOCUMENTATION org.bluetooth.characteristic.battery_level.xml - byte[] raw = characteristic.getValue(); + byte[] raw = characteristic.getData(); if (raw.length == 0) { return null; } @@ -126,7 +126,7 @@ public static BatteryLevel parseBatteryLevel(BluetoothGattCharacteristic charact public static HeartRate parseHeartRate(BluetoothGattCharacteristic characteristic) { //DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.heart_rate_measurement.xml - byte[] raw = characteristic.getValue(); + byte[] raw = characteristic.getData(); if (raw.length == 0) { return null; } @@ -143,7 +143,7 @@ public static HeartRate parseHeartRate(BluetoothGattCharacteristic characteristi } public static AtmosphericPressure parseEnvironmentalSensing(BluetoothGattCharacteristic characteristic) { - byte[] raw = characteristic.getValue(); + byte[] raw = characteristic.getData(); if (raw.length < 4) { return null; @@ -155,7 +155,7 @@ public static AtmosphericPressure parseEnvironmentalSensing(BluetoothGattCharact public static SensorDataCyclingPower.Data parseCyclingPower(String address, String sensorName, BluetoothGattCharacteristic characteristic) { // DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.cycling_power_measurement.xml - int valueLength = characteristic.getValue().length; + int valueLength = characteristic.getData().length; if (valueLength == 0) { return null; } @@ -197,12 +197,12 @@ public static SensorDataCyclingPower.Data parseCyclingPower(String address, Stri public static SensorDataCyclingCadenceAndDistanceSpeed parseCyclingCrankAndWheel(String address, String sensorName, @NonNull BluetoothGattCharacteristic characteristic) { // DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.csc_measurement.xml - int valueLength = characteristic.getValue().length; + int valueLength = characteristic.getData().length; if (valueLength == 0) { return null; } - int flags = characteristic.getValue()[0]; + int flags = characteristic.getData()[0]; boolean hasWheel = (flags & 0x01) > 0; boolean hasCrank = (flags & 0x02) > 0; @@ -230,12 +230,12 @@ public static SensorDataCyclingCadenceAndDistanceSpeed parseCyclingCrankAndWheel public static SensorDataRunning parseRunningSpeedAndCadence(String address, String sensorName, @NonNull BluetoothGattCharacteristic characteristic) { // DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.rsc_measurement.xml - int valueLength = characteristic.getValue().length; + int valueLength = characteristic.getData().length; if (valueLength == 0) { return null; } - int flags = characteristic.getValue()[0]; + int flags = characteristic.getData()[0]; boolean hasStrideLength = (flags & 0x01) > 0; boolean hasTotalDistance = (flags & 0x02) > 0; boolean hasStatus = (flags & 0x03) > 0; // walking vs running