diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2022-11-08 01:02:30 -0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2022-11-08 01:02:30 -0800 |
commit | 28fb84e8d1cb41e22e7f6210ea04190914db103f (patch) | |
tree | 5b738415dd104ede73fc0302be693557ad2cc3d5 | |
parent | c259797d7567e8fb71d46fb69a0fa941cdd4b72c (diff) | |
parent | ee0fa20a1d35466b22264116eaeb957495ce6667 (diff) |
Merge ee0fa20a1d35466b22264116eaeb957495ce6667 on remote branchHEADumineko-8350tachibana-8350
Change-Id: Ie3e99d857848862a71a6b35e4293b905b7fd9fd4
-rw-r--r-- | batching/BatchingAdapter.cpp | 105 | ||||
-rw-r--r-- | batching/BatchingAdapter.h | 42 | ||||
-rw-r--r-- | core/LocAdapterBase.cpp | 41 | ||||
-rw-r--r-- | core/LocAdapterBase.h | 40 | ||||
-rw-r--r-- | core/LocApiBase.cpp | 8 | ||||
-rw-r--r-- | core/LocApiBase.h | 10 | ||||
-rw-r--r-- | geofence/GeofenceAdapter.cpp | 105 | ||||
-rw-r--r-- | geofence/GeofenceAdapter.h | 40 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 78 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 39 | ||||
-rw-r--r-- | location/LocationDataTypes.h | 1 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 7 |
12 files changed, 45 insertions, 471 deletions
diff --git a/batching/BatchingAdapter.cpp b/batching/BatchingAdapter.cpp index 4fdacda..4f1a43c 100644 --- a/batching/BatchingAdapter.cpp +++ b/batching/BatchingAdapter.cpp @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. -*/ - #define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_BatchingAdapter" @@ -200,41 +163,6 @@ BatchingAdapter::updateClientsEventMask() } void -BatchingAdapter::handleEngineLockStatusEvent(EngineLockState engineLockState) { - - LOC_LOGD("%s]: Old Engine state %d, New Engine state : %d,", __func__, - mLocApi->getEngineLockState(), engineLockState); - - struct MsgEngineLockStateEvent : public LocMsg { - BatchingAdapter& mAdapter; - EngineLockState mEngineLockState; - - inline MsgEngineLockStateEvent(BatchingAdapter& adapter, EngineLockState engineLockState) : - LocMsg(), - mAdapter(adapter), - mEngineLockState(engineLockState){} - - virtual void proc() const { - mAdapter.handleEngineLockStatus(mEngineLockState); - } - }; - - sendMsg(new MsgEngineLockStateEvent(*this, engineLockState)); -} - -void -BatchingAdapter::handleEngineLockStatus(EngineLockState engineLockState) { - - LOC_LOGd("lock state %d, pending msgs %zu", engineLockState, mPendingGnssEnabledMsgs.size()); - if (ENGINE_LOCK_STATE_ENABLED == engineLockState) { - for (auto msg: mPendingGnssEnabledMsgs) { - sendMsg(msg); - } - mPendingGnssEnabledMsgs.clear(); - } -} - -void BatchingAdapter::handleEngineUpEvent() { struct MsgSSREvent : public LocMsg { @@ -250,13 +178,11 @@ BatchingAdapter::handleEngineUpEvent() mAdapter.broadcastCapabilities(mAdapter.getCapabilities()); mApi.setBatchSize(mAdapter.getBatchSize()); mApi.setTripBatchSize(mAdapter.getTripBatchSize()); - if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) { - mAdapter.restartSessions(); - for (auto msg: mAdapter.mPendingMsgs) { - mAdapter.sendMsg(msg); - } - mAdapter.mPendingMsgs.clear(); + mAdapter.restartSessions(); + for (auto msg: mAdapter.mPendingMsgs) { + mAdapter.sendMsg(msg); } + mAdapter.mPendingMsgs.clear(); } }; @@ -428,8 +354,7 @@ BatchingAdapter::startBatchingCommand( if (LOCATION_ERROR_SUCCESS == err) { if (mBatchingOptions.batchingMode == BATCHING_MODE_ROUTINE || mBatchingOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) { - mAdapter.startBatching( - mClient, mSessionId, mBatchingOptions, new MsgStartBatching(*this)); + mAdapter.startBatching(mClient, mSessionId, mBatchingOptions); } else if (mBatchingOptions.batchingMode == BATCHING_MODE_TRIP) { mAdapter.startTripBatchingMultiplex(mClient, mSessionId, mBatchingOptions); } else { @@ -446,7 +371,7 @@ BatchingAdapter::startBatchingCommand( void BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId, - const BatchingOptions& batchingOptions, LocMsg* pendingMsg) + const BatchingOptions& batchingOptions) { if (batchingOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT && 0 == autoReportBatchingSessionsCount()) { @@ -460,9 +385,8 @@ BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId, saveBatchingSession(client, sessionId, batchingOptions); mLocApi->startBatching(sessionId, batchingOptions, getBatchingAccuracy(), getBatchingTimeout(), new LocApiResponse(*getContext(), - [this, client, sessionId, batchingOptions, pendingMsg] (LocationError err) { - if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() && - LOCATION_ERROR_SUCCESS != err) { + [this, client, sessionId, batchingOptions] (LocationError err) { + if (LOCATION_ERROR_SUCCESS != err) { eraseBatchingSession(client, sessionId); } @@ -475,13 +399,6 @@ BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId, LOC_REGISTRATION_MASK_DISABLED); } - if (LOCATION_ERROR_GNSS_DISABLED == err && pendingMsg != nullptr) { - LOC_LOGd("GNSS_DISABLED, add request to pending queue"); - mPendingGnssEnabledMsgs.push_back(pendingMsg); - } else if (pendingMsg != nullptr) { - delete pendingMsg; - } - reportResponse(client, err, sessionId); })); } @@ -592,8 +509,7 @@ BatchingAdapter::stopBatching(LocationAPI* client, uint32_t sessionId, bool rest new LocApiResponse(*getContext(), [this, client, sessionId, flpOptions, restartNeeded, batchOptions] (LocationError err) { - if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() && - LOCATION_ERROR_SUCCESS != err) { + if (LOCATION_ERROR_SUCCESS != err) { saveBatchingSession(client, sessionId, batchOptions); } else { // if stopBatching is success, unregister for batch full event if this was the last @@ -850,8 +766,7 @@ BatchingAdapter::startTripBatchingMultiplex(LocationAPI* client, uint32_t sessio mLocApi->startOutdoorTripBatching(batchingOptions.minDistance, batchingOptions.minInterval, getBatchingTimeout(), new LocApiResponse(*getContext(), [this, client, sessionId, batchingOptions] (LocationError err) { - if (ENGINE_LOCK_STATE_DISABLED == mLocApi->getEngineLockState() || - err == LOCATION_ERROR_SUCCESS) { + if (err == LOCATION_ERROR_SUCCESS) { mOngoingTripDistance = batchingOptions.minDistance; mOngoingTripTBFInterval = batchingOptions.minInterval; LOC_LOGD("%s] New Trip started ...", __func__); diff --git a/batching/BatchingAdapter.h b/batching/BatchingAdapter.h index 4580976..66f7c5f 100644 --- a/batching/BatchingAdapter.h +++ b/batching/BatchingAdapter.h @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 BATCHING_ADAPTER_H #define BATCHING_ADAPTER_H @@ -151,7 +114,7 @@ public: void eraseBatchingSession(LocationAPI* client, uint32_t sessionId); uint32_t autoReportBatchingSessionsCount(); void startBatching(LocationAPI* client, uint32_t sessionId, - const BatchingOptions& batchingOptions, LocMsg* pendingMsg = nullptr); + const BatchingOptions& batchingOptions); void stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded, const BatchingOptions& batchOptions); void stopBatching(LocationAPI* client, uint32_t sessionId) { @@ -160,8 +123,6 @@ public: }; /* ==== REPORTS ======================================================================== */ - virtual void handleEngineLockStatusEvent(EngineLockState engineLockState); - void handleEngineLockStatus(EngineLockState engineLockState); /* ======== EVENTS ====(Called from QMI Thread)========================================= */ void reportLocationsEvent(const Location* locations, size_t count, BatchingMode batchingMode); @@ -185,6 +146,7 @@ public: uint32_t getBatchingTimeout() { return mBatchingTimeout; } void setBatchingAccuracy(uint32_t accuracy) { mBatchingAccuracy = accuracy; } uint32_t getBatchingAccuracy() { return mBatchingAccuracy; } + }; #endif /* BATCHING_ADAPTER_H */ diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 21975ed..95f2728 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - /* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. -*/ - #define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_LocAdapterBase" @@ -469,10 +432,6 @@ void LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/) DEFAULT_IMPL() -void -LocAdapterBase::handleEngineLockStatusEvent(const EngineLockState engineLockState) -DEFAULT_IMPL() - bool LocAdapterBase:: reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) DEFAULT_IMPL(false) diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index f2ae52e..51b2306 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - - /* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 LOC_API_ADAPTER_BASE_H #define LOC_API_ADAPTER_BASE_H @@ -117,8 +80,6 @@ protected: typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap; ClientDataMap mClientData; std::vector<LocMsg*> mPendingMsgs; // For temporal storage of msgs before Open is completed - std::vector<LocMsg*> mPendingGnssEnabledMsgs; // For temporal storage of msgs failed with - // GNSS disabled error /* ======== UTILITIES ================================================================== */ void saveClient(LocationAPI* client, const LocationCallbacks& callbacks); void eraseClient(LocationAPI* client); @@ -276,7 +237,6 @@ public: void requestCapabilitiesCommand(LocationAPI* client); virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo); - virtual void handleEngineLockStatusEvent(EngineLockState engineLockState); virtual bool reportQwesCapabilities( const std::unordered_map<LocationQwesFeatureType, bool> &featureMap); }; diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index b571e36..860da2e 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -155,7 +155,7 @@ volatile int32_t LocApiBase::mMsgTaskRefCount = 0; LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask, ContextBase* context) : mContext(context), - mMask(0), mExcludedMask(excludedMask), mEngineLockState(ENGINE_LOCK_STATE_ENABLED) + mMask(0), mExcludedMask(excludedMask) { memset(mLocAdapters, 0, sizeof(mLocAdapters)); @@ -615,12 +615,6 @@ void LocApiBase::reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo) TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLatencyInfoEvent(gnssLatencyInfo)); } -void LocApiBase::reportEngineLockStatus(EngineLockState engineLockState) -{ - // loop through adapters, and deliver to the All handling adapter. - TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineLockStatusEvent(engineLockState)); -} - enum loc_api_adapter_err LocApiBase:: open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 6f1b04f..cbe5f9f 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -137,7 +137,6 @@ protected: bool isInSession(); const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask; bool isMaster(); - EngineLockState mEngineLockState; public: inline void sendMsg(const LocMsg* msg) const { @@ -204,7 +203,6 @@ public: void sendNfwNotification(GnssNfwNotification& notification); void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig); void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo); - void reportEngineLockStatus(EngineLockState engineLockState); void reportQwesCapabilities ( const std::unordered_map<LocationQwesFeatureType, bool> &featureMap @@ -347,14 +345,6 @@ public: LocApiResponse* adapterResponse=nullptr); virtual void getConstellationMultiBandConfig(uint32_t sessionId, LocApiResponse* adapterResponse=nullptr); - - inline EngineLockState getEngineLockState() { - return mEngineLockState; - } - - inline void setEngineLockState(EngineLockState engineLockState) { - mEngineLockState = engineLockState; - } }; class ElapsedRealtimeEstimator { diff --git a/geofence/GeofenceAdapter.cpp b/geofence/GeofenceAdapter.cpp index 3fbe0a9..1aeea0a 100644 --- a/geofence/GeofenceAdapter.cpp +++ b/geofence/GeofenceAdapter.cpp @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. -*/ - #define LOG_TAG "LocSvc_GeofenceAdapter" #include <GeofenceAdapter.h> @@ -154,62 +117,25 @@ GeofenceAdapter::getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key) } void -GeofenceAdapter::handleEngineLockStatusEvent(EngineLockState engineLockState) { - - LOC_LOGD("%s]: Old Engine state %d, New Engine state : %d,", __func__, - mLocApi->getEngineLockState(), engineLockState); - - struct MsgEngineLockStateEvent : public LocMsg { - GeofenceAdapter& mAdapter; - EngineLockState mEngineLockState; - - inline MsgEngineLockStateEvent(GeofenceAdapter& adapter, EngineLockState engineLockState) : - LocMsg(), - mAdapter(adapter), - mEngineLockState(engineLockState){} - - virtual void proc() const { - mAdapter.handleEngineLockStatus(mEngineLockState); - } - }; - - sendMsg(new MsgEngineLockStateEvent(*this, engineLockState)); -} - -void -GeofenceAdapter::handleEngineLockStatus(EngineLockState engineLockState) { - - if (ENGINE_LOCK_STATE_ENABLED == engineLockState) { - for (auto msg: mPendingGnssEnabledMsgs) { - sendMsg(msg); - } - mPendingGnssEnabledMsgs.clear(); - } -} - -void GeofenceAdapter::handleEngineUpEvent() { struct MsgSSREvent : public LocMsg { GeofenceAdapter& mAdapter; - LocApiBase& mApi; - inline MsgSSREvent(GeofenceAdapter& adapter, LocApiBase& api) : + inline MsgSSREvent(GeofenceAdapter& adapter) : LocMsg(), - mAdapter(adapter), - mApi(api) {} + mAdapter(adapter) {} virtual void proc() const { mAdapter.setEngineCapabilitiesKnown(true); mAdapter.broadcastCapabilities(mAdapter.getCapabilities()); - if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) { - mAdapter.restartGeofences(); - for (auto msg: mAdapter.mPendingMsgs) { - mAdapter.sendMsg(msg); - } + mAdapter.restartGeofences(); + for (auto msg: mAdapter.mPendingMsgs) { + mAdapter.sendMsg(msg); } + mAdapter.mPendingMsgs.clear(); } }; - sendMsg(new MsgSSREvent(*this, *mLocApi)); + sendMsg(new MsgSSREvent(*this)); } void @@ -305,7 +231,7 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence mCount(count), mIds(ids), mOptions(options), - mInfos(infos){} + mInfos(infos) {} inline virtual void proc() const { LocationError* errs = new LocationError[mCount]; if (nullptr == errs) { @@ -323,10 +249,9 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence mApi.addGeofence(mIds[i], mOptions[i], mInfos[i], new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(), [&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient, - mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i, &mApi = mApi] + mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i] (LocationError err, LocApiGeofenceData data) { - if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() || - LOCATION_ERROR_SUCCESS == err) { + if (LOCATION_ERROR_SUCCESS == err) { mAdapter.saveGeofenceItem(mClient, mIds[i], data.hwId, @@ -428,9 +353,8 @@ GeofenceAdapter::removeGeofencesCommand(LocationAPI* client, size_t count, uint3 mApi.removeGeofence(hwId, mIds[i], new LocApiResponse(*mAdapter.getContext(), [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds, - hwId, errs, i, &mApi = mApi] (LocationError err ) { - if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() || - LOCATION_ERROR_SUCCESS == err) { + hwId, errs, i] (LocationError err ) { + if (LOCATION_ERROR_SUCCESS == err) { mAdapter.removeGeofenceItem(hwId); } errs[i] = err; @@ -663,10 +587,9 @@ GeofenceAdapter::modifyGeofencesCommand(LocationAPI* client, size_t count, uint3 mApi.modifyGeofence(hwId, mIds[i], mOptions[i], new LocApiResponse(*mAdapter.getContext(), [&mAdapter = mAdapter, mCount = mCount, mClient = mClient, - mIds = mIds, mOptions = mOptions, hwId, errs, i, &mApi = mApi] + mIds = mIds, mOptions = mOptions, hwId, errs, i] (LocationError err ) { - if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() || - LOCATION_ERROR_SUCCESS == err) { + if (LOCATION_ERROR_SUCCESS == err) { errs[i] = err; mAdapter.modifyGeofenceItem(hwId, mOptions[i]); diff --git a/geofence/GeofenceAdapter.h b/geofence/GeofenceAdapter.h index 83911a9..38f4823 100644 --- a/geofence/GeofenceAdapter.h +++ b/geofence/GeofenceAdapter.h @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 GEOFENCE_ADAPTER_H #define GEOFENCE_ADAPTER_H @@ -158,9 +121,8 @@ public: LocationError getHwIdFromClient(LocationAPI* client, uint32_t clientId, uint32_t& hwId); LocationError getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key); void dump(); + /* ==== REPORTS ======================================================================== */ - virtual void handleEngineLockStatusEvent(EngineLockState engineLockState); - void handleEngineLockStatus(EngineLockState engineLockState); /* ======== EVENTS ====(Called from QMI Thread)========================================= */ void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location, GeofenceBreachType breachType, uint64_t timestamp); diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 0235d2c..f3ccd99 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -170,6 +170,7 @@ GnssAdapter::GnssAdapter() : readConfigCommand(); initDefaultAgpsCommand(); initEngHubProxyCommand(); + // at last step, let us inform adapater base that we are done // with initialization, e.g.: ready to process handleEngineUpEvent doneInit(); @@ -2564,51 +2565,15 @@ GnssAdapter::updateClientsEventMask() } void -GnssAdapter::handleEngineLockStatusEvent(EngineLockState engineLockState) { - - LOC_LOGD("%s]: Old Engine state %d, New Engine state : %d,", - __func__, mLocApi->getEngineLockState(), engineLockState); - - struct MsgEngineLockStateEvent : public LocMsg { - GnssAdapter& mAdapter; - EngineLockState mEngineLockState; - - inline MsgEngineLockStateEvent(GnssAdapter& adapter, EngineLockState engineLockState) : - LocMsg(), - mAdapter(adapter), - mEngineLockState(engineLockState) {} - - virtual void proc() const { - mAdapter.handleEngineLockStatus(mEngineLockState); - } - }; - - sendMsg(new MsgEngineLockStateEvent(*this, engineLockState)); -} - -void -GnssAdapter::handleEngineLockStatus(EngineLockState engineLockState) { - - if (ENGINE_LOCK_STATE_ENABLED == engineLockState) { - for (auto msg: mPendingGnssEnabledMsgs) { - sendMsg(msg); - } - mPendingGnssEnabledMsgs.clear(); - } -} - -void GnssAdapter::handleEngineUpEvent() { LOC_LOGD("%s]: ", __func__); struct MsgHandleEngineUpEvent : public LocMsg { GnssAdapter& mAdapter; - LocApiBase& mApi; - inline MsgHandleEngineUpEvent(GnssAdapter& adapter, LocApiBase& api) : + inline MsgHandleEngineUpEvent(GnssAdapter& adapter) : LocMsg(), - mAdapter(adapter), - mApi(api) {} + mAdapter(adapter) {} virtual void proc() const { mAdapter.setEngineCapabilitiesKnown(true); mAdapter.broadcastCapabilities(mAdapter.getCapabilities()); @@ -2620,19 +2585,17 @@ GnssAdapter::handleEngineUpEvent() mAdapter.gnssSecondaryBandConfigUpdate(); // start CDFW service mAdapter.initCDFWService(); - - if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) { - // restart sessions - mAdapter.restartSessions(true); - for (auto msg: mAdapter.mPendingMsgs) { - mAdapter.sendMsg(msg); - } + // restart sessions + mAdapter.restartSessions(true); + for (auto msg: mAdapter.mPendingMsgs) { + mAdapter.sendMsg(msg); } + mAdapter.mPendingMsgs.clear(); } }; readConfigCommand(); - sendMsg(new MsgHandleEngineUpEvent(*this, *mLocApi)); + sendMsg(new MsgHandleEngineUpEvent(*this)); } void @@ -3009,11 +2972,9 @@ GnssAdapter::startTrackingCommand(LocationAPI* client, TrackingOptions& options) mAdapter.saveTrackingSession(mClient, mSessionId, mOptions); mApi.startDistanceBasedTracking(mSessionId, mOptions, new LocApiResponse(*mAdapter.getContext(), - [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient, - &mApi = mApi] + [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient] (LocationError err) { - if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState() && - LOCATION_ERROR_SUCCESS != err) { + if (LOCATION_ERROR_SUCCESS != err) { mAdapter.eraseTrackingSession(mClient, mSessionId); } mAdapter.reportResponse(mClient, err, mSessionId); @@ -3120,8 +3081,7 @@ GnssAdapter::startTimeBasedTracking(LocationAPI* client, uint32_t sessionId, if (!checkAndSetSPEToRunforNHz(tempOptions)) { mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(), [this, client, sessionId] (LocationError err) { - if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() && - LOCATION_ERROR_SUCCESS != err) { + if (LOCATION_ERROR_SUCCESS != err) { eraseTrackingSession(client, sessionId); } else { checkUpdateDgnssNtrip(false); @@ -3156,8 +3116,7 @@ GnssAdapter::updateTracking(LocationAPI* client, uint32_t sessionId, if(!checkAndSetSPEToRunforNHz(tempOptions)) { mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(), [this, client, sessionId, oldOptions] (LocationError err) { - if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() && - LOCATION_ERROR_SUCCESS != err) { + if (LOCATION_ERROR_SUCCESS != err) { // restore the old LocationOptions saveTrackingSession(client, sessionId, oldOptions); } @@ -3272,10 +3231,9 @@ GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id, if (LOCATION_ERROR_SUCCESS == err) { mApi.startDistanceBasedTracking(mSessionId, mOptions, new LocApiResponse(*mAdapter.getContext(), - [&mAdapter, mClient, mSessionId, mOptions, &mApi = mApi] + [&mAdapter, mClient, mSessionId, mOptions] (LocationError err) { - if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() || - LOCATION_ERROR_SUCCESS == err) { + if (LOCATION_ERROR_SUCCESS == err) { mAdapter.saveTrackingSession(mClient, mSessionId, mOptions); } mAdapter.reportResponse(mClient, err, mSessionId); @@ -3389,11 +3347,9 @@ GnssAdapter::stopTrackingCommand(LocationAPI* client, uint32_t id) } else if (isDistanceBased) { mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse( *mAdapter.getContext(), - [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient, - &mApi = mApi] + [&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient] (LocationError err) { - if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() || - LOCATION_ERROR_SUCCESS == err) { + if (LOCATION_ERROR_SUCCESS == err) { mAdapter.eraseTrackingSession(mClient, mSessionId); } mAdapter.reportResponse(mClient, err, mSessionId); diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index a9d0456..d7b4275 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -26,43 +26,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -/* -Changes from Qualcomm Innovation Center are provided under the following license: - -Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted (subject to the limitations in the -disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 GNSS_ADAPTER_H #define GNSS_ADAPTER_H @@ -524,8 +487,6 @@ public: void odcpiTimerExpireEvent(); /* ==== REPORTS ======================================================================== */ - virtual void handleEngineLockStatusEvent(EngineLockState engineLockState); - void handleEngineLockStatus(EngineLockState engineLockState); /* ======== EVENTS ====(Called from QMI/EngineHub Thread)===================================== */ virtual void reportPositionEvent(const UlpLocation& ulpLocation, const GpsLocationExtended& locationExtended, diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index ca8281a..b85464a 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -63,7 +63,6 @@ typedef enum { LOCATION_ERROR_GEOFENCES_AT_MAX, LOCATION_ERROR_NOT_SUPPORTED, LOCATION_ERROR_TIMEOUT, - LOCATION_ERROR_GNSS_DISABLED, } LocationError; // Flags to indicate which values are valid in a Location diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index fc10841..f368975 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -2422,13 +2422,6 @@ typedef uint64_t NetworkHandle; #define NETWORK_HANDLE_UNKNOWN ~0 #define MAX_NETWORK_HANDLES 10 -typedef enum { - ENGINE_LOCK_STATE_INVALID = 0, - ENGINE_LOCK_STATE_ENABLED = 1, /**< Location engine is enabled. */ - ENGINE_LOCK_STATE_DISABLED = 2, /**< location engine is disabled. */ - ENGINE_LOCK_STATE_MAX, -}EngineLockState; - #ifdef __cplusplus } #endif /* __cplusplus */ |