Example usage for android.location GnssClock getLeapSecond

List of usage examples for android.location GnssClock getLeapSecond

Introduction

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

Prototype

public int getLeapSecond() 

Source Link

Document

Gets the leap second associated with the clock's time.

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  ww w. ja  va2s  .co m*/

    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();
}