Skip to content

Commit

Permalink
While recording: show BLE sensor name instead of address.
Browse files Browse the repository at this point in the history
Fixes #1796.
  • Loading branch information
dennisguse committed Dec 26, 2023
1 parent 81a7882 commit 8f5388e
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ synchronized void connect(Context context, Handler handler, @NonNull BluetoothDe

bluetoothGatt = device.connectGatt(context, false, connectCallback, BluetoothDevice.TRANSPORT_AUTO, 0, handler);

observer.onConnect(sensorHandler.createEmptySensorData(bluetoothGatt.getDevice().getAddress()));
observer.onConnect(sensorHandler.createEmptySensorData(device.getAddress(), device.getName()));
}

private synchronized void clearData() {
observer.onDisconnect(sensorHandler.createEmptySensorData(bluetoothGatt.getDevice().getAddress()));
observer.onDisconnect(sensorHandler.createEmptySensorData(bluetoothGatt.getDevice().getAddress(), bluetoothGatt.getDevice().getName()));
}

synchronized void disconnect() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public Aggregator<?, ?> createEmptySensorData(String address) {
public Aggregator<?, ?> createEmptySensorData(String address, String name) {
return null; //TODO
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public AggregatorCyclingCadence createEmptySensorData(String address) {
return new AggregatorCyclingCadence(address);
public AggregatorCyclingCadence createEmptySensorData(String address, String name) {
return new AggregatorCyclingCadence(address, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public AggregatorCyclingDistanceSpeed createEmptySensorData(String address) {
return new AggregatorCyclingDistanceSpeed(address);
public AggregatorCyclingDistanceSpeed createEmptySensorData(String address, String name) {
return new AggregatorCyclingDistanceSpeed(address, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public AggregatorCyclingPower createEmptySensorData(String address) {
return new AggregatorCyclingPower(address);
public AggregatorCyclingPower createEmptySensorData(String address, String name) {
return new AggregatorCyclingPower(address, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public AggregatorHeartRate createEmptySensorData(String address) {
return new AggregatorHeartRate(address);
public AggregatorHeartRate createEmptySensorData(String address, String name) {
return new AggregatorHeartRate(address, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public List<ServiceMeasurementUUID> getServices() {
}

@Override
public AggregatorRunning createEmptySensorData(String address) {
return new AggregatorRunning(address);
public AggregatorRunning createEmptySensorData(String address, String name) {
return new AggregatorRunning(address, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ public class AggregatorCyclingCadence extends Aggregator<BluetoothHandlerCycling

private final String TAG = AggregatorCyclingCadence.class.getSimpleName();

public AggregatorCyclingCadence(String sensorAddress) {
super(sensorAddress);
}

public AggregatorCyclingCadence(String sensorAddress, String sensorName) {
super(sensorAddress, sensorName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public class AggregatorCyclingDistanceSpeed extends Aggregator<BluetoothHandlerC

private Distance wheelCircumference;

public AggregatorCyclingDistanceSpeed(String sensorAddress) {
super(sensorAddress);
}

public AggregatorCyclingDistanceSpeed(String sensorAddress, String sensorName) {
super(sensorAddress, sensorName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

public class AggregatorCyclingPower extends Aggregator<Power, Power> {

public AggregatorCyclingPower(String address) {
super(address);
}

public AggregatorCyclingPower(String name, String address) {
super(name, address);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {

public AggregatorHeartRate(String address) {
super(address);
}

public AggregatorHeartRate(String name, String address) {
super(name, address);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ public final class AggregatorRunning extends Aggregator<BluetoothHandlerRunningS

private static final String TAG = AggregatorRunning.class.getSimpleName();

public AggregatorRunning(String sensorAddress) {
super(sensorAddress);
}

public AggregatorRunning(String sensorAddress, String sensorName) {
super(sensorAddress, sensorName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface SensorHandlerInterface {

List<ServiceMeasurementUUID> getServices();

Aggregator<?, ?> createEmptySensorData(String address);
Aggregator<?, ?> createEmptySensorData(String address, String name);

void handlePayload(SensorManager.SensorDataChangedObserver observer, ServiceMeasurementUUID serviceMeasurementUUID, String sensorName, String address, BluetoothGattCharacteristic characteristic);
}

0 comments on commit 8f5388e

Please sign in to comment.