forked from upstream-mirrors/OpenTracks
Move handling of sensor removal (from settings) in BluetoothConnectionManager.BluetoothConnectionManager.
This commit is contained in:
@@ -28,21 +28,11 @@ public final class SensorDataSet {
|
||||
}
|
||||
|
||||
public void set(SensorData data) {
|
||||
if (data instanceof SensorDataHeartRate) {
|
||||
this.heartRate = (SensorDataHeartRate) data;
|
||||
return;
|
||||
}
|
||||
set(data, data);
|
||||
}
|
||||
|
||||
if (data instanceof SensorDataCycling.Cadence) {
|
||||
this.cyclingCadence = (SensorDataCycling.Cadence) data;
|
||||
return;
|
||||
}
|
||||
if (data instanceof SensorDataCycling.Speed) {
|
||||
this.cyclingSpeed = (SensorDataCycling.Speed) data;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException();
|
||||
public void remove(SensorData type) {
|
||||
set(type, null);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@@ -72,4 +62,22 @@ public final class SensorDataSet {
|
||||
+ (getCyclingCadence() != null ? " " + getCyclingCadence() : "")
|
||||
+ (getCyclingSpeed() != null ? " " + getCyclingSpeed() : "");
|
||||
}
|
||||
|
||||
private void set(SensorData type, SensorData data) {
|
||||
if (type instanceof SensorDataHeartRate) {
|
||||
this.heartRate = (SensorDataHeartRate) data;
|
||||
return;
|
||||
}
|
||||
|
||||
if (type instanceof SensorDataCycling.Cadence) {
|
||||
this.cyclingCadence = (SensorDataCycling.Cadence) data;
|
||||
return;
|
||||
}
|
||||
if (type instanceof SensorDataCycling.Speed) {
|
||||
this.cyclingSpeed = (SensorDataCycling.Speed) data;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user