List of usage examples for android.location GnssStatus CONSTELLATION_UNKNOWN
int CONSTELLATION_UNKNOWN
To view the source code for android.location GnssStatus CONSTELLATION_UNKNOWN.
Click Source Link
From source file:com.google.android.apps.location.gps.gnsslogger.PlotFragment.java
/** * Updates the CN0 versus Time plot data from a {@link GnssMeasurement} *//*from ww w . j a v a 2s . com*/ protected void updateCnoTab(GnssMeasurementsEvent event) { long timeInSeconds = TimeUnit.NANOSECONDS.toSeconds(event.getClock().getTimeNanos()); if (mInitialTimeSeconds < 0) { mInitialTimeSeconds = timeInSeconds; } // Building the texts message in analysis text view List<GnssMeasurement> measurements = sortByCarrierToNoiseRatio(new ArrayList<>(event.getMeasurements())); SpannableStringBuilder builder = new SpannableStringBuilder(); double currentAverage = 0; if (measurements.size() >= NUMBER_OF_STRONGEST_SATELLITES) { mAverageCn0 = (mAverageCn0 * mMeasurementCount + (measurements.get(0).getCn0DbHz() + measurements.get(1).getCn0DbHz() + measurements.get(2).getCn0DbHz() + measurements.get(3).getCn0DbHz()) / NUMBER_OF_STRONGEST_SATELLITES) / (++mMeasurementCount); currentAverage = (measurements.get(0).getCn0DbHz() + measurements.get(1).getCn0DbHz() + measurements.get(2).getCn0DbHz() + measurements.get(3).getCn0DbHz()) / NUMBER_OF_STRONGEST_SATELLITES; } builder.append(getString(R.string.history_average_hint, sDataFormat.format(mAverageCn0) + "\n")); builder.append(getString(R.string.current_average_hint, sDataFormat.format(currentAverage) + "\n")); for (int i = 0; i < NUMBER_OF_STRONGEST_SATELLITES && i < measurements.size(); i++) { int start = builder.length(); builder.append(mDataSetManager.getConstellationPrefix(measurements.get(i).getConstellationType()) + measurements.get(i).getSvid() + ": " + sDataFormat.format(measurements.get(i).getCn0DbHz()) + "\n"); int end = builder.length(); builder.setSpan( new ForegroundColorSpan(mColorMap.getColor(measurements.get(i).getSvid(), measurements.get(i).getConstellationType())), start, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } builder.append(getString(R.string.satellite_number_sum_hint, measurements.size())); mAnalysisView.setText(builder); // Adding incoming data into Dataset mLastTimeReceivedSeconds = timeInSeconds - mInitialTimeSeconds; for (GnssMeasurement measurement : measurements) { int constellationType = measurement.getConstellationType(); int svID = measurement.getSvid(); if (constellationType != GnssStatus.CONSTELLATION_UNKNOWN) { mDataSetManager.addValue(CN0_TAB, constellationType, svID, mLastTimeReceivedSeconds, measurement.getCn0DbHz()); } } mDataSetManager.fillInDiscontinuity(CN0_TAB, mLastTimeReceivedSeconds); // Checks if the plot has reached the end of frame and resize if (mLastTimeReceivedSeconds > mCurrentRenderer.getXAxisMax()) { mCurrentRenderer.setXAxisMax(mLastTimeReceivedSeconds); mCurrentRenderer.setXAxisMin(mLastTimeReceivedSeconds - TIME_INTERVAL_SECONDS); } mChartView.invalidate(); }