SUPL-2.0-con-034-1/2 test case fails

SUPL-2.0-con-034-1/2 Fail because Emergency-NI
did not check inprogress session

Change-Id: I377955c455830bf3bb7cb7fe05d45c4536dabfbc
CRs-fixed: 2483780
This commit is contained in:
Mike Cailean 2019-07-03 17:55:17 -07:00 committed by Gerrit - the friendly Code Review server
parent 8cb4f9cf02
commit 1608ffb38b
7 changed files with 64 additions and 20 deletions

View file

@ -154,7 +154,9 @@ bool LocAdapterBase::
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
requestNiNotifyEvent(const GnssNiNotification &/*notify*/,
const void* /*data*/,
const LocInEmergency emergencyState)
DEFAULT_IMPL(false)
void LocAdapterBase::

View file

@ -171,7 +171,8 @@ public:
virtual bool requestATL(int connHandle, LocAGpsType agps_type,
LocApnTypeMask apn_type_mask);
virtual bool releaseATL(int connHandle);
virtual bool requestNiNotifyEvent(const GnssNiNotification &notify, const void* data);
virtual bool requestNiNotifyEvent(const GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState);
inline virtual bool isInSession() { return false; }
ContextBase* getContext() const { return mContext; }
virtual void reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,

View file

@ -514,10 +514,14 @@ void LocApiBase::releaseATL(int connHandle)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle));
}
void LocApiBase::requestNiNotify(GnssNiNotification &notify, const void* data)
void LocApiBase::requestNiNotify(GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState)
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
TO_1ST_HANDLING_LOCADAPTERS(
mLocAdapters[i]->requestNiNotifyEvent(notify,
data,
emergencyState));
}
void* LocApiBase :: getSibling()

View file

@ -177,7 +177,8 @@ public:
void requestLocation();
void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
void releaseATL(int connHandle);
void requestNiNotify(GnssNiNotification &notify, const void* data);
void requestNiNotify(GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState);
void reportGnssMeasurements(GnssMeasurements& gnssMeasurements, int msInWeek);
void reportWwanZppFix(LocGpsLocation &zppLoc);
void reportZppBestAvailableFix(LocGpsLocation &zppLoc, GpsLocationExtended &location_extended,

View file

@ -3508,7 +3508,8 @@ GnssAdapter::reportData(GnssDataNotification& dataNotify)
}
bool
GnssAdapter::requestNiNotifyEvent(const GnssNiNotification &notify, const void* data)
GnssAdapter::requestNiNotifyEvent(const GnssNiNotification &notify, const void* data,
const LocInEmergency emergencyState)
{
LOC_LOGI("%s]: notif_type: %d, timeout: %d, default_resp: %d"
"requestor_id: %s (encoding: %d) text: %s text (encoding: %d) extras: %s",
@ -3521,37 +3522,49 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification &notify, const void*
LocApiBase& mApi;
const GnssNiNotification mNotify;
const void* mData;
const LocInEmergency mEmergencyState;
inline MsgReportNiNotify(GnssAdapter& adapter,
LocApiBase& api,
const GnssNiNotification& notify,
const void* data) :
const void* data,
const LocInEmergency emergencyState) :
LocMsg(),
mAdapter(adapter),
mApi(api),
mNotify(notify),
mData(data) {}
mData(data),
mEmergencyState(emergencyState) {}
inline virtual void proc() const {
bool bIsInEmergency = false;
bool bInformNiAccept = false;
bIsInEmergency = ((LOC_IN_EMERGENCY_UNKNOWN == mEmergencyState) &&
mAdapter.getE911State()) || // older modems
(LOC_IN_EMERGENCY_SET == mEmergencyState); // newer modems
if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type) {
if (mAdapter.getE911State() ||
(GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES)) {
mApi.informNiResponse(GNSS_NI_RESPONSE_ACCEPT, mData);
bInformNiAccept = bIsInEmergency ||
(GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES);
if (bInformNiAccept) {
mAdapter.requestNiNotify(mNotify, mData, bInformNiAccept);
} else {
mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData);
}
} else if (GNSS_NI_TYPE_CONTROL_PLANE == mNotify.type) {
if (mAdapter.getE911State() &&
(1 == ContextBase::mGps_conf.CP_MTLR_ES)) {
if (bIsInEmergency && (1 == ContextBase::mGps_conf.CP_MTLR_ES)) {
mApi.informNiResponse(GNSS_NI_RESPONSE_ACCEPT, mData);
} else {
mAdapter.requestNiNotify(mNotify, mData);
}
else {
mAdapter.requestNiNotify(mNotify, mData, false);
}
} else {
mAdapter.requestNiNotify(mNotify, mData);
mAdapter.requestNiNotify(mNotify, mData, false);
}
}
};
sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data));
sendMsg(new MsgReportNiNotify(*this, *mLocApi, notify, data, emergencyState));
return true;
}
@ -3674,7 +3687,8 @@ static void* niThreadProc(void *args)
}
bool
GnssAdapter::requestNiNotify(const GnssNiNotification& notify, const void* data)
GnssAdapter::requestNiNotify(const GnssNiNotification& notify, const void* data,
const bool bInformNiAccept)
{
NiSession* pSession = NULL;
gnssNiCallback gnssNiCb = nullptr;
@ -3686,6 +3700,20 @@ GnssAdapter::requestNiNotify(const GnssNiNotification& notify, const void* data)
}
}
if (nullptr == gnssNiCb) {
if (GNSS_NI_TYPE_EMERGENCY_SUPL == notify.type) {
if (bInformNiAccept) {
mLocApi->informNiResponse(GNSS_NI_RESPONSE_ACCEPT, data);
NiData& niData = getNiData();
// ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
if (NULL != niData.session.rawRequest) {
pthread_mutex_lock(&niData.session.tLock);
niData.session.resp = GNSS_NI_RESPONSE_IGNORE;
niData.session.respRecvd = true;
pthread_cond_signal(&niData.session.tCond);
pthread_mutex_unlock(&niData.session.tLock);
}
}
}
EXIT_LOG(%s, "no clients with gnssNiCb.");
return false;
}

View file

@ -359,7 +359,8 @@ public:
bool fromEngineHub=false);
virtual void reportNmeaEvent(const char* nmea, size_t length);
virtual void reportDataEvent(const GnssDataNotification& dataNotify, int msInWeek);
virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data);
virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data,
const LocInEmergency emergencyState);
virtual void reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurements,
int msInWeek);
virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
@ -389,7 +390,8 @@ public:
void reportSv(GnssSvNotification& svNotify);
void reportNmea(const char* nmea, size_t length);
void reportData(GnssDataNotification& dataNotify);
bool requestNiNotify(const GnssNiNotification& notify, const void* data);
bool requestNiNotify(const GnssNiNotification& notify, const void* data,
const bool bInformNiAccept);
void reportGnssMeasurementData(const GnssMeasurementsNotification& measurements);
void reportGnssSvIdConfig(const GnssSvIdConfig& config);
void reportGnssSvTypeConfig(const GnssSvTypeConfig& config);

View file

@ -457,6 +457,12 @@ typedef enum {
LOC_RELIABILITY_HIGH = 4
}LocReliability;
typedef enum {
LOC_IN_EMERGENCY_UNKNOWN = 0,
LOC_IN_EMERGENCY_SET = 1,
LOC_IN_EMERGENCY_NOT_SET = 2
}LocInEmergency;
typedef struct {
struct timespec32_t apTimeStamp;
/*boottime received from pps-ktimer*/