From 58d74dc1bddc9933c63c3877a934658f9788bc54 Mon Sep 17 00:00:00 2001 From: Katz Yamada Date: Tue, 6 Jun 2017 10:04:43 -0700 Subject: [PATCH] Add set default report API in systemstatus Add an API to set default report data cached in systemstatus. Call this API when delete all aiding data is requested, so that bugreport has all default values. Bug: 62068956 Change-Id: I76d661c6a89a1644aef2a8f47253ce9cc0d727fb CRs-Fixed: 2054705 --- core/SystemStatus.cpp | 72 +++++++++++++++++++++++++ core/SystemStatus.h | 123 +++++++++++++++++++++++++++++++++++++----- gnss/GnssAdapter.cpp | 4 +- 3 files changed, 183 insertions(+), 16 deletions(-) diff --git a/core/SystemStatus.cpp b/core/SystemStatus.cpp index 80406f62..939005d0 100644 --- a/core/SystemStatus.cpp +++ b/core/SystemStatus.cpp @@ -873,6 +873,7 @@ void SystemStatusInjectedPosition::dump() SystemStatusBestPosition ******************************************************************************/ SystemStatusBestPosition::SystemStatusBestPosition(const SystemStatusPQWP2& nmea) : + mValid(true), mBestLat(nmea.mBestLat), mBestLon(nmea.mBestLon), mBestAlt(nmea.mBestAlt), @@ -1598,5 +1599,76 @@ bool SystemStatus::getReport(SystemStatusReports& report, bool isLatestOnly) con return true; } +/****************************************************************************** +@brief API to set default report data + +@param[In] none + +@return true when successfully done +******************************************************************************/ +bool SystemStatus::setDefaultReport(void) +{ + pthread_mutex_lock(&mMutexSystemStatus); + + mCache.mLocation.push_back(SystemStatusLocation()); + if (mCache.mLocation.size() > maxLocation) { + mCache.mLocation.erase(mCache.mLocation.begin()); + } + + mCache.mTimeAndClock.push_back(SystemStatusTimeAndClock()); + if (mCache.mTimeAndClock.size() > maxTimeAndClock) { + mCache.mTimeAndClock.erase(mCache.mTimeAndClock.begin()); + } + mCache.mXoState.push_back(SystemStatusXoState()); + if (mCache.mXoState.size() > maxXoState) { + mCache.mXoState.erase(mCache.mXoState.begin()); + } + mCache.mRfAndParams.push_back(SystemStatusRfAndParams()); + if (mCache.mRfAndParams.size() > maxRfAndParams) { + mCache.mRfAndParams.erase(mCache.mRfAndParams.begin()); + } + mCache.mErrRecovery.push_back(SystemStatusErrRecovery()); + if (mCache.mErrRecovery.size() > maxErrRecovery) { + mCache.mErrRecovery.erase(mCache.mErrRecovery.begin()); + } + + mCache.mInjectedPosition.push_back(SystemStatusInjectedPosition()); + if (mCache.mInjectedPosition.size() > maxInjectedPosition) { + mCache.mInjectedPosition.erase(mCache.mInjectedPosition.begin()); + } + mCache.mBestPosition.push_back(SystemStatusBestPosition()); + if (mCache.mBestPosition.size() > maxBestPosition) { + mCache.mBestPosition.erase(mCache.mBestPosition.begin()); + } + mCache.mXtra.push_back(SystemStatusXtra()); + if (mCache.mXtra.size() > maxXtra) { + mCache.mXtra.erase(mCache.mXtra.begin()); + } + mCache.mEphemeris.push_back(SystemStatusEphemeris()); + if (mCache.mEphemeris.size() > maxEphemeris) { + mCache.mEphemeris.erase(mCache.mEphemeris.begin()); + } + mCache.mSvHealth.push_back(SystemStatusSvHealth()); + if (mCache.mSvHealth.size() > maxSvHealth) { + mCache.mSvHealth.erase(mCache.mSvHealth.begin()); + } + mCache.mPdr.push_back(SystemStatusPdr()); + if (mCache.mPdr.size() > maxPdr) { + mCache.mPdr.erase(mCache.mPdr.begin()); + } + mCache.mNavData.push_back(SystemStatusNavData()); + if (mCache.mNavData.size() > maxNavData) { + mCache.mNavData.erase(mCache.mNavData.begin()); + } + + mCache.mPositionFailure.push_back(SystemStatusPositionFailure()); + if (mCache.mPositionFailure.size() > maxPositionFailure) { + mCache.mPositionFailure.erase(mCache.mPositionFailure.begin()); + } + + pthread_mutex_unlock(&mMutexSystemStatus); + return true; +} + } // namespace loc_core diff --git a/core/SystemStatus.h b/core/SystemStatus.h index a3b38d34..78fc6f8f 100644 --- a/core/SystemStatus.h +++ b/core/SystemStatus.h @@ -74,12 +74,16 @@ public: class SystemStatusLocation : public SystemStatusItemBase { public: + bool mValid; UlpLocation mLocation; GpsLocationExtended mLocationEx; - SystemStatusLocation(const UlpLocation& location, + inline SystemStatusLocation() : + mValid(false) {} + inline SystemStatusLocation(const UlpLocation& location, const GpsLocationExtended& locationEx) : + mValid(true), mLocation(location), - mLocationEx(locationEx){ }; + mLocationEx(locationEx) { } bool equals(SystemStatusLocation& peer); void dump(void); }; @@ -97,7 +101,17 @@ public: int32_t mClockFreqBiasUnc; int32_t mLeapSeconds; int32_t mLeapSecUnc; - SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea); + inline SystemStatusTimeAndClock() : + mGpsWeek(0), + mGpsTowMs(0), + mTimeValid(0), + mTimeSource(0), + mTimeUnc(0), + mClockFreqBias(0), + mClockFreqBiasUnc(0), + mLeapSeconds(0), + mLeapSecUnc(0) {} + inline SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea); bool equals(SystemStatusTimeAndClock& peer); void dump(void); }; @@ -106,7 +120,9 @@ class SystemStatusXoState : public SystemStatusItemBase { public: uint8_t mXoState; - SystemStatusXoState(const SystemStatusPQWM1& nmea); + inline SystemStatusXoState() : + mXoState(0) {} + inline SystemStatusXoState(const SystemStatusPQWM1& nmea); bool equals(SystemStatusXoState& peer); void dump(void); }; @@ -127,7 +143,21 @@ public: double mAgcGlo; double mAgcBds; double mAgcGal; - SystemStatusRfAndParams(const SystemStatusPQWM1& nmea); + inline SystemStatusRfAndParams() : + mPgaGain(0), + mGpsBpAmpI(0), + mGpsBpAmpQ(0), + mAdcI(0), + mAdcQ(0), + mJammerGps(0), + mJammerGlo(0), + mJammerBds(0), + mJammerGal(0), + mAgcGps(0), + mAgcGlo(0), + mAgcBds(0), + mAgcGal(0) {} + inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea); bool equals(SystemStatusRfAndParams& peer); void dump(void); }; @@ -136,7 +166,9 @@ class SystemStatusErrRecovery : public SystemStatusItemBase { public: uint32_t mRecErrorRecovery; - SystemStatusErrRecovery(const SystemStatusPQWM1& nmea); + inline SystemStatusErrRecovery() : + mRecErrorRecovery(0) {}; + inline SystemStatusErrRecovery(const SystemStatusPQWM1& nmea); bool equals(SystemStatusErrRecovery& peer); void dump(void); }; @@ -152,7 +184,15 @@ public: float mEpiHepe; float mEpiAltUnc; uint8_t mEpiSrc; - SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea); + inline SystemStatusInjectedPosition() : + mEpiValidity(0), + mEpiLat(0), + mEpiLon(0), + mEpiAlt(0), + mEpiHepe(0), + mEpiAltUnc(0), + mEpiSrc(0) {} + inline SystemStatusInjectedPosition(const SystemStatusPQWP1& nmea); bool equals(SystemStatusInjectedPosition& peer); void dump(void); }; @@ -161,12 +201,20 @@ class SystemStatusPQWP2; class SystemStatusBestPosition : public SystemStatusItemBase { public: + bool mValid; float mBestLat; float mBestLon; float mBestAlt; float mBestHepe; float mBestAltUnc; - SystemStatusBestPosition(const SystemStatusPQWP2& nmea); + inline SystemStatusBestPosition() : + mValid(false), + mBestLat(0), + mBestLon(0), + mBestAlt(0), + mBestHepe(0), + mBestAltUnc(0) {} + inline SystemStatusBestPosition(const SystemStatusPQWP2& nmea); bool equals(SystemStatusBestPosition& peer); void dump(void); }; @@ -186,7 +234,19 @@ public: uint64_t mBdsXtraValid; uint64_t mGalXtraValid; uint8_t mQzssXtraValid; - SystemStatusXtra(const SystemStatusPQWP3& nmea); + inline SystemStatusXtra() : + mXtraValidMask(0), + mGpsXtraAge(0), + mGloXtraAge(0), + mBdsXtraAge(0), + mGalXtraAge(0), + mQzssXtraAge(0), + mGpsXtraValid(0), + mGloXtraValid(0), + mBdsXtraValid(0ULL), + mGalXtraValid(0ULL), + mQzssXtraValid(0) {} + inline SystemStatusXtra(const SystemStatusPQWP3& nmea); bool equals(SystemStatusXtra& peer); void dump(void); }; @@ -200,7 +260,13 @@ public: uint64_t mBdsEpheValid; uint64_t mGalEpheValid; uint8_t mQzssEpheValid; - SystemStatusEphemeris(const SystemStatusPQWP4& nmea); + inline SystemStatusEphemeris() : + mGpsEpheValid(0), + mGloEpheValid(0), + mBdsEpheValid(0ULL), + mGalEpheValid(0ULL), + mQzssEpheValid(0) {} + inline SystemStatusEphemeris(const SystemStatusPQWP4& nmea); bool equals(SystemStatusEphemeris& peer); void dump(void); }; @@ -224,7 +290,23 @@ public: uint64_t mBdsBadMask; uint64_t mGalBadMask; uint8_t mQzssBadMask; - SystemStatusSvHealth(const SystemStatusPQWP5& nmea); + inline SystemStatusSvHealth() : + mGpsUnknownMask(0), + mGloUnknownMask(0), + mBdsUnknownMask(0ULL), + mGalUnknownMask(0ULL), + mQzssUnknownMask(0), + mGpsGoodMask(0), + mGloGoodMask(0), + mBdsGoodMask(0ULL), + mGalGoodMask(0ULL), + mQzssGoodMask(0), + mGpsBadMask(0), + mGloBadMask(0), + mBdsBadMask(0ULL), + mGalBadMask(0ULL), + mQzssBadMask(0) {} + inline SystemStatusSvHealth(const SystemStatusPQWP5& nmea); bool equals(SystemStatusSvHealth& peer); void dump(void); }; @@ -234,7 +316,9 @@ class SystemStatusPdr : public SystemStatusItemBase { public: uint32_t mFixInfoMask; - SystemStatusPdr(const SystemStatusPQWP6& nmea); + inline SystemStatusPdr() : + mFixInfoMask(0) {} + inline SystemStatusPdr(const SystemStatusPQWP6& nmea); bool equals(SystemStatusPdr& peer); void dump(void); }; @@ -251,7 +335,14 @@ class SystemStatusNavData : public SystemStatusItemBase { public: SystemStatusNav mNav[SV_ALL_NUM]; - SystemStatusNavData(const SystemStatusPQWP7& nmea); + inline SystemStatusNavData() { + for (uint32_t i=0; i