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
This commit is contained in:
parent
2cb23d6015
commit
db3101c207
6 changed files with 87 additions and 16 deletions
|
@ -153,7 +153,8 @@ bool LocAdapterBase::
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
void LocAdapterBase::
|
void LocAdapterBase::
|
||||||
reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurementsNotify*/)
|
reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurements*/,
|
||||||
|
int /*msInWeek*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
bool LocAdapterBase::
|
bool LocAdapterBase::
|
||||||
|
|
|
@ -150,7 +150,8 @@ public:
|
||||||
virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
|
virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
|
||||||
inline virtual bool isInSession() { return false; }
|
inline virtual bool isInSession() { return false; }
|
||||||
ContextBase* getContext() const { return mContext; }
|
ContextBase* getContext() const { return mContext; }
|
||||||
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify);
|
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
|
||||||
|
int msInWeek);
|
||||||
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
|
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -401,10 +401,11 @@ void* LocApiBase :: getSibling()
|
||||||
LocApiProxyBase* LocApiBase :: getLocApiProxy()
|
LocApiProxyBase* LocApiBase :: getLocApiProxy()
|
||||||
DEFAULT_IMPL(NULL)
|
DEFAULT_IMPL(NULL)
|
||||||
|
|
||||||
void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify)
|
void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurements,
|
||||||
|
int msInWeek)
|
||||||
{
|
{
|
||||||
// loop through adapters, and deliver to all adapters.
|
// 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::
|
enum loc_api_adapter_err LocApiBase::
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
void reportDataCallClosed();
|
void reportDataCallClosed();
|
||||||
void requestNiNotify(GnssNiNotification ¬ify, const void* data);
|
void requestNiNotify(GnssNiNotification ¬ify, const void* data);
|
||||||
void saveSupportedMsgList(uint64_t supportedMsgList);
|
void saveSupportedMsgList(uint64_t supportedMsgList);
|
||||||
void reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify);
|
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
|
||||||
void saveSupportedFeatureList(uint8_t *featureList);
|
void saveSupportedFeatureList(uint8_t *featureList);
|
||||||
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
||||||
|
|
||||||
|
|
|
@ -818,6 +818,10 @@ GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
|
||||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||||
err = mApi.deleteAidingData(mData);
|
err = mApi.deleteAidingData(mData);
|
||||||
mAdapter.reportResponse(err, mSessionId);
|
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
|
void
|
||||||
GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify)
|
GnssAdapter::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
|
||||||
|
int msInWeek)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: ", __func__);
|
LOC_LOGD("%s]: ", __func__);
|
||||||
|
|
||||||
struct MsgReportGnssMeasurementData : public LocMsg {
|
struct MsgReportGnssMeasurementData : public LocMsg {
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
const GnssMeasurementsNotification mMeasurementsNotify;
|
GnssMeasurementsNotification mMeasurementsNotify;
|
||||||
inline MsgReportGnssMeasurementData(GnssAdapter& adapter,
|
inline MsgReportGnssMeasurementData(GnssAdapter& adapter,
|
||||||
const GnssMeasurementsNotification& measurementsNotify) :
|
const GnssMeasurementsNotification& measurements,
|
||||||
|
int msInWeek) :
|
||||||
LocMsg(),
|
LocMsg(),
|
||||||
mAdapter(adapter),
|
mAdapter(adapter),
|
||||||
mMeasurementsNotify(measurementsNotify) {}
|
mMeasurementsNotify(measurements) {
|
||||||
|
if (-1 != msInWeek) {
|
||||||
|
getAgcInformation(mMeasurementsNotify, msInWeek);
|
||||||
|
}
|
||||||
|
}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
mAdapter.reportGnssMeasurementData(mMeasurementsNotify);
|
mAdapter.reportGnssMeasurementData(mMeasurementsNotify);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMsg(new MsgReportGnssMeasurementData(*this, measurementsNotify));
|
sendMsg(new MsgReportGnssMeasurementData(*this, measurements, msInWeek));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify)
|
GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurements)
|
||||||
{
|
{
|
||||||
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
||||||
if (nullptr != it->second.gnssMeasurementsCb) {
|
if (nullptr != it->second.gnssMeasurementsCb) {
|
||||||
it->second.gnssMeasurementsCb(measurementsNotify);
|
it->second.gnssMeasurementsCb(measurements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2921,3 +2931,58 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,8 @@ public:
|
||||||
virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
|
virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
|
||||||
virtual void reportNmeaEvent(const char* nmea, size_t length, 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 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 reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
|
||||||
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
|
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
|
||||||
|
|
||||||
|
@ -235,10 +236,12 @@ public:
|
||||||
void reportSv(GnssSvNotification& svNotify);
|
void reportSv(GnssSvNotification& svNotify);
|
||||||
void reportNmea(const char* nmea, size_t length);
|
void reportNmea(const char* nmea, size_t length);
|
||||||
bool requestNiNotify(const GnssNiNotification& notify, const void* data);
|
bool requestNiNotify(const GnssNiNotification& notify, const void* data);
|
||||||
void reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify);
|
void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements);
|
||||||
|
|
||||||
/*======== GNSSDEBUG ================================================================*/
|
/*======== GNSSDEBUG ================================================================*/
|
||||||
bool getDebugReport(GnssDebugReport& report);
|
bool getDebugReport(GnssDebugReport& report);
|
||||||
|
/* get AGC information from system status and fill it */
|
||||||
|
static void getAgcInformation(GnssMeasurementsNotification& measurements, int msInWeek);
|
||||||
|
|
||||||
/*==== CONVERSION ===================================================================*/
|
/*==== CONVERSION ===================================================================*/
|
||||||
static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);
|
static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);
|
||||||
|
|
Loading…
Reference in a new issue