forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -34,7 +34,7 @@ public abstract class Aggregator<InputType, OutputType> {
|
|||||||
previous = next;
|
previous = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void computeValue(Raw<InputType> current);
|
protected abstract void computeValue(@NonNull Raw<InputType> current);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return did we process data from a sensor.
|
* @return did we process data from a sensor.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package de.dennisguse.opentracks.sensors.sensorData;
|
package de.dennisguse.opentracks.sensors.sensorData;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.AltitudeGainLoss;
|
import de.dennisguse.opentracks.data.models.AltitudeGainLoss;
|
||||||
import de.dennisguse.opentracks.data.models.AtmosphericPressure;
|
import de.dennisguse.opentracks.data.models.AtmosphericPressure;
|
||||||
import de.dennisguse.opentracks.sensors.PressureSensorUtils;
|
import de.dennisguse.opentracks.sensors.PressureSensorUtils;
|
||||||
@@ -13,7 +15,7 @@ public class AggregatorBarometer extends Aggregator<AtmosphericPressure, Altitud
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeValue(Raw<AtmosphericPressure> current) {
|
protected void computeValue(@NonNull Raw<AtmosphericPressure> current) {
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
lastAcceptedSensorValue = current.value();
|
lastAcceptedSensorValue = current.value();
|
||||||
output = new AltitudeGainLoss(0f, 0f);
|
output = new AltitudeGainLoss(0f, 0f);
|
||||||
|
|||||||
+3
-1
@@ -2,6 +2,8 @@ package de.dennisguse.opentracks.sensors.sensorData;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.Cadence;
|
import de.dennisguse.opentracks.data.models.Cadence;
|
||||||
@@ -17,7 +19,7 @@ public class AggregatorCyclingCadence extends Aggregator<CyclingCadenceBluetooth
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeValue(Raw<CyclingCadenceBluetooth.CrankData> current) {
|
protected void computeValue(@NonNull Raw<CyclingCadenceBluetooth.CrankData> current) {
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -2,6 +2,8 @@ package de.dennisguse.opentracks.sensors.sensorData;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.Distance;
|
import de.dennisguse.opentracks.data.models.Distance;
|
||||||
@@ -20,7 +22,7 @@ public class AggregatorCyclingDistanceSpeed extends Aggregator<CyclingDistanceSp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeValue(Raw<CyclingDistanceSpeedBluetooth.WheelData> current) {
|
protected void computeValue(@NonNull Raw<CyclingDistanceSpeedBluetooth.WheelData> current) {
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
package de.dennisguse.opentracks.sensors.sensorData;
|
package de.dennisguse.opentracks.sensors.sensorData;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.Power;
|
import de.dennisguse.opentracks.data.models.Power;
|
||||||
import de.dennisguse.opentracks.sensors.driver.CyclingPowerBluetooth;
|
import de.dennisguse.opentracks.sensors.driver.CyclingPowerBluetooth;
|
||||||
|
|
||||||
@@ -10,7 +12,7 @@ public class AggregatorCyclingPower extends Aggregator<CyclingPowerBluetooth.Dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void computeValue(Raw<CyclingPowerBluetooth.Data> current) {
|
public void computeValue(@NonNull Raw<CyclingPowerBluetooth.Data> current) {
|
||||||
this.output = current.value().power();
|
this.output = current.value().power();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package de.dennisguse.opentracks.sensors.sensorData;
|
|||||||
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.Position;
|
import de.dennisguse.opentracks.data.models.Position;
|
||||||
|
|
||||||
public class AggregatorGPS extends Aggregator<Location, Position> {
|
public class AggregatorGPS extends Aggregator<Location, Position> {
|
||||||
@@ -11,7 +13,7 @@ public class AggregatorGPS extends Aggregator<Location, Position> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeValue(Raw<Location> current) {
|
protected void computeValue(@NonNull Raw<Location> current) {
|
||||||
output = Position.of(current.value(), current.time());
|
output = Position.of(current.value(), current.time());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package de.dennisguse.opentracks.sensors.sensorData;
|
package de.dennisguse.opentracks.sensors.sensorData;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.HeartRate;
|
import de.dennisguse.opentracks.data.models.HeartRate;
|
||||||
|
|
||||||
public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {
|
public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {
|
||||||
@@ -9,7 +11,7 @@ public class AggregatorHeartRate extends Aggregator<HeartRate, HeartRate> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeValue(Raw<HeartRate> current) {
|
protected void computeValue(@NonNull Raw<HeartRate> current) {
|
||||||
if (current.value().isValid()) {
|
if (current.value().isValid()) {
|
||||||
this.output = current.value();
|
this.output = current.value();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public final class AggregatorRunning extends Aggregator<RunningSpeedAndCadenceBl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void computeValue(Raw<RunningSpeedAndCadenceBluetooth.Data> current) {
|
public void computeValue(@NonNull Raw<RunningSpeedAndCadenceBluetooth.Data> current) {
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
package de.dennisguse.opentracks.sensors.sensorData;
|
package de.dennisguse.opentracks.sensors.sensorData;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.data.models.Temperature;
|
import de.dennisguse.opentracks.data.models.Temperature;
|
||||||
@@ -10,7 +12,7 @@ public class AggregatorTemperature extends Aggregator<Temperature, Temperature>
|
|||||||
super(sensorAddress, sensorName);
|
super(sensorAddress, sensorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void computeValue(Raw<Temperature> current) {
|
protected void computeValue(@NonNull Raw<Temperature> current) {
|
||||||
this.output = current.value();
|
this.output = current.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user