Filter the configs sent to modem on change basis
Filter setServer, setPositionMode and startTracking commands sent to modem unless change happens and optimize out modem traffic hence. Change-Id: I389af9c11784848045d2d3d5d3c799675a4b24be CRs-Fixed: 2093253
This commit is contained in:
parent
2a9654103b
commit
cd3027e3a6
2 changed files with 31 additions and 16 deletions
|
@ -44,9 +44,7 @@
|
|||
#include <Agps.h>
|
||||
#include <SystemStatus.h>
|
||||
|
||||
#include <loc_nmea.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define RAD2DEG (180.0 / M_PI)
|
||||
|
||||
|
@ -68,7 +66,8 @@ GnssAdapter::GnssAdapter() :
|
|||
mNiData(),
|
||||
mAgpsManager(),
|
||||
mAgpsCbInfo(),
|
||||
mSystemStatus(SystemStatus::getInstance(mMsgTask))
|
||||
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
|
||||
mServerUrl("")
|
||||
{
|
||||
LOC_LOGD("%s]: Constructor %p", __func__, this);
|
||||
mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
|
||||
|
@ -636,8 +635,6 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
|||
delete[] mIds;
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
//const size_t MAX_BITS_COUNT = 10;
|
||||
//LocationError errs[MAX_BITS_COUNT] = {};
|
||||
LocationError* errs = new LocationError[mCount];
|
||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||
uint32_t index = 0;
|
||||
|
@ -669,30 +666,33 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
|||
if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
|
||||
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
|
||||
char serverUrl[MAX_URL_LEN] = {};
|
||||
uint32_t length = 0;
|
||||
int32_t length = 0;
|
||||
const char noHost[] = "NONE";
|
||||
if (NULL == mConfig.assistanceServer.hostName ||
|
||||
strncasecmp(noHost,
|
||||
mConfig.assistanceServer.hostName,
|
||||
sizeof(noHost)) == 0) {
|
||||
err = LOCATION_ERROR_INVALID_PARAMETER;
|
||||
} else {
|
||||
length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u",
|
||||
mConfig.assistanceServer.hostName,
|
||||
mConfig.assistanceServer.port);
|
||||
}
|
||||
|
||||
if (sizeof(serverUrl) > length) {
|
||||
if (length > 0 && strncasecmp(mAdapter.getServerUrl().c_str(),
|
||||
serverUrl, sizeof(serverUrl)) != 0) {
|
||||
mAdapter.setServerUrl(serverUrl);
|
||||
err = mApi.setServer(serverUrl, length);
|
||||
} else {
|
||||
err = LOCATION_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
} else {
|
||||
err = LOCATION_ERROR_SUCCESS;
|
||||
}
|
||||
} else if (GNSS_ASSISTANCE_TYPE_C2K == mConfig.assistanceServer.type) {
|
||||
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
|
||||
struct in_addr addr;
|
||||
if (!mAdapter.resolveInAddress(mConfig.assistanceServer.hostName, &addr)) {
|
||||
if (!mAdapter.resolveInAddress(mConfig.assistanceServer.hostName,
|
||||
&addr)) {
|
||||
LOC_LOGE("%s]: hostName %s cannot be resolved",
|
||||
__func__, mConfig.assistanceServer.hostName);
|
||||
err = LOCATION_ERROR_INVALID_PARAMETER;
|
||||
|
@ -1246,6 +1246,15 @@ GnssAdapter::eraseTrackingSession(LocationAPI* client, uint32_t sessionId)
|
|||
|
||||
}
|
||||
|
||||
bool GnssAdapter::setUlpPositionMode(const LocPosMode& mode) {
|
||||
if (!mUlpPositionMode.equals(mode)) {
|
||||
mUlpPositionMode = mode;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GnssAdapter::reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId)
|
||||
{
|
||||
|
@ -1411,8 +1420,9 @@ 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
|
||||
mAdapter.setUlpPositionMode(mLocPosMode);
|
||||
mApi.setPositionMode(mLocPosMode);
|
||||
if (mAdapter.setUlpPositionMode(mLocPosMode)) {
|
||||
mApi.setPositionMode(mLocPosMode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1435,8 +1445,10 @@ GnssAdapter::startTrackingCommand()
|
|||
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();
|
||||
mApi.startFix(ulpPositionMode);
|
||||
if (!mAdapter.isInSession()) {
|
||||
LocPosMode& ulpPositionMode = mAdapter.getUlpPositionMode();
|
||||
mApi.startFix(ulpPositionMode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ class GnssAdapter : public LocAdapterBase {
|
|||
|
||||
/* === SystemStatus ===================================================================== */
|
||||
SystemStatus* mSystemStatus;
|
||||
std::string mServerUrl;
|
||||
|
||||
/*==== CONVERSION ===================================================================*/
|
||||
static void convertOptions(LocPosMode& out, const LocationOptions& options);
|
||||
|
@ -170,7 +171,7 @@ public:
|
|||
void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
|
||||
const LocationOptions& options);
|
||||
void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
|
||||
void setUlpPositionMode(const LocPosMode& mode) { mUlpPositionMode = mode; }
|
||||
bool setUlpPositionMode(const LocPosMode& mode);
|
||||
LocPosMode& getUlpPositionMode() { return mUlpPositionMode; }
|
||||
LocationError startTrackingMultiplex(const LocationOptions& options);
|
||||
LocationError startTracking(const LocationOptions& options);
|
||||
|
@ -215,7 +216,7 @@ public:
|
|||
void setPowerVoteId(uint32_t id) { mPowerVoteId = id; }
|
||||
uint32_t getPowerVoteId() { return mPowerVoteId; }
|
||||
bool resolveInAddress(const char* hostAddress, struct in_addr* inAddress);
|
||||
|
||||
virtual bool isInSession() { return !mTrackingSessions.empty(); }
|
||||
/* ==== REPORTS ======================================================================== */
|
||||
/* ======== EVENTS ====(Called from QMI/ULP Thread)===================================== */
|
||||
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
|
||||
|
@ -254,6 +255,8 @@ public:
|
|||
|
||||
/*==== SYSTEM STATUS ================================================================*/
|
||||
inline SystemStatus* getSystemStatus(void) { return mSystemStatus; }
|
||||
std::string& getServerUrl(void) { return mServerUrl; }
|
||||
void setServerUrl(const char* server) { mServerUrl.assign(server); }
|
||||
|
||||
/*==== CONVERSION ===================================================================*/
|
||||
static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);
|
||||
|
|
Loading…
Reference in a new issue