sdm660-common: Import GPS HAL from LA.UM.8.2.r1-06500-sdm660.0

"LA.UM.8.2.r1-06500-sdm660.0"

Change-Id: Ib46ee24d1e05e749fe0b7f178142a01bdb090e57
This commit is contained in:
travarilo 2020-05-27 11:50:50 +02:00 committed by OdSazib
parent 5b2b25d58a
commit b586e7cb27
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69
41 changed files with 842 additions and 264 deletions

View file

@ -540,7 +540,7 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
} }
for (size_t i = 0; i < out.numSvs; i++) { for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i]; IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
info.svid = in.gnssSvs[i].svId; convertGnssSvid(in.gnssSvs[i], info.svid);
convertGnssConstellationType(in.gnssSvs[i].type, info.constellation); convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz; info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
info.elevationDegrees = in.gnssSvs[i].elevation; info.elevationDegrees = in.gnssSvs[i].elevation;

View file

@ -147,6 +147,64 @@ void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
} }
} }
void convertGnssSvid(GnssSv& in, int16_t& out)
{
switch(in.type){
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
out = in.svId - GLO_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
{
switch (in.svType) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
if (in.svId != 255) { // OSN is known
out = in.svId - GLO_SV_PRN_MIN + 1;
} else { // OSN is not known, report FCN
out = in.gloFrequency + 92;
}
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out) void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
{ {
switch(in) { switch(in) {

View file

@ -43,6 +43,8 @@ namespace implementation {
void convertGnssLocation(Location& in, V1_0::GnssLocation& out); void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out); void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssSvid(GnssSv& in, int16_t& out);
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);

View file

@ -163,7 +163,7 @@ static void convertGnssMeasurement(GnssMeasurementsData& in,
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT) if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
out.svid = in.svId; convertGnssSvid(in, out.svid);
convertGnssConstellationType(in.svType, out.constellation); convertGnssConstellationType(in.svType, out.constellation);
out.timeOffsetNs = in.timeOffsetNs; out.timeOffsetNs = in.timeOffsetNs;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT) if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)

View file

@ -379,7 +379,7 @@ 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); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
} }
return setCallback(callback); return setCallback(callback);
} }
@ -429,6 +429,9 @@ Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) {
void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) { void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
if (ODCPI_REQUEST_TYPE_STOP == request.type) {
return;
}
if (mGnssCbIface_1_1 != nullptr) { if (mGnssCbIface_1_1 != nullptr) {
// For emergency mode, request DBH (Device based hybrid) location // For emergency mode, request DBH (Device based hybrid) location
// Mark Independent from GNSS flag to false. // Mark Independent from GNSS flag to false.

View file

@ -540,7 +540,7 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
} }
for (size_t i = 0; i < out.numSvs; i++) { for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i]; IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
info.svid = in.gnssSvs[i].svId; convertGnssSvid(in.gnssSvs[i], info.svid);
convertGnssConstellationType(in.gnssSvs[i].type, info.constellation); convertGnssConstellationType(in.gnssSvs[i].type, info.constellation);
info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz; info.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
info.elevationDegrees = in.gnssSvs[i].elevation; info.elevationDegrees = in.gnssSvs[i].elevation;

View file

@ -147,6 +147,64 @@ void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
} }
} }
void convertGnssSvid(GnssSv& in, int16_t& out)
{
switch(in.type){
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
out = in.svId - GLO_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
{
switch (in.svType) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
if (in.svId != 255) { // OSN is known
out = in.svId - GLO_SV_PRN_MIN + 1;
} else { // OSN is not known, report FCN
out = in.gloFrequency + 92;
}
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out) void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
{ {
switch(in) { switch(in) {

View file

@ -43,6 +43,8 @@ namespace implementation {
void convertGnssLocation(Location& in, V1_0::GnssLocation& out); void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out); void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssSvid(GnssSv& in, int16_t& out);
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);

View file

@ -197,7 +197,7 @@ static void convertGnssMeasurement(GnssMeasurementsData& in,
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT) if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
out.svid = in.svId; convertGnssSvid(in, out.svid);
convertGnssConstellationType(in.svType, out.constellation); convertGnssConstellationType(in.svType, out.constellation);
out.timeOffsetNs = in.timeOffsetNs; out.timeOffsetNs = in.timeOffsetNs;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT) if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)

View file

@ -445,7 +445,7 @@ 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); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();
@ -508,6 +508,9 @@ Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) {
void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) { void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
if (ODCPI_REQUEST_TYPE_STOP == request.type) {
return;
}
if (mGnssCbIface_2_0 != nullptr) { if (mGnssCbIface_2_0 != nullptr) {
// For emergency mode, request DBH (Device based hybrid) location // For emergency mode, request DBH (Device based hybrid) location
// Mark Independent from GNSS flag to false. // Mark Independent from GNSS flag to false.
@ -575,7 +578,7 @@ 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); gnssInterface->odcpiInit(cb, OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW);
} }
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();

View file

@ -29,6 +29,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<hal format="hidl"> <hal format="hidl">
<name>android.hardware.gnss</name> <name>android.hardware.gnss</name>
<transport>hwbinder</transport> <transport>hwbinder</transport>
<fqname>@1.0::IGnss/gnss_vendor</fqname>
<fqname>@1.1::IGnss/default</fqname> <fqname>@1.1::IGnss/default</fqname>
<fqname>@2.0::IGnss/default</fqname> <fqname>@2.0::IGnss/default</fqname>
</hal> </hal>

View file

@ -678,7 +678,7 @@ static void convertGnssSvStatus(GnssSvNotification& in, V1_0::IGnssCallback::Gns
out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT); out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
} }
for (size_t i = 0; i < out.numSvs; i++) { for (size_t i = 0; i < out.numSvs; i++) {
out.gnssSvList[i].svid = in.gnssSvs[i].svId; convertGnssSvid(in.gnssSvs[i], out.gnssSvList[i].svid);
convertGnssConstellationType(in.gnssSvs[i].type, out.gnssSvList[i].constellation); convertGnssConstellationType(in.gnssSvs[i].type, out.gnssSvList[i].constellation);
out.gnssSvList[i].cN0Dbhz = in.gnssSvs[i].cN0Dbhz; out.gnssSvList[i].cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
out.gnssSvList[i].elevationDegrees = in.gnssSvs[i].elevation; out.gnssSvList[i].elevationDegrees = in.gnssSvs[i].elevation;
@ -701,7 +701,7 @@ static void convertGnssSvStatus(GnssSvNotification& in,
{ {
out.resize(in.count); out.resize(in.count);
for (size_t i = 0; i < in.count; i++) { for (size_t i = 0; i < in.count; i++) {
out[i].v1_0.svid = in.gnssSvs[i].svId; convertGnssSvid(in.gnssSvs[i], out[i].v1_0.svid);
out[i].v1_0.cN0Dbhz = in.gnssSvs[i].cN0Dbhz; out[i].v1_0.cN0Dbhz = in.gnssSvs[i].cN0Dbhz;
out[i].v1_0.elevationDegrees = in.gnssSvs[i].elevation; out[i].v1_0.elevationDegrees = in.gnssSvs[i].elevation;
out[i].v1_0.azimuthDegrees = in.gnssSvs[i].azimuth; out[i].v1_0.azimuthDegrees = in.gnssSvs[i].azimuth;

View file

@ -30,6 +30,7 @@
#include <LocationUtil.h> #include <LocationUtil.h>
#include <log_util.h> #include <log_util.h>
#include <inttypes.h> #include <inttypes.h>
#include <gps_extended_c.h>
namespace android { namespace android {
namespace hardware { namespace hardware {
@ -136,12 +137,17 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
if (currentTimeNanos >= locationTimeNanos) { if (currentTimeNanos >= locationTimeNanos) {
int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos; int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos;
LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos); LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
if (ageTimeNanos >= 0 && ageTimeNanos <= sinceBootTimeNanos) { // the max trusted propagation time 30s for ageTimeNanos to avoid user setting
//wrong time, it will affect elapsedRealtimeNanos
if (ageTimeNanos >= 0 && ageTimeNanos <= 30000000000) {
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS; out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos; out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS; out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
// time uncertainty is 1 ms since it is calculated from utc time that is in ms // time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
out.elapsedRealtime.timeUncertaintyNs = 1000000; //verify if user change the sys time
out.elapsedRealtime.timeUncertaintyNs =
std::max((int64_t)abs(currentTimeNanos - locationTimeNanos),
(int64_t)100000000);
LOC_LOGD("%s]: timestampNs:%" PRIi64 ")", LOC_LOGD("%s]: timestampNs:%" PRIi64 ")",
__FUNCTION__, out.elapsedRealtime.timestampNs); __FUNCTION__, out.elapsedRealtime.timestampNs);
} }
@ -256,6 +262,64 @@ void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& o
} }
} }
void convertGnssSvid(GnssSv& in, int16_t& out)
{
switch (in.type) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
out = in.svId - GLO_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out)
{
switch (in.svType) {
case GNSS_SV_TYPE_GPS:
out = in.svId;
break;
case GNSS_SV_TYPE_SBAS:
out = in.svId;
break;
case GNSS_SV_TYPE_GLONASS:
if (in.svId != 255) { // OSN is known
out = in.svId - GLO_SV_PRN_MIN + 1;
} else { // OSN is not known, report FCN
out = in.gloFrequency + 92;
}
break;
case GNSS_SV_TYPE_QZSS:
out = in.svId;
break;
case GNSS_SV_TYPE_BEIDOU:
out = in.svId - BDS_SV_PRN_MIN + 1;
break;
case GNSS_SV_TYPE_GALILEO:
out = in.svId - GAL_SV_PRN_MIN + 1;
break;
default:
out = in.svId;
break;
}
}
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out) void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out)
{ {
switch(in) { switch(in) {

View file

@ -46,6 +46,8 @@ void convertGnssLocation(const V1_0::GnssLocation& in, Location& out);
void convertGnssLocation(const V2_0::GnssLocation& in, Location& out); void convertGnssLocation(const V2_0::GnssLocation& in, Location& out);
void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out); void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out); void convertGnssConstellationType(GnssSvType& in, V2_0::GnssConstellationType& out);
void convertGnssSvid(GnssSv& in, int16_t& out);
void convertGnssSvid(GnssMeasurementsData& in, int16_t& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);

View file

@ -231,7 +231,7 @@ static void convertGnssMeasurement(GnssMeasurementsData& in,
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_CARRIER_PHASE_UNCERTAINTY;
if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT) if (in.flags & GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT)
out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL; out.flags |= IGnssMeasurementCallback::GnssMeasurementFlags::HAS_AUTOMATIC_GAIN_CONTROL;
out.svid = in.svId; convertGnssSvid(in, out.svid);
convertGnssConstellationType(in.svType, out.constellation); convertGnssConstellationType(in.svType, out.constellation);
out.timeOffsetNs = in.timeOffsetNs; out.timeOffsetNs = in.timeOffsetNs;
if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT) if (in.stateMask & GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT)

View file

@ -73,6 +73,11 @@ int main() {
#else #else
ALOGE("LOC_HIDL_VERSION not defined."); ALOGE("LOC_HIDL_VERSION not defined.");
#endif #endif
} else {
status = registerPassthroughServiceImplementation<IGnss>("gnss_vendor");
if (status != OK) {
ALOGE("Error while registering gnss_vendor service: %d", status);
}
} }
joinRpcThreadpool(); joinRpcThreadpool();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019, The Linux Foundation. All rights reserved. * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -183,7 +183,7 @@ BatteryListenerImpl::~BatteryListenerImpl()
{ {
std::lock_guard<std::mutex> _l(mLock); std::lock_guard<std::mutex> _l(mLock);
if (mHealth != NULL) if (mHealth != NULL)
mHealth->unlinkToDeath(this); mHealth->unregisterCallback(this);
auto r = mHealth->unlinkToDeath(this); auto r = mHealth->unlinkToDeath(this);
if (!r.isOk() || r == false) { if (!r.isOk() || r == false) {
LOC_LOGe("Transaction error in unregister to HealthHAL death: %s", LOC_LOGe("Transaction error in unregister to HealthHAL death: %s",
@ -206,6 +206,8 @@ void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
LOC_LOGi("health service died, reinit"); LOC_LOGi("health service died, reinit");
mDone = true; mDone = true;
} }
mHealth = NULL;
mCond.notify_one();
mThread->join(); mThread->join();
std::lock_guard<std::mutex> _l(mLock); std::lock_guard<std::mutex> _l(mLock);
init(); init();

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014,2016-2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014,2016-2017,2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -30,7 +30,6 @@
#define LOG_TAG "LocSvc_CtxBase" #define LOG_TAG "LocSvc_CtxBase"
#include <dlfcn.h> #include <dlfcn.h>
#include <cutils/sched_policy.h>
#include <unistd.h> #include <unistd.h>
#include <ContextBase.h> #include <ContextBase.h>
#include <msg_q.h> #include <msg_q.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2019 The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, 2016-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -185,6 +185,10 @@ DEFAULT_IMPL()
void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/) void LocAdapterBase::reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& /*config*/)
DEFAULT_IMPL() DEFAULT_IMPL()
void LocAdapterBase::reportGnssConfigEvent(uint32_t, /* session id*/
const GnssConfig& /*gnssConfig*/)
DEFAULT_IMPL()
bool LocAdapterBase:: bool LocAdapterBase::
requestOdcpiEvent(OdcpiRequestInfo& /*request*/) requestOdcpiEvent(OdcpiRequestInfo& /*request*/)
DEFAULT_IMPL(false) DEFAULT_IMPL(false)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2019 The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, 2016-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -206,6 +206,7 @@ public:
GpsLocationExtended &location_extended, LocPosTechMask tech_mask); GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config); virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config); virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
virtual void reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig);
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);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2019 The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, 2016-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -415,19 +415,17 @@ void LocApiBase::reportSv(GnssSvNotification& svNotify)
svNotify.gnssSvs[i].type = GNSS_SV_TYPE_UNKNOWN; svNotify.gnssSvs[i].type = GNSS_SV_TYPE_UNKNOWN;
} }
// Display what we report to clients // Display what we report to clients
uint16_t displaySvId = GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[i].type ? LOC_LOGV(" %03zu: %*s %02d %f %f %f %f 0x%02X 0x%2X",
svNotify.gnssSvs[i].svId + QZSS_SV_PRN_MIN - 1 :
svNotify.gnssSvs[i].svId;
LOC_LOGV(" %03zu: %*s %02d %f %f %f %f 0x%02X",
i, i,
13, 13,
constellationString[svNotify.gnssSvs[i].type], constellationString[svNotify.gnssSvs[i].type],
displaySvId, svNotify.gnssSvs[i].svId,
svNotify.gnssSvs[i].cN0Dbhz, svNotify.gnssSvs[i].cN0Dbhz,
svNotify.gnssSvs[i].elevation, svNotify.gnssSvs[i].elevation,
svNotify.gnssSvs[i].azimuth, svNotify.gnssSvs[i].azimuth,
svNotify.gnssSvs[i].carrierFrequencyHz, svNotify.gnssSvs[i].carrierFrequencyHz,
svNotify.gnssSvs[i].gnssSvOptionsMask); svNotify.gnssSvs[i].gnssSvOptionsMask,
svNotify.gnssSvs[i].gnssSignalTypeMask);
} }
// loop through adapters, and deliver to all adapters. // loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS( TO_ALL_LOCADAPTERS(
@ -593,6 +591,11 @@ void LocApiBase::handleBatchStatusEvent(BatchingStatus batchStatus)
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportBatchStatusChangeEvent(batchStatus)); TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportBatchStatusChangeEvent(batchStatus));
} }
void LocApiBase::reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig)
{
// loop through adapters, and deliver to the first handling adapter.
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssConfigEvent(sessionId, gnssConfig));
}
enum loc_api_adapter_err LocApiBase:: enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/) open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
@ -879,4 +882,14 @@ DEFAULT_IMPL()
void LocApiBase::updateSystemPowerState(PowerStateType /*powerState*/) void LocApiBase::updateSystemPowerState(PowerStateType /*powerState*/)
DEFAULT_IMPL() DEFAULT_IMPL()
void LocApiBase::
configRobustLocation(bool /*enabled*/,
bool /*enableForE911*/,
LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
void LocApiBase::
getRobustLocationConfig(uint32_t sessionId, LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
} // namespace loc_core } // namespace loc_core

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2019 The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2014, 2016-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -195,6 +195,7 @@ public:
void reportDeleteAidingDataEvent(GnssAidingData& aidingData); void reportDeleteAidingDataEvent(GnssAidingData& aidingData);
void reportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel); void reportKlobucharIonoModel(GnssKlobucharIonoModel& ionoModel);
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo); void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
void sendNfwNotification(GnssNfwNotification& notification); void sendNfwNotification(GnssNfwNotification& notification);
void geofenceBreach(size_t count, uint32_t* hwIds, Location& location, void geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
@ -318,6 +319,9 @@ public:
void updateNmeaMask(uint32_t mask); void updateNmeaMask(uint32_t mask);
virtual void updateSystemPowerState(PowerStateType systemPowerState); virtual void updateSystemPowerState(PowerStateType systemPowerState);
virtual void configRobustLocation(bool enable, bool enableForE911,
LocApiResponse* adapterResponse=nullptr);
virtual void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
}; };
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask, typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,

View file

@ -40,6 +40,10 @@ libloc_core_la_c_sources = \
SystemStatusOsObserver.cpp \ SystemStatusOsObserver.cpp \
SystemStatus.cpp SystemStatus.cpp
if USE_EXTERNAL_AP
AM_CFLAGS += -DFEATURE_EXTERNAL_AP
endif
library_includedir = $(pkgincludedir) library_includedir = $(pkgincludedir)
library_include_HEADERS = $(libloc_core_la_h_sources) library_include_HEADERS = $(libloc_core_la_h_sources)

View file

@ -38,7 +38,7 @@ namespace loc_core
{ {
template <typename CINT, typename COUT> template <typename CINT, typename COUT>
COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) { COUT SystemStatusOsObserver::containerTransfer(CINT& inContainer) {
COUT outContainer(0); COUT outContainer = {};
for (auto item : inContainer) { for (auto item : inContainer) {
outContainer.insert(outContainer.begin(), item); outContainer.insert(outContainer.begin(), item);
} }
@ -67,6 +67,7 @@ void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscript
inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) : inline SetSubsObj(ObserverContext& context, IDataItemSubscription* subscriptionObj) :
mContext(context), mSubsObj(subscriptionObj) {} mContext(context), mSubsObj(subscriptionObj) {}
void proc() const { void proc() const {
LOC_LOGi("SetSubsObj::enter");
mContext.mSubscriptionObj = mSubsObj; mContext.mSubscriptionObj = mSubsObj;
if (!mContext.mSSObserver->mDataItemToClients.empty()) { if (!mContext.mSSObserver->mDataItemToClients.empty()) {
@ -76,6 +77,7 @@ void SystemStatusOsObserver::setSubscriptionObj(IDataItemSubscription* subscript
mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver); mContext.mSubscriptionObj->subscribe(dis, mContext.mSSObserver);
mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver); mContext.mSubscriptionObj->requestData(dis, mContext.mSSObserver);
} }
LOC_LOGi("SetSubsObj::exit");
} }
}; };
@ -101,7 +103,7 @@ void SystemStatusOsObserver::subscribe(const list<DataItemId>& l, IDataItemObser
mToRequestData(requestData) {} mToRequestData(requestData) {}
void proc() const { void proc() const {
unordered_set<DataItemId> dataItemsToSubscribe(0); unordered_set<DataItemId> dataItemsToSubscribe = {};
mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe); mParent->mDataItemToClients.add(mDataItemSet, {mClient}, &dataItemsToSubscribe);
mParent->mClientToDataItems.add(mClient, mDataItemSet); mParent->mClientToDataItems.add(mClient, mDataItemSet);
@ -147,8 +149,8 @@ void SystemStatusOsObserver::updateSubscription(
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {} mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
void proc() const { void proc() const {
unordered_set<DataItemId> dataItemsToSubscribe(0); unordered_set<DataItemId> dataItemsToSubscribe = {};
unordered_set<DataItemId> dataItemsToUnsubscribe(0); unordered_set<DataItemId> dataItemsToUnsubscribe = {};
unordered_set<IDataItemObserver*> clients({mClient}); unordered_set<IDataItemObserver*> clients({mClient});
// below removes clients from all entries keyed with the return of the // below removes clients from all entries keyed with the return of the
// mClientToDataItems.update() call. If leaving an empty set of clients as the // mClientToDataItems.update() call. If leaving an empty set of clients as the
@ -219,11 +221,11 @@ void SystemStatusOsObserver::unsubscribe(
mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {} mDataItemSet(containerTransfer<list<DataItemId>, unordered_set<DataItemId>>(l)) {}
void proc() const { void proc() const {
unordered_set<DataItemId> dataItemsUnusedByClient(0); unordered_set<DataItemId> dataItemsUnusedByClient = {};
unordered_set<IDataItemObserver*> clientToRemove(0); unordered_set<IDataItemObserver*> clientToRemove = {};
unordered_set<DataItemId> dataItemsToUnsubscribe = {};
mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove, mParent->mClientToDataItems.trimOrRemove({mClient}, mDataItemSet, &clientToRemove,
&dataItemsUnusedByClient); &dataItemsUnusedByClient);
unordered_set<DataItemId> dataItemsToUnsubscribe(0);
mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient}, mParent->mDataItemToClients.trimOrRemove(dataItemsUnusedByClient, {mClient},
&dataItemsToUnsubscribe, nullptr); &dataItemsToUnsubscribe, nullptr);
@ -259,6 +261,7 @@ void SystemStatusOsObserver::unsubscribeAll(IDataItemObserver* client)
void proc() const { void proc() const {
unordered_set<DataItemId> diByClient = mParent->mClientToDataItems.getValSet(mClient); unordered_set<DataItemId> diByClient = mParent->mClientToDataItems.getValSet(mClient);
if (!diByClient.empty()) { if (!diByClient.empty()) {
unordered_set<DataItemId> dataItemsToUnsubscribe; unordered_set<DataItemId> dataItemsToUnsubscribe;
mParent->mClientToDataItems.remove(mClient); mParent->mClientToDataItems.remove(mClient);
@ -308,7 +311,7 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
void proc() const { void proc() const {
// Update Cache with received data items and prepare // Update Cache with received data items and prepare
// list of data items to be sent. // list of data items to be sent.
unordered_set<DataItemId> dataItemIdsToBeSent(0); unordered_set<DataItemId> dataItemIdsToBeSent = {};
for (auto item : mDiVec) { for (auto item : mDiVec) {
if (mParent->updateCache(item)) { if (mParent->updateCache(item)) {
dataItemIdsToBeSent.insert(item->getId()); dataItemIdsToBeSent.insert(item->getId());
@ -316,7 +319,7 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
} }
// Send data item to all subscribed clients // Send data item to all subscribed clients
unordered_set<IDataItemObserver*> clientSet(0); unordered_set<IDataItemObserver*> clientSet = {};
for (auto each : dataItemIdsToBeSent) { for (auto each : dataItemIdsToBeSent) {
auto clients = mParent->mDataItemToClients.getValSetPtr(each); auto clients = mParent->mDataItemToClients.getValSetPtr(each);
if (nullptr != clients) { if (nullptr != clients) {
@ -459,8 +462,9 @@ bool SystemStatusOsObserver::connectBackhaul()
mFwkActionReqObj(fwkActReq) {} mFwkActionReqObj(fwkActReq) {}
virtual ~HandleConnectBackhaul() {} virtual ~HandleConnectBackhaul() {}
void proc() const { void proc() const {
LOC_LOGD("HandleConnectBackhaul"); LOC_LOGi("HandleConnectBackhaul::enter");
mFwkActionReqObj->connectBackhaul(); mFwkActionReqObj->connectBackhaul();
LOC_LOGi("HandleConnectBackhaul::exit");
} }
IFrameworkActionReq* mFwkActionReqObj; IFrameworkActionReq* mFwkActionReqObj;
}; };
@ -488,8 +492,9 @@ bool SystemStatusOsObserver::disconnectBackhaul()
mFwkActionReqObj(fwkActReq) {} mFwkActionReqObj(fwkActReq) {}
virtual ~HandleDisconnectBackhaul() {} virtual ~HandleDisconnectBackhaul() {}
void proc() const { void proc() const {
LOC_LOGD("HandleDisconnectBackhaul"); LOC_LOGi("HandleDisconnectBackhaul::enter");
mFwkActionReqObj->disconnectBackhaul(); mFwkActionReqObj->disconnectBackhaul();
LOC_LOGi("HandleDisconnectBackhaul::exit");
} }
IFrameworkActionReq* mFwkActionReqObj; IFrameworkActionReq* mFwkActionReqObj;
}; };
@ -518,7 +523,7 @@ void SystemStatusOsObserver::sendCachedDataItems(
} else { } else {
string clientName; string clientName;
to->getName(clientName); to->getName(clientName);
list<IDataItemCore*> dataItems(0); list<IDataItemCore*> dataItems = {};
for (auto each : s) { for (auto each : s) {
auto citer = mDataItemCache.find(each); auto citer = mDataItemCache.find(each);

View file

@ -86,6 +86,19 @@ fi
AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes") AM_CONDITIONAL(USE_FEATURE_AUTOMOTIVE, test "x${with_auto_feature}" = "xyes")
# External AP
AC_ARG_WITH([external_ap],
AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
[Using External Application Processor]),
[],
with_external_ap=no)
if test "x$with_external_ap" != "xno"; then
CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
fi
AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
AC_CONFIG_FILES([ \ AC_CONFIG_FILES([ \
Makefile \ Makefile \
loc-core.pc \ loc-core.pc \

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -87,6 +87,7 @@ GnssAdapter::GnssAdapter() :
mOdcpiRequestActive(false), mOdcpiRequestActive(false),
mOdcpiTimer(this), mOdcpiTimer(this),
mOdcpiRequest(), mOdcpiRequest(),
mCallbackPriority(OdcpiPrioritytype::ODCPI_HANDLER_PRIORITY_LOW),
mSystemStatus(SystemStatus::getInstance(mMsgTask)), mSystemStatus(SystemStatus::getInstance(mMsgTask)),
mServerUrl(":"), mServerUrl(":"),
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask), mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask),
@ -526,6 +527,11 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out,
out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT; out.flags |= GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT;
out.locOutputEngMask = locationExtended.locOutputEngMask; out.locOutputEngMask = locationExtended.locOutputEngMask;
} }
if (GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX & locationExtended.flags) {
out.flags |= GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT;
out.conformityIndex = locationExtended.conformityIndex;
}
} }
@ -853,6 +859,13 @@ GnssAdapter::setConfig()
mLocApi->setPositionAssistedClockEstimatorMode( mLocApi->setPositionAssistedClockEstimatorMode(
mLocConfigInfo.paceConfigInfo.enable); mLocConfigInfo.paceConfigInfo.enable);
// we do not support control robust location from gps.conf
if (mLocConfigInfo.robustLocationConfigInfo.isValid == true) {
mLocApi->configRobustLocation(
mLocConfigInfo.robustLocationConfigInfo.enable,
mLocConfigInfo.robustLocationConfigInfo.enableFor911);
}
if (sapConf.GYRO_BIAS_RANDOM_WALK_VALID || if (sapConf.GYRO_BIAS_RANDOM_WALK_VALID ||
sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
sapConf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || sapConf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
@ -1298,9 +1311,10 @@ void
GnssAdapter::gnssSvIdConfigUpdate() GnssAdapter::gnssSvIdConfigUpdate()
{ {
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64 LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
", qzss 0x%" PRIx64 ", gal 0x%" PRIx64, ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask, mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask); mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
mGnssSvIdConfig.sbasBlacklistSvMask);
// Now set required blacklisted SVs // Now set required blacklisted SVs
mLocApi->setBlacklistSv(mGnssSvIdConfig); mLocApi->setBlacklistSv(mGnssSvIdConfig);
@ -1323,9 +1337,10 @@ LocationError
GnssAdapter::gnssSvIdConfigUpdateSync() GnssAdapter::gnssSvIdConfigUpdateSync()
{ {
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64 LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
", qzss 0x%" PRIx64 ", gal 0x%" PRIx64, ", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask, mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask); mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
mGnssSvIdConfig.sbasBlacklistSvMask);
// Now set required blacklisted SVs // Now set required blacklisted SVs
return mLocApi->setBlacklistSvSync(mGnssSvIdConfig); return mLocApi->setBlacklistSvSync(mGnssSvIdConfig);
@ -1479,6 +1494,19 @@ GnssAdapter::gnssGetConfigCommand(GnssConfigFlagsMask configMask) {
errs[index++] = LOCATION_ERROR_NOT_SUPPORTED; errs[index++] = LOCATION_ERROR_NOT_SUPPORTED;
} }
} }
if (mConfigMask & GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT) {
uint32_t sessionId = *(mIds+index);
LocApiResponse* locApiResponse =
new LocApiResponse(*mAdapter.getContext(),
[this, sessionId] (LocationError err) {
mAdapter.reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
mAdapter.reportResponse(LOCATION_ERROR_GENERAL_FAILURE, sessionId);
} else {
mApi.getRobustLocationConfig(sessionId, locApiResponse);
}
}
mAdapter.reportResponse(index, errs, mIds); mAdapter.reportResponse(index, errs, mIds);
delete[] errs; delete[] errs;
@ -1508,12 +1536,14 @@ GnssAdapter::convertToGnssSvIdConfig(
config.bdsBlacklistSvMask = 0; config.bdsBlacklistSvMask = 0;
config.qzssBlacklistSvMask = 0; config.qzssBlacklistSvMask = 0;
config.galBlacklistSvMask = 0; config.galBlacklistSvMask = 0;
config.sbasBlacklistSvMask = 0;
retVal = true; retVal = true;
} else { } else {
// Parse the vector and convert SV IDs to mask values // Parse the vector and convert SV IDs to mask values
for (GnssSvIdSource source : blacklistedSvIds) { for (GnssSvIdSource source : blacklistedSvIds) {
uint64_t* svMaskPtr = NULL; uint64_t* svMaskPtr = NULL;
GnssSvId initialSvId = 0; GnssSvId initialSvId = 0;
uint16_t svIndexOffset = 0;
switch(source.constellation) { switch(source.constellation) {
case GNSS_SV_TYPE_GLONASS: case GNSS_SV_TYPE_GLONASS:
svMaskPtr = &config.gloBlacklistSvMask; svMaskPtr = &config.gloBlacklistSvMask;
@ -1531,6 +1561,28 @@ GnssAdapter::convertToGnssSvIdConfig(
svMaskPtr = &config.galBlacklistSvMask; svMaskPtr = &config.galBlacklistSvMask;
initialSvId = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID; initialSvId = GNSS_SV_CONFIG_GAL_INITIAL_SV_ID;
break; break;
case GNSS_SV_TYPE_SBAS:
// SBAS does not support enable/disable whole constellation
// so do not set up svTypeMask for SBAS
svMaskPtr = &config.sbasBlacklistSvMask;
// SBAS currently has two ranges
// range of SV id: 120 to 158 and 183 to 191
if (0 == source.svId) {
LOC_LOGd("blacklist all SBAS SV");
} else if (source.svId >= GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID) {
// handle SV id in range of 183 to 191
initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
svIndexOffset = GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH;
} else if ((source.svId >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID) &&
(source.svId < (GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID +
GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH))){
// handle SV id in range of 120 to 158
initialSvId = GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID;
} else {
LOC_LOGe("invalid SBAS sv id %d", source.svId);
svMaskPtr = nullptr;
}
break;
default: default:
break; break;
} }
@ -1545,7 +1597,8 @@ GnssAdapter::convertToGnssSvIdConfig(
LOC_LOGe("Invalid sv id %d for sv type %d", LOC_LOGe("Invalid sv id %d for sv type %d",
source.svId, source.constellation); source.svId, source.constellation);
} else { } else {
*svMaskPtr |= (1ULL << (source.svId - initialSvId)); uint32_t shiftCnt = source.svId + svIndexOffset - initialSvId;
*svMaskPtr |= (1ULL << shiftCnt);
} }
} }
} }
@ -1554,41 +1607,49 @@ GnssAdapter::convertToGnssSvIdConfig(
if (0 != config.gloBlacklistSvMask || if (0 != config.gloBlacklistSvMask ||
0 != config.bdsBlacklistSvMask || 0 != config.bdsBlacklistSvMask ||
0 != config.galBlacklistSvMask || 0 != config.galBlacklistSvMask ||
0 != config.qzssBlacklistSvMask) { 0 != config.qzssBlacklistSvMask ||
0 != config.sbasBlacklistSvMask) {
retVal = true; retVal = true;
} }
} }
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
config.bdsBlacklistSvMask, config.gloBlacklistSvMask,
config.qzssBlacklistSvMask, config.galBlacklistSvMask,
config.sbasBlacklistSvMask);
return retVal; return retVal;
} }
void GnssAdapter::convertFromGnssSvIdConfig( void GnssAdapter::convertFromGnssSvIdConfig(
const GnssSvIdConfig& svConfig, GnssConfig& config) const GnssSvIdConfig& svConfig, std::vector<GnssSvIdSource>& blacklistedSvIds)
{ {
// Convert blacklisted SV mask values to vectors // Convert blacklisted SV mask values to vectors
if (svConfig.bdsBlacklistSvMask) { if (svConfig.bdsBlacklistSvMask) {
convertGnssSvIdMaskToList( convertGnssSvIdMaskToList(
svConfig.bdsBlacklistSvMask, config.blacklistedSvIds, svConfig.bdsBlacklistSvMask, blacklistedSvIds,
GNSS_SV_CONFIG_BDS_INITIAL_SV_ID, GNSS_SV_TYPE_BEIDOU); GNSS_SV_CONFIG_BDS_INITIAL_SV_ID, GNSS_SV_TYPE_BEIDOU);
config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
} }
if (svConfig.galBlacklistSvMask) { if (svConfig.galBlacklistSvMask) {
convertGnssSvIdMaskToList( convertGnssSvIdMaskToList(
svConfig.galBlacklistSvMask, config.blacklistedSvIds, svConfig.galBlacklistSvMask, blacklistedSvIds,
GNSS_SV_CONFIG_GAL_INITIAL_SV_ID, GNSS_SV_TYPE_GALILEO); GNSS_SV_CONFIG_GAL_INITIAL_SV_ID, GNSS_SV_TYPE_GALILEO);
config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
} }
if (svConfig.gloBlacklistSvMask) { if (svConfig.gloBlacklistSvMask) {
convertGnssSvIdMaskToList( convertGnssSvIdMaskToList(
svConfig.gloBlacklistSvMask, config.blacklistedSvIds, svConfig.gloBlacklistSvMask, blacklistedSvIds,
GNSS_SV_CONFIG_GLO_INITIAL_SV_ID, GNSS_SV_TYPE_GLONASS); GNSS_SV_CONFIG_GLO_INITIAL_SV_ID, GNSS_SV_TYPE_GLONASS);
config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
} }
if (svConfig.qzssBlacklistSvMask) { if (svConfig.qzssBlacklistSvMask) {
convertGnssSvIdMaskToList( convertGnssSvIdMaskToList(
svConfig.qzssBlacklistSvMask, config.blacklistedSvIds, svConfig.qzssBlacklistSvMask, blacklistedSvIds,
GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID, GNSS_SV_TYPE_QZSS); GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID, GNSS_SV_TYPE_QZSS);
config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT; }
if (svConfig.sbasBlacklistSvMask) {
convertGnssSvIdMaskToList(
svConfig.sbasBlacklistSvMask, blacklistedSvIds,
GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID, GNSS_SV_TYPE_SBAS);
} }
} }
@ -1602,6 +1663,7 @@ void GnssAdapter::convertGnssSvIdMaskToList(
// SV ID 0 => All SV IDs in mask // SV ID 0 => All SV IDs in mask
if (GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK == svIdMask) { if (GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK == svIdMask) {
LOC_LOGd("blacklist all SVs in constellation %d", source.constellation);
source.svId = 0; source.svId = 0;
svIds.push_back(source); svIds.push_back(source);
return; return;
@ -1612,6 +1674,18 @@ void GnssAdapter::convertGnssSvIdMaskToList(
while (svIdMask > 0) { while (svIdMask > 0) {
if (svIdMask & 0x1) { if (svIdMask & 0x1) {
source.svId = bitNumber + initialSvId; source.svId = bitNumber + initialSvId;
// SBAS has two ranges:
// SBAS - SV 120 to 158, maps to 0 to 38
// SV 183 to 191, maps to 39 to 47
// #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID 120
// #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH 39
// #define GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID 183
if (svType == GNSS_SV_TYPE_SBAS) {
if (bitNumber >= GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH) {
source.svId = bitNumber - GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH +
GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID;
}
}
svIds.push_back(source); svIds.push_back(source);
} }
bitNumber++; bitNumber++;
@ -1645,12 +1719,18 @@ void GnssAdapter::reportGnssSvIdConfig(const GnssSvIdConfig& svIdConfig)
// Invoke control clients config callback // Invoke control clients config callback
if (nullptr != mControlCallbacks.gnssConfigCb && if (nullptr != mControlCallbacks.gnssConfigCb &&
svIdConfig.size == sizeof(GnssSvIdConfig)) { svIdConfig.size == sizeof(GnssSvIdConfig)) {
convertFromGnssSvIdConfig(svIdConfig, config);
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64 convertFromGnssSvIdConfig(svIdConfig, config.blacklistedSvIds);
", qzss 0x%" PRIx64 ", gal 0x%" PRIx64, if (config.blacklistedSvIds.size() > 0) {
config.flags |= GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
}
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64 ", "
"qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
svIdConfig.bdsBlacklistSvMask, svIdConfig.gloBlacklistSvMask, svIdConfig.bdsBlacklistSvMask, svIdConfig.gloBlacklistSvMask,
svIdConfig.qzssBlacklistSvMask, svIdConfig.galBlacklistSvMask); svIdConfig.qzssBlacklistSvMask, svIdConfig.galBlacklistSvMask,
mControlCallbacks.gnssConfigCb(config); svIdConfig.sbasBlacklistSvMask);
// use 0 session id to indicate that receiver does not yet care about session id
mControlCallbacks.gnssConfigCb(0, config);
} else { } else {
LOC_LOGe("Failed to report, size %d", (uint32_t)config.size); LOC_LOGe("Failed to report, size %d", (uint32_t)config.size);
} }
@ -1711,6 +1791,12 @@ GnssAdapter::gnssSvTypeConfigUpdate(bool sendReset)
mGnssSvTypeConfig.size, mGnssSvTypeConfig.blacklistedSvTypesMask, mGnssSvTypeConfig.size, mGnssSvTypeConfig.blacklistedSvTypesMask,
mGnssSvTypeConfig.enabledSvTypesMask, sendReset); mGnssSvTypeConfig.enabledSvTypesMask, sendReset);
LOC_LOGd("blacklist bds 0x%" PRIx64 ", glo 0x%" PRIx64
", qzss 0x%" PRIx64 ", gal 0x%" PRIx64 ", sbas 0x%" PRIx64,
mGnssSvIdConfig.bdsBlacklistSvMask, mGnssSvIdConfig.gloBlacklistSvMask,
mGnssSvIdConfig.qzssBlacklistSvMask, mGnssSvIdConfig.galBlacklistSvMask,
mGnssSvIdConfig.sbasBlacklistSvMask);
if (mGnssSvTypeConfig.size == sizeof(mGnssSvTypeConfig)) { if (mGnssSvTypeConfig.size == sizeof(mGnssSvTypeConfig)) {
if (sendReset) { if (sendReset) {
@ -2097,8 +2183,6 @@ GnssAdapter::addClientCommand(LocationAPI* client, const LocationCallbacks& call
inline virtual void proc() const { inline virtual void proc() const {
// check whether we need to notify client of cached location system info // check whether we need to notify client of cached location system info
mAdapter.notifyClientOfCachedLocationSystemInfo(mClient, mCallbacks); mAdapter.notifyClientOfCachedLocationSystemInfo(mClient, mCallbacks);
// check whether we need to request sv poly for the registered client
mAdapter.requestSvPolyForClient(mClient, mCallbacks);
mAdapter.saveClient(mClient, mCallbacks); mAdapter.saveClient(mClient, mCallbacks);
} }
}; };
@ -2159,9 +2243,6 @@ GnssAdapter::updateClientsEventMask()
if (it->second.gnssMeasurementsCb != nullptr) { if (it->second.gnssMeasurementsCb != nullptr) {
mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
} }
if (it->second.gnssSvPolynomialCb != nullptr) {
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
}
if (it->second.gnssDataCb != nullptr) { if (it->second.gnssDataCb != nullptr) {
mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT; mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
@ -2228,7 +2309,8 @@ GnssAdapter::handleEngineUpEvent()
mAdapter.gnssSvIdConfigUpdate(); mAdapter.gnssSvIdConfigUpdate();
mAdapter.gnssSvTypeConfigUpdate(); mAdapter.gnssSvTypeConfigUpdate();
mAdapter.updateSystemPowerState(mAdapter.getSystemPowerState()); mAdapter.updateSystemPowerState(mAdapter.getSystemPowerState());
mAdapter.restartSessions(); // restart sessions
mAdapter.restartSessions(true);
for (auto msg: mAdapter.mPendingMsgs) { for (auto msg: mAdapter.mPendingMsgs) {
mAdapter.sendMsg(msg); mAdapter.sendMsg(msg);
} }
@ -2241,12 +2323,14 @@ GnssAdapter::handleEngineUpEvent()
} }
void void
GnssAdapter::restartSessions() GnssAdapter::restartSessions(bool modemSSR)
{ {
LOC_LOGD("%s]: ", __func__); LOC_LOGi(":enter");
if (modemSSR) {
// odcpi session is no longer active after restart // odcpi session is no longer active after restart
mOdcpiRequestActive = false; mOdcpiRequestActive = false;
}
// SPE will be restarted now, so set this variable to false. // SPE will be restarted now, so set this variable to false.
mSPEAlreadyRunningAtHighestInterval = false; mSPEAlreadyRunningAtHighestInterval = false;
@ -2261,6 +2345,20 @@ GnssAdapter::restartSessions()
} }
} }
// suspend all on-going sessions
void
GnssAdapter::suspendSessions()
{
LOC_LOGi(":enter");
if (!mTimeBasedTrackingSessions.empty()) {
// inform engine hub that GNSS session has stopped
mEngHubProxy->gnssStopFix();
mLocApi->stopFix(nullptr);
mSPEAlreadyRunningAtHighestInterval = false;
}
}
void GnssAdapter::checkAndRestartTimeBasedSession() void GnssAdapter::checkAndRestartTimeBasedSession()
{ {
LOC_LOGD("%s]: ", __func__); LOC_LOGD("%s]: ", __func__);
@ -2345,8 +2443,7 @@ GnssAdapter::hasCallbacksToStartTracking(LocationAPI* client)
auto it = mClientData.find(client); auto it = mClientData.find(client);
if (it != mClientData.end()) { if (it != mClientData.end()) {
if (it->second.trackingCb || it->second.gnssLocationInfoCb || if (it->second.trackingCb || it->second.gnssLocationInfoCb ||
it->second.engineLocationsInfoCb || it->second.gnssMeasurementsCb || it->second.engineLocationsInfoCb || it->second.gnssMeasurementsCb) {
it->second.gnssSvPolynomialCb) {
allowed = true; allowed = true;
} else { } else {
LOC_LOGi("missing right callback to start tracking") LOC_LOGi("missing right callback to start tracking")
@ -3404,15 +3501,21 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
} }
} }
// if PACE is enabled and engine hub is running and the fix is from sensor, // if PACE is enabled
// e.g.: DRE, inject DRE fix to modem if ((true == mLocConfigInfo.paceConfigInfo.isValid) &&
if ((true == mLocConfigInfo.paceConfigInfo.isValid && (true == mLocConfigInfo.paceConfigInfo.enable)) {
true == mLocConfigInfo.paceConfigInfo.enable) && // If fix has sensor contribution, and it is fused fix with DRE engine
(true == initEngHubProxy()) && (LOC_POS_TECH_MASK_SENSORS & techMask)) { // contributing to the fix, inject to modem
if ((LOC_POS_TECH_MASK_SENSORS & techMask) &&
(locationInfo.flags & GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT) &&
(locationInfo.locOutputEngType == LOC_OUTPUT_ENGINE_FUSED) &&
(locationInfo.flags & GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT) &&
(locationInfo.locOutputEngMask & DEAD_RECKONING_ENGINE)) {
mLocApi->injectPosition(locationInfo, false); mLocApi->injectPosition(locationInfo, false);
} }
} }
} }
}
if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER && if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER &&
!mTimeBasedTrackingSessions.empty()) { !mTimeBasedTrackingSessions.empty()) {
@ -3618,10 +3721,6 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
svUsedIdMask = mGnssSvIdUsedInPosition.qzss_sv_used_ids_mask; svUsedIdMask = mGnssSvIdUsedInPosition.qzss_sv_used_ids_mask;
} }
} }
// QZSS SV id's need to reported as it is to framework, since
// framework expects it as it is. See GnssStatus.java.
// SV id passed to here by LocApi is 1-based.
svNotify.gnssSvs[i].svId += (QZSS_SV_PRN_MIN - 1);
break; break;
case GNSS_SV_TYPE_NAVIC: case GNSS_SV_TYPE_NAVIC:
if (mGnssSvIdUsedInPosAvail) { if (mGnssSvIdUsedInPosAvail) {
@ -4095,53 +4194,11 @@ GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measu
} }
} }
void
GnssAdapter::requestSvPolyForClient(LocationAPI* client, const LocationCallbacks& callbacks) {
if (callbacks.gnssSvPolynomialCb) {
LocationCallbacks oldCallbacks = getClientCallbacks(client);
if (!oldCallbacks.gnssSvPolynomialCb) {
LOC_LOGd("request sv poly");
GnssAidingDataSvMask svDataMask = GNSS_AIDING_DATA_SV_POLY_BIT;
mLocApi->requestForAidingData(svDataMask);
}
}
}
void
GnssAdapter::reportSvPolynomial(const GnssSvPolynomial &svPolynomial)
{
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
if (nullptr != it->second.gnssSvPolynomialCb) {
it->second.gnssSvPolynomialCb(svPolynomial);
}
}
}
void void
GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial) GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
{ {
LOC_LOGD("%s]: ", __func__); LOC_LOGD("%s]: ", __func__);
// report SV poly to engine hub to dispatch to engine plugins
mEngHubProxy->gnssReportSvPolynomial(svPolynomial); mEngHubProxy->gnssReportSvPolynomial(svPolynomial);
// report SV poly to registered client
struct MsgReportGnssSvPolynomial : public LocMsg {
GnssAdapter& mAdapter;
GnssSvPolynomial mGnssSvPolynomialNotify;
inline MsgReportGnssSvPolynomial(GnssAdapter& adapter,
const GnssSvPolynomial& svPoly) :
LocMsg(),
mAdapter(adapter),
mGnssSvPolynomialNotify(svPoly) {
}
inline virtual void proc() const {
mAdapter.reportSvPolynomial(mGnssSvPolynomialNotify);
}
};
sendMsg(new MsgReportGnssSvPolynomial(*this, svPolynomial));
} }
void void
@ -4208,8 +4265,12 @@ void GnssAdapter::requestOdcpi(const OdcpiRequestInfo& request)
// the request is being stopped, but allow timer to expire first // the request is being stopped, but allow timer to expire first
// before stopping the timer just in case more ODCPI requests come // before stopping the timer just in case more ODCPI requests come
// to avoid spamming more odcpi requests to the framework // to avoid spamming more odcpi requests to the framework
} else { } else if (ODCPI_REQUEST_TYPE_STOP == request.type) {
LOC_LOGd("request: type %d, isEmergency %d", request.type, request.isEmergencyMode);
mOdcpiRequestCb(request);
mOdcpiRequestActive = false; mOdcpiRequestActive = false;
} else {
LOC_LOGE("Invalid ODCPI request type..");
} }
} else { } else {
LOC_LOGw("ODCPI request not supported"); LOC_LOGw("ODCPI request not supported");
@ -4238,31 +4299,38 @@ bool GnssAdapter::reportGnssAdditionalSystemInfoEvent(
return true; return true;
} }
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback) void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority)
{ {
struct MsgInitOdcpi : public LocMsg { struct MsgInitOdcpi : public LocMsg {
GnssAdapter& mAdapter; GnssAdapter& mAdapter;
OdcpiRequestCallback mOdcpiCb; OdcpiRequestCallback mOdcpiCb;
OdcpiPrioritytype mPriority;
inline MsgInitOdcpi(GnssAdapter& adapter, inline MsgInitOdcpi(GnssAdapter& adapter,
const OdcpiRequestCallback& callback) : const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority) :
LocMsg(), LocMsg(),
mAdapter(adapter), mAdapter(adapter),
mOdcpiCb(callback) {} mOdcpiCb(callback), mPriority(priority){}
inline virtual void proc() const { inline virtual void proc() const {
mAdapter.initOdcpi(mOdcpiCb); mAdapter.initOdcpi(mOdcpiCb, mPriority);
} }
}; };
sendMsg(new MsgInitOdcpi(*this, callback)); sendMsg(new MsgInitOdcpi(*this, callback, priority));
} }
void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback) void GnssAdapter::initOdcpi(const OdcpiRequestCallback& callback,
OdcpiPrioritytype priority)
{ {
LOC_LOGd("In priority: %d, Curr priority: %d", priority, mCallbackPriority);
if (priority >= mCallbackPriority) {
mOdcpiRequestCb = callback; mOdcpiRequestCb = callback;
mCallbackPriority = priority;
/* Register for WIFI request */ /* Register for WIFI request */
updateEvtMask(LOC_API_ADAPTER_BIT_REQUEST_WIFI, updateEvtMask(LOC_API_ADAPTER_BIT_REQUEST_WIFI,
LOC_REGISTRATION_MASK_ENABLED); LOC_REGISTRATION_MASK_ENABLED);
}
} }
void GnssAdapter::injectOdcpiCommand(const Location& location) void GnssAdapter::injectOdcpiCommand(const Location& location)
@ -5263,6 +5331,8 @@ GnssAdapter::updateSvConfig(uint32_t sessionId,
mGnssSvTypeConfig = svTypeConfig; mGnssSvTypeConfig = svTypeConfig;
mGnssSvIdConfig = svIdConfig; mGnssSvIdConfig = svIdConfig;
mBlacklistedSvIds.clear();
convertFromGnssSvIdConfig(svIdConfig, mBlacklistedSvIds);
// Send blacklist info // Send blacklist info
mLocApi->setBlacklistSv(mGnssSvIdConfig); mLocApi->setBlacklistSv(mGnssSvIdConfig);
@ -5317,6 +5387,17 @@ uint32_t GnssAdapter::gnssUpdateSvConfigCommand(
void void
GnssAdapter::resetSvConfig(uint32_t sessionId) { GnssAdapter::resetSvConfig(uint32_t sessionId) {
// Clear blacklisting
memset(&mGnssSvIdConfig, 0, sizeof(GnssSvIdConfig));
mGnssSvIdConfig.size = sizeof(mGnssSvIdConfig);
mBlacklistedSvIds.clear();
gnssSvIdConfigUpdate();
// Reset constellation config, including mGnssSvTypeConfig
// when size is set to 0, upon subsequent modem restart, sv type
// config will not be sent down to modem
gnssSetSvTypeConfig({sizeof(GnssSvTypeConfig), 0, 0});
LocApiResponse* locApiResponse = nullptr; LocApiResponse* locApiResponse = nullptr;
if (sessionId != 0) { if (sessionId != 0) {
locApiResponse = locApiResponse =
@ -5393,6 +5474,91 @@ GnssAdapter::configLeverArmCommand(const LeverArmConfigInfo& configInfo) {
return sessionId; return sessionId;
} }
void
GnssAdapter::configRobustLocation(uint32_t sessionId,
bool enable, bool enableForE911) {
mLocConfigInfo.robustLocationConfigInfo.isValid = true;
mLocConfigInfo.robustLocationConfigInfo.enable = enable;
mLocConfigInfo.robustLocationConfigInfo.enableFor911 = enableForE911;
// suspend all tracking sessions so modem can take the E911 configure
suspendSessions();
LocApiResponse* locApiResponse = nullptr;
if (sessionId != 0) {
locApiResponse =
new LocApiResponse(*getContext(),
[this, sessionId] (LocationError err) {
reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
}
}
mLocApi->configRobustLocation(enable, enableForE911, locApiResponse);
// resume all tracking sessions after the E911 configure
restartSessions(false);
}
uint32_t GnssAdapter::configRobustLocationCommand(
bool enable, bool enableForE911) {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgConfigRobustLocation : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
bool mEnable;
bool mEnableForE911;
inline MsgConfigRobustLocation(GnssAdapter& adapter,
uint32_t sessionId,
bool enable,
bool enableForE911) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mEnable(enable),
mEnableForE911(enableForE911) {}
inline virtual void proc() const {
mAdapter.configRobustLocation(mSessionId, mEnable, mEnableForE911);
}
};
sendMsg(new MsgConfigRobustLocation(*this, sessionId, enable, enableForE911));
return sessionId;
}
void GnssAdapter::reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig)
{
struct MsgReportGnssConfig : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
mutable GnssConfig mGnssConfig;
inline MsgReportGnssConfig(GnssAdapter& adapter,
uint32_t sessionId,
const GnssConfig& gnssConfig) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mGnssConfig(gnssConfig) {}
inline virtual void proc() const {
// Invoke control clients config callback
if (nullptr != mAdapter.mControlCallbacks.gnssConfigCb) {
mAdapter.mControlCallbacks.gnssConfigCb(mSessionId, mGnssConfig);
} else {
LOC_LOGe("Failed to report, callback not registered");
}
}
};
sendMsg(new MsgReportGnssConfig(*this, sessionId, gnssConfig));
}
/* ==== Eng Hub Proxy ================================================================= */ /* ==== Eng Hub Proxy ================================================================= */
/* ======== UTILITIES ================================================================= */ /* ======== UTILITIES ================================================================= */
void void

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -134,9 +134,16 @@ typedef struct {
bool enable; bool enable;
} PaceConfigInfo; } PaceConfigInfo;
typedef struct {
bool isValid;
bool enable;
bool enableFor911;
} RobustLocationConfigInfo;
typedef struct { typedef struct {
TuncConfigInfo tuncConfigInfo; TuncConfigInfo tuncConfigInfo;
PaceConfigInfo paceConfigInfo; PaceConfigInfo paceConfigInfo;
RobustLocationConfigInfo robustLocationConfigInfo;
} LocIntegrationConfigInfo; } LocIntegrationConfigInfo;
using namespace loc_core; using namespace loc_core;
@ -196,6 +203,7 @@ class GnssAdapter : public LocAdapterBase {
/* ==== ODCPI ========================================================================== */ /* ==== ODCPI ========================================================================== */
OdcpiRequestCallback mOdcpiRequestCb; OdcpiRequestCallback mOdcpiRequestCb;
bool mOdcpiRequestActive; bool mOdcpiRequestActive;
OdcpiPrioritytype mCallbackPriority;
OdcpiTimer mOdcpiTimer; OdcpiTimer mOdcpiTimer;
OdcpiRequestInfo mOdcpiRequest; OdcpiRequestInfo mOdcpiRequest;
void odcpiTimerExpire(); void odcpiTimerExpire();
@ -229,7 +237,7 @@ class GnssAdapter : public LocAdapterBase {
int totalSvCntInThisConstellation); int totalSvCntInThisConstellation);
/* ======== UTILITIES ================================================================== */ /* ======== UTILITIES ================================================================== */
inline void initOdcpi(const OdcpiRequestCallback& callback); inline void initOdcpi(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
inline void injectOdcpi(const Location& location); inline void injectOdcpi(const Location& location);
static bool isFlpClient(LocationCallbacks& locationCallbacks); static bool isFlpClient(LocationCallbacks& locationCallbacks);
@ -248,8 +256,9 @@ public:
/* ======== EVENTS ====(Called from QMI Thread)========================================= */ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
virtual void handleEngineUpEvent(); virtual void handleEngineUpEvent();
/* ======== UTILITIES ================================================================== */ /* ======== UTILITIES ================================================================== */
void restartSessions(); void restartSessions(bool modemSSR = false);
void checkAndRestartTimeBasedSession(); void checkAndRestartTimeBasedSession();
void suspendSessions();
/* ==== CLIENT ========================================================================= */ /* ==== CLIENT ========================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
@ -295,6 +304,7 @@ public:
const GnssSvIdConfig& svIdConfig); const GnssSvIdConfig& svIdConfig);
void resetSvConfig(uint32_t sessionId); void resetSvConfig(uint32_t sessionId);
void configLeverArm(uint32_t sessionId, const LeverArmConfigInfo& configInfo); void configLeverArm(uint32_t sessionId, const LeverArmConfigInfo& configInfo);
void configRobustLocation(uint32_t sessionId, bool enable, bool enableForE911);
/* ==== NI ============================================================================= */ /* ==== NI ============================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
@ -362,10 +372,11 @@ public:
const GnssSvIdConfig& svIdConfig); const GnssSvIdConfig& svIdConfig);
uint32_t gnssResetSvConfigCommand(); uint32_t gnssResetSvConfigCommand();
uint32_t configLeverArmCommand(const LeverArmConfigInfo& configInfo); uint32_t configLeverArmCommand(const LeverArmConfigInfo& configInfo);
uint32_t configRobustLocationCommand(bool enable, bool enableForE911);
/* ========= ODCPI ===================================================================== */ /* ========= ODCPI ===================================================================== */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
void initOdcpiCommand(const OdcpiRequestCallback& callback); void initOdcpiCommand(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
void injectOdcpiCommand(const Location& location); void injectOdcpiCommand(const Location& location);
/* ======== RESPONSES ================================================================== */ /* ======== RESPONSES ================================================================== */
void reportResponse(LocationError err, uint32_t sessionId); void reportResponse(LocationError err, uint32_t sessionId);
@ -404,6 +415,7 @@ public:
virtual void reportSvEphemerisEvent(GnssSvEphemerisReport & svEphemeris); virtual void reportSvEphemerisEvent(GnssSvEphemerisReport & svEphemeris);
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config); virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config); virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
virtual void reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig);
virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot); virtual bool reportGnssEngEnergyConsumedEvent(uint64_t energyConsumedSinceFirstBoot);
virtual void reportLocationSystemInfoEvent(const LocationSystemInfo& locationSystemInfo); virtual void reportLocationSystemInfoEvent(const LocationSystemInfo& locationSystemInfo);
@ -452,8 +464,7 @@ public:
void updateSystemPowerState(PowerStateType systemPowerState); void updateSystemPowerState(PowerStateType systemPowerState);
void reportSvPolynomial(const GnssSvPolynomial &svPolynomial); void reportSvPolynomial(const GnssSvPolynomial &svPolynomial);
void requestSvPolyForClient(LocationAPI* client,
const LocationCallbacks& callbacks);
/*======== GNSSDEBUG ================================================================*/ /*======== GNSSDEBUG ================================================================*/
@ -483,7 +494,7 @@ public:
static bool convertToGnssSvIdConfig( static bool convertToGnssSvIdConfig(
const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config); const std::vector<GnssSvIdSource>& blacklistedSvIds, GnssSvIdConfig& config);
static void convertFromGnssSvIdConfig( static void convertFromGnssSvIdConfig(
const GnssSvIdConfig& svConfig, GnssConfig& config); const GnssSvIdConfig& svConfig, std::vector<GnssSvIdSource>& blacklistedSvIds);
static void convertGnssSvIdMaskToList( static void convertGnssSvIdMaskToList(
uint64_t svIdMask, std::vector<GnssSvIdSource>& svIds, uint64_t svIdMask, std::vector<GnssSvIdSource>& svIds,
GnssSvId initialSvId, GnssSvType svType); GnssSvId initialSvId, GnssSvType svType);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -73,7 +73,7 @@ static void enableNfwLocationAccess(bool enable);
static void nfwInit(const NfwCbInfo& cbInfo); static void nfwInit(const NfwCbInfo& cbInfo);
static void getPowerStateChanges(void* powerStateCb); static void getPowerStateChanges(void* powerStateCb);
static void odcpiInit(const OdcpiRequestCallback& callback); static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
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,
@ -87,6 +87,7 @@ static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig); const GnssSvIdConfig& svIdConfig);
static uint32_t gnssResetSvConfig(); static uint32_t gnssResetSvConfig();
static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo); static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo);
static uint32_t configRobustLocation(bool enable, bool enableForE911);
static const GnssInterface gGnssInterface = { static const GnssInterface gGnssInterface = {
sizeof(GnssInterface), sizeof(GnssInterface),
@ -132,6 +133,7 @@ static const GnssInterface gGnssInterface = {
gnssUpdateSvConfig, gnssUpdateSvConfig,
gnssResetSvConfig, gnssResetSvConfig,
configLeverArm, configLeverArm,
configRobustLocation,
}; };
#ifndef DEBUG_X86 #ifndef DEBUG_X86
@ -140,6 +142,7 @@ extern "C" const GnssInterface* getGnssInterface()
const GnssInterface* getGnssInterface() const GnssInterface* getGnssInterface()
#endif // DEBUG_X86 #endif // DEBUG_X86
{ {
gGnssInterface.initialize();
return &gGnssInterface; return &gGnssInterface;
} }
@ -346,10 +349,10 @@ static void updateConnectionStatus(bool connected, int8_t type,
} }
} }
static void odcpiInit(const OdcpiRequestCallback& callback) static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority)
{ {
if (NULL != gGnssAdapter) { if (NULL != gGnssAdapter) {
gGnssAdapter->initOdcpiCommand(callback); gGnssAdapter->initOdcpiCommand(callback, priority);
} }
} }
@ -453,3 +456,11 @@ static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo){
return 0; return 0;
} }
} }
static uint32_t configRobustLocation(bool enable, bool enableForE911){
if (NULL != gGnssAdapter) {
return gGnssAdapter->configRobustLocationCommand(enable, enableForE911);
} else {
return 0;
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -302,6 +302,27 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
*/ */
virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) = 0; virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) = 0;
/** @brief
Configure the robust location setting.
@param
enable: true to enable robust location and false to disable
robust location.
@param
enableForE911: true to enable robust location when device is on
E911 session and false to disable on E911 session.
This parameter is only valid if robust location is enabled.
@return
A session id that will be returned in responseCallback to
match command with response. This effect is global for all
clients of LocationAPI responseCallback returns:
LOCATION_ERROR_SUCCESS if successful
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
*/
virtual uint32_t configRobustLocation(bool enable, bool enableForE911) = 0;
}; };
#endif /* ILOCATIONAPI_H */ #endif /* ILOCATIONAPI_H */

View file

@ -87,7 +87,7 @@ static bool isGnssClient(LocationCallbacks& locationCallbacks)
locationCallbacks.gnssLocationInfoCb != nullptr || locationCallbacks.gnssLocationInfoCb != nullptr ||
locationCallbacks.engineLocationsInfoCb != nullptr || locationCallbacks.engineLocationsInfoCb != nullptr ||
locationCallbacks.gnssMeasurementsCb != nullptr || locationCallbacks.gnssMeasurementsCb != nullptr ||
locationCallbacks.gnssSvPolynomialCb != nullptr); locationCallbacks.locationSystemInfoCb != nullptr);
} }
static bool isBatchingClient(LocationCallbacks& locationCallbacks) static bool isBatchingClient(LocationCallbacks& locationCallbacks)
@ -796,3 +796,17 @@ uint32_t LocationControlAPI::configLeverArm(const LeverArmConfigInfo& configInfo
pthread_mutex_unlock(&gDataMutex); pthread_mutex_unlock(&gDataMutex);
return id; return id;
} }
uint32_t LocationControlAPI::configRobustLocation(bool enable, bool enableForE911) {
uint32_t id = 0;
pthread_mutex_lock(&gDataMutex);
if (gData.gnssInterface != NULL) {
id = gData.gnssInterface->configRobustLocation(enable, enableForE911);
} else {
LOC_LOGe("No gnss interface available for Location Control API");
}
pthread_mutex_unlock(&gDataMutex);
return id;
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -374,6 +374,27 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
*/ */
virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override; virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
/** @brief
Configure the robust location setting.
@param
enable: true to enable robust location and false to disable
robust location.
@param
enableForE911: true to enable robust location when device is
on E911 session and false to disable on E911 session.
This parameter is only valid if robust location is enabled.
@return
A session id that will be returned in responseCallback to
match command with response. This effect is global for all
clients of LocationAPI responseCallback returns:
LOCATION_ERROR_SUCCESS if successful
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
*/
virtual uint32_t configRobustLocation(bool enable, bool enableForE911) override;
}; };
#endif /* LOCATIONAPI_H */ #endif /* LOCATIONAPI_H */

View file

@ -177,6 +177,7 @@ typedef enum {
GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26), // valid sensor cal status GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26), // valid sensor cal status
GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27), // valid output engine type GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT = (1<<27), // valid output engine type
GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28), // valid output engine mask GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT = (1<<28), // valid output engine mask
GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<29), // valid conformity index
} GnssLocationInfoFlagBits; } GnssLocationInfoFlagBits;
typedef enum { typedef enum {
@ -318,6 +319,7 @@ typedef enum {
GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9), GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9),
GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT = (1<<10), GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT = (1<<10),
GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT = (1<<11), GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT = (1<<11),
GNSS_CONFIG_FLAGS_ROBUST_LOCATION_BIT = (1<<12),
} GnssConfigFlagsBits; } GnssConfigFlagsBits;
typedef enum { typedef enum {
@ -1044,6 +1046,11 @@ typedef struct {
// when loc output eng type is set to fused, this field // when loc output eng type is set to fused, this field
// indicates the set of engines contribute to the fix. // indicates the set of engines contribute to the fix.
PositioningEngineMask locOutputEngMask; PositioningEngineMask locOutputEngMask;
/* When robust location is enabled, this field
* will how well the various input data considered for
* navigation solution conform to expectations.
* Range: 0 (least conforming) to 1 (most conforming) */
float conformityIndex;
} GnssLocationInfoNotification; } GnssLocationInfoNotification;
typedef struct { typedef struct {
@ -1148,6 +1155,7 @@ typedef struct {
double agcLevelDb; double agcLevelDb;
GnssMeasurementsCodeType codeType; GnssMeasurementsCodeType codeType;
char otherCodeTypeName[GNSS_MAX_NAME_LENGTH]; char otherCodeTypeName[GNSS_MAX_NAME_LENGTH];
int16_t gloFrequency;
} GnssMeasurementsData; } GnssMeasurementsData;
typedef struct { typedef struct {
@ -1192,80 +1200,6 @@ typedef struct {
GnssMeasurementsClock clock; // clock GnssMeasurementsClock clock; // clock
} GnssMeasurementsNotification; } GnssMeasurementsNotification;
#define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12
#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_SV_CLKBIAS_COEFF_MAX_SIZE 4
typedef uint16_t GnssSvPolyStatusMask;
#define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01)
#define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02)
#define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04)
#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08)
typedef uint16_t GnssSvPolyStatusMaskValidity;
#define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01)
#define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02)
#define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04)
#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08)
typedef struct {
uint32_t size;
uint16_t gnssSvId;
/* GPS: 1-32, GLO: 65-96, 0: Invalid,
SBAS: 120-151, BDS:201-237,GAL:301 to 336
All others are reserved
*/
int8_t freqNum;
/* Freq index, only valid if u_SysInd is GLO */
GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity;
GnssSvPolyStatusMask svPolyStatusMask;
uint32_t is_valid;
uint16_t iode;
/* Ephemeris reference time
GPS:Issue of Data Ephemeris used [unitless].
GLO: Tb 7-bit, refer to ICD02
*/
double T0;
/* Reference time for polynominal calculations
GPS: Secs in week.
GLO: Full secs since Jan/01/96
*/
double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
/* C0X, C0Y, C0Z */
double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
/* C1X, C2X ... C2Z, C3Z */
float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
/* C0T, C1T, C2T, C3T */
float svPosUnc; /* SV position uncertainty [m]. */
float ionoDelay; /* Ionospheric delay at d_T0 [m]. */
float ionoDot; /* Iono delay rate [m/s]. */
float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */
float tropoDelay; /* Tropospheric delay [m]. */
float elevation; /* Elevation [rad] at d_T0 */
float elevationDot; /* Elevation rate [rad/s] */
float elevationUnc; /* SV elevation [rad] uncertainty */
double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
/* Coefficients of velocity poly */
uint32_t enhancedIOD; /* Enhanced Reference Time */
float gpsIscL1ca;
float gpsIscL2c;
float gpsIscL5I5;
float gpsIscL5Q5;
float gpsTgd;
float gloTgdG1G2;
float bdsTgdB1;
float bdsTgdB2;
float bdsTgdB2a;
float bdsIscB2a;
float galBgdE1E5a;
float galBgdE1E5b;
float navicTgdL5;
} GnssSvPolynomial;
typedef uint32_t GnssSvId; typedef uint32_t GnssSvId;
struct GnssSvIdSource{ struct GnssSvIdSource{
@ -1308,6 +1242,32 @@ typedef struct {
uint64_t sbasBlacklistSvMask; uint64_t sbasBlacklistSvMask;
} GnssSvIdConfig; } GnssSvIdConfig;
// Specify the valid mask for robust location configure that
// will be returned via LocConfigGetMinGpsWeekCb when invoking
// getRobustLocationConfig. */
enum GnssConfigRobustLocationValidMask {
// GnssConfigRobustLocation has valid enabled field.
GNSS_CONFIG_ROBUST_LOCATION_ENABLED_VALID_BIT = (1<<0),
// GnssConfigRobustLocation has valid enabledForE911 field.
GNSS_CONFIG_ROBUST_LOCATION_ENABLED_FOR_E911_VALID_BIT = (1<<1),
};
// specify the robust location configuration used by modem GNSS engine
struct GnssConfigRobustLocation {
GnssConfigRobustLocationValidMask validMask;
bool enabled;
bool enabledForE911;
inline bool equals(const GnssConfigRobustLocation& config) const {
if (config.validMask == validMask &&
config.enabled == enabled &&
config.enabledForE911 == enabledForE911) {
return true;
}
return false;
}
};
struct GnssConfig{ struct GnssConfig{
uint32_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
@ -1323,6 +1283,7 @@ struct GnssConfig{
GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits
std::vector<GnssSvIdSource> blacklistedSvIds; std::vector<GnssSvIdSource> blacklistedSvIds;
uint32_t emergencyExtensionSeconds; uint32_t emergencyExtensionSeconds;
GnssConfigRobustLocation robustLocationConfig;
inline bool equals(const GnssConfig& config) { inline bool equals(const GnssConfig& config) {
if (flags == config.flags && if (flags == config.flags &&
@ -1337,7 +1298,8 @@ struct GnssConfig{
suplEmergencyServices == config.suplEmergencyServices && suplEmergencyServices == config.suplEmergencyServices &&
suplModeMask == config.suplModeMask && suplModeMask == config.suplModeMask &&
blacklistedSvIds == config.blacklistedSvIds && blacklistedSvIds == config.blacklistedSvIds &&
emergencyExtensionSeconds == config.emergencyExtensionSeconds) { emergencyExtensionSeconds == config.emergencyExtensionSeconds &&
robustLocationConfig.equals(config.robustLocationConfig)) {
return true; return true;
} }
return false; return false;
@ -1608,17 +1570,10 @@ typedef std::function<void(
GnssMeasurementsNotification gnssMeasurementsNotification GnssMeasurementsNotification gnssMeasurementsNotification
)> gnssMeasurementsCallback; )> gnssMeasurementsCallback;
/* Gives GNSS SV poly information, optional can be NULL
gnssSvPolyCallback is called only during a tracking session
broadcasted to all clients that registers for the poly */
typedef std::function<void(
GnssSvPolynomial gnssSvPolynomialNotification
)> gnssSvPolynomialCallback;
/* Provides the current GNSS configuration to the client */ /* Provides the current GNSS configuration to the client */
typedef std::function<void( typedef std::function<void(
GnssConfig& config uint32_t session_id,
const GnssConfig& config
)> gnssConfigCallback; )> gnssConfigCallback;
/* LocationSystemInfoCb is for receiving rare occuring location /* LocationSystemInfoCb is for receiving rare occuring location
@ -1656,7 +1611,6 @@ typedef struct {
batchingStatusCallback batchingStatusCb; // optional batchingStatusCallback batchingStatusCb; // optional
locationSystemInfoCallback locationSystemInfoCb; // optional locationSystemInfoCallback locationSystemInfoCb; // optional
engineLocationsInfoCallback engineLocationsInfoCb; // optional engineLocationsInfoCallback engineLocationsInfoCb; // optional
gnssSvPolynomialCallback gnssSvPolynomialCb; // optional
} LocationCallbacks; } LocationCallbacks;
#endif /* LOCATIONDATATYPES_H */ #endif /* LOCATIONDATATYPES_H */

View file

@ -11,6 +11,10 @@ liblocation_api_la_SOURCES = \
LocationAPI.cpp \ LocationAPI.cpp \
LocationAPIClientBase.cpp LocationAPIClientBase.cpp
if USE_EXTERNAL_AP
AM_CFLAGS += -DFEATURE_EXTERNAL_AP
endif
if USE_GLIB if USE_GLIB
liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ liblocation_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
liblocation_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 liblocation_api_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0

View file

@ -74,6 +74,19 @@ fi
AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
# External AP
AC_ARG_WITH([external_ap],
AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
[Using External Application Processor]),
[],
with_external_ap=no)
if test "x$with_external_ap" != "xno"; then
CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP"
fi
AM_CONDITIONAL(USE_EXTERNAL_AP, test "x${with_external_ap}" = "xyes")
AC_CONFIG_FILES([ \ AC_CONFIG_FILES([ \
Makefile \ Makefile \
location-api.pc \ location-api.pc \

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -78,7 +78,7 @@ 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); NetworkHandle networkHandle);
void (*odcpiInit)(const OdcpiRequestCallback& callback); void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority);
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);
@ -95,6 +95,7 @@ struct GnssInterface {
const GnssSvIdConfig& svIdConfig); const GnssSvIdConfig& svIdConfig);
uint32_t (*gnssResetSvConfig)(); uint32_t (*gnssResetSvConfig)();
uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo); uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo);
uint32_t (*configRobustLocation)(bool enable, bool enableForE911);
}; };
struct BatchingInterface { struct BatchingInterface {

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2014, 2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -37,6 +37,22 @@
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#if defined(__GNUC__) && defined(__GNUC_PREREQ)
#if __GNUC_PREREQ(6,0)
#pragma message "GNU C version is above 6"
#else
#pragma message "GNU C version is less than 6"
#define NO_UNORDERED_SET_OR_MAP
#endif
#endif
// use set/map instead of unordered_set/unordered_map for
// older GCC versions
#ifdef NO_UNORDERED_SET_OR_MAP
#define unordered_set set
#define unordered_map map
#endif
inline int64_t sysTimeMillis(int clock) inline int64_t sysTimeMillis(int clock)
{ {
struct timespec ts; struct timespec ts;
@ -61,6 +77,8 @@ extern "C" {
#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>
#else
#define set_sched_policy(a, b)
#endif /* FEATURE_EXTERNAL_AP */ #endif /* FEATURE_EXTERNAL_AP */
#include <pthread.h> #include <pthread.h>
#include <sys/time.h> #include <sys/time.h>

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2015, 2017, 2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -30,8 +30,15 @@
#define __LOC_UNORDERDED_SETMAP_H__ #define __LOC_UNORDERDED_SETMAP_H__
#include <algorithm> #include <algorithm>
#include <unordered_set> #include <loc_pla.h>
#include <unordered_map>
#ifdef NO_UNORDERED_SET_OR_MAP
#include <set>
#include <map>
#else
#include <unordered_set>
#include <unordered_map>
#endif
using std::unordered_set; using std::unordered_set;
using std::unordered_map; using std::unordered_map;
@ -55,7 +62,7 @@ inline static void trimSet(unordered_set<T>& fromSet, const unordered_set<T>& rV
// *s1* and *s2* will be left with the intersect removed from them. // *s1* and *s2* will be left with the intersect removed from them.
template <typename T> template <typename T>
static unordered_set<T> removeAndReturnInterset(unordered_set<T>& s1, unordered_set<T>& s2) { static unordered_set<T> removeAndReturnInterset(unordered_set<T>& s1, unordered_set<T>& s2) {
unordered_set<T> common(0); unordered_set<T> common = {};
for (auto b = s2.begin(); b != s2.end(); b++) { for (auto b = s2.begin(); b != s2.end(); b++) {
auto a = find(s1.begin(), s1.end(), *b); auto a = find(s1.begin(), s1.end(), *b);
if (a != s1.end()) { if (a != s1.end()) {
@ -73,7 +80,6 @@ template <typename KEY, typename VAL>
class LocUnorderedSetMap { class LocUnorderedSetMap {
unordered_map<KEY, unordered_set<VAL>> mMap; unordered_map<KEY, unordered_set<VAL>> mMap;
// Trim the VALs pointed to by *iter*, with everything that also exist in *rVals*. // Trim the VALs pointed to by *iter*, with everything that also exist in *rVals*.
// If the set becomes empty, remove the map entry. *goneVals*, if not null, records // If the set becomes empty, remove the map entry. *goneVals*, if not null, records
// the trimmed VALs. // the trimmed VALs.
@ -89,7 +95,9 @@ class LocUnorderedSetMap {
public: public:
inline LocUnorderedSetMap() {} inline LocUnorderedSetMap() {}
inline LocUnorderedSetMap(size_t size) : mMap(size) {} inline LocUnorderedSetMap(size_t size) : LocUnorderedSetMap() {
mMap.get_allocator().allocate(size);
}
inline bool empty() { return mMap.empty(); } inline bool empty() { return mMap.empty(); }
@ -104,12 +112,12 @@ public:
// If the entry is not in the map, an empty set will be returned. // If the entry is not in the map, an empty set will be returned.
inline unordered_set<VAL> getValSet(const KEY& key) { inline unordered_set<VAL> getValSet(const KEY& key) {
auto entry = mMap.find(key); auto entry = mMap.find(key);
return (entry != mMap.end()) ? entry->second : unordered_set<VAL>(0); return (entry != mMap.end()) ? entry->second : unordered_set<VAL>{};
} }
// This gets all the KEYs from the map // This gets all the KEYs from the map
inline unordered_set<KEY> getKeys() { inline unordered_set<KEY> getKeys() {
unordered_set<KEY> keys(0); unordered_set<KEY> keys = {};
for (auto entry : mMap) { for (auto entry : mMap) {
keys.insert(entry.first); keys.insert(entry.first);
} }
@ -128,6 +136,7 @@ public:
unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) { unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
trimOrRemove(keys, rVals, goneKeys, goneVals); trimOrRemove(keys, rVals, goneKeys, goneVals);
} }
inline void trimOrRemove(unordered_set<KEY>& keys, const unordered_set<VAL>& rVals, inline void trimOrRemove(unordered_set<KEY>& keys, const unordered_set<VAL>& rVals,
unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) { unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
for (auto key : keys) { for (auto key : keys) {
@ -161,6 +170,7 @@ public:
unordered_set<KEY>* newKeys) { unordered_set<KEY>* newKeys) {
add(keys, newVals, newKeys); add(keys, newVals, newKeys);
} }
inline void add(const unordered_set<KEY>& keys, const unordered_set<VAL>& newVals, inline void add(const unordered_set<KEY>& keys, const unordered_set<VAL>& newVals,
unordered_set<KEY>* newKeys) { unordered_set<KEY>* newKeys) {
for (auto key : keys) { for (auto key : keys) {
@ -174,8 +184,7 @@ public:
// in effect removed from the keyed VAL set in the map entry. // in effect removed from the keyed VAL set in the map entry.
// This call would also remove those same VALs from *newVals*. // This call would also remove those same VALs from *newVals*.
inline unordered_set<VAL> update(const KEY& key, unordered_set<VAL>& newVals) { inline unordered_set<VAL> update(const KEY& key, unordered_set<VAL>& newVals) {
unordered_set<VAL> goneVals(0); unordered_set<VAL> goneVals = {};
if (newVals.empty()) { if (newVals.empty()) {
mMap.erase(key); mMap.erase(key);
} else { } else {

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2013, 2015, 2017The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2013, 2015, 2017, 2020 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -83,10 +83,8 @@ 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

@ -401,6 +401,9 @@ typedef uint64_t GpsLocationExtendedFlags;
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000
/** GpsLocationExtended has dgnss data age */ /** GpsLocationExtended has dgnss data age */
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000
/** GpsLocationExtended has the conformityIndex computed from
* robust location feature. */
#define GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX 0x100000000000
typedef uint32_t LocNavSolutionMask; typedef uint32_t LocNavSolutionMask;
/* Bitmask to specify whether SBAS ionospheric correction is used */ /* Bitmask to specify whether SBAS ionospheric correction is used */
@ -619,6 +622,17 @@ typedef uint16_t GnssMeasUsageInfoValidityMask;
#define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul) #define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul)
#define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul) #define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul)
typedef uint16_t GnssSvPolyStatusMask;
#define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01)
#define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02)
#define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04)
#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08)
typedef uint16_t GnssSvPolyStatusMaskValidity;
#define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01)
#define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02)
#define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04)
#define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08)
typedef struct { typedef struct {
/** Specifies GNSS signal type /** Specifies GNSS signal type
@ -797,6 +811,12 @@ typedef struct {
/** If DGNSS is used, DGNSS data age in milli-seconds */ /** If DGNSS is used, DGNSS data age in milli-seconds */
uint32_t dgnssDataAgeMsec; uint32_t dgnssDataAgeMsec;
/* When robust location is enabled, this field
* will how well the various input data considered for
* navigation solution conform to expectations.
* Range: 0 (least conforming) to 1 (most conforming) */
float conformityIndex;
} GpsLocationExtended; } GpsLocationExtended;
enum loc_sess_status { enum loc_sess_status {
@ -1005,9 +1025,14 @@ typedef uint32_t LOC_GPS_LOCK_MASK;
#define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3) #define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
/*++ *********************************************** /*++ ***********************************************
** Satellite Measurement Structure definitions ** Satellite Measurement and Satellite Polynomial
** structure definitions
** *********************************************** ** ***********************************************
--*/ --*/
#define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12
#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_SV_CLKBIAS_COEFF_MAX_SIZE 4
/** Max number of GNSS SV measurement */ /** Max number of GNSS SV measurement */
#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128 #define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128
@ -1564,7 +1589,66 @@ typedef enum
GNSS_SV_POLY_GLO_STR4 = 0x40 GNSS_SV_POLY_GLO_STR4 = 0x40
/**< GLONASS String 4 has been received */ /**< GLONASS String 4 has been received */
}Gnss_SvPolyStatusMaskType; } Gnss_SvPolyStatusMaskType;
typedef struct {
uint32_t size;
uint16_t gnssSvId;
/** Unique SV Identifier.
* For SV Range of supported constellation, please refer to the
* comment section of gnssSvId in GpsMeasUsageInfo.
*/
int8_t freqNum;
/** Freq index, only valid if u_SysInd is GLO */
GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity;
GnssSvPolyStatusMask svPolyStatusMask;
uint32_t is_valid;
uint16_t iode;
/* Ephemeris reference time
GPS:Issue of Data Ephemeris used [unitless].
GLO: Tb 7-bit, refer to ICD02
*/
double T0;
/* Reference time for polynominal calculations
GPS: Secs in week.
GLO: Full secs since Jan/01/96
*/
double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
/* C0X, C0Y, C0Z */
double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
/* C1X, C2X ... C2Z, C3Z */
float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
/* C0T, C1T, C2T, C3T */
float svPosUnc; /* SV position uncertainty [m]. */
float ionoDelay; /* Ionospheric delay at d_T0 [m]. */
float ionoDot; /* Iono delay rate [m/s]. */
float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */
float tropoDelay; /* Tropospheric delay [m]. */
float elevation; /* Elevation [rad] at d_T0 */
float elevationDot; /* Elevation rate [rad/s] */
float elevationUnc; /* SV elevation [rad] uncertainty */
double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
/* Coefficients of velocity poly */
uint32_t enhancedIOD; /* Enhanced Reference Time */
float gpsIscL1ca;
float gpsIscL2c;
float gpsIscL5I5;
float gpsIscL5Q5;
float gpsTgd;
float gloTgdG1G2;
float bdsTgdB1;
float bdsTgdB2;
float bdsTgdB2a;
float bdsIscB2a;
float galBgdE1E5a;
float galBgdE1E5b;
float navicTgdL5;
} GnssSvPolynomial;
typedef enum { typedef enum {
GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02 = 0, /**<Update ephemeris. Source of ephemeris is unknown */ GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02 = 0, /**<Update ephemeris. Source of ephemeris is unknown */
@ -2173,6 +2257,12 @@ struct OdcpiRequestInfo {
/* Callback to send ODCPI request to framework */ /* Callback to send ODCPI request to framework */
typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback; typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback;
/* ODCPI callback priorities*/
enum OdcpiPrioritytype {
ODCPI_HANDLER_PRIORITY_LOW,
ODCPI_HANDLER_PRIORITY_HIGH
};
/* /*
* Callback with AGNSS(IpV4) status information. * Callback with AGNSS(IpV4) status information.
* *

View file

@ -36,7 +36,9 @@
#include <loc_cfg.h> #include <loc_cfg.h>
#define GLONASS_SV_ID_OFFSET 64 #define GLONASS_SV_ID_OFFSET 64
#define QZSS_SV_ID_OFFSET (-192) #define QZSS_SV_ID_OFFSET (192)
#define BDS_SV_ID_OFFSET (200)
#define GALILEO_SV_ID_OFFSET (300)
#define MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION 64 #define MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION 64
#define MAX_SATELLITES_IN_USE 12 #define MAX_SATELLITES_IN_USE 12
#define MSEC_IN_ONE_WEEK 604800000ULL #define MSEC_IN_ONE_WEEK 604800000ULL
@ -429,6 +431,8 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[0] = 'G'; sv_meta.talker[0] = 'G';
sv_meta.talker[1] = 'A'; sv_meta.talker[1] = 'A';
sv_meta.mask = sv_cache_info.gal_used_mask; sv_meta.mask = sv_cache_info.gal_used_mask;
// GALILEO SV ids are from 301-336, So keep svIdOffset 300
sv_meta.svIdOffset = GALILEO_SV_ID_OFFSET;
sv_meta.systemId = SYSTEM_ID_GALILEO; sv_meta.systemId = SYSTEM_ID_GALILEO;
if (GNSS_SIGNAL_GALILEO_E1 == signalType) { if (GNSS_SIGNAL_GALILEO_E1 == signalType) {
sv_meta.svCount = sv_cache_info.gal_e1_count; sv_meta.svCount = sv_cache_info.gal_e1_count;
@ -440,7 +444,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[0] = 'G'; sv_meta.talker[0] = 'G';
sv_meta.talker[1] = 'Q'; sv_meta.talker[1] = 'Q';
sv_meta.mask = sv_cache_info.qzss_used_mask; sv_meta.mask = sv_cache_info.qzss_used_mask;
// QZSS SV ids are from 193-199. So keep svIdOffset -192 // QZSS SV ids are from 193-197. So keep svIdOffset 192
sv_meta.svIdOffset = QZSS_SV_ID_OFFSET; sv_meta.svIdOffset = QZSS_SV_ID_OFFSET;
sv_meta.systemId = SYSTEM_ID_QZSS; sv_meta.systemId = SYSTEM_ID_QZSS;
if (GNSS_SIGNAL_QZSS_L1CA == signalType) { if (GNSS_SIGNAL_QZSS_L1CA == signalType) {
@ -453,7 +457,8 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[0] = 'G'; sv_meta.talker[0] = 'G';
sv_meta.talker[1] = 'B'; sv_meta.talker[1] = 'B';
sv_meta.mask = sv_cache_info.bds_used_mask; sv_meta.mask = sv_cache_info.bds_used_mask;
// BDS SV ids are from 201-235. So keep svIdOffset 0 // BDS SV ids are from 201-237. So keep svIdOffset 200
sv_meta.svIdOffset = BDS_SV_ID_OFFSET;
sv_meta.systemId = SYSTEM_ID_BDS; sv_meta.systemId = SYSTEM_ID_BDS;
if (GNSS_SIGNAL_BEIDOU_B1I == signalType) { if (GNSS_SIGNAL_BEIDOU_B1I == signalType) {
sv_meta.svCount = sv_cache_info.bds_b1_count; sv_meta.svCount = sv_cache_info.bds_b1_count;
@ -724,6 +729,9 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
return; return;
} }
if (GNSS_SV_TYPE_GLONASS == sv_meta_p->svType) {
svIdOffset = 0;
}
svNumber = 1; svNumber = 1;
sentenceNumber = 1; sentenceNumber = 1;
sentenceCount = svCount / 4 + (svCount % 4 != 0); sentenceCount = svCount / 4 + (svCount % 4 != 0);
@ -782,13 +790,8 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
if (sv_meta_p->svType == svNotify.gnssSvs[svNumber - 1].type && if (sv_meta_p->svType == svNotify.gnssSvs[svNumber - 1].type &&
sv_meta_p->signalId == convert_signalType_to_signalId(signalType)) sv_meta_p->signalId == convert_signalType_to_signalId(signalType))
{ {
uint16_t svId = svNotify.gnssSvs[svNumber - 1].svId; length = snprintf(pMarker, lengthRemaining, ",%02d,%02d,%03d,",
// For QZSS we adjusted SV id's in GnssAdapter, we need to re-adjust here svNotify.gnssSvs[svNumber - 1].svId - svIdOffset,
if (GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[svNumber - 1].type) {
svId = svId - (QZSS_SV_PRN_MIN - 1);
}
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
svId + svIdOffset,
(int)(0.5 + svNotify.gnssSvs[svNumber - 1].elevation), //float to int (int)(0.5 + svNotify.gnssSvs[svNumber - 1].elevation), //float to int
(int)(0.5 + svNotify.gnssSvs[svNumber - 1].azimuth)); //float to int (int)(0.5 + svNotify.gnssSvs[svNumber - 1].azimuth)); //float to int

View file

@ -250,6 +250,7 @@ PRODUCT_PACKAGES += \
# GPS Config # GPS Config
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(COMMON_PATH)/gps/etc/apdr.conf:$(TARGET_COPY_OUT_VENDOR)/etc/apdr.conf \
$(COMMON_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \ $(COMMON_PATH)/gps/etc/flp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/flp.conf \
$(COMMON_PATH)/gps/etc/gps.conf:$(TARGET_COPY_OUT_VENDOR)/etc/gps.conf \ $(COMMON_PATH)/gps/etc/gps.conf:$(TARGET_COPY_OUT_VENDOR)/etc/gps.conf \
$(COMMON_PATH)/gps/etc/izat.conf:$(TARGET_COPY_OUT_VENDOR)/etc/izat.conf \ $(COMMON_PATH)/gps/etc/izat.conf:$(TARGET_COPY_OUT_VENDOR)/etc/izat.conf \