diff --git a/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java b/src/main/java/de/dennisguse/opentracks/sensors/BluetoothUtils.java index 48e0bb296..292a056b0 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 diff --git a/src/main/java/de/dennisguse/opentracks/settings/bluetooth/BluetoothLeSensorPreference.java b/src/main/java/de/dennisguse/opentracks/settings/bluetooth/BluetoothLeSensorPreference.java index fc0ed34ef..1ba90ac4f 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/bluetooth/BluetoothLeSensorPreference.java +++ b/src/main/java/de/dennisguse/opentracks/settings/bluetooth/BluetoothLeSensorPreference.java @@ -62,11 +62,11 @@ public BluetoothLeSensorPreference(Context context) { private String value; private boolean valueSet = false; - public String getValue() { + public String getData() { return value; } - public void setValue(String value) { + public void setData(String value) { final boolean changed = !TextUtils.equals(this.value, value); if (changed || !valueSet) { this.value = value; @@ -80,16 +80,16 @@ public void setValue(String value) { @Override protected void onSetInitialValue(Object defaultValue) { - setValue(getPersistedString((String) defaultValue)); + setData(getPersistedString((String) defaultValue)); } @Override public CharSequence getSummary() { - if (getValue() == null || PreferencesUtils.isBluetoothSensorAddressNone(getValue())) { + if (getData() == null || PreferencesUtils.isBluetoothSensorAddressNone(getData())) { return getContext().getString(DEVICE_NONE_RESOURCEID); } - return getValue(); + return getData(); } public abstract PreferenceDialogFragmentCompat createInstance(); @@ -192,9 +192,9 @@ private void startBluetoothScan() { selectedEntryIndex = 0; BluetoothLeSensorPreference preference = (BluetoothLeSensorPreference) getPreference(); - String deviceSelected = preference.getValue(); + String deviceSelected = preference.getData(); if (deviceSelected != null && !deviceNone.equals(deviceSelected)) { - listAdapter.add(preference.getValue(), preference.getValue()); + listAdapter.add(preference.getData(), preference.getData()); selectedEntryIndex = 1; } @@ -239,7 +239,7 @@ public void onDialogClosed(boolean positiveResult) { String value = listAdapter.get(selectedEntryIndex).getAddress(); BluetoothLeSensorPreference preference = (BluetoothLeSensorPreference) getPreference(); if (preference.callChangeListener(value)) { - preference.setValue(value); + preference.setData(value); } } }