Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Removed "getValue()" method; as it is deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
khushaliparmar authored Oct 15, 2023
1 parent 271a57c commit 0a36007
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a36007

Please sign in to comment.