diff options
author | Isaac Chen <isaacchen@isaacchen.cn> | 2018-12-31 10:55:08 +0100 |
---|---|---|
committer | TingyiChen <tingyi364@gmail.com> | 2019-08-13 11:54:40 +0200 |
commit | e5c53750f06e9d9739b45ec108260ead7ff80941 (patch) | |
tree | fe1d84884caefc481e994ae9c59c84b11fddd408 /gps/android/GnssDebug.cpp | |
parent | 3ac2a0309619515c9ac27a5b6ec7c212b86dc355 (diff) |
wayne-common: Synchorize gps to P
* QC Tag: LA.UM.7.2.r1-04900-sdm660.0
Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
Change-Id: I34383e8fbf394b774f83f8d662873e8786ff1bbf
Diffstat (limited to 'gps/android/GnssDebug.cpp')
-rw-r--r-- | gps/android/GnssDebug.cpp | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/gps/android/GnssDebug.cpp b/gps/android/GnssDebug.cpp index ff467d3..94238ab 100644 --- a/gps/android/GnssDebug.cpp +++ b/gps/android/GnssDebug.cpp @@ -25,13 +25,19 @@ namespace android { namespace hardware { namespace gnss { -namespace V1_0 { +namespace V1_1 { namespace implementation { using ::android::hardware::hidl_vec; -#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT -#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns +#define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000) +#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000) +#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500) +#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180) + +#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT +#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns +#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss) { @@ -91,6 +97,40 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb) data.position.valid = false; } + if (data.position.horizontalAccuracyMeters <= 0 || + data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) { + data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS; + } + if (data.position.verticalAccuracyMeters <= 0 || + data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) { + data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS; + } + if (data.position.speedAccuracyMetersPerSecond <= 0 || + data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) { + data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC; + } + if (data.position.bearingAccuracyDegrees <= 0 || + data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) { + data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG; + } + + if (data.position.horizontalAccuracyMeters <= 0 || + data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) { + data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS; + } + if (data.position.verticalAccuracyMeters <= 0 || + data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) { + data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS; + } + if (data.position.speedAccuracyMetersPerSecond <= 0 || + data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) { + data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC; + } + if (data.position.bearingAccuracyDegrees <= 0 || + data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) { + data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG; + } + // time block if (reports.mTime.mValid) { data.time.timeEstimate = reports.mTime.timeEstimate; @@ -98,10 +138,17 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb) data.time.frequencyUncertaintyNsPerSec = reports.mTime.frequencyUncertaintyNsPerSec; } - else { + + if (data.time.timeEstimate < GNSS_DEBUG_UNKNOWN_UTC_TIME) { data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME; - data.time.timeUncertaintyNs = (float)(GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC); - data.time.frequencyUncertaintyNsPerSec = 0; + } + if (data.time.timeUncertaintyNs <= 0 || + data.time.timeUncertaintyNs > (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC) { + data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC; + } + if (data.time.frequencyUncertaintyNsPerSec <= 0 || + data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) { + data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC; } // satellite data block @@ -137,7 +184,7 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb) } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace gnss } // namespace hardware } // namespace android |