Merge "Merge remote-tracking branch 'quic/location.lnx.4.0' into HEAD"

This commit is contained in:
qctecmdr Service 2019-03-18 06:13:41 -07:00 committed by Gerrit - the friendly Code Review server
commit a7953cd7ea
23 changed files with 653 additions and 388 deletions

View file

@ -90,6 +90,17 @@ public:
(void) systemInfo; (void) systemInfo;
return false; return false;
} }
inline virtual bool gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel& ionoModel) {
(void) ionoModel;
return false;
}
inline virtual bool gnssReportAdditionalSystemInfo(
const GnssAdditionalSystemInfo& additionalSystemInfo) {
(void) additionalSystemInfo;
return false;
}
}; };
typedef std::function<void(const UlpLocation& ulpLocation, typedef std::function<void(const UlpLocation& ulpLocation,

View file

@ -191,4 +191,12 @@ DEFAULT_IMPL(false)
bool LocAdapterBase:: bool LocAdapterBase::
reportDeleteAidingDataEvent(GnssAidingData & /*aidingData*/) reportDeleteAidingDataEvent(GnssAidingData & /*aidingData*/)
DEFAULT_IMPL(false) DEFAULT_IMPL(false)
bool LocAdapterBase::
reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& /*ionoModel*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportGnssAdditionalSystemInfoEvent(GnssAdditionalSystemInfo& /*additionalSystemInfo*/)
DEFAULT_IMPL(false)
} // namespace loc_core } // namespace loc_core

View file

@ -168,6 +168,9 @@ public:
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request); virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot); virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
virtual bool reportDeleteAidingDataEvent(GnssAidingData &aidingData); virtual bool reportDeleteAidingDataEvent(GnssAidingData &aidingData);
virtual bool reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& ionoModel);
virtual bool reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo& additionalSystemInfo);
}; };
} // namespace loc_core } // namespace loc_core

View file

@ -380,6 +380,16 @@ void LocApiBase::reportDeleteAidingDataEvent(GnssAidingData& aidingData) {
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDeleteAidingDataEvent(aidingData)); TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDeleteAidingDataEvent(aidingData));
} }
void LocApiBase::reportKlobucharIonoModel(GnssKlobucharIonoModel & ionoModel) {
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportKlobucharIonoModelEvent(ionoModel));
}
void LocApiBase::reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo) {
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportGnssAdditionalSystemInfoEvent(
additionalSystemInfo));
}
void LocApiBase::reportSv(GnssSvNotification& svNotify) void LocApiBase::reportSv(GnssSvNotification& svNotify)
{ {

View file

@ -187,6 +187,8 @@ public:
void requestOdcpi(OdcpiRequestInfo& request); void requestOdcpi(OdcpiRequestInfo& request);
void reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot); void reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
void reportDeleteAidingDataEvent(GnssAidingData& aidingData); void reportDeleteAidingDataEvent(GnssAidingData& aidingData);
void reportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel);
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
// downward calls // downward calls
// All below functions are to be defined by adapter specific modules: // All below functions are to be defined by adapter specific modules:

View file

@ -681,45 +681,36 @@ GnssAdapter::setConfigCommand()
mApi.sendMsg(new LocApiMsg( mApi.sendMsg(new LocApiMsg(
[&adapter, gpsConf, sapConf, oldServerUrl, oldMoServerUrl] () { [&adapter, gpsConf, sapConf, oldServerUrl, oldMoServerUrl] () {
//cache the injected configuration with GnssConfigRequested struct
std::string serverUrl = adapter.getServerUrl(); GnssConfig gnssConfigRequested = {};
std::string moServerUrl = adapter.getMoServerUrl(); gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT |
int serverUrlLen = serverUrl.length(); GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT |
int moServerUrlLen = moServerUrl.length(); GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT |
GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
if (0 == adapter.getPowerVoteId()) {
gnssConfigRequested.gpsLock = adapter.convertGpsLock(gpsConf.GPS_LOCK);
}
if (gpsConf.AGPS_CONFIG_INJECT) { if (gpsConf.AGPS_CONFIG_INJECT) {
adapter.mLocApi->setSUPLVersionSync( gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
adapter.mLocApi->convertSuplVersion(gpsConf.SUPL_VER)); GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
adapter.mLocApi->setLPPConfigSync( GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT;
adapter.mLocApi->convertLppProfile(gpsConf.LPP_PROFILE)); gnssConfigRequested.suplVersion =
adapter.mLocApi->setAGLONASSProtocolSync( adapter.mLocApi->convertSuplVersion(gpsConf.SUPL_VER);
gpsConf.A_GLONASS_POS_PROTOCOL_SELECT); gnssConfigRequested.lppProfile =
adapter.mLocApi->convertLppProfile(gpsConf.LPP_PROFILE);
gnssConfigRequested.aGlonassPositionProtocolMask =
gpsConf.A_GLONASS_POS_PROTOCOL_SELECT;
} }
gnssConfigRequested.lppeControlPlaneMask =
if ((serverUrlLen !=0) && (oldServerUrl.compare(serverUrl) != 0)) { adapter.mLocApi->convertLppeCp(gpsConf.LPPE_CP_TECHNOLOGY);
LocationError locErr = gnssConfigRequested.lppeUserPlaneMask =
adapter.mLocApi->setServerSync(serverUrl.c_str(), serverUrlLen, adapter.mLocApi->convertLppeUp(gpsConf.LPPE_UP_TECHNOLOGY);
LOC_AGPS_SUPL_SERVER); gnssConfigRequested.blacklistedSvIds.assign(adapter.mBlacklistedSvIds.begin(),
if (locErr != LOCATION_ERROR_SUCCESS) { adapter.mBlacklistedSvIds.end());
LOC_LOGe("Error while setting SUPL_HOST server:%s", adapter.gnssUpdateConfig(oldServerUrl, oldMoServerUrl, gnssConfigRequested,
serverUrl.c_str()); gnssConfigRequested);
}
}
if ((moServerUrlLen != 0) && (oldMoServerUrl.compare(moServerUrl) != 0)) {
LocationError locErr =
adapter.mLocApi->setServerSync(moServerUrl.c_str(),
moServerUrlLen,
LOC_AGPS_MO_SUPL_SERVER);
if (locErr != LOCATION_ERROR_SUCCESS) {
LOC_LOGe("Error while setting MO SUPL_HOST server:%s",
moServerUrl.c_str());
}
}
adapter.mLocApi->setLPPeProtocolCpSync(
adapter.mLocApi->convertLppeCp(gpsConf.LPPE_CP_TECHNOLOGY));
adapter.mLocApi->setLPPeProtocolUpSync(
adapter.mLocApi->convertLppeUp(gpsConf.LPPE_UP_TECHNOLOGY));
// set nmea mask type // set nmea mask type
uint32_t mask = 0; uint32_t mask = 0;
@ -778,6 +769,180 @@ GnssAdapter::setConfigCommand()
sendMsg(new MsgSetConfig(*this, *mLocApi)); sendMsg(new MsgSetConfig(*this, *mLocApi));
} }
std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldServerUrl,
const std::string& oldMoServerUrl, const GnssConfig& gnssConfigRequested,
const GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
size_t index = 0;
LocationError err = LOCATION_ERROR_SUCCESS;
std::vector<LocationError> errsList = {err};
if (count > 0) {
errsList.insert(errsList.begin(), count, LOCATION_ERROR_SUCCESS);
}
std::string serverUrl = getServerUrl();
std::string moServerUrl = getMoServerUrl();
int serverUrlLen = serverUrl.length();
int moServerUrlLen = moServerUrl.length();
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
err = mLocApi->setGpsLockSync(gnssConfigRequested.gpsLock);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags &
GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
GNSS_ASSISTANCE_TYPE_SUPL) {
if ((serverUrlLen != 0) && (oldServerUrl.compare(serverUrl) !=0)) {
err = mLocApi->setServerSync(
serverUrl.c_str(), serverUrlLen, LOC_AGPS_SUPL_SERVER);
if (index < count) {
errsList[index] = err;
}
}
if ((moServerUrlLen != 0) && (oldMoServerUrl.compare(moServerUrl) != 0)) {
LocationError locErr =
mLocApi->setServerSync(moServerUrl.c_str(),
moServerUrlLen,
LOC_AGPS_MO_SUPL_SERVER);
if (locErr != LOCATION_ERROR_SUCCESS) {
LOC_LOGe("Error while setting MO SUPL_HOST server:%s",
moServerUrl.c_str());
}
}
} else if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
GNSS_ASSISTANCE_TYPE_C2K) {
struct in_addr addr;
struct hostent* hp;
bool resolveAddrSuccess = true;
hp = gethostbyname(
gnssConfigNeedEngineUpdate.assistanceServer.hostName);
if (hp != NULL) { /* DNS OK */
memcpy(&addr, hp->h_addr_list[0], hp->h_length);
} else {
/* Try IP representation */
if (inet_aton(
gnssConfigNeedEngineUpdate.assistanceServer.hostName,
&addr) == 0) {
/* IP not valid */
LOC_LOGE("%s]: hostname '%s' cannot be resolved ",
__func__,
gnssConfigNeedEngineUpdate.assistanceServer.hostName);
if (index < count) {
errsList[index] = LOCATION_ERROR_INVALID_PARAMETER;
}
} else {
resolveAddrSuccess = false;
}
}
if (resolveAddrSuccess) {
unsigned int ip = htonl(addr.s_addr);
err = mLocApi->setServerSync(ip,
gnssConfigNeedEngineUpdate.assistanceServer.port,
LOC_AGPS_CDMA_PDE_SERVER);
if (index < count) {
errsList[index] = err;
}
}
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
err = mLocApi->setSUPLVersionSync(gnssConfigRequested.suplVersion);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
err = mLocApi->setLPPConfigSync(gnssConfigRequested.lppProfile);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
err = mLocApi->setLPPeProtocolCpSync(
gnssConfigRequested.lppeControlPlaneMask);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
err = mLocApi->setLPPeProtocolUpSync(
gnssConfigRequested.lppeUserPlaneMask);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags &
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
err = mLocApi->setAGLONASSProtocolSync(
gnssConfigRequested.aGlonassPositionProtocolMask);
if (index < count) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
// Check if feature is supported
if (!ContextBase::isFeatureSupported(
LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
LOC_LOGe("Feature constellation enablement not supported.");
err = LOCATION_ERROR_NOT_SUPPORTED;
} else {
// Send the SV ID Config to Modem
mBlacklistedSvIds.assign(gnssConfigRequested.blacklistedSvIds.begin(),
gnssConfigRequested.blacklistedSvIds.end());
err = gnssSvIdConfigUpdateSync(gnssConfigRequested.blacklistedSvIds);
if (LOCATION_ERROR_SUCCESS != err) {
LOC_LOGe("Failed to send config to modem, err %d", err);
}
}
if (index < count) {
errsList[index] = err;
}
index++;
}
return errsList;
}
uint32_t* uint32_t*
GnssAdapter::gnssUpdateConfigCommand(GnssConfig config) GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
{ {
@ -846,13 +1011,14 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) { if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
uint32_t newGpsLock = mAdapter.convertGpsLock(gnssConfigRequested.gpsLock); uint32_t newGpsLock = mAdapter.convertGpsLock(gnssConfigRequested.gpsLock);
ContextBase::mGps_conf.GPS_LOCK = newGpsLock; if (0 == newGpsLock) {
if (0 == ContextBase::mGps_conf.GPS_LOCK) { newGpsLock = 3;
ContextBase::mGps_conf.GPS_LOCK = 3;
} }
if (0 != mAdapter.getPowerVoteId()) { if (newGpsLock == ContextBase::mGps_conf.GPS_LOCK ||
0 != mAdapter.getPowerVoteId()) {
gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT); gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
} }
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
index++; index++;
} }
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) { if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
@ -961,148 +1127,11 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
mApi.sendMsg(new LocApiMsg( mApi.sendMsg(new LocApiMsg(
[&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate, [&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate,
countOfConfigs, configCollectiveResponse, errs, oldServerUrl] () { countOfConfigs, configCollectiveResponse, errs, oldServerUrl] () {
size_t index = 0;
LocationError err = LOCATION_ERROR_SUCCESS;
std::vector<LocationError> errsList(errs);
std::string serverUrl = adapter.getServerUrl(); std::string serverUrl = adapter.getServerUrl();
int serverUrlLen = serverUrl.length(); int serverUrlLen = serverUrl.length();
std::vector<LocationError> errsList = adapter.gnssUpdateConfig(oldServerUrl,
"", gnssConfigRequested, gnssConfigNeedEngineUpdate, countOfConfigs);
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
err = adapter.mLocApi->setGpsLockSync(gnssConfigRequested.gpsLock);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags &
GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
GNSS_ASSISTANCE_TYPE_SUPL) {
if ((serverUrlLen != 0) && (oldServerUrl.compare(serverUrl) !=0)) {
err = adapter.mLocApi->setServerSync(
serverUrl.c_str(), serverUrlLen, LOC_AGPS_SUPL_SERVER);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
} else if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
GNSS_ASSISTANCE_TYPE_C2K) {
struct in_addr addr;
struct hostent* hp;
bool resolveAddrSuccess = true;
hp = gethostbyname(
gnssConfigNeedEngineUpdate.assistanceServer.hostName);
if (hp != NULL) { /* DNS OK */
memcpy(&addr, hp->h_addr_list[0], hp->h_length);
} else {
/* Try IP representation */
if (inet_aton(
gnssConfigNeedEngineUpdate.assistanceServer.hostName,
&addr) == 0) {
/* IP not valid */
LOC_LOGE("%s]: hostname '%s' cannot be resolved ",
__func__,
gnssConfigNeedEngineUpdate.assistanceServer.hostName);
if (index < countOfConfigs) {
errsList[index] = LOCATION_ERROR_INVALID_PARAMETER;
}
} else {
resolveAddrSuccess = false;
}
}
if (resolveAddrSuccess) {
unsigned int ip = htonl(addr.s_addr);
err = adapter.mLocApi->setServerSync(ip,
gnssConfigNeedEngineUpdate.assistanceServer.port,
LOC_AGPS_CDMA_PDE_SERVER);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
err = adapter.mLocApi->setSUPLVersionSync(gnssConfigRequested.suplVersion);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
err = adapter.mLocApi->setLPPConfigSync(gnssConfigRequested.lppProfile);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
err = adapter.mLocApi->setLPPeProtocolCpSync(
gnssConfigRequested.lppeControlPlaneMask);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
err = adapter.mLocApi->setLPPeProtocolUpSync(
gnssConfigRequested.lppeUserPlaneMask);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags &
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.flags &
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
err = adapter.mLocApi->setAGLONASSProtocolSync(
gnssConfigRequested.aGlonassPositionProtocolMask);
if (index < countOfConfigs) {
errsList[index] = err;
}
}
index++;
}
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT) {
// Check if feature is supported
if (!ContextBase::isFeatureSupported(
LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
LOC_LOGe("Feature constellation enablement not supported.");
err = LOCATION_ERROR_NOT_SUPPORTED;
} else {
// Send the SV ID Config to Modem
err = adapter.gnssSvIdConfigUpdateSync(gnssConfigRequested.blacklistedSvIds);
if (LOCATION_ERROR_SUCCESS != err) {
LOC_LOGe("Failed to send config to modem, err %d", err);
}
}
if (index < countOfConfigs) {
errsList[index] = err;
}
index++;
}
configCollectiveResponse->returnToSender(errsList); configCollectiveResponse->returnToSender(errsList);
})); }));
} }
@ -1938,10 +1967,12 @@ GnssAdapter::updateClientsEventMask()
if((1 == ContextBase::mGps_conf.EXTERNAL_DR_ENABLED) || if((1 == ContextBase::mGps_conf.EXTERNAL_DR_ENABLED) ||
(true == initEngHubProxy())) { (true == initEngHubProxy())) {
mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
mask |= LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT;
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT; mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT; mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT; mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT;
mask |= LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO; mask |= LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO;
mask |= LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
LOC_LOGd("Auto usecase, Enable MEAS/POLY/EPHEMERIS - mask 0x%" PRIx64 "", LOC_LOGd("Auto usecase, Enable MEAS/POLY/EPHEMERIS - mask 0x%" PRIx64 "",
mask); mask);
@ -1999,8 +2030,10 @@ GnssAdapter::restartSessions()
} }
// get the LocationOptions that has the smallest interval, which should be the active one // get the LocationOptions that has the smallest interval, which should be the active one
TrackingOptions smallestIntervalOptions = {}; // size is zero until set for the first time TrackingOptions smallestIntervalOptions; // size is zero until set for the first time
TrackingOptions highestPowerTrackingOptions = {}; TrackingOptions highestPowerTrackingOptions;
memset(&smallestIntervalOptions, 0, sizeof(smallestIntervalOptions));
memset(&highestPowerTrackingOptions, 0, sizeof(highestPowerTrackingOptions));
for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) { for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) {
// size of zero means we havent set it yet // size of zero means we havent set it yet
if (0 == smallestIntervalOptions.size || if (0 == smallestIntervalOptions.size ||
@ -3022,8 +3055,8 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo, loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo,
generate_nmea, nmeaArraystr); generate_nmea, nmeaArraystr);
stringstream ss; stringstream ss;
for (auto sentence : nmeaArraystr) { for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
ss << sentence; ss << *itor;
} }
string s = ss.str(); string s = ss.str();
reportNmea(s.c_str(), s.length()); reportNmea(s.c_str(), s.length());
@ -3118,8 +3151,8 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
std::vector<std::string> nmeaArraystr; std::vector<std::string> nmeaArraystr;
loc_nmea_generate_sv(svNotify, nmeaArraystr); loc_nmea_generate_sv(svNotify, nmeaArraystr);
stringstream ss; stringstream ss;
for (auto sentence : nmeaArraystr) { for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
ss << sentence; ss << *itor;
} }
string s = ss.str(); string s = ss.str();
reportNmea(s.c_str(), s.length()); reportNmea(s.c_str(), s.length());
@ -3587,24 +3620,24 @@ void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
bool GnssAdapter::reportDeleteAidingDataEvent(GnssAidingData& aidingData) bool GnssAdapter::reportDeleteAidingDataEvent(GnssAidingData& aidingData)
{ {
LOC_LOGD("%s]:", __func__); LOC_LOGD("%s]:", __func__);
mEngHubProxy->gnssDeleteAidingData(aidingData);
struct MsgHandleDeleteAidingDataEvent : public LocMsg {
GnssAdapter& mAdapter;
GnssAidingData mData;
inline MsgHandleDeleteAidingDataEvent(GnssAdapter& adapter,
GnssAidingData& data) :
LocMsg(),
mAdapter(adapter),
mData(data) {}
inline virtual void proc() const {
mAdapter.mEngHubProxy->gnssDeleteAidingData(mData);
}
};
sendMsg(new MsgHandleDeleteAidingDataEvent(*this, aidingData));
return true; return true;
} }
bool GnssAdapter::reportKlobucharIonoModelEvent(GnssKlobucharIonoModel & ionoModel)
{
LOC_LOGD("%s]:", __func__);
mEngHubProxy->gnssReportKlobucharIonoModel(ionoModel);
return true;
}
bool GnssAdapter::reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo & additionalSystemInfo)
{
LOC_LOGD("%s]:", __func__);
mEngHubProxy->gnssReportAdditionalSystemInfo(additionalSystemInfo);
return true;
}
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback) void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback)
{ {

View file

@ -175,6 +175,7 @@ class GnssAdapter : public LocAdapterBase {
std::string mMoServerUrl; std::string mMoServerUrl;
XtraSystemStatusObserver mXtraObserver; XtraSystemStatusObserver mXtraObserver;
LocationSystemInfo mLocSystemInfo; LocationSystemInfo mLocSystemInfo;
std::vector<GnssSvIdSource> mBlacklistedSvIds;
/* === Misc ===================================================================== */ /* === Misc ===================================================================== */
BlockCPIInfo mBlockCPIInfo; BlockCPIInfo mBlockCPIInfo;
@ -278,6 +279,9 @@ public:
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data); uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
void deleteAidingData(const GnssAidingData &data, uint32_t sessionId); void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
void gnssUpdateXtraThrottleCommand(const bool enabled); void gnssUpdateXtraThrottleCommand(const bool enabled);
std::vector<LocationError> gnssUpdateConfig(const std::string& oldServerUrl,
const std::string& oldMoServerUrl, const GnssConfig& gnssConfigRequested,
const GnssConfig& gnssConfigNeedEngineUpdate, size_t count = 0);
/* ==== GNSS SV TYPE CONFIG ============================================================ */ /* ==== GNSS SV TYPE CONFIG ============================================================ */
/* ==== COMMANDS ====(Called from Client Thread)======================================== */ /* ==== COMMANDS ====(Called from Client Thread)======================================== */
@ -356,6 +360,9 @@ public:
virtual bool releaseATL(int connHandle); virtual bool releaseATL(int connHandle);
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request); virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
virtual bool reportDeleteAidingDataEvent(GnssAidingData& aidingData); virtual bool reportDeleteAidingDataEvent(GnssAidingData& aidingData);
virtual bool reportKlobucharIonoModelEvent(GnssKlobucharIonoModel& ionoModel);
virtual bool reportGnssAdditionalSystemInfoEvent(
GnssAdditionalSystemInfo& additionalSystemInfo);
/* ======== UTILITIES ================================================================= */ /* ======== UTILITIES ================================================================= */
bool needReport(const UlpLocation& ulpLocation, bool needReport(const UlpLocation& ulpLocation,

View file

@ -219,8 +219,11 @@ void XtraSystemStatusObserver::notify(const list<IDataItemCore*>& dlist)
} }
inline ~HandleOsObserverUpdateMsg() { inline ~HandleOsObserverUpdateMsg() {
for (auto each : mDataItemList) { for (auto itor = mDataItemList.begin(); itor != mDataItemList.end(); ++itor) {
delete each; if (*itor != nullptr) {
delete *itor;
*itor = nullptr;
}
} }
} }

View file

@ -37,13 +37,6 @@
typedef void* (getLocationInterface)(); typedef void* (getLocationInterface)();
typedef uint16_t LocationAdapterTypeMask;
typedef enum {
LOCATION_ADAPTER_GNSS_TYPE_BIT = (1<<0), // adapter type is GNSS
LOCATION_ADAPTER_FLP_TYPE_BIT = (1<<1), // adapter type is FLP
LOCATION_ADAPTER_GEOFENCE_TYPE_BIT = (1<<2) // adapter type is geo fence
} LocationAdapterTypeBits;
typedef struct { typedef struct {
// bit mask of the adpaters that we need to wait for the removeClientCompleteCallback // bit mask of the adpaters that we need to wait for the removeClientCompleteCallback
// before we invoke the registered locationApiDestroyCompleteCallback // before we invoke the registered locationApiDestroyCompleteCallback
@ -129,14 +122,13 @@ static void* loadLocationInterface(const char* library, const char* name)
} }
} }
void onRemoveClientCompleteCb ( void LocationAPI::onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType)
LocationAPI* client, LocationAdapterTypeMask adapterType)
{ {
bool invokeCallback = false; bool invokeCallback = false;
locationApiDestroyCompleteCallback destroyCompleteCb; locationApiDestroyCompleteCallback destroyCompleteCb;
LOC_LOGd("adatper type %x", adapterType); LOC_LOGd("adatper type %x", adapterType);
pthread_mutex_lock(&gDataMutex); pthread_mutex_lock(&gDataMutex);
auto it = gData.destroyClientData.find(client); auto it = gData.destroyClientData.find(this);
if (it != gData.destroyClientData.end()) { if (it != gData.destroyClientData.end()) {
it->second.waitAdapterMask &= ~adapterType; it->second.waitAdapterMask &= ~adapterType;
if (it->second.waitAdapterMask == 0) { if (it->second.waitAdapterMask == 0) {
@ -151,22 +143,24 @@ void onRemoveClientCompleteCb (
LOC_LOGd("invoke client destroy cb"); LOC_LOGd("invoke client destroy cb");
(destroyCompleteCb) (); (destroyCompleteCb) ();
LOC_LOGd("finish invoke client destroy cb"); LOC_LOGd("finish invoke client destroy cb");
delete this;
} }
} }
void onGnssRemoveClientCompleteCb (LocationAPI* client) void onGnssRemoveClientCompleteCb (LocationAPI* client)
{ {
onRemoveClientCompleteCb (client, LOCATION_ADAPTER_GNSS_TYPE_BIT); client->onRemoveClientCompleteCb (LOCATION_ADAPTER_GNSS_TYPE_BIT);
} }
void onFlpRemoveClientCompleteCb (LocationAPI* client) void onFlpRemoveClientCompleteCb (LocationAPI* client)
{ {
onRemoveClientCompleteCb (client, LOCATION_ADAPTER_FLP_TYPE_BIT); client->onRemoveClientCompleteCb (LOCATION_ADAPTER_FLP_TYPE_BIT);
} }
void onGeofenceRemoveClientCompleteCb (LocationAPI* client) void onGeofenceRemoveClientCompleteCb (LocationAPI* client)
{ {
onRemoveClientCompleteCb (client, LOCATION_ADAPTER_GEOFENCE_TYPE_BIT); client->onRemoveClientCompleteCb (LOCATION_ADAPTER_GEOFENCE_TYPE_BIT);
} }
LocationAPI* LocationAPI*
@ -310,6 +304,7 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
pthread_mutex_unlock(&gDataMutex); pthread_mutex_unlock(&gDataMutex);
if (invokeDestroyCb == true) { if (invokeDestroyCb == true) {
(destroyCompleteCb) (); (destroyCompleteCb) ();
delete this;
} }
} }
@ -321,6 +316,7 @@ LocationAPI::LocationAPI()
// private destructor // private destructor
LocationAPI::~LocationAPI() LocationAPI::~LocationAPI()
{ {
LOC_LOGD("LOCATION API DESTRUCTOR");
} }
void void

View file

@ -52,6 +52,8 @@ public:
*/ */
void destroy(locationApiDestroyCompleteCallback destroyCompleteCb=nullptr); void destroy(locationApiDestroyCompleteCallback destroyCompleteCb=nullptr);
void onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType);
/* updates/changes the callbacks that will be called. /* updates/changes the callbacks that will be called.
mandatory callbacks must be present for callbacks to be successfully updated mandatory callbacks must be present for callbacks to be successfully updated
no return value */ no return value */

View file

@ -514,6 +514,22 @@ typedef enum {
GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4), GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4),
} GnssAidingDataSvTypeBits; } GnssAidingDataSvTypeBits;
/* Gnss constellation type mask */
typedef uint16_t GnssConstellationTypeMask;
typedef enum {
GNSS_CONSTELLATION_TYPE_GPS_BIT = (1<<0),
GNSS_CONSTELLATION_TYPE_GLONASS_BIT = (1<<1),
GNSS_CONSTELLATION_TYPE_QZSS_BIT = (1<<2),
GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3),
GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4),
GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5)
} GnssConstellationTypeBits;
#define GNSS_CONSTELLATION_TYPE_MASK_ALL\
(GNSS_CONSTELLATION_TYPE_GPS_BIT | GNSS_CONSTELLATION_TYPE_GLONASS_BIT |\
GNSS_CONSTELLATION_TYPE_QZSS_BIT | GNSS_CONSTELLATION_TYPE_BEIDOU_BIT |\
GNSS_CONSTELLATION_TYPE_GALILEO_BIT | GNSS_CONSTELLATION_TYPE_SBAS_BIT)
/** GNSS Signal Type and RF Band */ /** GNSS Signal Type and RF Band */
typedef uint32_t GnssSignalTypeMask; typedef uint32_t GnssSignalTypeMask;
typedef enum { typedef enum {
@ -555,21 +571,29 @@ typedef enum {
GNSS_SIGNAL_SBAS_L1 = (1<<17) GNSS_SIGNAL_SBAS_L1 = (1<<17)
} GnssSignalTypeBits; } GnssSignalTypeBits;
#define GNSS_SIGNAL_TYPE_MASK_ALL\
(GNSS_SIGNAL_GPS_L1CA | GNSS_SIGNAL_GPS_L1C | GNSS_SIGNAL_GPS_L2 |\
GNSS_SIGNAL_GPS_L5| GNSS_SIGNAL_GLONASS_G1 | GNSS_SIGNAL_GLONASS_G2 |\
GNSS_SIGNAL_GALILEO_E1 | GNSS_SIGNAL_GALILEO_E5A | GNSS_SIGNAL_GALILEO_E5B |\
GNSS_SIGNAL_BEIDOU_B1I | GNSS_SIGNAL_BEIDOU_B1C | GNSS_SIGNAL_BEIDOU_B2I|\
GNSS_SIGNAL_BEIDOU_B2AI | GNSS_SIGNAL_QZSS_L1CA | GNSS_SIGNAL_QZSS_L1S |\
GNSS_SIGNAL_QZSS_L2| GNSS_SIGNAL_QZSS_L5 | GNSS_SIGNAL_SBAS_L1)
typedef enum typedef enum
{ {
GNSS_LOC_SV_SYSTEM_UNKNOWN = 0,
/** unknown sv system. */
GNSS_LOC_SV_SYSTEM_GPS = 1, GNSS_LOC_SV_SYSTEM_GPS = 1,
/**< GPS satellite. */ /**< GPS satellite. */
GNSS_LOC_SV_SYSTEM_GALILEO = 2, GNSS_LOC_SV_SYSTEM_GALILEO = 2,
/**< GALILEO satellite. */ /**< GALILEO satellite. */
GNSS_LOC_SV_SYSTEM_SBAS = 3, GNSS_LOC_SV_SYSTEM_SBAS = 3,
/**< SBAS satellite. */ /**< SBAS satellite. */
GNSS_LOC_SV_SYSTEM_COMPASS = 4, GNSS_LOC_SV_SYSTEM_GLONASS = 4,
/**< COMPASS satellite. */
GNSS_LOC_SV_SYSTEM_GLONASS = 5,
/**< GLONASS satellite. */ /**< GLONASS satellite. */
GNSS_LOC_SV_SYSTEM_BDS = 6, GNSS_LOC_SV_SYSTEM_BDS = 5,
/**< BDS satellite. */ /**< BDS satellite. */
GNSS_LOC_SV_SYSTEM_QZSS = 7 GNSS_LOC_SV_SYSTEM_QZSS = 6
/**< QZSS satellite. */ /**< QZSS satellite. */
} Gnss_LocSvSystemEnumType; } Gnss_LocSvSystemEnumType;
@ -616,7 +640,7 @@ typedef enum {
typedef uint32_t GnssGloTimeStructTypeFlags; typedef uint32_t GnssGloTimeStructTypeFlags;
typedef enum { typedef enum {
GNSS_CLO_DAYS_VALID = (1 << 0), GNSS_CLO_DAYS_VALID = (1 << 0),
GNSS_GLOS_MSEC_VALID = (1 << 1), GNSS_GLO_MSEC_VALID = (1 << 1),
GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2), GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2),
GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3), GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3),
GNSS_GLO_REF_FCOUNT_VALID = (1 << 4), GNSS_GLO_REF_FCOUNT_VALID = (1 << 4),
@ -650,7 +674,7 @@ typedef struct {
} GnssAidingData; } GnssAidingData;
typedef struct { typedef struct {
size_t size; // set to sizeof(Location) uint32_t size; // set to sizeof(Location)
LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970 uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970
double latitude; // in degrees double latitude; // in degrees
@ -667,7 +691,7 @@ typedef struct {
} Location; } Location;
struct LocationOptions { struct LocationOptions {
size_t size; // set to sizeof(LocationOptions) uint32_t size; // set to sizeof(LocationOptions)
uint32_t minInterval; // in milliseconds uint32_t minInterval; // in milliseconds
uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/ uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/
// gnssMeasurementsCallback may not be called // gnssMeasurementsCallback may not be called
@ -694,7 +718,7 @@ struct TrackingOptions : LocationOptions {
inline TrackingOptions() : inline TrackingOptions() :
LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
inline TrackingOptions(size_t s, GnssPowerMode m, uint32_t t) : inline TrackingOptions(uint32_t s, GnssPowerMode m, uint32_t t) :
LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; } LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; }
inline TrackingOptions(const LocationOptions& options) : inline TrackingOptions(const LocationOptions& options) :
LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
@ -718,7 +742,7 @@ struct BatchingOptions : LocationOptions {
inline BatchingOptions() : inline BatchingOptions() :
LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {} LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {}
inline BatchingOptions(size_t s, BatchingMode m) : inline BatchingOptions(uint32_t s, BatchingMode m) :
LocationOptions(), batchingMode(m) { LocationOptions::size = s; } LocationOptions(), batchingMode(m) { LocationOptions::size = s; }
inline BatchingOptions(const LocationOptions& options) : inline BatchingOptions(const LocationOptions& options) :
LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {} LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {}
@ -730,27 +754,27 @@ struct BatchingOptions : LocationOptions {
}; };
typedef struct { typedef struct {
size_t size; uint32_t size;
BatchingStatus batchingStatus; BatchingStatus batchingStatus;
} BatchingStatusInfo; } BatchingStatusInfo;
typedef struct { typedef struct {
size_t size; // set to sizeof(GeofenceOption) uint32_t size; // set to sizeof(GeofenceOption)
GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits
uint32_t responsiveness; // in milliseconds uint32_t responsiveness; // in milliseconds
uint32_t dwellTime; // in seconds uint32_t dwellTime; // in seconds
} GeofenceOption; } GeofenceOption;
typedef struct { typedef struct {
size_t size; // set to sizeof(GeofenceInfo) uint32_t size; // set to sizeof(GeofenceInfo)
double latitude; // in degrees double latitude; // in degrees
double longitude; // in degrees double longitude; // in degrees
double radius; // in meters double radius; // in meters
} GeofenceInfo; } GeofenceInfo;
typedef struct { typedef struct {
size_t size; // set to sizeof(GeofenceBreachNotification) uint32_t size; // set to sizeof(GeofenceBreachNotification)
size_t count; // number of ids in array uint32_t count; // number of ids in array
uint32_t* ids; // array of ids that have breached uint32_t* ids; // array of ids that have breached
Location location; // location associated with breach Location location; // location associated with breach
GeofenceBreachType type; // type of breach GeofenceBreachType type; // type of breach
@ -758,7 +782,7 @@ typedef struct {
} GeofenceBreachNotification; } GeofenceBreachNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GeofenceBreachNotification) uint32_t size; // set to sizeof(GeofenceBreachNotification)
GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
LocationTechnologyType techType; // GNSS LocationTechnologyType techType; // GNSS
} GeofenceStatusNotification; } GeofenceStatusNotification;
@ -892,7 +916,7 @@ typedef struct {
} GnssSystemTime; } GnssSystemTime;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssLocationInfo) uint32_t size; // set to sizeof(GnssLocationInfo)
GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity
float altitudeMeanSeaLevel; // altitude wrt mean sea level float altitudeMeanSeaLevel; // altitude wrt mean sea level
float pdop; // position dilusion of precision float pdop; // position dilusion of precision
@ -928,7 +952,7 @@ typedef struct {
} GnssLocationInfoNotification; } GnssLocationInfoNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssNiNotification) uint32_t size; // set to sizeof(GnssNiNotification)
GnssNiType type; // type of NI (Voice, SUPL, Control Plane) GnssNiType type; // type of NI (Voice, SUPL, Control Plane)
GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits
uint32_t timeout; // time (seconds) to wait for user input uint32_t timeout; // time (seconds) to wait for user input
@ -941,7 +965,7 @@ typedef struct {
} GnssNiNotification; } GnssNiNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssSv) uint32_t size; // set to sizeof(GnssSv)
uint16_t svId; // Unique Identifier uint16_t svId; // Unique Identifier
GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
float cN0Dbhz; // signal strength float cN0Dbhz; // signal strength
@ -953,7 +977,7 @@ typedef struct {
} GnssSv; } GnssSv;
struct GnssConfigSetAssistanceServer { struct GnssConfigSetAssistanceServer {
size_t size; // set to sizeof(GnssConfigSetAssistanceServer) uint32_t size; // set to sizeof(GnssConfigSetAssistanceServer)
GnssAssistanceType type; // SUPL or C2K GnssAssistanceType type; // SUPL or C2K
const char* hostName; // null terminated string const char* hostName; // null terminated string
uint32_t port; // port of server uint32_t port; // port of server
@ -970,7 +994,7 @@ struct GnssConfigSetAssistanceServer {
}; };
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssMeasurementsData) uint32_t size; // set to sizeof(GnssMeasurementsData)
GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits
int16_t svId; int16_t svId;
GnssSvType svType; GnssSvType svType;
@ -996,7 +1020,7 @@ typedef struct {
} GnssMeasurementsData; } GnssMeasurementsData;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssMeasurementsClock) uint32_t size; // set to sizeof(GnssMeasurementsClock)
GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits
int16_t leapSecond; int16_t leapSecond;
int64_t timeNs; int64_t timeNs;
@ -1010,29 +1034,29 @@ typedef struct {
} GnssMeasurementsClock; } GnssMeasurementsClock;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssSvNotification) uint32_t size; // set to sizeof(GnssSvNotification)
size_t count; // number of SVs in the GnssSv array uint32_t count; // number of SVs in the GnssSv array
bool gnssSignalTypeMaskValid; bool gnssSignalTypeMaskValid;
GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
} GnssSvNotification; } GnssSvNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssNmeaNotification) uint32_t size; // set to sizeof(GnssNmeaNotification)
uint64_t timestamp; // timestamp uint64_t timestamp; // timestamp
const char* nmea; // nmea text const char* nmea; // nmea text
size_t length; // length of the nmea text uint32_t length; // length of the nmea text
} GnssNmeaNotification; } GnssNmeaNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssDataNotification) uint32_t size; // set to sizeof(GnssDataNotification)
GnssDataMask gnssDataMask[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // bitwise OR of GnssDataBits GnssDataMask gnssDataMask[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // bitwise OR of GnssDataBits
double jammerInd[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Jammer Indication double jammerInd[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Jammer Indication
double agc[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Automatic gain control double agc[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Automatic gain control
} GnssDataNotification; } GnssDataNotification;
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssMeasurementsNotification) uint32_t size; // set to sizeof(GnssMeasurementsNotification)
size_t count; // number of items in GnssMeasurements array uint32_t count; // number of items in GnssMeasurements array
GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX]; GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
GnssMeasurementsClock clock; // clock GnssMeasurementsClock clock; // clock
} GnssMeasurementsNotification; } GnssMeasurementsNotification;
@ -1040,7 +1064,7 @@ typedef struct {
typedef uint32_t GnssSvId; typedef uint32_t GnssSvId;
struct GnssSvIdSource{ struct GnssSvIdSource{
size_t size; // set to sizeof(GnssSvIdSource) uint32_t size; // set to sizeof(GnssSvIdSource)
GnssSvType constellation; // constellation for the sv to blacklist GnssSvType constellation; // constellation for the sv to blacklist
GnssSvId svId; // sv id to blacklist GnssSvId svId; // sv id to blacklist
}; };
@ -1051,7 +1075,7 @@ inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right)
#define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF) #define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF)
typedef struct { typedef struct {
size_t size; // set to sizeof(GnssSvIdConfig) uint32_t size; // set to sizeof(GnssSvIdConfig)
// GLONASS - SV 65 maps to bit 0 // GLONASS - SV 65 maps to bit 0
#define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65 #define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65
@ -1071,7 +1095,7 @@ typedef struct {
} GnssSvIdConfig; } GnssSvIdConfig;
struct GnssConfig{ struct GnssConfig{
size_t size; // set to sizeof(GnssConfig) uint32_t size; // set to sizeof(GnssConfig)
GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid
GnssConfigGpsLock gpsLock; GnssConfigGpsLock gpsLock;
GnssConfigSuplVersion suplVersion; GnssConfigSuplVersion suplVersion;
@ -1105,7 +1129,7 @@ struct GnssConfig{
}; };
typedef struct { typedef struct {
size_t size; // set to sizeof uint32_t size; // set to sizeof
bool mValid; bool mValid;
Location mLocation; Location mLocation;
double verticalAccuracyMeters; double verticalAccuracyMeters;
@ -1115,7 +1139,7 @@ typedef struct {
} GnssDebugLocation; } GnssDebugLocation;
typedef struct { typedef struct {
size_t size; // set to sizeof uint32_t size; // set to sizeof
bool mValid; bool mValid;
int64_t timeEstimate; int64_t timeEstimate;
float timeUncertaintyNs; float timeUncertaintyNs;
@ -1123,7 +1147,7 @@ typedef struct {
} GnssDebugTime; } GnssDebugTime;
typedef struct { typedef struct {
size_t size; // set to sizeof uint32_t size; // set to sizeof
uint32_t svid; uint32_t svid;
GnssSvType constellation; GnssSvType constellation;
GnssEphemerisType mEphemerisType; GnssEphemerisType mEphemerisType;
@ -1135,7 +1159,7 @@ typedef struct {
} GnssDebugSatelliteInfo; } GnssDebugSatelliteInfo;
typedef struct { typedef struct {
size_t size; // set to sizeof uint32_t size; // set to sizeof
GnssDebugLocation mLocation; GnssDebugLocation mLocation;
GnssDebugTime mTime; GnssDebugTime mTime;
std::vector<GnssDebugSatelliteInfo> mSatelliteInfo; std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
@ -1210,7 +1234,7 @@ typedef std::function<void(
collectiveResponseCallback is called for every geofence API call. collectiveResponseCallback is called for every geofence API call.
ids array and LocationError array are only valid until collectiveResponseCallback returns. */ ids array and LocationError array are only valid until collectiveResponseCallback returns. */
typedef std::function<void( typedef std::function<void(
size_t count, // number of locations in arrays uint32_t count, // number of locations in arrays
LocationError* errs, // array of LocationError associated to the request LocationError* errs, // array of LocationError associated to the request
uint32_t* ids // array of ids to be associated to the request uint32_t* ids // array of ids to be associated to the request
)> collectiveResponseCallback; )> collectiveResponseCallback;
@ -1226,7 +1250,7 @@ typedef std::function<void(
batchingCallback is called when delivering locations in a batching session. batchingCallback is called when delivering locations in a batching session.
broadcasted to all clients, no matter if a session has started by client */ broadcasted to all clients, no matter if a session has started by client */
typedef std::function<void( typedef std::function<void(
size_t count, // number of locations in array uint32_t count, // number of locations in array
Location* location, // array of locations Location* location, // array of locations
BatchingOptions batchingOptions // Batching options BatchingOptions batchingOptions // Batching options
)> batchingCallback; )> batchingCallback;
@ -1305,8 +1329,15 @@ typedef std::function<void(
typedef std::function<void( typedef std::function<void(
)> locationApiDestroyCompleteCallback; )> locationApiDestroyCompleteCallback;
typedef uint16_t LocationAdapterTypeMask;
typedef enum {
LOCATION_ADAPTER_GNSS_TYPE_BIT = (1<<0), // adapter type is GNSS
LOCATION_ADAPTER_FLP_TYPE_BIT = (1<<1), // adapter type is FLP
LOCATION_ADAPTER_GEOFENCE_TYPE_BIT = (1<<2) // adapter type is geo fence
} LocationAdapterTypeBits;
typedef struct { typedef struct {
size_t size; // set to sizeof(LocationCallbacks) uint32_t size; // set to sizeof(LocationCallbacks)
capabilitiesCallback capabilitiesCb; // mandatory capabilitiesCallback capabilitiesCb; // mandatory
responseCallback responseCb; // mandatory responseCallback responseCb; // mandatory
collectiveResponseCallback collectiveResponseCb; // mandatory collectiveResponseCallback collectiveResponseCb; // mandatory

View file

@ -30,7 +30,10 @@
#define __LOC_PLA__ #define __LOC_PLA__
#ifdef __cplusplus #ifdef __cplusplus
#ifndef FEATURE_EXTERNAL_AP
#include <utils/SystemClock.h> #include <utils/SystemClock.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <inttypes.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
@ -47,10 +50,14 @@ inline int64_t uptimeMillis()
extern "C" { extern "C" {
#endif #endif
#ifndef FEATURE_EXTERNAL_AP
#include <cutils/properties.h> #include <cutils/properties.h>
#include <cutils/threads.h> #include <cutils/threads.h>
#include <cutils/sched_policy.h> #include <cutils/sched_policy.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <pthread.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef OFF_TARGET #ifndef OFF_TARGET
@ -76,6 +83,16 @@ extern "C" {
#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf" #define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf"
#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf" #define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf"
#ifdef FEATURE_EXTERNAL_AP
#define PROPERTY_VALUE_MAX 92
inline int property_get(const char* key, char* value, const char* default_value)
{
strlcpy(value, default_value, PROPERTY_VALUE_MAX - 1);
return strlen(value);
}
#endif /* FEATURE_EXTERNAL_AP */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus */ #endif /*__cplusplus */

View file

@ -27,8 +27,8 @@
* *
*/ */
#ifndef __LOC_SOCKET__ #ifndef __LOC_IPC__
#define __LOC_SOCKET__ #define __LOC_IPC__
#include <string> #include <string>
#include <memory> #include <memory>
@ -105,7 +105,7 @@ public:
// This class hides generated fd and destination address object from user. // This class hides generated fd and destination address object from user.
inline LocIpcSender(const char* destSocket): inline LocIpcSender(const char* destSocket):
LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) { LocIpcSender(std::make_shared<int>(::socket(AF_UNIX, SOCK_DGRAM, 0)), destSocket) {
if (-1 == *mSocket) { if (mSocket != nullptr && -1 == *mSocket) {
mSocket = nullptr; mSocket = nullptr;
} }
} }
@ -149,4 +149,4 @@ private:
} }
#endif //__LOC_SOCKET__ #endif //__LOC_IPC__

View file

@ -30,10 +30,28 @@
#define __LOC_SHARED_LOCK__ #define __LOC_SHARED_LOCK__
#include <stddef.h> #include <stddef.h>
#ifndef FEATURE_EXTERNAL_AP
#include <cutils/atomic.h> #include <cutils/atomic.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <pthread.h> #include <pthread.h>
// This is a utility created for use cases such that there are more than #ifdef FEATURE_EXTERNAL_AP
#include <atomic>
inline int32_t android_atomic_inc(volatile int32_t *addr)
{
volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr;
return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release);
}
inline int32_t android_atomic_dec(volatile int32_t *addr)
{
volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr;
return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release);
}
#endif /* FEATURE_EXTERNAL_AP */
// This is a utility created for use cases such that there are more than
// one client who need to share the same lock, but it is not predictable // one client who need to share the same lock, but it is not predictable
// which of these clients is to last to go away. This shared lock deletes // which of these clients is to last to go away. This shared lock deletes
// itself when the last client calls its drop() method. To add a cient, // itself when the last client calls its drop() method. To add a cient,

View file

@ -85,8 +85,8 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
if (mThandle) { if (mThandle) {
// set thread name // set thread name
char lname[16]; char lname[16];
int len = (sizeof(lname)>sizeof(threadName)) ? int len = (sizeof(lname) > (strlen(threadName) + 1)) ?
(sizeof(threadName) -1):(sizeof(lname) - 1); (strlen(threadName)):(sizeof(lname) - 1);
memcpy(lname, threadName, len); memcpy(lname, threadName, len);
lname[len] = 0; lname[len] = 0;
// set the thread name here // set the thread name here

View file

@ -83,8 +83,10 @@ void MsgTask::sendMsg(const LocMsg* msg) const {
} }
void MsgTask::prerun() { void MsgTask::prerun() {
#ifndef FEATURE_EXTERNAL_AP
// make sure we do not run in background scheduling group // make sure we do not run in background scheduling group
set_sched_policy(gettid(), SP_FOREGROUND); set_sched_policy(gettid(), SP_FOREGROUND);
#endif /* FEATURE_EXTERNAL_AP */
} }
bool MsgTask::run() { bool MsgTask::run() {

View file

@ -28,10 +28,20 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
# Checks for libraries. AC_ARG_WITH([external_ap],
PKG_CHECK_MODULES([CUTILS], [libcutils]) AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
AC_SUBST([CUTILS_CFLAGS]) [Using External Application Processor]),
AC_SUBST([CUTILS_LIBS]) [],
with_external_ap=no)
if test "x$with_external_ap" != "xno"; then
CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
else
# Checks for libraries.
PKG_CHECK_MODULES([CUTILS], [libcutils])
AC_SUBST([CUTILS_CFLAGS])
AC_SUBST([CUTILS_LIBS])
fi
AC_ARG_WITH([core_includes], AC_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],

View file

@ -407,9 +407,18 @@ typedef uint32_t LocPosDataMask;
/* Bitmask to specify whether Navigation data has Body pitch Unc*/ /* Bitmask to specify whether Navigation data has Body pitch Unc*/
#define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200) #define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200)
typedef uint32_t GnssAdditionalSystemInfoMask;
/* Bitmask to specify whether Tauc is valid */
#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001)
/* Bitmask to specify whether leapSec is valid */
#define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002)
/** GPS PRN Range */ /** GPS PRN Range */
#define GPS_SV_PRN_MIN 1 #define GPS_SV_PRN_MIN 1
#define GPS_SV_PRN_MAX 32 #define GPS_SV_PRN_MAX 32
#define SBAS_SV_PRN_MIN 33
#define SBAS_SV_PRN_MAX 64
#define GLO_SV_PRN_MIN 65 #define GLO_SV_PRN_MIN 65
#define GLO_SV_PRN_MAX 96 #define GLO_SV_PRN_MAX 96
#define QZSS_SV_PRN_MIN 193 #define QZSS_SV_PRN_MIN 193
@ -838,8 +847,8 @@ enum loc_api_adapter_event_index {
LOC_API_ADAPTER_BATCH_FULL, // Batching on full LOC_API_ADAPTER_BATCH_FULL, // Batching on full
LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix
LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, //
LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, //GNSS Measurement Report LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report
LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, //GNSS SV Polynomial Report LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report
LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request
LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request
LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report
@ -853,6 +862,8 @@ enum loc_api_adapter_event_index {
LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request
LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report
LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event
LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report
LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info
LOC_API_ADAPTER_EVENT_MAX LOC_API_ADAPTER_EVENT_MAX
}; };
@ -893,6 +904,8 @@ enum loc_api_adapter_event_index {
#define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ) #define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ)
#define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT) #define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT)
#define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO) #define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO)
#define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
#define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T; typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
@ -925,7 +938,8 @@ typedef uint32_t LOC_GPS_LOCK_MASK;
#define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3 #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3
#define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9 #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9
#define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4 #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4
#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 16 /** Max number of GNSS SV measurement */
#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128
enum ulp_gnss_sv_measurement_valid_flags{ enum ulp_gnss_sv_measurement_valid_flags{
@ -1055,71 +1069,12 @@ typedef struct
/**< System-1 to System-2 Time Bias uncertainty \n /**< System-1 to System-2 Time Bias uncertainty \n
- Units: msec \n - Units: msec \n
*/ */
}Gnss_InterSystemBiasStructType; } Gnss_InterSystemBiasStructType;
typedef struct
{
size_t size;
uint16_t systemWeek;
/**< System week number for GPS, BDS and GAL satellite systems. \n
Set to 65535 when invalid or not available. \n
Not valid for GLONASS system. \n
*/
uint32_t systemMsec;
/**< System time msec. Time of Week for GPS, BDS, GAL and
Time of Day for GLONASS.
- Units: msec \n
*/
float systemClkTimeBias;
/**< System clock time bias \n
- Units: msec \n
System time = systemMsec - systemClkTimeBias \n
*/
float systemClkTimeUncMs;
/**< Single sided maximum time bias uncertainty \n
- Units: msec \n
*/
}Gnss_LocSystemTimeStructType;
typedef struct { typedef struct {
size_t size; size_t size;
uint8_t gloFourYear;
/**< GLONASS four year number from 1996. Refer to GLONASS ICD.\n
Applicable only for GLONASS and shall be ignored for other constellations. \n
If unknown shall be set to 255
*/
uint16_t gloDays;
/**< GLONASS day number in four years. Refer to GLONASS ICD.
Applicable only for GLONASS and shall be ignored for other constellations. \n
If unknown shall be set to 65535
*/
uint32_t gloMsec;
/**< GLONASS time of day in msec. Refer to GLONASS ICD.
- Units: msec \n
*/
float gloClkTimeBias;
/**< System clock time bias (sub-millisecond) \n
- Units: msec \n
System time = systemMsec - systemClkTimeBias \n
*/
float gloClkTimeUncMs;
/**< Single sided maximum time bias uncertainty \n
- Units: msec \n
*/
}Gnss_LocGloTimeStructType; /* Type */
typedef struct {
size_t size;
uint32_t refFCount;
/**< Receiver frame counter value at reference tick */
uint8_t systemRtc_valid; uint8_t systemRtc_valid;
/**< Validity indicator for System RTC */ /**< Validity indicator for System RTC */
@ -1129,13 +1084,8 @@ typedef struct {
- Units: msec \n - Units: msec \n
*/ */
uint32_t sourceOfTime;
/**< Source of time information */
}Gnss_LocGnssTimeExtStructType; }Gnss_LocGnssTimeExtStructType;
typedef enum typedef enum
{ {
GNSS_LOC_MEAS_STATUS_NULL = 0x00000000, GNSS_LOC_MEAS_STATUS_NULL = 0x00000000,
@ -1231,6 +1181,9 @@ typedef enum
typedef struct typedef struct
{ {
size_t size; size_t size;
Gnss_LocSvSystemEnumType gnssSystem;
// 0 signal type mask indicates invalid value
GnssSignalTypeMask gnssSignalTypeMask;
uint16_t gnssSvId; uint16_t gnssSvId;
/**< GNSS SV ID. /**< GNSS SV ID.
\begin{itemize1} \begin{itemize1}
@ -1367,70 +1320,75 @@ typedef struct
} Gnss_SVMeasurementStructType; } Gnss_SVMeasurementStructType;
/**< Maximum number of satellites in measurement block for given system. */
typedef struct typedef uint64_t GpsSvMeasHeaderFlags;
{ #define GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND 0x00000001
size_t size; #define GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ 0x00000002
Gnss_LocSvSystemEnumType system; #define GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP 0x00000004
/**< Specifies the Satellite System Type #define GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS 0x00000008
*/ #define GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS 0x00000010
bool isSystemTimeValid; #define GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS 0x00000020
/**< Indicates whether System Time is Valid:\n #define GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS 0x00000040
- 0x01 (TRUE) -- System Time is valid \n #define GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS 0x00000080
- 0x00 (FALSE) -- System Time is not valid #define GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS 0x00000100
*/ #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME 0x00000200
Gnss_LocSystemTimeStructType systemTime; #define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME 0x00000400
/**< System Time Information \n #define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME 0x00000800
*/ #define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME 0x00001000
bool isGloTime_valid; #define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME 0x00002000
Gnss_LocGloTimeStructType gloTime; #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT 0x00004000
#define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT 0x00008000
#define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT 0x00010000
#define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT 0x00020000
#define GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS 0x00040000
#define GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS 0x00080000
bool isSystemTimeExt_valid;
Gnss_LocGnssTimeExtStructType systemTimeExt;
uint8_t numSvs;
/* Number of SVs in this report block */
Gnss_SVMeasurementStructType svMeasurement[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
/**< Satellite measurement Information \n
*/
} Gnss_ClockMeasurementStructType;
typedef struct typedef struct
{ {
size_t size; size_t size;
uint8_t seqNum; // see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX
/**< Current message Number */ uint64_t flags;
uint8_t maxMessageNum;
/**< Maximum number of message that will be sent for present time epoch. */
bool leapSecValid;
Gnss_LeapSecondInfoStructType leapSec; Gnss_LeapSecondInfoStructType leapSec;
Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
Gnss_InterSystemBiasStructType galGloInterSystemBias;
Gnss_InterSystemBiasStructType galBdsInterSystemBias;
bool clockFreqValid;
Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */ Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */
bool gnssMeasValid;
Gnss_ClockMeasurementStructType gnssMeas; Gnss_ApTimeStampStructType apBootTimeStamp;
Gnss_ApTimeStampStructType timeStamp;
/* Extended Time Information - Cumulative Number of Clock Resets */ Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
uint8_t numClockResets_valid; /**< Must be set to true if numClockResets is being passed */ Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
uint32_t numClockResets; Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
bool gnssSignalTypeMaskValid; Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
GnssSignalTypeMask gnssSignalTypeMask; Gnss_InterSystemBiasStructType galGloInterSystemBias;
Gnss_InterSystemBiasStructType galBdsInterSystemBias;
Gnss_InterSystemBiasStructType gpsL1L5TimeBias;
Gnss_InterSystemBiasStructType galE1E5aTimeBias;
GnssSystemTimeStructType gpsSystemTime;
GnssSystemTimeStructType galSystemTime;
GnssSystemTimeStructType bdsSystemTime;
GnssSystemTimeStructType qzssSystemTime;
GnssGloTimeStructType gloSystemTime;
/** GPS system RTC time information. */
Gnss_LocGnssTimeExtStructType gpsSystemTimeExt;
/** GAL system RTC time information. */
Gnss_LocGnssTimeExtStructType galSystemTimeExt;
/** BDS system RTC time information. */
Gnss_LocGnssTimeExtStructType bdsSystemTimeExt;
/** QZSS system RTC time information. */
Gnss_LocGnssTimeExtStructType qzssSystemTimeExt;
} GnssSvMeasurementHeader;
typedef struct {
size_t size;
bool isNhz;
GnssSvMeasurementHeader svMeasSetHeader;
uint32_t svMeasCount;
Gnss_SVMeasurementStructType svMeas[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
} GnssSvMeasurementSet; } GnssSvMeasurementSet;
@ -1916,6 +1874,10 @@ typedef struct {
Mandatory field */ Mandatory field */
Gnss_LocSvSystemEnumType gnssConstellation; Gnss_LocSvSystemEnumType gnssConstellation;
/** GPS System Time of the ephemeris report */
bool isSystemTimeValid;
GnssSystemTimeStructType systemTime;
union { union {
/** GPS Ephemeris */ /** GPS Ephemeris */
GpsEphemerisResponse gpsEphemeris; GpsEphemerisResponse gpsEphemeris;
@ -1930,6 +1892,73 @@ typedef struct {
} ephInfo; } ephInfo;
} GnssSvEphemerisReport; } GnssSvEphemerisReport;
typedef struct {
/** GPS System Time of the iono model report */
bool isSystemTimeValid;
GnssSystemTimeStructType systemTime;
/** Indicates GNSS Constellation Type */
Gnss_LocSvSystemEnumType gnssConstellation;
float alpha0;
/**< Klobuchar Model Parameter Alpha 0.
- Type: float
- Unit: Seconds
*/
float alpha1;
/**< Klobuchar Model Parameter Alpha 1.
- Type: float
- Unit: Seconds / Semi-Circle
*/
float alpha2;
/**< Klobuchar Model Parameter Alpha 2.
- Type: float
- Unit: Seconds / Semi-Circle^2
*/
float alpha3;
/**< Klobuchar Model Parameter Alpha 3.
- Type: float
- Unit: Seconds / Semi-Circle^3
*/
float beta0;
/**< Klobuchar Model Parameter Beta 0.
- Type: float
- Unit: Seconds
*/
float beta1;
/**< Klobuchar Model Parameter Beta 1.
- Type: float
- Unit: Seconds / Semi-Circle
*/
float beta2;
/**< Klobuchar Model Parameter Beta 2.
- Type: float
- Unit: Seconds / Semi-Circle^2
*/
float beta3;
/**< Klobuchar Model Parameter Beta 3.
- Type: float
- Unit: Seconds / Semi-Circle^3
*/
} GnssKlobucharIonoModel;
typedef struct {
/** GPS System Time of the report */
bool isSystemTimeValid;
GnssSystemTimeStructType systemTime;
GnssAdditionalSystemInfoMask validityMask;
double tauC;
int8_t leapSec;
} GnssAdditionalSystemInfo;
/* Various Short Range Node Technology type*/ /* Various Short Range Node Technology type*/
typedef enum { typedef enum {
SRN_AP_DATA_TECH_TYPE_NONE, SRN_AP_DATA_TECH_TYPE_NONE,
@ -2053,6 +2082,7 @@ typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void*
#define SOCKET_DIR_TO_CLIENT "/dev/socket/loc_client/" #define SOCKET_DIR_TO_CLIENT "/dev/socket/loc_client/"
#define SOCKET_TO_LOCATION_CLIENT_BASE "/dev/socket/loc_client/toclient" #define SOCKET_TO_LOCATION_CLIENT_BASE "/dev/socket/loc_client/toclient"
#define SOCKET_TO_EXTERANL_AP_LOCATION_CLIENT_BASE "/dev/socket/loc_client/extap.toclient"
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -50,6 +50,8 @@ typedef enum
/**< Failed because an there were not enough resources. */ /**< Failed because an there were not enough resources. */
eLINKED_LIST_INSUFFICIENT_BUFFER = -5, eLINKED_LIST_INSUFFICIENT_BUFFER = -5,
/**< Failed because an the supplied buffer was too small. */ /**< Failed because an the supplied buffer was too small. */
eLINKED_LIST_EMPTY = -6
/**< Failed because list is empty. */
}linked_list_err_type; }linked_list_err_type;
/*=========================================================================== /*===========================================================================

View file

@ -674,6 +674,9 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
case GNSS_SV_TYPE_BEIDOU: case GNSS_SV_TYPE_BEIDOU:
signalType = GNSS_SIGNAL_BEIDOU_B1I; signalType = GNSS_SIGNAL_BEIDOU_B1I;
break; break;
case GNSS_SV_TYPE_SBAS:
signalType = GNSS_SIGNAL_SBAS_L1;
break;
default: default:
LOC_LOGE("NMEA Error unknow constellation type: %d", LOC_LOGE("NMEA Error unknow constellation type: %d",
svNotify.gnssSvs[svNumber - 1].type); svNotify.gnssSvs[svNumber - 1].type);

View file

@ -47,6 +47,14 @@
#endif /* LOG_TAG */ #endif /* LOG_TAG */
// LE targets with no logcat support // LE targets with no logcat support
#ifdef FEATURE_EXTERNAL_AP
#include <syslog.h>
#define ALOGE(...) syslog(LOG_ERR, "LOC_LOGE: " __VA_ARGS__);
#define ALOGW(...) syslog(LOG_WARNING, "LOC_LOGW: " __VA_ARGS__);
#define ALOGI(...) syslog(LOG_NOTICE, "LOC_LOGI: " __VA_ARGS__);
#define ALOGD(...) syslog(LOG_DEBUG, "LOC_LOGD: " __VA_ARGS__);
#define ALOGV(...) syslog(LOG_NOTICE, "LOC_LOGV: " __VA_ARGS__);
#else /* FEATURE_EXTERNAL_AP */
#define TS_PRINTF(format, x...) \ #define TS_PRINTF(format, x...) \
{ \ { \
struct timeval tv; \ struct timeval tv; \
@ -64,6 +72,7 @@
#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x)
#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x)
#endif /* FEATURE_EXTERNAL_AP */
#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */ #endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */

View file

@ -265,6 +265,51 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj)
return rv; return rv;
} }
/*===========================================================================
FUNCTION: msg_q_rmv
===========================================================================*/
msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj)
{
msq_q_err_type rv;
if (msg_q_data == NULL) {
LOC_LOGE("%s: Invalid msg_q_data parameter!\n", __FUNCTION__);
return eMSG_Q_INVALID_HANDLE;
}
if (msg_obj == NULL) {
LOC_LOGE("%s: Invalid msg_obj parameter!\n", __FUNCTION__);
return eMSG_Q_INVALID_PARAMETER;
}
msg_q* p_msg_q = (msg_q*)msg_q_data;
pthread_mutex_lock(&p_msg_q->list_mutex);
if (p_msg_q->unblocked) {
LOC_LOGE("%s: Message queue has been unblocked.\n", __FUNCTION__);
pthread_mutex_unlock(&p_msg_q->list_mutex);
return eMSG_Q_UNAVAILABLE_RESOURCE;
}
if (linked_list_empty(p_msg_q->msg_list)) {
LOC_LOGW("%s: list is empty !!\n", __FUNCTION__);
pthread_mutex_unlock(&p_msg_q->list_mutex);
return eLINKED_LIST_EMPTY;
}
rv = convert_linked_list_err_type(linked_list_remove(p_msg_q->msg_list, msg_obj));
pthread_mutex_unlock(&p_msg_q->list_mutex);
LOC_LOGV("%s: Removed message %p rv = %d\n", __FUNCTION__, *msg_obj, rv);
return rv;
}
/*=========================================================================== /*===========================================================================
FUNCTION: msg_q_flush FUNCTION: msg_q_flush

View file

@ -157,6 +157,29 @@ SIDE EFFECTS
===========================================================================*/ ===========================================================================*/
msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj); msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj);
/*===========================================================================
FUNCTION msg_q_rmv
DESCRIPTION
Remove data from the message queue. msg_obj is the oldest message received
and pointer is simply removed from message queue.
msg_q_data: Message Queue to copy data from into msgp.
msg_obj: Pointer to space to copy msg_q contents to.
DEPENDENCIES
N/A
RETURN VALUE
Look at error codes above.
SIDE EFFECTS
N/A
===========================================================================*/
msq_q_err_type msg_q_rmv(void* msg_q_data, void** msg_obj);
/*=========================================================================== /*===========================================================================
FUNCTION msg_q_flush FUNCTION msg_q_flush