diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2017-08-09 18:40:51 -0700 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2017-08-11 12:32:34 -0700 |
commit | db3101c207f101a19a078916f2146b4b38f8a7e2 (patch) | |
tree | 81993b69e0aa6c0158a5f35ba1cfeab2d27a5e74 | |
parent | 2cb23d6015a7c45a9cd9bd2ba6f2b4d59d681e95 (diff) | |
download | gps-db3101c207f101a19a078916f2146b4b38f8a7e2.tar.gz |
move getAgcInformation and setDefaultReport into GnssAdapter
They are currently in LocApiv02, which is incorrect. SystemStatus
shouldn't be referenced at this layer. And both of these two calls
are specific to GnssAdapter use cases too.
Change-Id: I7098e3963be163199a833a8fb6b12a100405f71e
CRs-Fixed: 2090442
-rw-r--r-- | core/LocAdapterBase.cpp | 3 | ||||
-rw-r--r-- | core/LocAdapterBase.h | 3 | ||||
-rw-r--r-- | core/LocApiBase.cpp | 5 | ||||
-rw-r--r-- | core/LocApiBase.h | 2 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 83 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 7 |
6 files changed, 87 insertions, 16 deletions
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 9d89c4b..3943819 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -153,7 +153,8 @@ bool LocAdapterBase:: DEFAULT_IMPL(false) void LocAdapterBase:: - reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurementsNotify*/) + reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurements*/, + int /*msInWeek*/) DEFAULT_IMPL() bool LocAdapterBase:: diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 5c471fd..e7beca8 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -150,7 +150,8 @@ public: virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data); inline virtual bool isInSession() { return false; } ContextBase* getContext() const { return mContext; } - virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify); + virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements, + int msInWeek); virtual bool reportWwanZppFix(LocGpsLocation &zppLoc); }; diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 6cc00b1..303d03a 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -401,10 +401,11 @@ void* LocApiBase :: getSibling() LocApiProxyBase* LocApiBase :: getLocApiProxy() DEFAULT_IMPL(NULL) -void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify) +void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurements, + int msInWeek) { // loop through adapters, and deliver to all adapters. - TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurementsNotify)); + TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurements, msInWeek)); } enum loc_api_adapter_err LocApiBase:: diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 86610e7..f2fcd9d 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -131,7 +131,7 @@ public: void reportDataCallClosed(); void requestNiNotify(GnssNiNotification ¬ify, const void* data); void saveSupportedMsgList(uint64_t supportedMsgList); - void reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify); + void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek); void saveSupportedFeatureList(uint8_t *featureList); void reportWwanZppFix(LocGpsLocation &zppLoc); diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 677a020..ef3657d 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -818,6 +818,10 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data) LocationError err = LOCATION_ERROR_SUCCESS; err = mApi.deleteAidingData(mData); mAdapter.reportResponse(err, mSessionId); + SystemStatus* s = LocDualContext::getSystemStatus(); + if ((nullptr != s) && (mData.deleteAll)) { + s->setDefaultReport(); + } } }; @@ -2289,32 +2293,38 @@ GnssAdapter::requestNiNotify(const GnssNiNotification& notify, const void* data) } void -GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify) +GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements, + int msInWeek) { LOC_LOGD("%s]: ", __func__); struct MsgReportGnssMeasurementData : public LocMsg { GnssAdapter& mAdapter; - const GnssMeasurementsNotification mMeasurementsNotify; + GnssMeasurementsNotification mMeasurementsNotify; inline MsgReportGnssMeasurementData(GnssAdapter& adapter, - const GnssMeasurementsNotification& measurementsNotify) : - LocMsg(), - mAdapter(adapter), - mMeasurementsNotify(measurementsNotify) {} + const GnssMeasurementsNotification& measurements, + int msInWeek) : + LocMsg(), + mAdapter(adapter), + mMeasurementsNotify(measurements) { + if (-1 != msInWeek) { + getAgcInformation(mMeasurementsNotify, msInWeek); + } + } inline virtual void proc() const { mAdapter.reportGnssMeasurementData(mMeasurementsNotify); } }; - sendMsg(new MsgReportGnssMeasurementData(*this, measurementsNotify)); + sendMsg(new MsgReportGnssMeasurementData(*this, measurements, msInWeek)); } void -GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify) +GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurements) { for (auto it=mClientData.begin(); it != mClientData.end(); ++it) { if (nullptr != it->second.gnssMeasurementsCb) { - it->second.gnssMeasurementsCb(measurementsNotify); + it->second.gnssMeasurementsCb(measurements); } } } @@ -2921,3 +2931,58 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r) return true; } +/* get AGC information from system status and fill it */ +void +GnssAdapter::getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek) +{ + SystemStatus* systemstatus = LocDualContext::getSystemStatus(); + + if (nullptr != systemstatus) { + SystemStatusReports reports = {}; + systemstatus->getReport(reports, true); + + if ((!reports.mRfAndParams.empty()) && (!reports.mTimeAndClock.empty()) && + reports.mTimeAndClock.back().mTimeValid && + (abs(msInWeek - (int)reports.mTimeAndClock.back().mGpsTowMs) < 2000)) { + + for (size_t i = 0; i < measurements.count; i++) { + switch (measurements.measurements[i].svType) { + case GNSS_SV_TYPE_GPS: + measurements.measurements[i].agcLevelDb = + reports.mRfAndParams.back().mAgcGps; + measurements.measurements[i].flags |= + GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT; + break; + + case GNSS_SV_TYPE_GALILEO: + measurements.measurements[i].agcLevelDb = + reports.mRfAndParams.back().mAgcGal; + measurements.measurements[i].flags |= + GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT; + break; + + case GNSS_SV_TYPE_GLONASS: + measurements.measurements[i].agcLevelDb = + reports.mRfAndParams.back().mAgcGlo; + measurements.measurements[i].flags |= + GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT; + break; + + case GNSS_SV_TYPE_BEIDOU: + measurements.measurements[i].agcLevelDb = + reports.mRfAndParams.back().mAgcBds; + measurements.measurements[i].flags |= + GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT; + break; + + case GNSS_SV_TYPE_QZSS: + case GNSS_SV_TYPE_SBAS: + case GNSS_SV_TYPE_UNKNOWN: + default: + break; + } + } + } + } +} + diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 2db9758..6e12d7c 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -217,7 +217,8 @@ public: virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false); virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false); virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data); - virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify); + virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements, + int msInWeek); virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet); virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial); @@ -235,10 +236,12 @@ public: void reportSv(GnssSvNotification& svNotify); void reportNmea(const char* nmea, size_t length); bool requestNiNotify(const GnssNiNotification& notify, const void* data); - void reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify); + void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements); /*======== GNSSDEBUG ================================================================*/ bool getDebugReport(GnssDebugReport& report); + /* get AGC information from system status and fill it */ + static void getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek); /*==== CONVERSION ===================================================================*/ static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock); |