High speed GPS/GNSS Navigation Information Block
am: 5d5bac8383
Change-Id: If8e8576f7e18faf6cb45ff228222c0c34be98d6d
This commit is contained in:
@@ -417,6 +417,12 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
|
|
||||||
private int mYearOfHardware = 0;
|
private int mYearOfHardware = 0;
|
||||||
|
|
||||||
|
// Set lower than the current ITAR limit of 600m/s to allow this to trigger even if GPS HAL
|
||||||
|
// stops output right at 600m/s, depriving this of the information of a device that reaches
|
||||||
|
// greater than 600m/s, and higher than the speed of sound to avoid impacting most use cases.
|
||||||
|
private static final float ITAR_SPEED_LIMIT_METERS_PER_SECOND = 400.0F;
|
||||||
|
private boolean mItarSpeedLimitExceeded = false;
|
||||||
|
|
||||||
private final IGnssStatusProvider mGnssStatusProvider = new IGnssStatusProvider.Stub() {
|
private final IGnssStatusProvider mGnssStatusProvider = new IGnssStatusProvider.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void registerGnssStatusCallback(IGnssStatusListener callback) {
|
public void registerGnssStatusCallback(IGnssStatusListener callback) {
|
||||||
@@ -1414,6 +1420,12 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
mStarted = true;
|
mStarted = true;
|
||||||
mSingleShot = singleShot;
|
mSingleShot = singleShot;
|
||||||
mPositionMode = GPS_POSITION_MODE_STANDALONE;
|
mPositionMode = GPS_POSITION_MODE_STANDALONE;
|
||||||
|
// Notify about suppressed output, if speed limit was previously exceeded.
|
||||||
|
// Elsewhere, we check again with every speed output reported.
|
||||||
|
if (mItarSpeedLimitExceeded) {
|
||||||
|
Log.i(TAG, "startNavigating with ITAR limit in place. Output limited " +
|
||||||
|
"until slow enough speed reported.");
|
||||||
|
}
|
||||||
|
|
||||||
boolean agpsEnabled =
|
boolean agpsEnabled =
|
||||||
(Settings.Global.getInt(mContext.getContentResolver(),
|
(Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
@@ -1500,7 +1512,17 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
* called from native code to update our position.
|
* called from native code to update our position.
|
||||||
*/
|
*/
|
||||||
private void reportLocation(int flags, double latitude, double longitude, double altitude,
|
private void reportLocation(int flags, double latitude, double longitude, double altitude,
|
||||||
float speed, float bearing, float accuracy, long timestamp) {
|
float speedMetersPerSecond, float bearing, float accuracy, long timestamp) {
|
||||||
|
if ((flags & LOCATION_HAS_SPEED) == LOCATION_HAS_SPEED) {
|
||||||
|
mItarSpeedLimitExceeded = speedMetersPerSecond > ITAR_SPEED_LIMIT_METERS_PER_SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mItarSpeedLimitExceeded) {
|
||||||
|
Log.i(TAG, "Hal reported a speed in excess of ITAR limit." +
|
||||||
|
" GPS/GNSS Navigation output blocked.");
|
||||||
|
return; // No output of location allowed
|
||||||
|
}
|
||||||
|
|
||||||
if (VERBOSE) Log.v(TAG, "reportLocation lat: " + latitude + " long: " + longitude +
|
if (VERBOSE) Log.v(TAG, "reportLocation lat: " + latitude + " long: " + longitude +
|
||||||
" timestamp: " + timestamp);
|
" timestamp: " + timestamp);
|
||||||
|
|
||||||
@@ -1520,7 +1542,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
mLocation.removeAltitude();
|
mLocation.removeAltitude();
|
||||||
}
|
}
|
||||||
if ((flags & LOCATION_HAS_SPEED) == LOCATION_HAS_SPEED) {
|
if ((flags & LOCATION_HAS_SPEED) == LOCATION_HAS_SPEED) {
|
||||||
mLocation.setSpeed(speed);
|
mLocation.setSpeed(speedMetersPerSecond);
|
||||||
} else {
|
} else {
|
||||||
mLocation.removeSpeed();
|
mLocation.removeSpeed();
|
||||||
}
|
}
|
||||||
@@ -1704,23 +1726,29 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
|||||||
* called from native code to report NMEA data received
|
* called from native code to report NMEA data received
|
||||||
*/
|
*/
|
||||||
private void reportNmea(long timestamp) {
|
private void reportNmea(long timestamp) {
|
||||||
int length = native_read_nmea(mNmeaBuffer, mNmeaBuffer.length);
|
if (!mItarSpeedLimitExceeded) {
|
||||||
String nmea = new String(mNmeaBuffer, 0 /* offset */, length);
|
int length = native_read_nmea(mNmeaBuffer, mNmeaBuffer.length);
|
||||||
mListenerHelper.onNmeaReceived(timestamp, nmea);
|
String nmea = new String(mNmeaBuffer, 0 /* offset */, length);
|
||||||
|
mListenerHelper.onNmeaReceived(timestamp, nmea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called from native code - Gps measurements callback
|
* called from native code - Gps measurements callback
|
||||||
*/
|
*/
|
||||||
private void reportMeasurementData(GnssMeasurementsEvent event) {
|
private void reportMeasurementData(GnssMeasurementsEvent event) {
|
||||||
mGnssMeasurementsProvider.onMeasurementsAvailable(event);
|
if (!mItarSpeedLimitExceeded) {
|
||||||
|
mGnssMeasurementsProvider.onMeasurementsAvailable(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called from native code - GPS navigation message callback
|
* called from native code - GPS navigation message callback
|
||||||
*/
|
*/
|
||||||
private void reportNavigationMessage(GnssNavigationMessage event) {
|
private void reportNavigationMessage(GnssNavigationMessage event) {
|
||||||
mGnssNavigationMessageProvider.onNavigationMessageAvailable(event);
|
if (!mItarSpeedLimitExceeded) {
|
||||||
|
mGnssNavigationMessageProvider.onNavigationMessageAvailable(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user