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