sm8450-common: gps: Support WiFi RTT position injection for non ES case

Change-Id: I92248c5a95c042c90164308d0617d9197625e6dd
CRs-Fixed: 3432072
This commit is contained in:
haohuang 2023-02-08 17:49:17 +08:00 committed by Arian
parent 58ea2a68e5
commit 7def8dd105
10 changed files with 244 additions and 30 deletions

View file

@ -390,7 +390,8 @@ Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
return setCallback(callback); return setCallback(callback);
} }

View file

@ -459,7 +459,8 @@ Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();
@ -593,7 +594,8 @@ Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();

View file

@ -474,7 +474,8 @@ Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();
@ -626,7 +627,8 @@ Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();
@ -765,7 +767,8 @@ Return<bool> Gnss::setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) {
OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) {
odcpiRequestCb(odcpiRequest); odcpiRequestCb(odcpiRequest);
}; };
gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW,
(EMERGENCY_ODCPI | NON_EMERGENCY_ODCPI));
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();

View file

@ -5119,7 +5119,7 @@ void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
// extending the odcpi session past 30 seconds if needed // extending the odcpi session past 30 seconds if needed
if (ODCPI_REQUEST_TYPE_START == request.type) { if (ODCPI_REQUEST_TYPE_START == request.type) {
if (!(mOdcpiStateMask & ODCPI_REQ_ACTIVE) && false == mOdcpiTimer.isActive()) { if (!(mOdcpiStateMask & ODCPI_REQ_ACTIVE) && false == mOdcpiTimer.isActive()) {
mOdcpiRequestCb(request); fireOdcpiRequest(request);
mOdcpiStateMask |= ODCPI_REQ_ACTIVE; mOdcpiStateMask |= ODCPI_REQ_ACTIVE;
mOdcpiTimer.start(); mOdcpiTimer.start();
sendEmergencyCallStatusEvent = true; sendEmergencyCallStatusEvent = true;
@ -5128,7 +5128,7 @@ void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
// and restart the timer // and restart the timer
} else if (false == mOdcpiRequest.isEmergencyMode && } else if (false == mOdcpiRequest.isEmergencyMode &&
true == request.isEmergencyMode) { true == request.isEmergencyMode) {
mOdcpiRequestCb(request); fireOdcpiRequest(request);
mOdcpiStateMask |= ODCPI_REQ_ACTIVE; mOdcpiStateMask |= ODCPI_REQ_ACTIVE;
if (true == mOdcpiTimer.isActive()) { if (true == mOdcpiTimer.isActive()) {
mOdcpiTimer.restart(); mOdcpiTimer.restart();
@ -5153,7 +5153,7 @@ void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
// to avoid spamming more odcpi requests to the framework // to avoid spamming more odcpi requests to the framework
} else if (ODCPI_REQUEST_TYPE_STOP == request.type) { } else if (ODCPI_REQUEST_TYPE_STOP == request.type) {
LOC_LOGd("request: type %d, isEmergency %d", request.type, request.isEmergencyMode); LOC_LOGd("request: type %d, isEmergency %d", request.type, request.isEmergencyMode);
mOdcpiRequestCb(request); fireOdcpiRequest(request);
mOdcpiStateMask = 0; mOdcpiStateMask = 0;
sendEmergencyCallStatusEvent = true; sendEmergencyCallStatusEvent = true;
} else { } else {
@ -5222,29 +5222,70 @@ bool GnssAdapter::reportQwesCapabilities(
} }
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback, void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority) OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask)
{ {
struct MsgInitOdcpi : public LocMsg { struct MsgInitOdcpi : public LocMsg {
GnssAdapter& mAdapter; GnssAdapter& mAdapter;
OdcpiRequestCallback mOdcpiCb; OdcpiRequestCallback mOdcpiCb;
OdcpiPrioritytype mPriority; OdcpiPrioritytype mPriority;
OdcpiCallbackTypeMask mTypeMask;
inline MsgInitOdcpi(GnssAdapter& adapter, inline MsgInitOdcpi(GnssAdapter& adapter,
const OdcpiRequestCallback& callback, const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority) : OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask) :
LocMsg(), LocMsg(),
mAdapter(adapter), mAdapter(adapter),
mOdcpiCb(callback), mPriority(priority){} mOdcpiCb(callback), mPriority(priority),
mTypeMask(typeMask) {}
inline virtual void proc() const { inline virtual void proc() const {
mAdapter.initOdcpi(mOdcpiCb, mPriority); mAdapter.initOdcpi(mOdcpiCb, mPriority, mTypeMask);
} }
}; };
sendMsg(new MsgInitOdcpi(*this, callback, priority)); sendMsg(new MsgInitOdcpi(*this, callback, priority, typeMask));
}
void GnssAdapter::deRegisterOdcpiCommand(OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask) {
struct MsgDeRegisterNonEsOdcpi : public LocMsg {
GnssAdapter& mAdapter;
OdcpiPrioritytype mPriority;
OdcpiCallbackTypeMask mTypeMask;
inline MsgDeRegisterNonEsOdcpi(GnssAdapter& adapter,
OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask) :
LocMsg(),
mAdapter(adapter),
mPriority(priority),
mTypeMask(typeMask) {}
inline virtual void proc() const {
mAdapter.deRegisterOdcpi(mPriority, mTypeMask);
}
};
sendMsg(new MsgDeRegisterNonEsOdcpi(*this, priority, typeMask));
}
void GnssAdapter::fireOdcpiRequest(const OdcpiRequestInfo& request) {
if (request.isEmergencyMode) {
mOdcpiRequestCb(request);
} else {
std::unordered_map<OdcpiPrioritytype, OdcpiRequestCallback>::iterator iter;
for (int priority = ODCPI_HANDLER_PRIORITY_HIGH;
priority >= ODCPI_HANDLER_PRIORITY_LOW && iter == mNonEsOdcpiReqCbMap.end();
priority--) {
iter = mNonEsOdcpiReqCbMap.find((OdcpiPrioritytype)priority);
}
if (iter != mNonEsOdcpiReqCbMap.end()) {
iter->second(request);
}
}
} }
void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback, void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority) OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask) {
{ if (typeMask & EMERGENCY_ODCPI) {
LOC_LOGd("In priority: %d, Curr priority: %d", priority, mCallbackPriority); LOC_LOGd("In priority: %d, Curr priority: %d", priority, mCallbackPriority);
if (priority >= mCallbackPriority) { if (priority >= mCallbackPriority) {
mOdcpiRequestCb = callback; mOdcpiRequestCb = callback;
@ -5254,6 +5295,13 @@ void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback,
LOC_REGISTRATION_MASK_ENABLED); LOC_REGISTRATION_MASK_ENABLED);
} }
} }
if (typeMask & NON_EMERGENCY_ODCPI) {
//If this is for non emergency odcpi,
//Only set callback to mNonEsOdcpiReqCbMap according to its priority
//Will overwrite callback with same priority in this map
mNonEsOdcpiReqCbMap[priority] = callback;
}
}
void GnssAdapter::injectOdcpiCommand(const Location& location) void GnssAdapter::injectOdcpiCommand(const Location& location)
{ {
@ -5373,7 +5421,7 @@ void GnssAdapter::odcpiTimerExpire()
// if ODCPI request is still active after timer // if ODCPI request is still active after timer
// expires, request again and restart timer // expires, request again and restart timer
if (mOdcpiStateMask & ODCPI_REQ_ACTIVE) { if (mOdcpiStateMask & ODCPI_REQ_ACTIVE) {
mOdcpiRequestCb(mOdcpiRequest); fireOdcpiRequest(mOdcpiRequest);
mOdcpiTimer.restart(); mOdcpiTimer.restart();
} else { } else {
mOdcpiTimer.stop(); mOdcpiTimer.stop();

View file

@ -79,6 +79,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <loc_misc_utils.h> #include <loc_misc_utils.h>
#include <queue> #include <queue>
#include <NativeAgpsHandler.h> #include <NativeAgpsHandler.h>
#include <unordered_map>
#define MAX_URL_LEN 256 #define MAX_URL_LEN 256
#define NMEA_SENTENCE_MAX_LENGTH 200 #define NMEA_SENTENCE_MAX_LENGTH 200
@ -303,6 +304,7 @@ class GnssAdapter : public LocAdapterBase {
OdcpiPrioritytype mCallbackPriority; OdcpiPrioritytype mCallbackPriority;
OdcpiTimer mOdcpiTimer; OdcpiTimer mOdcpiTimer;
OdcpiRequestInfo mOdcpiRequest; OdcpiRequestInfo mOdcpiRequest;
std::unordered_map<OdcpiPrioritytype, OdcpiRequestCallback> mNonEsOdcpiReqCbMap;
void odcpiTimerExpire(); void odcpiTimerExpire();
std::function<void(const Location&)> mAddressRequestCb; std::function<void(const Location&)> mAddressRequestCb;
@ -344,8 +346,16 @@ class GnssAdapter : public LocAdapterBase {
int totalSvCntInThisConstellation); int totalSvCntInThisConstellation);
/* ======== UTILITIES ================================================================== */ /* ======== UTILITIES ================================================================== */
inline void initOdcpi(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); inline void initOdcpi(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask);
inline void deRegisterOdcpi(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask) {
if (typeMask & NON_EMERGENCY_ODCPI) {
mNonEsOdcpiReqCbMap.erase(priority);
}
}
inline void injectOdcpi(const Location& location); inline void injectOdcpi(const Location& location);
void fireOdcpiRequest(const OdcpiRequestInfo& request);
inline void setAddressRequestCb(const std::function<void(const Location&)>& addressRequestCb) inline void setAddressRequestCb(const std::function<void(const Location&)>& addressRequestCb)
{ mAddressRequestCb = addressRequestCb;} { mAddressRequestCb = addressRequestCb;}
inline void injectLocationAndAddr(const Location& location, const GnssCivicAddress& addr) inline void injectLocationAndAddr(const Location& location, const GnssCivicAddress& addr)
@ -523,7 +533,10 @@ public:
/* ========= ODCPI ===================================================================== */ /* ========= ODCPI ===================================================================== */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
void initOdcpiCommand(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); void initOdcpiCommand(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask);
void deRegisterOdcpiCommand(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask);
void injectOdcpiCommand(const Location& location); void injectOdcpiCommand(const Location& location);
void setAddressRequestCbCommand(const std::function<void(const Location&)>& addressRequestCb); void setAddressRequestCbCommand(const std::function<void(const Location&)>& addressRequestCb);
void injectLocationAndAddrCommand(const Location& location, const GnssCivicAddress& addr); void injectLocationAndAddrCommand(const Location& location, const GnssCivicAddress& addr);

View file

@ -27,6 +27,42 @@
* *
*/ */
/*
Changes from Qualcomm Innovation Center are provided under the following license:
Copyright (c) 2022, 2023 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.
*/
#include "GnssAdapter.h" #include "GnssAdapter.h"
#include "location_interface.h" #include "location_interface.h"
@ -75,7 +111,9 @@ static void enableNfwLocationAccess(std::vector<std::string>& enabledNfws);
static void nfwInit(const NfwCbInfo& cbInfo); static void nfwInit(const NfwCbInfo& cbInfo);
static void getPowerStateChanges(std::function<void(bool)> powerStateCb); static void getPowerStateChanges(std::function<void(bool)> powerStateCb);
static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask);
static void deRegisterOdcpi(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask);
static void odcpiInject(const Location& location); static void odcpiInject(const Location& location);
static void blockCPI(double latitude, double longitude, float accuracy, static void blockCPI(double latitude, double longitude, float accuracy,
@ -142,6 +180,7 @@ static const GnssInterface gGnssInterface = {
getDebugReport, getDebugReport,
updateConnectionStatus, updateConnectionStatus,
odcpiInit, odcpiInit,
deRegisterOdcpi,
odcpiInject, odcpiInject,
blockCPI, blockCPI,
getGnssEnergyConsumed, getGnssEnergyConsumed,
@ -404,10 +443,17 @@ static void updateConnectionStatus(bool connected, int8_t type,
} }
} }
static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority) static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask)
{ {
if (NULL != gGnssAdapter) { if (NULL != gGnssAdapter) {
gGnssAdapter->initOdcpiCommand(callback, priority); gGnssAdapter->initOdcpiCommand(callback, priority, typeMask);
}
}
static void deRegisterOdcpi(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask) {
if (NULL != gGnssAdapter) {
gGnssAdapter->deRegisterOdcpiCommand(priority, typeMask);
} }
} }

View file

@ -25,6 +25,42 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* 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, 2023 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_LocationAPI" #define LOG_TAG "LocSvc_LocationAPI"

View file

@ -2097,6 +2097,20 @@ enum GnssNmeaTypesMask {
NMEA_TYPE_ALL = 0xffffffff, NMEA_TYPE_ALL = 0xffffffff,
}; };
/* Specify the Geodetic datum for NMEA sentence types that
* are generated by GNSS stack on HLOS.
*
* Please note that this setting is only applicable if
* NMEA_PROVIDER in gps.conf is set to 0 to use HLOS
* generated NMEA. */
enum GnssGeodeticDatumType {
// Geodetic datum defined in World Geodetic System 1984 (WGS84) format.
GEODETIC_TYPE_WGS_84 = 0,
// Geodetic datum defined for use in the GLONASS system.
GEODETIC_TYPE_PZ_90 = 1,
};
/* Provides the capabilities of the system /* Provides the capabilities of the system
capabilities callback is called once soon after createInstance is called */ capabilities callback is called once soon after createInstance is called */
typedef std::function<void( typedef std::function<void(
@ -2331,4 +2345,11 @@ enum PowerStateType {
}; };
enum {
NON_EMERGENCY_ODCPI = (1<<0),
EMERGENCY_ODCPI = (1<<1)
} OdcpiCallbackTypeMaskBits;
typedef uint16_t OdcpiCallbackTypeMask;
#endif /* LOCATIONDATATYPES_H */ #endif /* LOCATIONDATATYPES_H */

View file

@ -26,6 +26,41 @@
* 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, 2023 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 LOCATION_INTERFACE_H #ifndef LOCATION_INTERFACE_H
#define LOCATION_INTERFACE_H #define LOCATION_INTERFACE_H
@ -79,7 +114,9 @@ struct GnssInterface {
void (*getDebugReport)(GnssDebugReport& report); void (*getDebugReport)(GnssDebugReport& report);
void (*updateConnectionStatus)(bool connected, int8_t type, bool roaming, void (*updateConnectionStatus)(bool connected, int8_t type, bool roaming,
NetworkHandle networkHandle, std::string& apn); NetworkHandle networkHandle, std::string& apn);
void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority,
OdcpiCallbackTypeMask typeMask);
void (*deRegisterOdcpi)(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask);
void (*odcpiInject)(const Location& location); void (*odcpiInject)(const Location& location);
void (*blockCPI)(double latitude, double longitude, float accuracy, void (*blockCPI)(double latitude, double longitude, float accuracy,
int blockDurationMsec, double latLonDiffThreshold); int blockDurationMsec, double latLonDiffThreshold);

View file

@ -2366,10 +2366,17 @@ typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallbac
/* ODCPI callback priorities*/ /* ODCPI callback priorities*/
enum OdcpiPrioritytype { enum OdcpiPrioritytype {
//ODCPI callback registered by AFW via IGNSS AIDL has LOW priority
ODCPI_HANDLER_PRIORITY_LOW, ODCPI_HANDLER_PRIORITY_LOW,
ODCPI_HANDLER_PRIORITY_DEFAULT = ODCPI_HANDLER_PRIORITY_LOW,
//ODCPI callback registered by IzatProvider on LE/KaiOS has medium priority
ODCPI_HANDLER_PRIORITY_MEDIUM,
//Non emergency ODCPI callback registered by IzatManager for RTT position injection
//has high priority
ODCPI_HANDLER_PRIORITY_HIGH ODCPI_HANDLER_PRIORITY_HIGH
}; };
/* /*
* Callback with AGNSS(IpV4) status information. * Callback with AGNSS(IpV4) status information.
* *