sdm660-common: GPS: Update from LA.UM.11.2.1.r1-02500-sdm660.0
Signed-off-by: pix106 <sbordenave@gmail.com>
This commit is contained in:
parent
aa76e60586
commit
cb79a6f914
12 changed files with 471 additions and 45 deletions
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_BatchingAdapter"
|
#define LOG_TAG "LocSvc_BatchingAdapter"
|
||||||
|
|
||||||
|
@ -162,6 +199,41 @@ BatchingAdapter::updateClientsEventMask()
|
||||||
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
BatchingAdapter::handleEngineUpEvent()
|
BatchingAdapter::handleEngineUpEvent()
|
||||||
{
|
{
|
||||||
|
@ -178,11 +250,13 @@ BatchingAdapter::handleEngineUpEvent()
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||||
mApi.setBatchSize(mAdapter.getBatchSize());
|
mApi.setBatchSize(mAdapter.getBatchSize());
|
||||||
mApi.setTripBatchSize(mAdapter.getTripBatchSize());
|
mApi.setTripBatchSize(mAdapter.getTripBatchSize());
|
||||||
mAdapter.restartSessions();
|
if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) {
|
||||||
for (auto msg: mAdapter.mPendingMsgs) {
|
mAdapter.restartSessions();
|
||||||
mAdapter.sendMsg(msg);
|
for (auto msg: mAdapter.mPendingMsgs) {
|
||||||
|
mAdapter.sendMsg(msg);
|
||||||
|
}
|
||||||
|
mAdapter.mPendingMsgs.clear();
|
||||||
}
|
}
|
||||||
mAdapter.mPendingMsgs.clear();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -354,7 +428,8 @@ BatchingAdapter::startBatchingCommand(
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (LOCATION_ERROR_SUCCESS == err) {
|
||||||
if (mBatchingOptions.batchingMode == BATCHING_MODE_ROUTINE ||
|
if (mBatchingOptions.batchingMode == BATCHING_MODE_ROUTINE ||
|
||||||
mBatchingOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) {
|
mBatchingOptions.batchingMode == BATCHING_MODE_NO_AUTO_REPORT) {
|
||||||
mAdapter.startBatching(mClient, mSessionId, mBatchingOptions);
|
mAdapter.startBatching(
|
||||||
|
mClient, mSessionId, mBatchingOptions, new MsgStartBatching(*this));
|
||||||
} else if (mBatchingOptions.batchingMode == BATCHING_MODE_TRIP) {
|
} else if (mBatchingOptions.batchingMode == BATCHING_MODE_TRIP) {
|
||||||
mAdapter.startTripBatchingMultiplex(mClient, mSessionId, mBatchingOptions);
|
mAdapter.startTripBatchingMultiplex(mClient, mSessionId, mBatchingOptions);
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +446,7 @@ BatchingAdapter::startBatchingCommand(
|
||||||
|
|
||||||
void
|
void
|
||||||
BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId,
|
BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId,
|
||||||
const BatchingOptions& batchingOptions)
|
const BatchingOptions& batchingOptions, LocMsg* pendingMsg)
|
||||||
{
|
{
|
||||||
if (batchingOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT &&
|
if (batchingOptions.batchingMode != BATCHING_MODE_NO_AUTO_REPORT &&
|
||||||
0 == autoReportBatchingSessionsCount()) {
|
0 == autoReportBatchingSessionsCount()) {
|
||||||
|
@ -385,8 +460,9 @@ BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId,
|
||||||
saveBatchingSession(client, sessionId, batchingOptions);
|
saveBatchingSession(client, sessionId, batchingOptions);
|
||||||
mLocApi->startBatching(sessionId, batchingOptions, getBatchingAccuracy(), getBatchingTimeout(),
|
mLocApi->startBatching(sessionId, batchingOptions, getBatchingAccuracy(), getBatchingTimeout(),
|
||||||
new LocApiResponse(*getContext(),
|
new LocApiResponse(*getContext(),
|
||||||
[this, client, sessionId, batchingOptions] (LocationError err) {
|
[this, client, sessionId, batchingOptions, pendingMsg] (LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS != err) {
|
if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() &&
|
||||||
|
LOCATION_ERROR_SUCCESS != err) {
|
||||||
eraseBatchingSession(client, sessionId);
|
eraseBatchingSession(client, sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +475,13 @@ BatchingAdapter::startBatching(LocationAPI* client, uint32_t sessionId,
|
||||||
LOC_REGISTRATION_MASK_DISABLED);
|
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);
|
reportResponse(client, err, sessionId);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -509,7 +592,8 @@ BatchingAdapter::stopBatching(LocationAPI* client, uint32_t sessionId, bool rest
|
||||||
new LocApiResponse(*getContext(),
|
new LocApiResponse(*getContext(),
|
||||||
[this, client, sessionId, flpOptions, restartNeeded, batchOptions]
|
[this, client, sessionId, flpOptions, restartNeeded, batchOptions]
|
||||||
(LocationError err) {
|
(LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS != err) {
|
if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() &&
|
||||||
|
LOCATION_ERROR_SUCCESS != err) {
|
||||||
saveBatchingSession(client, sessionId, batchOptions);
|
saveBatchingSession(client, sessionId, batchOptions);
|
||||||
} else {
|
} else {
|
||||||
// if stopBatching is success, unregister for batch full event if this was the last
|
// if stopBatching is success, unregister for batch full event if this was the last
|
||||||
|
@ -766,7 +850,8 @@ BatchingAdapter::startTripBatchingMultiplex(LocationAPI* client, uint32_t sessio
|
||||||
mLocApi->startOutdoorTripBatching(batchingOptions.minDistance,
|
mLocApi->startOutdoorTripBatching(batchingOptions.minDistance,
|
||||||
batchingOptions.minInterval, getBatchingTimeout(), new LocApiResponse(*getContext(),
|
batchingOptions.minInterval, getBatchingTimeout(), new LocApiResponse(*getContext(),
|
||||||
[this, client, sessionId, batchingOptions] (LocationError err) {
|
[this, client, sessionId, batchingOptions] (LocationError err) {
|
||||||
if (err == LOCATION_ERROR_SUCCESS) {
|
if (ENGINE_LOCK_STATE_DISABLED == mLocApi->getEngineLockState() ||
|
||||||
|
err == LOCATION_ERROR_SUCCESS) {
|
||||||
mOngoingTripDistance = batchingOptions.minDistance;
|
mOngoingTripDistance = batchingOptions.minDistance;
|
||||||
mOngoingTripTBFInterval = batchingOptions.minInterval;
|
mOngoingTripTBFInterval = batchingOptions.minInterval;
|
||||||
LOC_LOGD("%s] New Trip started ...", __func__);
|
LOC_LOGD("%s] New Trip started ...", __func__);
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
#ifndef BATCHING_ADAPTER_H
|
||||||
#define BATCHING_ADAPTER_H
|
#define BATCHING_ADAPTER_H
|
||||||
|
|
||||||
|
@ -114,7 +151,7 @@ public:
|
||||||
void eraseBatchingSession(LocationAPI* client, uint32_t sessionId);
|
void eraseBatchingSession(LocationAPI* client, uint32_t sessionId);
|
||||||
uint32_t autoReportBatchingSessionsCount();
|
uint32_t autoReportBatchingSessionsCount();
|
||||||
void startBatching(LocationAPI* client, uint32_t sessionId,
|
void startBatching(LocationAPI* client, uint32_t sessionId,
|
||||||
const BatchingOptions& batchingOptions);
|
const BatchingOptions& batchingOptions, LocMsg* pendingMsg = nullptr);
|
||||||
void stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded,
|
void stopBatching(LocationAPI* client, uint32_t sessionId, bool restartNeeded,
|
||||||
const BatchingOptions& batchOptions);
|
const BatchingOptions& batchOptions);
|
||||||
void stopBatching(LocationAPI* client, uint32_t sessionId) {
|
void stopBatching(LocationAPI* client, uint32_t sessionId) {
|
||||||
|
@ -123,6 +160,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ==== REPORTS ======================================================================== */
|
/* ==== REPORTS ======================================================================== */
|
||||||
|
virtual void handleEngineLockStatusEvent(EngineLockState engineLockState);
|
||||||
|
void handleEngineLockStatus(EngineLockState engineLockState);
|
||||||
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
|
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
|
||||||
void reportLocationsEvent(const Location* locations, size_t count,
|
void reportLocationsEvent(const Location* locations, size_t count,
|
||||||
BatchingMode batchingMode);
|
BatchingMode batchingMode);
|
||||||
|
@ -146,7 +185,6 @@ public:
|
||||||
uint32_t getBatchingTimeout() { return mBatchingTimeout; }
|
uint32_t getBatchingTimeout() { return mBatchingTimeout; }
|
||||||
void setBatchingAccuracy(uint32_t accuracy) { mBatchingAccuracy = accuracy; }
|
void setBatchingAccuracy(uint32_t accuracy) { mBatchingAccuracy = accuracy; }
|
||||||
uint32_t getBatchingAccuracy() { return mBatchingAccuracy; }
|
uint32_t getBatchingAccuracy() { return mBatchingAccuracy; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BATCHING_ADAPTER_H */
|
#endif /* BATCHING_ADAPTER_H */
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_LocAdapterBase"
|
#define LOG_TAG "LocSvc_LocAdapterBase"
|
||||||
|
|
||||||
|
@ -432,6 +469,10 @@ void
|
||||||
LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/)
|
LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
|
void
|
||||||
|
LocAdapterBase::handleEngineLockStatusEvent(const EngineLockState engineLockState)
|
||||||
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
bool LocAdapterBase::
|
bool LocAdapterBase::
|
||||||
reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
|
reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
#ifndef LOC_API_ADAPTER_BASE_H
|
||||||
#define LOC_API_ADAPTER_BASE_H
|
#define LOC_API_ADAPTER_BASE_H
|
||||||
|
|
||||||
|
@ -80,6 +117,8 @@ protected:
|
||||||
typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap;
|
typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap;
|
||||||
ClientDataMap mClientData;
|
ClientDataMap mClientData;
|
||||||
std::vector<LocMsg*> mPendingMsgs; // For temporal storage of msgs before Open is completed
|
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 ================================================================== */
|
/* ======== UTILITIES ================================================================== */
|
||||||
void saveClient(LocationAPI* client, const LocationCallbacks& callbacks);
|
void saveClient(LocationAPI* client, const LocationCallbacks& callbacks);
|
||||||
void eraseClient(LocationAPI* client);
|
void eraseClient(LocationAPI* client);
|
||||||
|
@ -237,6 +276,7 @@ public:
|
||||||
void requestCapabilitiesCommand(LocationAPI* client);
|
void requestCapabilitiesCommand(LocationAPI* client);
|
||||||
|
|
||||||
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
|
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
|
||||||
|
virtual void handleEngineLockStatusEvent(EngineLockState engineLockState);
|
||||||
virtual bool reportQwesCapabilities(
|
virtual bool reportQwesCapabilities(
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
|
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,7 +155,7 @@ volatile int32_t LocApiBase::mMsgTaskRefCount = 0;
|
||||||
LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
|
LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
|
||||||
ContextBase* context) :
|
ContextBase* context) :
|
||||||
mContext(context),
|
mContext(context),
|
||||||
mMask(0), mExcludedMask(excludedMask)
|
mMask(0), mExcludedMask(excludedMask), mEngineLockState(ENGINE_LOCK_STATE_ENABLED)
|
||||||
{
|
{
|
||||||
memset(mLocAdapters, 0, sizeof(mLocAdapters));
|
memset(mLocAdapters, 0, sizeof(mLocAdapters));
|
||||||
|
|
||||||
|
@ -615,6 +615,12 @@ void LocApiBase::reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo)
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLatencyInfoEvent(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::
|
enum loc_api_adapter_err LocApiBase::
|
||||||
open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
|
open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
|
||||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
|
|
@ -137,6 +137,7 @@ protected:
|
||||||
bool isInSession();
|
bool isInSession();
|
||||||
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
|
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
|
||||||
bool isMaster();
|
bool isMaster();
|
||||||
|
EngineLockState mEngineLockState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline void sendMsg(const LocMsg* msg) const {
|
inline void sendMsg(const LocMsg* msg) const {
|
||||||
|
@ -203,6 +204,7 @@ public:
|
||||||
void sendNfwNotification(GnssNfwNotification& notification);
|
void sendNfwNotification(GnssNfwNotification& notification);
|
||||||
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
|
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
|
||||||
void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
|
void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
|
||||||
|
void reportEngineLockStatus(EngineLockState engineLockState);
|
||||||
void reportQwesCapabilities
|
void reportQwesCapabilities
|
||||||
(
|
(
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
||||||
|
@ -345,6 +347,14 @@ public:
|
||||||
LocApiResponse* adapterResponse=nullptr);
|
LocApiResponse* adapterResponse=nullptr);
|
||||||
virtual void getConstellationMultiBandConfig(uint32_t sessionId,
|
virtual void getConstellationMultiBandConfig(uint32_t sessionId,
|
||||||
LocApiResponse* adapterResponse=nullptr);
|
LocApiResponse* adapterResponse=nullptr);
|
||||||
|
|
||||||
|
inline EngineLockState getEngineLockState() {
|
||||||
|
return mEngineLockState;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setEngineLockState(EngineLockState engineLockState) {
|
||||||
|
mEngineLockState = engineLockState;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ElapsedRealtimeEstimator {
|
class ElapsedRealtimeEstimator {
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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"
|
#define LOG_TAG "LocSvc_GeofenceAdapter"
|
||||||
|
|
||||||
#include <GeofenceAdapter.h>
|
#include <GeofenceAdapter.h>
|
||||||
|
@ -116,26 +153,63 @@ GeofenceAdapter::getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key)
|
||||||
return LOCATION_ERROR_ID_UNKNOWN;
|
return LOCATION_ERROR_ID_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
GeofenceAdapter::handleEngineUpEvent()
|
GeofenceAdapter::handleEngineUpEvent()
|
||||||
{
|
{
|
||||||
struct MsgSSREvent : public LocMsg {
|
struct MsgSSREvent : public LocMsg {
|
||||||
GeofenceAdapter& mAdapter;
|
GeofenceAdapter& mAdapter;
|
||||||
inline MsgSSREvent(GeofenceAdapter& adapter) :
|
LocApiBase& mApi;
|
||||||
|
inline MsgSSREvent(GeofenceAdapter& adapter, LocApiBase& api) :
|
||||||
LocMsg(),
|
LocMsg(),
|
||||||
mAdapter(adapter) {}
|
mAdapter(adapter),
|
||||||
|
mApi(api) {}
|
||||||
virtual void proc() const {
|
virtual void proc() const {
|
||||||
mAdapter.setEngineCapabilitiesKnown(true);
|
mAdapter.setEngineCapabilitiesKnown(true);
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||||
mAdapter.restartGeofences();
|
if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) {
|
||||||
for (auto msg: mAdapter.mPendingMsgs) {
|
mAdapter.restartGeofences();
|
||||||
mAdapter.sendMsg(msg);
|
for (auto msg: mAdapter.mPendingMsgs) {
|
||||||
|
mAdapter.sendMsg(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mAdapter.mPendingMsgs.clear();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMsg(new MsgSSREvent(*this));
|
sendMsg(new MsgSSREvent(*this, *mLocApi));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -231,7 +305,7 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
|
||||||
mCount(count),
|
mCount(count),
|
||||||
mIds(ids),
|
mIds(ids),
|
||||||
mOptions(options),
|
mOptions(options),
|
||||||
mInfos(infos) {}
|
mInfos(infos){}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
LocationError* errs = new LocationError[mCount];
|
LocationError* errs = new LocationError[mCount];
|
||||||
if (nullptr == errs) {
|
if (nullptr == errs) {
|
||||||
|
@ -249,9 +323,10 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
|
||||||
mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
|
mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
|
||||||
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
|
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
|
||||||
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
|
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
|
||||||
mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
|
mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i, &mApi = mApi]
|
||||||
(LocationError err, LocApiGeofenceData data) {
|
(LocationError err, LocApiGeofenceData data) {
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() ||
|
||||||
|
LOCATION_ERROR_SUCCESS == err) {
|
||||||
mAdapter.saveGeofenceItem(mClient,
|
mAdapter.saveGeofenceItem(mClient,
|
||||||
mIds[i],
|
mIds[i],
|
||||||
data.hwId,
|
data.hwId,
|
||||||
|
@ -353,8 +428,9 @@ GeofenceAdapter::removeGeofencesCommand(LocationAPI* client, size_t count, uint3
|
||||||
mApi.removeGeofence(hwId, mIds[i],
|
mApi.removeGeofence(hwId, mIds[i],
|
||||||
new LocApiResponse(*mAdapter.getContext(),
|
new LocApiResponse(*mAdapter.getContext(),
|
||||||
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
|
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient, mIds = mIds,
|
||||||
hwId, errs, i] (LocationError err ) {
|
hwId, errs, i, &mApi = mApi] (LocationError err ) {
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() ||
|
||||||
|
LOCATION_ERROR_SUCCESS == err) {
|
||||||
mAdapter.removeGeofenceItem(hwId);
|
mAdapter.removeGeofenceItem(hwId);
|
||||||
}
|
}
|
||||||
errs[i] = err;
|
errs[i] = err;
|
||||||
|
@ -587,9 +663,10 @@ GeofenceAdapter::modifyGeofencesCommand(LocationAPI* client, size_t count, uint3
|
||||||
mApi.modifyGeofence(hwId, mIds[i], mOptions[i],
|
mApi.modifyGeofence(hwId, mIds[i], mOptions[i],
|
||||||
new LocApiResponse(*mAdapter.getContext(),
|
new LocApiResponse(*mAdapter.getContext(),
|
||||||
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
|
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
|
||||||
mIds = mIds, mOptions = mOptions, hwId, errs, i]
|
mIds = mIds, mOptions = mOptions, hwId, errs, i, &mApi = mApi]
|
||||||
(LocationError err ) {
|
(LocationError err ) {
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() ||
|
||||||
|
LOCATION_ERROR_SUCCESS == err) {
|
||||||
errs[i] = err;
|
errs[i] = err;
|
||||||
|
|
||||||
mAdapter.modifyGeofenceItem(hwId, mOptions[i]);
|
mAdapter.modifyGeofenceItem(hwId, mOptions[i]);
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
#ifndef GEOFENCE_ADAPTER_H
|
||||||
#define GEOFENCE_ADAPTER_H
|
#define GEOFENCE_ADAPTER_H
|
||||||
|
|
||||||
|
@ -121,8 +158,9 @@ public:
|
||||||
LocationError getHwIdFromClient(LocationAPI* client, uint32_t clientId, uint32_t& hwId);
|
LocationError getHwIdFromClient(LocationAPI* client, uint32_t clientId, uint32_t& hwId);
|
||||||
LocationError getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key);
|
LocationError getGeofenceKeyFromHwId(uint32_t hwId, GeofenceKey& key);
|
||||||
void dump();
|
void dump();
|
||||||
|
|
||||||
/* ==== REPORTS ======================================================================== */
|
/* ==== REPORTS ======================================================================== */
|
||||||
|
virtual void handleEngineLockStatusEvent(EngineLockState engineLockState);
|
||||||
|
void handleEngineLockStatus(EngineLockState engineLockState);
|
||||||
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
|
/* ======== EVENTS ====(Called from QMI Thread)========================================= */
|
||||||
void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
|
void geofenceBreachEvent(size_t count, uint32_t* hwIds, Location& location,
|
||||||
GeofenceBreachType breachType, uint64_t timestamp);
|
GeofenceBreachType breachType, uint64_t timestamp);
|
||||||
|
|
|
@ -170,7 +170,6 @@ GnssAdapter::GnssAdapter() :
|
||||||
readConfigCommand();
|
readConfigCommand();
|
||||||
initDefaultAgpsCommand();
|
initDefaultAgpsCommand();
|
||||||
initEngHubProxyCommand();
|
initEngHubProxyCommand();
|
||||||
|
|
||||||
// at last step, let us inform adapater base that we are done
|
// at last step, let us inform adapater base that we are done
|
||||||
// with initialization, e.g.: ready to process handleEngineUpEvent
|
// with initialization, e.g.: ready to process handleEngineUpEvent
|
||||||
doneInit();
|
doneInit();
|
||||||
|
@ -2564,6 +2563,40 @@ GnssAdapter::updateClientsEventMask()
|
||||||
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
GnssAdapter::handleEngineUpEvent()
|
GnssAdapter::handleEngineUpEvent()
|
||||||
{
|
{
|
||||||
|
@ -2571,9 +2604,11 @@ GnssAdapter::handleEngineUpEvent()
|
||||||
|
|
||||||
struct MsgHandleEngineUpEvent : public LocMsg {
|
struct MsgHandleEngineUpEvent : public LocMsg {
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
inline MsgHandleEngineUpEvent(GnssAdapter& adapter) :
|
LocApiBase& mApi;
|
||||||
|
inline MsgHandleEngineUpEvent(GnssAdapter& adapter, LocApiBase& api) :
|
||||||
LocMsg(),
|
LocMsg(),
|
||||||
mAdapter(adapter) {}
|
mAdapter(adapter),
|
||||||
|
mApi(api) {}
|
||||||
virtual void proc() const {
|
virtual void proc() const {
|
||||||
mAdapter.setEngineCapabilitiesKnown(true);
|
mAdapter.setEngineCapabilitiesKnown(true);
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
||||||
|
@ -2585,17 +2620,19 @@ GnssAdapter::handleEngineUpEvent()
|
||||||
mAdapter.gnssSecondaryBandConfigUpdate();
|
mAdapter.gnssSecondaryBandConfigUpdate();
|
||||||
// start CDFW service
|
// start CDFW service
|
||||||
mAdapter.initCDFWService();
|
mAdapter.initCDFWService();
|
||||||
// restart sessions
|
|
||||||
mAdapter.restartSessions(true);
|
if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState()) {
|
||||||
for (auto msg: mAdapter.mPendingMsgs) {
|
// restart sessions
|
||||||
mAdapter.sendMsg(msg);
|
mAdapter.restartSessions(true);
|
||||||
|
for (auto msg: mAdapter.mPendingMsgs) {
|
||||||
|
mAdapter.sendMsg(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mAdapter.mPendingMsgs.clear();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
readConfigCommand();
|
readConfigCommand();
|
||||||
sendMsg(new MsgHandleEngineUpEvent(*this));
|
sendMsg(new MsgHandleEngineUpEvent(*this, *mLocApi));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2972,9 +3009,11 @@ GnssAdapter::startTrackingCommand(LocationAPI* client, TrackingOptions& options)
|
||||||
mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
|
mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
|
||||||
mApi.startDistanceBasedTracking(mSessionId, mOptions,
|
mApi.startDistanceBasedTracking(mSessionId, mOptions,
|
||||||
new LocApiResponse(*mAdapter.getContext(),
|
new LocApiResponse(*mAdapter.getContext(),
|
||||||
[&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient]
|
[&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient,
|
||||||
|
&mApi = mApi]
|
||||||
(LocationError err) {
|
(LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS != err) {
|
if (ENGINE_LOCK_STATE_ENABLED == mApi.getEngineLockState() &&
|
||||||
|
LOCATION_ERROR_SUCCESS != err) {
|
||||||
mAdapter.eraseTrackingSession(mClient, mSessionId);
|
mAdapter.eraseTrackingSession(mClient, mSessionId);
|
||||||
}
|
}
|
||||||
mAdapter.reportResponse(mClient, err, mSessionId);
|
mAdapter.reportResponse(mClient, err, mSessionId);
|
||||||
|
@ -3081,7 +3120,8 @@ GnssAdapter::startTimeBasedTracking(LocationAPI* client, uint32_t sessionId,
|
||||||
if (!checkAndSetSPEToRunforNHz(tempOptions)) {
|
if (!checkAndSetSPEToRunforNHz(tempOptions)) {
|
||||||
mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
|
mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
|
||||||
[this, client, sessionId] (LocationError err) {
|
[this, client, sessionId] (LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS != err) {
|
if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() &&
|
||||||
|
LOCATION_ERROR_SUCCESS != err) {
|
||||||
eraseTrackingSession(client, sessionId);
|
eraseTrackingSession(client, sessionId);
|
||||||
} else {
|
} else {
|
||||||
checkUpdateDgnssNtrip(false);
|
checkUpdateDgnssNtrip(false);
|
||||||
|
@ -3116,7 +3156,8 @@ GnssAdapter::updateTracking(LocationAPI* client, uint32_t sessionId,
|
||||||
if(!checkAndSetSPEToRunforNHz(tempOptions)) {
|
if(!checkAndSetSPEToRunforNHz(tempOptions)) {
|
||||||
mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
|
mLocApi->startTimeBasedTracking(tempOptions, new LocApiResponse(*getContext(),
|
||||||
[this, client, sessionId, oldOptions] (LocationError err) {
|
[this, client, sessionId, oldOptions] (LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS != err) {
|
if (ENGINE_LOCK_STATE_ENABLED == mLocApi->getEngineLockState() &&
|
||||||
|
LOCATION_ERROR_SUCCESS != err) {
|
||||||
// restore the old LocationOptions
|
// restore the old LocationOptions
|
||||||
saveTrackingSession(client, sessionId, oldOptions);
|
saveTrackingSession(client, sessionId, oldOptions);
|
||||||
}
|
}
|
||||||
|
@ -3231,9 +3272,10 @@ GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id,
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (LOCATION_ERROR_SUCCESS == err) {
|
||||||
mApi.startDistanceBasedTracking(mSessionId, mOptions,
|
mApi.startDistanceBasedTracking(mSessionId, mOptions,
|
||||||
new LocApiResponse(*mAdapter.getContext(),
|
new LocApiResponse(*mAdapter.getContext(),
|
||||||
[&mAdapter, mClient, mSessionId, mOptions]
|
[&mAdapter, mClient, mSessionId, mOptions, &mApi = mApi]
|
||||||
(LocationError err) {
|
(LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() ||
|
||||||
|
LOCATION_ERROR_SUCCESS == err) {
|
||||||
mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
|
mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
|
||||||
}
|
}
|
||||||
mAdapter.reportResponse(mClient, err, mSessionId);
|
mAdapter.reportResponse(mClient, err, mSessionId);
|
||||||
|
@ -3347,9 +3389,11 @@ GnssAdapter::stopTrackingCommand(LocationAPI* client, uint32_t id)
|
||||||
} else if (isDistanceBased) {
|
} else if (isDistanceBased) {
|
||||||
mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse(
|
mApi.stopDistanceBasedTracking(mSessionId, new LocApiResponse(
|
||||||
*mAdapter.getContext(),
|
*mAdapter.getContext(),
|
||||||
[&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient]
|
[&mAdapter = mAdapter, mSessionId = mSessionId, mClient = mClient,
|
||||||
|
&mApi = mApi]
|
||||||
(LocationError err) {
|
(LocationError err) {
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
if (ENGINE_LOCK_STATE_DISABLED == mApi.getEngineLockState() ||
|
||||||
|
LOCATION_ERROR_SUCCESS == err) {
|
||||||
mAdapter.eraseTrackingSession(mClient, mSessionId);
|
mAdapter.eraseTrackingSession(mClient, mSessionId);
|
||||||
}
|
}
|
||||||
mAdapter.reportResponse(mClient, err, mSessionId);
|
mAdapter.reportResponse(mClient, err, mSessionId);
|
||||||
|
|
|
@ -26,6 +26,43 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
#ifndef GNSS_ADAPTER_H
|
||||||
#define GNSS_ADAPTER_H
|
#define GNSS_ADAPTER_H
|
||||||
|
|
||||||
|
@ -487,6 +524,8 @@ public:
|
||||||
void odcpiTimerExpireEvent();
|
void odcpiTimerExpireEvent();
|
||||||
|
|
||||||
/* ==== REPORTS ======================================================================== */
|
/* ==== REPORTS ======================================================================== */
|
||||||
|
virtual void handleEngineLockStatusEvent(EngineLockState engineLockState);
|
||||||
|
void handleEngineLockStatus(EngineLockState engineLockState);
|
||||||
/* ======== EVENTS ====(Called from QMI/EngineHub Thread)===================================== */
|
/* ======== EVENTS ====(Called from QMI/EngineHub Thread)===================================== */
|
||||||
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
|
virtual void reportPositionEvent(const UlpLocation& ulpLocation,
|
||||||
const GpsLocationExtended& locationExtended,
|
const GpsLocationExtended& locationExtended,
|
||||||
|
|
|
@ -63,6 +63,7 @@ typedef enum {
|
||||||
LOCATION_ERROR_GEOFENCES_AT_MAX,
|
LOCATION_ERROR_GEOFENCES_AT_MAX,
|
||||||
LOCATION_ERROR_NOT_SUPPORTED,
|
LOCATION_ERROR_NOT_SUPPORTED,
|
||||||
LOCATION_ERROR_TIMEOUT,
|
LOCATION_ERROR_TIMEOUT,
|
||||||
|
LOCATION_ERROR_GNSS_DISABLED,
|
||||||
} LocationError;
|
} LocationError;
|
||||||
|
|
||||||
// Flags to indicate which values are valid in a Location
|
// Flags to indicate which values are valid in a Location
|
||||||
|
|
|
@ -2422,6 +2422,13 @@ typedef uint64_t NetworkHandle;
|
||||||
#define NETWORK_HANDLE_UNKNOWN ~0
|
#define NETWORK_HANDLE_UNKNOWN ~0
|
||||||
#define MAX_NETWORK_HANDLES 10
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
Loading…
Reference in a new issue