diff options
author | Dante Russo <drusso@codeaurora.org> | 2019-02-20 11:30:12 -0800 |
---|---|---|
committer | Dante Russo <drusso@codeaurora.org> | 2019-02-26 12:33:25 -0800 |
commit | e22619060be72c2e5729612a2f811c8b252c5eec (patch) | |
tree | 9b5b6c3acf73a52c1df39f88376a0e6938caba43 | |
parent | d31be6470042dd744a408c207d2b5b7fb7839959 (diff) | |
download | gps-e22619060be72c2e5729612a2f811c8b252c5eec.tar.gz |
Remove tracking redundanty and assure min interval
A tracking interval should not be less than 100ms
If tracking interval or power mode is updated to
the same value, then start tracking should not be
sent to the modem again.
Fix some issues with multiplex with powerMode
Change-Id: I91e5d0577569b96179a5337af0fc91641dc126db
CRs-fixed: 2190953
-rw-r--r-- | core/LocAdapterBase.h | 2 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index e4f7be2..a0dd63e 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -34,6 +34,8 @@ #include <LocationAPI.h> #include <map> +#define MIN_TRACKING_INTERVAL (100) // 100 msec + typedef struct LocationSessionKey { LocationAPI* client; uint32_t id; diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 016356b..7b8d07f 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -2303,6 +2303,9 @@ GnssAdapter::startTrackingCommand(LocationAPI* client, TrackingOptions& options) mTrackingOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS); mTrackingOptions.powerMode = GNSS_POWER_MODE_M2; } + if (mTrackingOptions.minInterval < MIN_TRACKING_INTERVAL) { + mTrackingOptions.minInterval = MIN_TRACKING_INTERVAL; + } // Api doesn't support multiple clients for time based tracking, so mutiplex bool reportToClientWithNoWait = mAdapter.startTrackingMultiplex(mClient, mSessionId, mTrackingOptions); @@ -2361,6 +2364,7 @@ GnssAdapter::startTrackingMultiplex(LocationAPI* client, uint32_t sessionId, } if (updateOptions) { // restart time based tracking with the newly updated options + startTracking(client, sessionId, multiplexedOptions); // need to wait for QMI callback reportToClientWithNoWait = false; @@ -2375,6 +2379,10 @@ void GnssAdapter::startTracking(LocationAPI* client, uint32_t sessionId, const TrackingOptions& trackingOptions) { + LOC_LOGd("minInterval %u minDistance %u mode %u powermode %u tbm %u", + trackingOptions.minInterval, trackingOptions.minDistance, + trackingOptions.mode, trackingOptions.powerMode, trackingOptions.tbm); + LocPosMode locPosMode = {}; convertOptions(locPosMode, trackingOptions); @@ -2487,6 +2495,9 @@ GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id, mTrackingOptions.tbm, TRACKING_TBM_THRESHOLD_MILLIS); mTrackingOptions.powerMode = GNSS_POWER_MODE_M2; } + if (mTrackingOptions.minInterval < MIN_TRACKING_INTERVAL) { + mTrackingOptions.minInterval = MIN_TRACKING_INTERVAL; + } // Api doesn't support multiple clients for time based tracking, so mutiplex bool reportToClientWithNoWait = mAdapter.updateTrackingMultiplex(mClient, mSessionId, mTrackingOptions); |