diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/BluetoothCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/BluetoothCsvLogger.java index 0bbb8563..3f57272b 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/BluetoothCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/BluetoothCsvLogger.java @@ -104,8 +104,8 @@ private String[] convertToObjectArray(BluetoothRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CdmaCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CdmaCsvLogger.java index b6a07790..58510cfe 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CdmaCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CdmaCsvLogger.java @@ -82,8 +82,8 @@ private String[] convertToObjectArray(CdmaRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CsvRecordLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CsvRecordLogger.java index 52668aca..c6831f2d 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CsvRecordLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/CsvRecordLogger.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; import timber.log.Timber; @@ -425,4 +426,15 @@ public void reset() recordCount.set(0); } } + + /** + * Trims a double (location) to six decimal places. + * + * @param value The double to trim. + * @return The trimmed double as a string. + */ + String trimToSixDecimalPlaces(double value) + { + return String.format(Locale.getDefault(), "%.6f", value); + } } diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/DeviceStatusCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/DeviceStatusCsvLogger.java index b1d42ce4..cde83a96 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/DeviceStatusCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/DeviceStatusCsvLogger.java @@ -86,20 +86,20 @@ private String[] convertToObjectArray(DeviceStatus record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), data.hasBatteryLevelPercent() ? String.valueOf(data.getBatteryLevelPercent().getValue()) : "", - hasGnssLocation ? String.valueOf(gnssLatitude) : "", - hasGnssLocation ? String.valueOf(gnssLongitude) : "", + hasGnssLocation ? trimToSixDecimalPlaces(gnssLatitude) : "", + hasGnssLocation ? trimToSixDecimalPlaces(gnssLongitude) : "", hasGnssLocation ? String.valueOf(data.getGnssAltitude()) : "", hasGnssLocation ? String.valueOf(data.getGnssAccuracy()) : "", - hasNetworkLocation ? String.valueOf(networkLatitude) : "", - hasNetworkLocation ? String.valueOf(networkLongitude) : "", + hasNetworkLocation ? trimToSixDecimalPlaces(networkLatitude) : "", + hasNetworkLocation ? trimToSixDecimalPlaces(networkLongitude) : "", hasNetworkLocation ? String.valueOf(data.getNetworkAltitude()) : "", hasNetworkLocation ? String.valueOf(data.getNetworkAccuracy()) : "", data.getDeviceSerialNumber() diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GnssCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GnssCsvLogger.java index c055ebb4..23e92ca4 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GnssCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GnssCsvLogger.java @@ -87,8 +87,8 @@ private String[] convertToObjectArray(GnssRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GsmCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GsmCsvLogger.java index d4576994..2b7d8a1f 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GsmCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/GsmCsvLogger.java @@ -82,8 +82,8 @@ private String[] convertToObjectArray(GsmRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/LteCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/LteCsvLogger.java index b3772b3f..14ccfb78 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/LteCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/LteCsvLogger.java @@ -90,8 +90,8 @@ private String[] convertToObjectArray(LteRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/NrCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/NrCsvLogger.java index 69fc8d16..a7ef0bbc 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/NrCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/NrCsvLogger.java @@ -87,8 +87,8 @@ private String[] convertToObjectArray(NrRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/PhoneStateCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/PhoneStateCsvLogger.java index fc45aca4..3af90e33 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/PhoneStateCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/PhoneStateCsvLogger.java @@ -123,8 +123,8 @@ private String[] convertToObjectArray(PhoneState record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/UmtsCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/UmtsCsvLogger.java index a25f3197..b325a82d 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/UmtsCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/UmtsCsvLogger.java @@ -83,8 +83,8 @@ private String[] convertToObjectArray(UmtsRecord record) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()), diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/WifiCsvLogger.java b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/WifiCsvLogger.java index 1207d816..9878b5f9 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/logging/WifiCsvLogger.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/logging/WifiCsvLogger.java @@ -113,8 +113,8 @@ private String[] convertToObjectArray(WifiRecordWrapper wrapper) return new String[]{ data.getDeviceTime(), - String.valueOf(data.getLatitude()), - String.valueOf(data.getLongitude()), + trimToSixDecimalPlaces(data.getLatitude()), + trimToSixDecimalPlaces(data.getLongitude()), String.valueOf(data.getAltitude()), String.valueOf(data.getSpeed()), String.valueOf(data.getAccuracy()),