diff options
author | qctecmdr <qctecmdr@localhost> | 2020-12-19 19:57:16 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-12-19 19:57:16 -0800 |
commit | 5c4f7f8c19024886049d63fad25b8ee40bca926d (patch) | |
tree | 458d744b039b65f6b72018b249fc1760db1ee9aa | |
parent | 79cbbb3d2d17f89d98ab8ca1b95648dd32a128b3 (diff) | |
parent | 18e36f9f421caab6c2c886b93e4dc98b9ff8ed61 (diff) |
Merge "Send SUPL notification to the framework for E911 sessions only (older modems)"
-rw-r--r-- | gnss/GnssAdapter.cpp | 52 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 11 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 6 |
3 files changed, 61 insertions, 8 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 116505c..bd36e90 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -122,7 +122,8 @@ GnssAdapter::GnssAdapter() : mLocSystemInfo{}, mGnssMbSvIdUsedInPosition{}, mGnssMbSvIdUsedInPosAvail(false), - mPowerState(POWER_STATE_UNKNOWN) + mPowerState(POWER_STATE_UNKNOWN), + mIsE911Session(NULL) { LOC_LOGD("%s]: Constructor %p", __func__, this); mLocPositionMode.mode = LOC_POSITION_MODE_INVALID; @@ -2403,6 +2404,10 @@ GnssAdapter::stopClientSessions(LocationAPI* client) } +bool isInEmergencySession() { + return false; +} + void GnssAdapter::updateClientsEventMask() { @@ -2416,9 +2421,6 @@ GnssAdapter::updateClientsEventMask() it->second.engineLocationsInfoCb != nullptr) { mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT; } - if (it->second.gnssNiCb != nullptr) { - mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; - } if (it->second.gnssSvCb != nullptr) { mask |= LOC_API_ADAPTER_BIT_SATELLITE_REPORT; } @@ -2466,6 +2468,15 @@ GnssAdapter::updateClientsEventMask() mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI; } + // always register for NI NOTIFY VERIFY to handle internally in HAL + mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; + // and register callback + + NfwCbInfo cbInfo = {}; + cbInfo.isInEmergencySession = (void*)isInEmergencySession; + + initNfw(cbInfo); + // Enable the latency report if (mask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT) { if (mLogger.isLogEnabled()) { @@ -4201,21 +4212,36 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* struct MsgReportNiNotify : public LocMsg { GnssAdapter& mAdapter; + LocApiBase& mApi; const GnssNiNotification mNotify; const void* mData; inline MsgReportNiNotify(GnssAdapter& adapter, + LocApiBase& api, const GnssNiNotification& notify, const void* data) : LocMsg(), mAdapter(adapter), + mApi(api), mNotify(notify), mData(data) {} inline virtual void proc() const { - mAdapter.requestNiNotify(mNotify, mData); + if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type || + GNSS_NI_TYPE_CONTROL_PLANE == mNotify.type) { + if (mAdapter.getE911State() || + ((GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES) && + (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type))) { + mApi.informNiResponse(GNSS_NI_RESPONSE_ACCEPT, mData); + } + else { + mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData); + } + } else { + mAdapter.requestNiNotify(mNotify, mData); + } } }; - sendMsg(new MsgReportNiNotify(*this, notify, data)); + sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data)); return true; } @@ -4799,9 +4825,19 @@ void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) { mAgpsManager.createAgpsStateMachines(); + LOC_API_ADAPTER_EVENT_MASK_T mask; + // always register for NI NOTIFY VERIFY to handle internally in HAL + mask = LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST | + LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST; + // and register callback + + NfwCbInfo cbInfo = {}; + cbInfo.isInEmergencySession = (void*)isInEmergencySession; + + initNfw(cbInfo); + /* Register for AGPS event mask */ - updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST, - LOC_REGISTRATION_MASK_ENABLED); + updateEvtMask(mask, LOC_REGISTRATION_MASK_ENABLED); } } diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 73a5a3b..04d0299 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -233,6 +233,11 @@ class GnssAdapter : public LocAdapterBase { bool mDGnssNeedReport; bool mDGnssDataUsage; void reportDGnssDataUsable(GnssSvMeasurementSet &svMeasurementSet); + /* ==== NFW =========================================================================== */ + IsInEmergencySession mIsE911Session; + inline void initNfw(const NfwCbInfo& cbInfo) { + mIsE911Session = (IsInEmergencySession)cbInfo.isInEmergencySession; + } /* ==== ODCPI ========================================================================== */ OdcpiRequestCallback mOdcpiRequestCb; @@ -512,6 +517,12 @@ public: void saveGnssEnergyConsumedCallback(GnssEnergyConsumedCallback energyConsumedCb); void reportLocationSystemInfo(const LocationSystemInfo & locationSystemInfo); void updatePowerState(PowerStateType powerState); + inline bool getE911State(void) { + if (NULL != mIsE911Session) { + return mIsE911Session(); + } + return false; + } /*======== GNSSDEBUG ================================================================*/ bool getDebugReport(GnssDebugReport& report); diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 691822a..99bae91 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -2267,6 +2267,12 @@ enum OdcpiPrioritytype { */ typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status); +typedef bool(*IsInEmergencySession)(void); + +typedef struct { + void* isInEmergencySession; +} NfwCbInfo; + /* * Callback with AGNSS(IpV6) status information. * |