Example usage for android.location GnssClock getDriftNanosPerSecond

List of usage examples for android.location GnssClock getDriftNanosPerSecond

Introduction

In this page you can find the example usage for android.location GnssClock getDriftNanosPerSecond.

Prototype

public double getDriftNanosPerSecond() 

Source Link

Document

Gets the clock's Drift in nanoseconds per second.

Usage

From source file:com.google.android.apps.location.gps.gnsslogger.FileLogger.java

private void writeGnssMeasurementToFile(GnssClock clock, GnssMeasurement measurement) throws IOException {
    String clockStream = String.format("Raw,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", SystemClock.elapsedRealtime(),
            clock.getTimeNanos(), clock.hasLeapSecond() ? clock.getLeapSecond() : "",
            clock.hasTimeUncertaintyNanos() ? clock.getTimeUncertaintyNanos() : "", clock.getFullBiasNanos(),
            clock.hasBiasNanos() ? clock.getBiasNanos() : "",
            clock.hasBiasUncertaintyNanos() ? clock.getBiasUncertaintyNanos() : "",
            clock.hasDriftNanosPerSecond() ? clock.getDriftNanosPerSecond() : "",
            clock.hasDriftUncertaintyNanosPerSecond() ? clock.getDriftUncertaintyNanosPerSecond() : "",
            clock.getHardwareClockDiscontinuityCount() + ",");
    mFileWriter.write(clockStream);//from w ww . j a  va  2  s  . com

    String measurementStream = String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
            measurement.getSvid(), measurement.getTimeOffsetNanos(), measurement.getState(),
            measurement.getReceivedSvTimeNanos(), measurement.getReceivedSvTimeUncertaintyNanos(),
            measurement.getCn0DbHz(), measurement.getPseudorangeRateMetersPerSecond(),
            measurement.getPseudorangeRateUncertaintyMetersPerSecond(),
            measurement.getAccumulatedDeltaRangeState(), measurement.getAccumulatedDeltaRangeMeters(),
            measurement.getAccumulatedDeltaRangeUncertaintyMeters(),
            measurement.hasCarrierFrequencyHz() ? measurement.getCarrierFrequencyHz() : "",
            measurement.hasCarrierCycles() ? measurement.getCarrierCycles() : "",
            measurement.hasCarrierPhase() ? measurement.getCarrierPhase() : "",
            measurement.hasCarrierPhaseUncertainty() ? measurement.getCarrierPhaseUncertainty() : "",
            measurement.getMultipathIndicator(), measurement.hasSnrInDb() ? measurement.getSnrInDb() : "",
            measurement.getConstellationType(),
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && measurement.hasAutomaticGainControlLevelDb()
                    ? measurement.getAutomaticGainControlLevelDb()
                    : "",
            measurement.hasCarrierFrequencyHz() ? measurement.getCarrierFrequencyHz() : "");
    mFileWriter.write(measurementStream);
    mFileWriter.newLine();
}