summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Tang <zhikait@codeaurora.org>2018-06-07 12:03:55 -0700
committerKevin Tang <zhikait@codeaurora.org>2018-06-07 12:04:42 -0700
commit8cc52b448c15ab85a2786d08b6294371ccb96119 (patch)
tree640632568f9a8ee670b24477da0da0b0784a70c4
parent53695be16c974925db16de4ae434549345abe42a (diff)
downloadgps-8cc52b448c15ab85a2786d08b6294371ccb96119.tar.gz
changes to work without ULP module
Rework the module with ULP module being removed Change-Id: I5ac81e8c1c734352b3087545b83f4812fa3e8aff CRs-fixed: 2235309
-rw-r--r--core/ContextBase.h5
-rw-r--r--core/EngineHubProxyBase.h3
-rw-r--r--core/LBSProxyBase.h7
-rw-r--r--core/LocAdapterBase.cpp6
-rw-r--r--core/LocAdapterBase.h16
-rw-r--r--core/LocApiBase.cpp1
-rw-r--r--core/Makefile.am1
-rw-r--r--core/UlpProxyBase.h124
-rw-r--r--gnss/GnssAdapter.cpp414
-rw-r--r--gnss/GnssAdapter.h43
-rw-r--r--utils/gps_extended_c.h14
11 files changed, 98 insertions, 536 deletions
diff --git a/core/ContextBase.h b/core/ContextBase.h
index fca381f..478283f 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -128,13 +128,8 @@ public:
inline LocApiBase* getLocApi() { return mLocApi; }
inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
- inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
- inline void requestUlp(LocAdapterBase* adapter,
- unsigned long capabilities) {
- mLBSProxy->requestUlp(adapter, capabilities);
- }
inline IzatDevId_t getIzatDevId() const {
return mLBSProxy->getIzatDevId();
}
diff --git a/core/EngineHubProxyBase.h b/core/EngineHubProxyBase.h
index 4e259ba..3851b2f 100644
--- a/core/EngineHubProxyBase.h
+++ b/core/EngineHubProxyBase.h
@@ -39,7 +39,6 @@ public:
// gnss session related functions
inline virtual bool gnssStartFix() {
- LOC_LOGD("%s]: empty called ", __func__);
return false;
}
@@ -92,12 +91,10 @@ typedef std::function<void(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
- bool fromUlp,
bool fromEngineHub)>
GnssAdapterReportPositionEventCb;
typedef std::function<void(const GnssSvNotification& svNotify,
- bool fromUlp,
bool fromEngineHub)>
GnssAdapterReportSvEventCb;
diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h
index bf786a3..564c60b 100644
--- a/core/LBSProxyBase.h
+++ b/core/LBSProxyBase.h
@@ -50,14 +50,7 @@ protected:
inline LBSProxyBase() {}
public:
inline virtual ~LBSProxyBase() {}
- inline virtual void requestUlp(LocAdapterBase* adapter,
- unsigned long capabilities) const {
-
- (void)adapter;
- (void)capabilities;
- }
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
- inline virtual bool hasCPIExtendedCapabilities() const { return false; }
inline virtual void modemPowerVote(bool power) const {
(void)power;
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index 267d539..744a440 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -79,7 +79,7 @@ void LocAdapterBase::
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
- bool /*fromUlp*/, bool /*fromEngineHub*/) {
+ bool /*fromEngineHub*/) {
if (mLocAdapterProxyBase != NULL) {
mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
(GpsLocationExtended&)locationExtended,
@@ -92,7 +92,7 @@ void LocAdapterBase::
void LocAdapterBase::
reportSvEvent(const GnssSvNotification& /*svNotify*/,
- bool /*fromUlp*/, bool /*fromEngineHub*/)
+ bool /*fromEngineHub*/)
DEFAULT_IMPL()
void LocAdapterBase::
@@ -109,7 +109,7 @@ DEFAULT_IMPL()
void LocAdapterBase::
- reportNmeaEvent(const char* /*nmea*/, size_t /*length*/, bool /*fromUlp*/)
+ reportNmeaEvent(const char* /*nmea*/, size_t /*length*/)
DEFAULT_IMPL()
bool LocAdapterBase::
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index 2083ac4..e31a5d2 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -30,7 +30,6 @@
#define LOC_API_ADAPTER_BASE_H
#include <gps_extended.h>
-#include <UlpProxyBase.h>
#include <ContextBase.h>
#include <LocationAPI.h>
#include <map>
@@ -112,31 +111,20 @@ public:
}
uint32_t generateSessionId();
-
- // This will be overridden by the individual adapters
- // if necessary.
- inline virtual void setUlpProxyCommand(UlpProxyBase* ulp) {
-
- (void)ulp;
- }
virtual void handleEngineUpEvent();
virtual void handleEngineDownEvent();
inline virtual void setPositionModeCommand(LocPosMode& posMode) {
(void)posMode;
}
- virtual void startTrackingCommand() {}
- virtual void stopTrackingCommand() {}
- virtual void getZppCommand() {}
virtual void reportPositionEvent(const UlpLocation& location,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask,
- bool fromUlp=false,
bool fromEngineHub=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify,
- bool fromUlp=false, bool fromEngineHub=false);
- virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
+ bool fromEngineHub=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length);
virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
virtual void reportStatus(LocGpsStatusValue status);
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index c1e0802..b7e3aeb 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -134,7 +134,6 @@ struct LocCloseMsg : public LocMsg {
mLocApi->close();
}
inline void locallog() const {
- LOC_LOGV("%s]: LocCloseMsg");
}
inline virtual void log() const {
locallog();
diff --git a/core/Makefile.am b/core/Makefile.am
index cf8d9ff..53059e4 100644
--- a/core/Makefile.am
+++ b/core/Makefile.am
@@ -17,7 +17,6 @@ libloc_core_la_h_sources = \
ContextBase.h \
LocDualContext.h \
LBSProxyBase.h \
- UlpProxyBase.h \
loc_core_log.h \
LocAdapterProxyBase.h \
EngineHubProxyBase.h \
diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h
deleted file mode 100644
index 8863b66..0000000
--- a/core/UlpProxyBase.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation, nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#ifndef ULP_PROXY_BASE_H
-#define ULP_PROXY_BASE_H
-
-#include <gps_extended.h>
-#include <LocationAPI.h>
-
-namespace loc_core {
-
-class LocAdapterBase;
-
-class UlpProxyBase {
-public:
- LocPosMode mPosMode;
- bool mFixSet;
- inline UlpProxyBase() {
- mPosMode.mode = LOC_POSITION_MODE_INVALID;
- mFixSet = false;
- }
- inline virtual ~UlpProxyBase() {}
- inline virtual bool sendStartFix() { mFixSet = true; return false; }
- inline virtual bool sendStopFix() { mFixSet = false; return false; }
- inline virtual bool sendFixMode(LocPosMode &params) {
- mPosMode = params;
- return false;
- }
-
- inline virtual bool reportPosition(const UlpLocation &location,
- const GpsLocationExtended &locationExtended,
- enum loc_sess_status status,
- LocPosTechMask loc_technology_mask) {
- (void)location;
- (void)locationExtended;
- (void)status;
- (void)loc_technology_mask;
- return false;
- }
- inline virtual bool reportSv(const GnssSvNotification& svNotify) {
- (void)svNotify;
- return false;
- }
- inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
- (void)svMeasurementSet;
- return false;
- }
-
- inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
- {
- (void)svPolynomial;
- return false;
- }
- inline virtual bool reportStatus(LocGpsStatusValue status) {
-
- (void)status;
- return false;
- }
- inline virtual void setAdapter(LocAdapterBase* adapter) {
-
- (void)adapter;
- }
- inline virtual void setCapabilities(unsigned long capabilities) {
-
- (void)capabilities;
- }
- inline virtual bool reportBatchingSession(const LocationOptions& options, bool active)
- {
- (void)options;
- (void)active;
- return false;
- }
- inline virtual bool reportPositions(const UlpLocation* ulpLocations,
- const GpsLocationExtended* extendedLocations,
- const uint32_t* techMasks,
- const size_t count)
- {
- (void)ulpLocations;
- (void)extendedLocations;
- (void)techMasks;
- (void)count;
- return false;
- }
- inline virtual bool reportDeleteAidingData(LocGpsAidingData aidingData)
- {
- (void)aidingData;
- return false;
- }
- inline virtual bool reportNmea(const char* nmea, int length)
- {
- (void)nmea;
- (void)length;
- return false;
- }
-};
-
-} // namespace loc_core
-
-#endif // ULP_PROXY_BASE_H
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 9a722be..b566681 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -66,9 +66,8 @@ GnssAdapter::GnssAdapter() :
NULL,
LocDualContext::mLocationHalName,
false)),
- mUlpProxy(new UlpProxyBase()),
mEngHubProxy(new EngineHubProxyBase()),
- mUlpPositionMode(),
+ mLocPositionMode(),
mGnssSvIdUsedInPosition(),
mGnssSvIdUsedInPosAvail(false),
mControlCallbacks(),
@@ -88,7 +87,7 @@ GnssAdapter::GnssAdapter() :
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask)
{
LOC_LOGD("%s]: Constructor %p", __func__, this);
- mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
+ mLocPositionMode.mode = LOC_POSITION_MODE_INVALID;
pthread_condattr_t condAttr;
pthread_condattr_init(&condAttr);
@@ -153,7 +152,6 @@ GnssAdapter::GnssAdapter() :
dsClientCloseDataCallFn, dsClientReleaseFn, sendMsgFn);
readConfigCommand();
- requestUlpCommand();
initDefaultAgpsCommand();
initEngHubProxyCommand();
}
@@ -578,7 +576,6 @@ GnssAdapter::readConfigCommand()
inline virtual void proc() const {
// reads config into mContext->mGps_conf
mContext.readConfig();
- mContext.requestUlp((LocAdapterBase*)mAdapter, mContext.getCarrierCapabilities());
}
};
@@ -588,29 +585,6 @@ GnssAdapter::readConfigCommand()
}
void
-GnssAdapter::requestUlpCommand()
-{
- LOC_LOGD("%s]: ", __func__);
-
- struct MsgRequestUlp : public LocMsg {
- GnssAdapter* mAdapter;
- ContextBase& mContext;
- inline MsgRequestUlp(GnssAdapter* adapter,
- ContextBase& context) :
- LocMsg(),
- mAdapter(adapter),
- mContext(context) {}
- inline virtual void proc() const {
- mContext.requestUlp((LocAdapterBase*)mAdapter, mContext.getCarrierCapabilities());
- }
- };
-
- if (mContext != NULL) {
- sendMsg(new MsgRequestUlp(this, *mContext));
- }
-}
-
-void
GnssAdapter::setSuplHostServer(const char* server, int port)
{
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
@@ -910,8 +884,6 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
uint32_t newSuplMode = mAdapter.convertSuplMode(gnssConfigRequested.suplModeMask);
if (newSuplMode != ContextBase::mGps_conf.SUPL_MODE) {
ContextBase::mGps_conf.SUPL_MODE = newSuplMode;
- mAdapter.getUlpProxy()->setCapabilities(
- ContextBase::getCarrierCapabilities());
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
}
}
@@ -1674,9 +1646,7 @@ GnssAdapter::injectLocationCommand(double latitude, double longitude, float accu
mLongitude(longitude),
mAccuracy(accuracy) {}
inline virtual void proc() const {
- if (!mContext.hasCPIExtendedCapabilities()) {
- mApi.injectPosition(mLatitude, mLongitude, mAccuracy);
- }
+ mApi.injectPosition(mLatitude, mLongitude, mAccuracy);
}
};
@@ -1715,58 +1685,6 @@ GnssAdapter::injectTimeCommand(int64_t time, int64_t timeReference, int32_t unce
}
void
-GnssAdapter::setUlpProxyCommand(UlpProxyBase* ulp)
-{
- LOC_LOGD("%s]: ", __func__);
-
- struct MsgSetUlpProxy : public LocMsg {
- GnssAdapter& mAdapter;
- UlpProxyBase* mUlp;
- inline MsgSetUlpProxy(GnssAdapter& adapter,
- UlpProxyBase* ulp) :
- LocMsg(),
- mAdapter(adapter),
- mUlp(ulp) {}
- inline virtual void proc() const {
- mAdapter.setUlpProxy(mUlp);
- if (mUlp) {
- mUlp->setCapabilities(ContextBase::getCarrierCapabilities());
- }
- }
- };
-
- sendMsg(new MsgSetUlpProxy(*this, ulp));
-}
-
-void
-GnssAdapter::setUlpProxy(UlpProxyBase* ulp)
-{
- if (ulp == mUlpProxy) {
- //This takes care of the case when double initalization happens
- //and we get the same object back for UlpProxyBase . Do nothing
- return;
- }
-
- LOC_LOGV("%s]: %p", __func__, ulp);
- if (NULL == ulp) {
- LOC_LOGE("%s]: ulp pointer is NULL", __func__);
- ulp = new UlpProxyBase();
- }
-
- if (LOC_POSITION_MODE_INVALID != mUlpProxy->mPosMode.mode) {
- // need to send this mode and start msg to ULP
- ulp->sendFixMode(mUlpProxy->mPosMode);
- }
-
- if (mUlpProxy->mFixSet) {
- ulp->sendStartFix();
- }
-
- delete mUlpProxy;
- mUlpProxy = ulp;
-}
-
-void
GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks)
{
LOC_LOGD("%s]: client %p", __func__, client);
@@ -1930,9 +1848,7 @@ GnssAdapter::restartSessions()
LocPosMode locPosMode = {};
highestPowerTrackingOptions.setLocationOptions(smallestIntervalOptions);
convertOptions(locPosMode, highestPowerTrackingOptions);
- mLocApi->startFix(locPosMode, new LocApiResponse(*getContext(),
- [] (LocationError err) {}
- ));
+ mLocApi->startFix(locPosMode, nullptr);
}
void
@@ -2076,9 +1992,9 @@ GnssAdapter::eraseTrackingSession(LocationAPI* client, uint32_t sessionId)
}
}
-bool GnssAdapter::setUlpPositionMode(const LocPosMode& mode) {
- if (!mUlpPositionMode.equals(mode)) {
- mUlpPositionMode = mode;
+bool GnssAdapter::setLocPositionMode(const LocPosMode& mode) {
+ if (!mLocPositionMode.equals(mode)) {
+ mLocPositionMode = mode;
return true;
} else {
return false;
@@ -2205,7 +2121,9 @@ GnssAdapter::startTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
bool reportToClientWithNoWait = true;
if (mTrackingSessions.empty()) {
- reportToClientWithNoWait = startTracking(client, sessionId, options);
+ startTracking(client, sessionId, options);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
} else {
// find the smallest interval and powerMode
TrackingOptions multiplexedOptions = {}; // size is 0 until set for the first time
@@ -2236,79 +2154,61 @@ GnssAdapter::startTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
}
if (updateOptions) {
// restart time based tracking with the newly updated options
- reportToClientWithNoWait = startTracking(client, sessionId, multiplexedOptions);
+ startTracking(client, sessionId, multiplexedOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
}
+ // else part: no QMI call is made, need to report back to client right away
}
return reportToClientWithNoWait;
}
-bool
+void
GnssAdapter::startTracking(LocationAPI* client, uint32_t sessionId,
const TrackingOptions& trackingOptions)
{
- bool reportToClientWithNoWait = true;
-
LocPosMode locPosMode = {};
convertOptions(locPosMode, trackingOptions);
- if (!mUlpProxy->sendFixMode(locPosMode)) {
- // do nothing
- }
- if (!mUlpProxy->sendStartFix()) {
- // inform engine hub that GNSS session is about to start
- mEngHubProxy->gnssSetFixMode(locPosMode);
- mEngHubProxy->gnssStartFix();
-
- mLocApi->startFix(locPosMode, new LocApiResponse(*getContext(),
- [this, client, sessionId] (LocationError err) {
- if (LOCATION_ERROR_SUCCESS != err) {
- eraseTrackingSession(client, sessionId);
- }
- reportResponse(client, err, sessionId);
- }
- ));
+ // inform engine hub that GNSS session is about to start
+ mEngHubProxy->gnssSetFixMode(locPosMode);
+ mEngHubProxy->gnssStartFix();
- reportToClientWithNoWait = false;
- }
+ mLocApi->startFix(locPosMode, new LocApiResponse(*getContext(),
+ [this, client, sessionId] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ eraseTrackingSession(client, sessionId);
+ }
- return reportToClientWithNoWait;
+ reportResponse(client, err, sessionId);
+ }
+ ));
}
-bool
+void
GnssAdapter::updateTracking(LocationAPI* client, uint32_t sessionId,
const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions)
{
- bool reportToClientWithNoWait = true;
-
LocPosMode locPosMode = {};
convertOptions(locPosMode, updatedOptions);
- if (!mUlpProxy->sendFixMode(locPosMode)) {
- // do nothing
- }
- if (!mUlpProxy->sendStartFix()) {
- // inform engine hub that GNSS session is about to start
- mEngHubProxy->gnssSetFixMode(locPosMode);
- mEngHubProxy->gnssStartFix();
-
- mLocApi->startFix(locPosMode, new LocApiResponse(*getContext(),
- [this, client, sessionId, oldOptions] (LocationError err) {
- if (LOCATION_ERROR_SUCCESS != err) {
- // restore the old LocationOptions
- saveTrackingSession(client, sessionId, oldOptions);
- }
- reportResponse(client, err, sessionId);
- }
- ));
+ // inform engine hub that GNSS session is about to start
+ mEngHubProxy->gnssSetFixMode(locPosMode);
+ mEngHubProxy->gnssStartFix();
- reportToClientWithNoWait = false;
- }
+ mLocApi->startFix(locPosMode, new LocApiResponse(*getContext(),
+ [this, client, sessionId, oldOptions] (LocationError err) {
+ if (LOCATION_ERROR_SUCCESS != err) {
+ // restore the old LocationOptions
+ saveTrackingSession(client, sessionId, oldOptions);
+ }
- return reportToClientWithNoWait;
+ reportResponse(client, err, sessionId);
+ }
+ ));
}
-
void
GnssAdapter::setPositionModeCommand(LocPosMode& locPosMode)
{
@@ -2328,7 +2228,7 @@ GnssAdapter::setPositionModeCommand(LocPosMode& locPosMode)
mLocPosMode(locPosMode) {}
inline virtual void proc() const {
// saves the mode in adapter to be used when startTrackingCommand is called from ULP
- if (mAdapter.setUlpPositionMode(mLocPosMode)) {
+ if (mAdapter.setLocPositionMode(mLocPosMode)) {
mAdapter.mEngHubProxy->gnssSetFixMode(mLocPosMode);
mApi.setPositionMode(mLocPosMode);
}
@@ -2339,42 +2239,6 @@ GnssAdapter::setPositionModeCommand(LocPosMode& locPosMode)
}
void
-GnssAdapter::startTrackingCommand()
-{
- LOC_LOGD("%s]: ", __func__);
-
- struct MsgStartTracking : public LocMsg {
- GnssAdapter& mAdapter;
- LocApiBase& mApi;
- inline MsgStartTracking(GnssAdapter& adapter,
- LocApiBase& api) :
- LocMsg(),
- mAdapter(adapter),
- mApi(api) {}
- inline virtual void proc() const {
- // we get this call from ULP, so just call LocApi without multiplexing because
- // ulp would be doing the multiplexing for us if it is present
- LocPosMode& ulpPositionMode = mAdapter.getUlpPositionMode();
-
- // TBD: once CR 2165853 is fixed, move below codes
- // to inside condition of if (!mAdapter.isInSession())
- //
- // inform engine hub of the fix mode and start session
- mAdapter.mEngHubProxy->gnssSetFixMode(ulpPositionMode);
- mAdapter.mEngHubProxy->gnssStartFix();
- if (!mAdapter.isInSession()) {
- LocPosMode& ulpPositionMode = mAdapter.getUlpPositionMode();
- mApi.startFix(ulpPositionMode, new LocApiResponse(*mAdapter.getContext(),
- [] (LocationError err) {}
- ));
- }
- }
- };
-
- sendMsg(new MsgStartTracking(*this, *mLocApi));
-}
-
-void
GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id,
TrackingOptions& options)
{
@@ -2467,6 +2331,7 @@ GnssAdapter::updateTrackingMultiplex(LocationAPI* client, uint32_t id,
it2->second.powerMode < multiplexedPowerMode)) {
multiplexedPowerMode = it2->second.powerMode;
}
+ // else part: no QMI call is made, need to report back to client right away
}
bool updateOptions = false;
// if session we are updating has smaller interval then next smallest
@@ -2486,8 +2351,9 @@ GnssAdapter::updateTrackingMultiplex(LocationAPI* client, uint32_t id,
}
if (updateOptions) {
// restart time based tracking with the newly updated options
- reportToClientWithNoWait = updateTracking(
- client, id, multiplexedOptions, oldOptions);
+ updateTracking(client, id, multiplexedOptions, oldOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
}
}
@@ -2539,7 +2405,9 @@ GnssAdapter::stopTrackingMultiplex(LocationAPI* client, uint32_t id)
bool reportToClientWithNoWait = true;
if (1 == mTrackingSessions.size()) {
- reportToClientWithNoWait = stopTracking(client, id);
+ stopTracking(client, id);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
} else {
LocationSessionKey key(client, id);
@@ -2569,86 +2437,27 @@ GnssAdapter::stopTrackingMultiplex(LocationAPI* client, uint32_t id)
it->second.powerMode < multiplexedPowerMode) {
multiplexedOptions.powerMode = multiplexedPowerMode;
// restart time based tracking with the newly updated options
- reportToClientWithNoWait = startTracking(client, id, multiplexedOptions);
+ startTracking(client, id, multiplexedOptions);
+ // need to wait for QMI callback
+ reportToClientWithNoWait = false;
}
+ // else part: no QMI call is made, need to report back to client right away
}
}
return reportToClientWithNoWait;
}
-bool
-GnssAdapter::stopTracking(LocationAPI* client, uint32_t id)
-{
- bool reportToClientWithNoWait = true;
-
- if (!mUlpProxy->sendStopFix()) {
- // inform engine hub that GNSS session has stopped
- mEngHubProxy->gnssStopFix();
-
- mLocApi->stopFix(new LocApiResponse(*getContext(),
- [this, client, id] (LocationError err) {
- reportResponse(client, err, id);
- }));
-
- reportToClientWithNoWait = false;
- }
-
- return reportToClientWithNoWait;
-}
-
void
-GnssAdapter::stopTrackingCommand()
-{
- LOC_LOGD("%s]: ", __func__);
-
- struct MsgStopTracking : public LocMsg {
- GnssAdapter& mAdapter;
- LocApiBase& mApi;
- inline MsgStopTracking(GnssAdapter& adapter,
- LocApiBase& api) :
- LocMsg(),
- mAdapter(adapter),
- mApi(api) {}
- inline virtual void proc() const {
- // inform engine hub that GNSS session has stopped
- mAdapter.mEngHubProxy->gnssStopFix();
-
- // clear the position mode
- LocPosMode mLocPosMode = {};
- mLocPosMode.mode = LOC_POSITION_MODE_INVALID;
- mAdapter.setUlpPositionMode(mLocPosMode);
- // don't need to multiplex because ULP will do that for us if it is present
- mApi.stopFix(new LocApiResponse(*mAdapter.getContext(),
- [] (LocationError /* err*/) {}
- ));
- }
- };
-
- sendMsg(new MsgStopTracking(*this, *mLocApi));
-}
-
-void
-GnssAdapter::getZppCommand()
+GnssAdapter::stopTracking(LocationAPI* client, uint32_t id)
{
- LOC_LOGD("%s]: ", __func__);
-
- struct MsgGetZpp : public LocMsg {
- GnssAdapter& mAdapter;
- LocApiBase& mApi;
- inline MsgGetZpp(GnssAdapter& adapter,
- LocApiBase& api) :
- LocMsg(),
- mAdapter(adapter),
- mApi(api) {}
- inline virtual void proc() const {
- mApi.getBestAvailableZppFix();
- }
- };
+ // inform engine hub that GNSS session has stopped
+ mEngHubProxy->gnssStopFix();
- // TODO: we could avoid this extra context switch, as getBestAvailableZppFix
- // will return asynchronously anyways.
- sendMsg(new MsgGetZpp(*this, *mLocApi));
+ mLocApi->stopFix(new LocApiResponse(*getContext(),
+ [this, client, id] (LocationError err) {
+ reportResponse(client, err, id);
+ }));
}
bool
@@ -2747,7 +2556,6 @@ GnssAdapter::gnssNiResponseCommand(GnssNiResponse response, void* rawRequest)
inline virtual ~MsgGnssNiResponse() {
}
inline virtual void proc() const {
- const void *rawPayload = mPayload;
mApi.informNiResponse(mResponse, mPayload);
}
};
@@ -2861,14 +2669,12 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
- bool fromUlp,
bool fromEngineHub)
{
- LOC_LOGD("%s]: fromUlp %u status %u", __func__, fromUlp, status);
-
- // if this event is called from QMI LOC API, then try to call into ULP and return if successfull
- // if the position is called from ULP or engine hub, then send it out directly
- if (!fromUlp && !fromEngineHub) {
+ // if this event is called from QMI LOC API, then send report to engine hub
+ // if sending is successful, we return as we will wait for final report from engine hub
+ // if the position is called from engine hub, then send it out directly
+ if (!fromEngineHub) {
// report QMI position (both propagated and unpropagated) to engine hub,
// and engine hub will be distributing it to the registered plugins
mEngHubProxy->gnssReportPosition(ulpLocation, locationExtended, status);
@@ -2877,27 +2683,18 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
return;
}
- // only send propagated position report to ulp
- if (mUlpProxy->reportPosition(ulpLocation, locationExtended,
- status, techMask)) {
- return;
- }
-
// engine hub is loaded, do not report qmi position to client as
// final position report should come from engine hub
if (true == initEngHubProxy()){
return;
}
- } else if ((true == fromUlp) && (true == initEngHubProxy())) {
- LOC_LOGV("%s]: drop ULP GNSS fix as engine hub is loaded", __func__);
- return;
}
// for all other cases:
- // case 1: fix is from ULP and engine hub is not loaded, queue the msg
- // case 2: fix is from engine hub, queue the msg
+ // case 1: fix is from engine hub, queue the msg
+ // case 2: fix is not from engine hub, e.g. from QMI, and it is not an
+ // unpropagated position and engine hub is not loaded, queue the msg
// when message is queued, the position can be dispatched to requesting client
-
struct MsgReportPosition : public LocMsg {
GnssAdapter& mAdapter;
const UlpLocation mUlpLocation;
@@ -2999,28 +2796,13 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
void
GnssAdapter::reportSvEvent(const GnssSvNotification& svNotify,
- bool fromUlp,
bool fromEngineHub)
{
- LOC_LOGD("%s]: fromUlp %u", __func__, fromUlp);
-
- // if this event is not called from ULP, then try to call into ULP and return if successfull
- if (!fromUlp && !fromEngineHub) {
- // report QMI SV report to eng hub
+ if (!fromEngineHub) {
mEngHubProxy->gnssReportSv(svNotify);
-
- if (mUlpProxy->reportSv(svNotify)) {
- return;
- }
-
- // engine hub is loaded, do not report sv to client
- // as sv report should come from engine hub
if (true == initEngHubProxy()){
return;
}
- } else if ((true == fromUlp) && (true == initEngHubProxy())) {
- LOC_LOGV("%s]: drop ULP GNSS SV event as engine hub is loaded", __func__);
- return;
}
struct MsgReportSv : public LocMsg {
@@ -3108,14 +2890,10 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
}
void
-GnssAdapter::reportNmeaEvent(const char* nmea, size_t length, bool fromUlp)
+GnssAdapter::reportNmeaEvent(const char* nmea, size_t length)
{
- // if this event is not called from ULP, then try to call into ULP and return if successfull
- if (!fromUlp && !loc_nmea_is_debug(nmea, length)) {
+ if (!loc_nmea_is_debug(nmea, length)) {
mEngHubProxy->gnssReportNmea(nmea);
- if (mUlpProxy->reportNmea(nmea, length)) {
- return;
- }
}
struct MsgReportNmea : public LocMsg {
@@ -3380,9 +3158,6 @@ void
GnssAdapter::reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet)
{
LOC_LOGD("%s]: ", __func__);
-
- // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
- mUlpProxy->reportSvMeasurement(svMeasurementSet);
mEngHubProxy->gnssReportSvMeasurement(svMeasurementSet);
}
@@ -3390,10 +3165,6 @@ void
GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
{
LOC_LOGD("%s]: ", __func__);
-
- // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
- mUlpProxy->reportSvPolynomial(svPolynomial);
-
mEngHubProxy->gnssReportSvPolynomial(svPolynomial);
}
@@ -3705,41 +3476,6 @@ bool GnssAdapter::reportDataCallClosed(){
return true;
}
-bool GnssAdapter::reportZppBestAvailableFix(LocGpsLocation &zppLoc,
- GpsLocationExtended &location_extended, LocPosTechMask tech_mask) {
-
- struct MsgReportZpp : public LocMsg {
- GnssAdapter& mAdapter;
- UlpLocation mUlpLocation;
- GpsLocationExtended mGpsLocationExtended;
- LocPosTechMask mPosTechMask;
-
- inline MsgReportZpp(GnssAdapter& adapter,
- LocGpsLocation &zppLoc, GpsLocationExtended &location_extended,
- LocPosTechMask tech_mask) :
- LocMsg(),
- mAdapter(adapter),
- mGpsLocationExtended(location_extended),
- mPosTechMask(tech_mask) {
- mUlpLocation = {};
- memcpy(&mUlpLocation.gpsLocation, &zppLoc, sizeof(LocGpsLocation));
-
- //Mark the location source as from ZPP
- mUlpLocation.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
- mUlpLocation.position_source = ULP_LOCATION_IS_FROM_ZPP;
- }
- inline virtual void proc() const {
- mAdapter.getUlpProxy()->reportPosition(mUlpLocation,
- mGpsLocationExtended,
- LOC_SESS_SUCCESS,
- mPosTechMask);
- }
- };
-
- sendMsg(new MsgReportZpp(*this, zppLoc, location_extended, tech_mask));
- return true;
-}
-
void GnssAdapter::dataConnOpenCommand(
AGpsExtType agpsType,
const char* apnName, int apnLen, AGpsBearerType bearerType){
@@ -4230,17 +3966,16 @@ GnssAdapter::initEngHubProxy() {
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
- bool fromUlp,
bool fromEngineHub) {
// report from engine hub on behalf of PPE will be treated as fromUlp
reportPositionEvent(ulpLocation, locationExtended, status,
- techMask, fromUlp, fromEngineHub);
+ techMask, fromEngineHub);
};
// callback function for engine hub to report back sv event
GnssAdapterReportSvEventCb reportSvEventCb =
- [this](const GnssSvNotification& svNotify, bool fromUlp, bool fromEngineHub) {
- reportSvEvent(svNotify, fromUlp, fromEngineHub);
+ [this](const GnssSvNotification& svNotify, bool fromEngineHub) {
+ reportSvEvent(svNotify, fromEngineHub);
};
getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");
@@ -4256,6 +3991,10 @@ GnssAdapter::initEngHubProxy() {
else {
LOC_LOGD("%s]: entered, did not find function", __func__);
}
+
+ LOC_LOGD("%s]: first time initialization %d, returned %d",
+ __func__, firstTime, engHubLoadSuccessful);
+
} while (0);
if (processInfoList != nullptr) {
@@ -4263,9 +4002,6 @@ GnssAdapter::initEngHubProxy() {
processInfoList = nullptr;
}
- LOC_LOGD("%s]: first time initialization %d, returned %d",
- __func__, firstTime, engHubLoadSuccessful);
-
firstTime = false;
return engHubLoadSuccessful;
}
diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h
index 277cc2a..cf556d7 100644
--- a/gnss/GnssAdapter.h
+++ b/gnss/GnssAdapter.h
@@ -31,7 +31,6 @@
#include <LocAdapterBase.h>
#include <LocDualContext.h>
-#include <UlpProxyBase.h>
#include <IOsObserver.h>
#include <EngineHubProxyBase.h>
#include <LocationAPI.h>
@@ -84,8 +83,6 @@ namespace loc_core {
}
class GnssAdapter : public LocAdapterBase {
- /* ==== ULP ============================================================================ */
- UlpProxyBase* mUlpProxy;
/* ==== Engine Hub ===================================================================== */
EngineHubProxyBase* mEngHubProxy;
@@ -96,7 +93,7 @@ class GnssAdapter : public LocAdapterBase {
/* ==== TRACKING ======================================================================= */
TrackingOptionsMap mTrackingSessions;
- LocPosMode mUlpPositionMode;
+ LocPosMode mLocPositionMode;
GnssSvUsedInPosition mGnssSvIdUsedInPosition;
bool mGnssSvIdUsedInPosAvail;
@@ -142,7 +139,7 @@ class GnssAdapter : public LocAdapterBase {
public:
GnssAdapter();
- virtual inline ~GnssAdapter() { delete mUlpProxy; }
+ virtual inline ~GnssAdapter() { }
/* ==== SSR ============================================================================ */
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
@@ -150,13 +147,6 @@ public:
/* ======== UTILITIES ================================================================== */
void restartSessions();
- /* ==== ULP ============================================================================ */
- /* ======== COMMANDS ====(Called from ULP Thread)==================================== */
- virtual void setUlpProxyCommand(UlpProxyBase* ulp);
- /* ======== UTILITIES ================================================================== */
- void setUlpProxy(UlpProxyBase* ulp);
- inline UlpProxyBase* getUlpProxy() { return mUlpProxy; }
-
/* ==== CLIENT ========================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks);
@@ -179,11 +169,7 @@ public:
void updateTrackingOptionsCommand(
LocationAPI* client, uint32_t id, TrackingOptions& trackingOptions);
void stopTrackingCommand(LocationAPI* client, uint32_t id);
- /* ======================(Called from ULP Thread)======================================= */
virtual void setPositionModeCommand(LocPosMode& locPosMode);
- virtual void startTrackingCommand();
- virtual void stopTrackingCommand();
- virtual void getZppCommand();
/* ======== RESPONSES ================================================================== */
void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
/* ======== UTILITIES ================================================================== */
@@ -193,17 +179,19 @@ public:
void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
const TrackingOptions& trackingOptions);
void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
- bool setUlpPositionMode(const LocPosMode& mode);
- LocPosMode& getUlpPositionMode() { return mUlpPositionMode; }
+
+ bool setLocPositionMode(const LocPosMode& mode);
+ LocPosMode& getLocPositionMode() { return mLocPositionMode; }
+
bool startTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
- const TrackingOptions& trackingOptions);
- bool startTracking(LocationAPI* client, uint32_t sessionId,
const TrackingOptions& trackingOptions);
+ void startTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions);
bool stopTrackingMultiplex(LocationAPI* client, uint32_t id);
- bool stopTracking(LocationAPI* client, uint32_t id);
+ void stopTracking(LocationAPI* client, uint32_t id);
bool updateTrackingMultiplex(LocationAPI* client, uint32_t id,
- const TrackingOptions& trackingOptions);
- bool updateTracking(LocationAPI* client, uint32_t sessionId,
+ const TrackingOptions& trackingOptions);
+ void updateTracking(LocationAPI* client, uint32_t sessionId,
const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions);
/* ==== NI ============================================================================= */
@@ -222,7 +210,6 @@ public:
void setControlCallbacksCommand(LocationControlCallbacks& controlCallbacks);
void readConfigCommand();
void setConfigCommand();
- void requestUlpCommand();
void initEngHubProxyCommand();
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
uint32_t* gnssGetConfigCommand(GnssConfigFlagsMask mask);
@@ -279,17 +266,15 @@ public:
bool initEngHubProxy();
/* ==== REPORTS ======================================================================== */
- /* ======== EVENTS ====(Called from QMI/ULP Thread)===================================== */
+ /* ======== EVENTS ====(Called from QMI/EngineHub Thread)===================================== */
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
const GpsLocationExtended& locationExtended,
enum loc_sess_status status,
LocPosTechMask techMask,
- bool fromUlp=false,
bool fromEngineHub=false);
virtual void reportSvEvent(const GnssSvNotification& svNotify,
- bool fromUlp=false,
bool fromEngineHub=false);
- virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length);
virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data);
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
int msInWeek);
@@ -303,8 +288,6 @@ public:
virtual bool requestSuplES(int connHandle, LocApnTypeMask mask);
virtual bool reportDataCallOpened();
virtual bool reportDataCallClosed();
- virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
- GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
/* ======== UTILITIES ================================================================= */
diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h
index c0b97af..ed4a1b8 100644
--- a/utils/gps_extended_c.h
+++ b/utils/gps_extended_c.h
@@ -65,20 +65,16 @@ extern "C" {
#define ULP_LOCATION_IS_FROM_HYBRID 0x0001
/** Position source is GNSS only */
#define ULP_LOCATION_IS_FROM_GNSS 0x0002
-/** Position source is ZPP only */
-#define ULP_LOCATION_IS_FROM_ZPP 0x0004
/** Position is from a Geofence Breach Event */
-#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0004
/** Position is from Hardware FLP */
-#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0008
/** Position is from NLP */
-#define ULP_LOCATION_IS_FROM_NLP 0x0020
-/** Position is from PIP */
-#define ULP_LOCATION_IS_FROM_PIP 0x0040
+#define ULP_LOCATION_IS_FROM_NLP 0x0010
/** Position is from external DR solution*/
-#define ULP_LOCATION_IS_FROM_EXT_DR 0X0080
+#define ULP_LOCATION_IS_FROM_EXT_DR 0X0020
/** Raw GNSS position fixes */
-#define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0100
+#define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0040
typedef uint32_t LocSvInfoSource;
/** SVinfo source is GNSS/DR */