Merge tag 'LA.UM.8.2.r1-06300-sdm660.0' of https://source.codeaurora.org/quic/la/platform/hardware/qcom/gps into HEAD
"LA.UM.8.2.r1-06300-sdm660.0" Change-Id: I7be67877f4ec71566d2859873d79c94272a659f5 Change-Id: Ia8bda530845f35ff9526961ff99c40afc2cc53f7
This commit is contained in:
parent
ce470a71de
commit
b87dec2474
51 changed files with 1868 additions and 500 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
#include <LocationUtil.h>
|
#include <LocationUtil.h>
|
||||||
#include "battery_listener.h"
|
#include "battery_listener.h"
|
||||||
|
#include "loc_misc_utils.h"
|
||||||
|
|
||||||
typedef const GnssInterface* (getLocationInterface)();
|
typedef const GnssInterface* (getLocationInterface)();
|
||||||
|
|
||||||
|
@ -102,25 +103,14 @@ GnssAPIClient* Gnss::getApi() {
|
||||||
const GnssInterface* Gnss::getGnssInterface() {
|
const GnssInterface* Gnss::getGnssInterface() {
|
||||||
static bool getGnssInterfaceFailed = false;
|
static bool getGnssInterfaceFailed = false;
|
||||||
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
||||||
LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
|
void * libHandle = nullptr;
|
||||||
getLocationInterface* getter = NULL;
|
getLocationInterface* getter = (getLocationInterface*)
|
||||||
const char *error = NULL;
|
dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
|
||||||
dlerror();
|
|
||||||
void *handle = dlopen("libgnss.so", RTLD_NOW);
|
|
||||||
if (NULL == handle || (error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
|
|
||||||
} else {
|
|
||||||
getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
|
|
||||||
if ((error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
|
|
||||||
getter = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == getter) {
|
if (nullptr == getter) {
|
||||||
getGnssInterfaceFailed = true;
|
getGnssInterfaceFailed = true;
|
||||||
} else {
|
} else {
|
||||||
mGnssInterface = (const GnssInterface*)(*getter)();
|
mGnssInterface = (GnssInterface*)(*getter)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mGnssInterface;
|
return mGnssInterface;
|
||||||
|
@ -264,14 +254,7 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
||||||
|
|
||||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||||
int32_t uncertaintyMs) {
|
int32_t uncertaintyMs) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
|
||||||
const GnssInterface* gnssInterface = getGnssInterface();
|
|
||||||
if (nullptr != gnssInterface) {
|
|
||||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
#include <LocationUtil.h>
|
#include <LocationUtil.h>
|
||||||
|
|
||||||
#include "battery_listener.h"
|
#include "battery_listener.h"
|
||||||
|
#include "loc_misc_utils.h"
|
||||||
|
|
||||||
typedef const GnssInterface* (getLocationInterface)();
|
typedef const GnssInterface* (getLocationInterface)();
|
||||||
|
|
||||||
|
@ -143,25 +144,14 @@ GnssAPIClient* Gnss::getApi() {
|
||||||
const GnssInterface* Gnss::getGnssInterface() {
|
const GnssInterface* Gnss::getGnssInterface() {
|
||||||
static bool getGnssInterfaceFailed = false;
|
static bool getGnssInterfaceFailed = false;
|
||||||
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
||||||
LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
|
void * libHandle = nullptr;
|
||||||
getLocationInterface* getter = NULL;
|
getLocationInterface* getter = (getLocationInterface*)
|
||||||
const char *error = NULL;
|
dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
|
||||||
dlerror();
|
|
||||||
void *handle = dlopen("libgnss.so", RTLD_NOW);
|
|
||||||
if (NULL == handle || (error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
|
|
||||||
} else {
|
|
||||||
getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
|
|
||||||
if ((error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
|
|
||||||
getter = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == getter) {
|
if (nullptr == getter) {
|
||||||
getGnssInterfaceFailed = true;
|
getGnssInterfaceFailed = true;
|
||||||
} else {
|
} else {
|
||||||
mGnssInterface = (const GnssInterface*)(*getter)();
|
mGnssInterface = (GnssInterface*)(*getter)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mGnssInterface;
|
return mGnssInterface;
|
||||||
|
@ -305,14 +295,7 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
||||||
|
|
||||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||||
int32_t uncertaintyMs) {
|
int32_t uncertaintyMs) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
|
||||||
const GnssInterface* gnssInterface = getGnssInterface();
|
|
||||||
if (nullptr != gnssInterface) {
|
|
||||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||||
* Not a Contribution
|
* Not a Contribution
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include "Gnss.h"
|
#include "Gnss.h"
|
||||||
#include "LocationUtil.h"
|
#include "LocationUtil.h"
|
||||||
#include "battery_listener.h"
|
#include "battery_listener.h"
|
||||||
|
#include "loc_misc_utils.h"
|
||||||
|
|
||||||
typedef const GnssInterface* (getLocationInterface)();
|
typedef const GnssInterface* (getLocationInterface)();
|
||||||
|
|
||||||
|
@ -145,26 +146,16 @@ GnssAPIClient* Gnss::getApi() {
|
||||||
|
|
||||||
const GnssInterface* Gnss::getGnssInterface() {
|
const GnssInterface* Gnss::getGnssInterface() {
|
||||||
static bool getGnssInterfaceFailed = false;
|
static bool getGnssInterfaceFailed = false;
|
||||||
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
|
||||||
LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
|
|
||||||
getLocationInterface* getter = NULL;
|
|
||||||
const char *error = NULL;
|
|
||||||
dlerror();
|
|
||||||
void *handle = dlopen("libgnss.so", RTLD_NOW);
|
|
||||||
if (NULL == handle || (error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
|
|
||||||
} else {
|
|
||||||
getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
|
|
||||||
if ((error = dlerror()) != NULL) {
|
|
||||||
LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
|
|
||||||
getter = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == getter) {
|
if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
|
||||||
|
void * libHandle = nullptr;
|
||||||
|
getLocationInterface* getter = (getLocationInterface*)
|
||||||
|
dlGetSymFromLib(libHandle, "libgnss.so", "getGnssInterface");
|
||||||
|
|
||||||
|
if (nullptr == getter) {
|
||||||
getGnssInterfaceFailed = true;
|
getGnssInterfaceFailed = true;
|
||||||
} else {
|
} else {
|
||||||
mGnssInterface = (const GnssInterface*)(*getter)();
|
mGnssInterface = (GnssInterface*)(*getter)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mGnssInterface;
|
return mGnssInterface;
|
||||||
|
@ -330,14 +321,7 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
||||||
|
|
||||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||||
int32_t uncertaintyMs) {
|
int32_t uncertaintyMs) {
|
||||||
ENTRY_LOG_CALLFLOW();
|
|
||||||
const GnssInterface* gnssInterface = getGnssInterface();
|
|
||||||
if (nullptr != gnssInterface) {
|
|
||||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
|
||||||
|
@ -385,31 +369,41 @@ Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
|
||||||
|
|
||||||
Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
|
Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssConfig == nullptr) {
|
||||||
mGnssConfig = new GnssConfiguration(this);
|
mGnssConfig = new GnssConfiguration(this);
|
||||||
|
}
|
||||||
return mGnssConfig;
|
return mGnssConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
|
Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssGeofencingIface == nullptr) {
|
||||||
mGnssGeofencingIface = new GnssGeofencing();
|
mGnssGeofencingIface = new GnssGeofencing();
|
||||||
|
}
|
||||||
return mGnssGeofencingIface;
|
return mGnssGeofencingIface;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
|
Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssBatching == nullptr) {
|
||||||
mGnssBatching = new GnssBatching();
|
mGnssBatching = new GnssBatching();
|
||||||
|
}
|
||||||
return mGnssBatching;
|
return mGnssBatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
|
Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssDebug == nullptr) {
|
||||||
mGnssDebug = new GnssDebug(this);
|
mGnssDebug = new GnssDebug(this);
|
||||||
|
}
|
||||||
return mGnssDebug;
|
return mGnssDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
|
Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssRil == nullptr) {
|
||||||
mGnssRil = new AGnssRil(this);
|
mGnssRil = new AGnssRil(this);
|
||||||
|
}
|
||||||
return mGnssRil;
|
return mGnssRil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,17 +590,23 @@ Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
|
||||||
|
|
||||||
Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
|
Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mAGnssIface_2_0 == nullptr) {
|
||||||
mAGnssIface_2_0 = new AGnss(this);
|
mAGnssIface_2_0 = new AGnss(this);
|
||||||
|
}
|
||||||
return mAGnssIface_2_0;
|
return mAGnssIface_2_0;
|
||||||
}
|
}
|
||||||
Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() {
|
Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() {
|
||||||
|
if (mGnssRil == nullptr) {
|
||||||
mGnssRil = new AGnssRil(this);
|
mGnssRil = new AGnssRil(this);
|
||||||
|
}
|
||||||
return mGnssRil;
|
return mGnssRil;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
|
Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssConfig == nullptr) {
|
||||||
mGnssConfig = new GnssConfiguration(this);
|
mGnssConfig = new GnssConfiguration(this);
|
||||||
|
}
|
||||||
return mGnssConfig;
|
return mGnssConfig;
|
||||||
}
|
}
|
||||||
Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
|
Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
|
||||||
|
@ -646,13 +646,17 @@ Return<bool> Gnss::injectBestLocation_2_0(const V2_0::GnssLocation& gnssLocation
|
||||||
|
|
||||||
Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
|
Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssDebug == nullptr) {
|
||||||
mGnssDebug = new GnssDebug(this);
|
mGnssDebug = new GnssDebug(this);
|
||||||
|
}
|
||||||
return mGnssDebug;
|
return mGnssDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() {
|
Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() {
|
||||||
ENTRY_LOG_CALLFLOW();
|
ENTRY_LOG_CALLFLOW();
|
||||||
|
if (mGnssBatching == nullptr) {
|
||||||
mGnssBatching = new GnssBatching();
|
mGnssBatching = new GnssBatching();
|
||||||
|
}
|
||||||
return mGnssBatching;
|
return mGnssBatching;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
102
gps/android/2.0/location_api/LocationUtil.cpp
Normal file → Executable file
102
gps/android/2.0/location_api/LocationUtil.cpp
Normal file → Executable 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 {
|
||||||
|
@ -81,21 +82,16 @@ void convertGnssLocation(Location& in, V1_0::GnssLocation& out)
|
||||||
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
|
out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
|
||||||
convertGnssLocation(in, out.v1_0);
|
|
||||||
|
|
||||||
struct timespec sinceBootTime;
|
struct timespec sinceBootTime;
|
||||||
struct timespec currentTime;
|
|
||||||
struct timespec sinceBootTimeTest;
|
struct timespec sinceBootTimeTest;
|
||||||
int64_t sinceBootTimeNanos = 0;
|
|
||||||
bool clockGetTimeSuccess = false;
|
bool clockGetTimeSuccess = false;
|
||||||
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
||||||
const uint32_t MAX_GET_TIME_COUNT = 20;
|
const uint32_t MAX_GET_TIME_COUNT = 20;
|
||||||
/* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
|
/* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
|
||||||
or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */
|
or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */
|
||||||
for (uint32_t i=0; i < MAX_GET_TIME_COUNT; i++) {
|
for (uint32_t i = 0; i < MAX_GET_TIME_COUNT; i++) {
|
||||||
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
@ -105,9 +101,9 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
||||||
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
sinceBootTimeNanos = sinceBootTime.tv_sec*1000000000 + sinceBootTime.tv_nsec;
|
sinceBootTimeNanos = sinceBootTime.tv_sec * 1000000000 + sinceBootTime.tv_nsec;
|
||||||
int64_t sinceBootTimeTestNanos =
|
int64_t sinceBootTimeTestNanos =
|
||||||
sinceBootTimeTest.tv_sec*1000000000 + sinceBootTimeTest.tv_nsec;
|
sinceBootTimeTest.tv_sec * 1000000000 + sinceBootTimeTest.tv_nsec;
|
||||||
int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
|
int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
|
||||||
|
|
||||||
/* sinceBootTime and sinceBootTimeTest should have a close value if there was no
|
/* sinceBootTime and sinceBootTimeTest should have a close value if there was no
|
||||||
|
@ -117,12 +113,22 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
||||||
clockGetTimeSuccess = true;
|
clockGetTimeSuccess = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
LOC_LOGD("%s]: Delta:%" PRIi64 "ns time too large, retry number #%u...",
|
LOC_LOGd("Delta:%" PRIi64 "ns time too large, retry number #%u...",
|
||||||
__FUNCTION__, sinceBootTimeDeltaNanos, i+1);
|
sinceBootTimeDeltaNanos, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return clockGetTimeSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
if (clockGetTimeSuccess) {
|
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
||||||
|
{
|
||||||
|
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
||||||
|
convertGnssLocation(in, out.v1_0);
|
||||||
|
|
||||||
|
struct timespec currentTime;
|
||||||
|
int64_t sinceBootTimeNanos;
|
||||||
|
|
||||||
|
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
||||||
int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
|
int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
|
||||||
int64_t locationTimeNanos = in.timestamp*1000000;
|
int64_t locationTimeNanos = in.timestamp*1000000;
|
||||||
LOC_LOGD("%s]: sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
LOC_LOGD("%s]: sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
@ -131,19 +137,23 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOC_LOGE("%s]: Failed to calculate elapsedRealtimeNanos timestamp after %u tries",
|
LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
|
||||||
__FUNCTION__, MAX_GET_TIME_COUNT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,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) {
|
||||||
|
|
|
@ -46,9 +46,12 @@ 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);
|
||||||
|
bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos);
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
} // namespace V2_0
|
} // namespace V2_0
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "LocationUtil.h"
|
#include "LocationUtil.h"
|
||||||
#include "MeasurementAPIClient.h"
|
#include "MeasurementAPIClient.h"
|
||||||
|
@ -230,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)
|
||||||
|
@ -414,6 +415,41 @@ static void convertGnssData_2_0(GnssMeasurementsNotification& in,
|
||||||
out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_2ND_CODE_LOCK;
|
out.measurements[i].state |= IGnssMeasurementCallback::GnssMeasurementState::STATE_2ND_CODE_LOCK;
|
||||||
}
|
}
|
||||||
convertGnssClock(in.clock, out.clock);
|
convertGnssClock(in.clock, out.clock);
|
||||||
|
|
||||||
|
const uint32_t UTC_TO_GPS_SECONDS = 315964800;
|
||||||
|
struct timespec currentTime;
|
||||||
|
int64_t sinceBootTimeNanos;
|
||||||
|
|
||||||
|
if (getCurrentTime(currentTime, sinceBootTimeNanos) &&
|
||||||
|
in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT &&
|
||||||
|
in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT &&
|
||||||
|
in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT &&
|
||||||
|
in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT) {
|
||||||
|
int64_t currentTimeNanos = currentTime.tv_sec * 1000000000 + currentTime.tv_nsec;
|
||||||
|
int64_t measTimeNanos = (int64_t)in.clock.timeNs - (int64_t)in.clock.fullBiasNs
|
||||||
|
- (int64_t)in.clock.biasNs - (int64_t)in.clock.leapSecond * 1000000000
|
||||||
|
+ (int64_t)UTC_TO_GPS_SECONDS * 1000000000;
|
||||||
|
|
||||||
|
LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
" measTimeNanos:%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, currentTimeNanos, measTimeNanos);
|
||||||
|
if (currentTimeNanos >= measTimeNanos) {
|
||||||
|
int64_t ageTimeNanos = currentTimeNanos - measTimeNanos;
|
||||||
|
LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
|
||||||
|
if (ageTimeNanos >= 0 && ageTimeNanos <= sinceBootTimeNanos) {
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
// time uncertainty is 1 ms since it is calculated from utc time that is in ms
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs = 1000000;
|
||||||
|
LOC_LOGd("timestampNs:%" PRIi64 ") timeUncertaintyNs:%" PRIi64 ")",
|
||||||
|
out.elapsedRealtime.timestampNs,
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
|
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -7,7 +7,7 @@ AC_PREREQ(2.61)
|
||||||
# Initialize the gps location-batching package version 1.0.0
|
# Initialize the gps location-batching package version 1.0.0
|
||||||
AC_INIT([location-batching],1.0.0)
|
AC_INIT([location-batching],1.0.0)
|
||||||
# Does not strictly follow GNU Coding standards
|
# Does not strictly follow GNU Coding standards
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||||
# Disables auto rebuilding of configure, Makefile.ins
|
# Disables auto rebuilding of configure, Makefile.ins
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
# Verifies the --srcdir is correct by checking for the path
|
# Verifies the --srcdir is correct by checking for the path
|
||||||
|
|
|
@ -193,7 +193,7 @@ void ContextBase::readConfig()
|
||||||
mGps_conf.GNSS_DEPLOYMENT = 0;
|
mGps_conf.GNSS_DEPLOYMENT = 0;
|
||||||
mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
|
mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
|
||||||
/* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
|
/* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
|
||||||
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 0;
|
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
|
||||||
|
|
||||||
UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
|
UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
|
||||||
UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
|
UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2015-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
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,11 +349,6 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
||||||
vector<IDataItemCore*> dataItemVec(dlist.size());
|
vector<IDataItemCore*> dataItemVec(dlist.size());
|
||||||
|
|
||||||
for (auto each : dlist) {
|
for (auto each : dlist) {
|
||||||
IF_LOC_LOGD {
|
|
||||||
string dv;
|
|
||||||
each->stringify(dv);
|
|
||||||
LOC_LOGD("notify: DataItem In Value:%s", dv.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
|
IDataItemCore* di = DataItemsFactoryProxy::createNewDataItem(each->getId());
|
||||||
if (nullptr == di) {
|
if (nullptr == di) {
|
||||||
|
@ -364,6 +361,11 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
||||||
|
|
||||||
// add this dataitem if updated from last one
|
// add this dataitem if updated from last one
|
||||||
dataItemVec.push_back(di);
|
dataItemVec.push_back(di);
|
||||||
|
IF_LOC_LOGD {
|
||||||
|
string dv;
|
||||||
|
di->stringify(dv);
|
||||||
|
LOC_LOGd("notify: DataItem In Value:%s", dv.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dataItemVec.empty()) {
|
if (!dataItemVec.empty()) {
|
||||||
|
@ -459,8 +461,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 +491,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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2017, 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
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#include <DataItemsFactoryProxy.h>
|
#include <DataItemsFactoryProxy.h>
|
||||||
#include <loc_pla.h>
|
#include <loc_pla.h>
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
|
#include "loc_misc_utils.h"
|
||||||
|
|
||||||
namespace loc_core
|
namespace loc_core
|
||||||
{
|
{
|
||||||
|
@ -48,28 +49,11 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
|
||||||
mydi = (*getConcreteDIFunc)(id);
|
mydi = (*getConcreteDIFunc)(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// first call to this function, symbol not yet loaded
|
|
||||||
if (NULL == dataItemLibHandle) {
|
|
||||||
LOC_LOGD("Loaded library %s",DATA_ITEMS_LIB_NAME);
|
|
||||||
dataItemLibHandle = dlopen(DATA_ITEMS_LIB_NAME, RTLD_NOW);
|
|
||||||
if (NULL == dataItemLibHandle) {
|
|
||||||
// dlopen failed.
|
|
||||||
const char * err = dlerror();
|
|
||||||
if (NULL == err)
|
|
||||||
{
|
|
||||||
err = "Unknown";
|
|
||||||
}
|
|
||||||
LOC_LOGE("%s:%d]: failed to load library %s; error=%s",
|
|
||||||
__func__, __LINE__, DATA_ITEMS_LIB_NAME, err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// load sym - if dlopen handle is obtained and symbol is not yet obtained
|
|
||||||
if (NULL != dataItemLibHandle) {
|
|
||||||
getConcreteDIFunc = (get_concrete_data_item_fn * )
|
getConcreteDIFunc = (get_concrete_data_item_fn * )
|
||||||
dlsym(dataItemLibHandle, DATA_ITEMS_GET_CONCRETE_DI);
|
dlGetSymFromLib(dataItemLibHandle, DATA_ITEMS_LIB_NAME, DATA_ITEMS_GET_CONCRETE_DI);
|
||||||
|
|
||||||
if (NULL != getConcreteDIFunc) {
|
if (NULL != getConcreteDIFunc) {
|
||||||
LOC_LOGD("Loaded function %s : %p",DATA_ITEMS_GET_CONCRETE_DI,getConcreteDIFunc);
|
LOC_LOGd("Loaded function %s : %p", DATA_ITEMS_GET_CONCRETE_DI, getConcreteDIFunc);
|
||||||
mydi = (*getConcreteDIFunc)(id);
|
mydi = (*getConcreteDIFunc)(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -79,9 +63,7 @@ IDataItemCore* DataItemsFactoryProxy::createNewDataItem(DataItemId id)
|
||||||
{
|
{
|
||||||
err = "Unknown";
|
err = "Unknown";
|
||||||
}
|
}
|
||||||
LOC_LOGE("%s:%d]: failed to find symbol %s; error=%s",
|
LOC_LOGe("failed to find symbol %s; error=%s", DATA_ITEMS_GET_CONCRETE_DI, err);
|
||||||
__func__, __LINE__, DATA_ITEMS_GET_CONCRETE_DI, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mydi;
|
return mydi;
|
||||||
|
|
|
@ -322,3 +322,24 @@ CP_MTLR_ES=0
|
||||||
# and QCSR SS5 hardware receiver.
|
# and QCSR SS5 hardware receiver.
|
||||||
# By default QTI GNSS receiver is enabled.
|
# By default QTI GNSS receiver is enabled.
|
||||||
# GNSS_DEPLOYMENT = 0
|
# GNSS_DEPLOYMENT = 0
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
## LOG BUFFER CONFIGURATION
|
||||||
|
##################################################
|
||||||
|
#LOG_BUFFER_ENABLED, 1=enable, 0=disable
|
||||||
|
#*_LEVEL_TIME_DEPTH, maximum time depth of level *
|
||||||
|
#in log buffer, unit is second
|
||||||
|
#*_LEVEL_MAX_CAPACITY, maximum numbers of level *
|
||||||
|
#log print sentences in log buffer
|
||||||
|
LOG_BUFFER_ENABLED = 0
|
||||||
|
E_LEVEL_TIME_DEPTH = 600
|
||||||
|
E_LEVEL_MAX_CAPACITY = 50
|
||||||
|
W_LEVEL_TIME_DEPTH = 500
|
||||||
|
W_LEVEL_MAX_CAPACITY = 100
|
||||||
|
I_LEVEL_TIME_DEPTH = 400
|
||||||
|
I_LEVEL_MAX_CAPACITY = 200
|
||||||
|
D_LEVEL_TIME_DEPTH = 30
|
||||||
|
D_LEVEL_MAX_CAPACITY = 300
|
||||||
|
V_LEVEL_TIME_DEPTH = 200
|
||||||
|
V_LEVEL_MAX_CAPACITY = 400
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.61)
|
||||||
AC_INIT([location-geofence], 1.0.0)
|
AC_INIT([location-geofence], 1.0.0)
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||||
AC_CONFIG_SRCDIR([Makefile.am])
|
AC_CONFIG_SRCDIR([Makefile.am])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
|
@ -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
|
||||||
|
@ -526,6 +526,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -784,8 +789,6 @@ GnssAdapter::setConfig()
|
||||||
} else {
|
} else {
|
||||||
gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpsConf.AGPS_CONFIG_INJECT) {
|
|
||||||
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
|
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
|
||||||
GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
|
GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
|
||||||
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT |
|
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT |
|
||||||
|
@ -796,7 +799,6 @@ GnssAdapter::setConfig()
|
||||||
mLocApi->convertLppProfile(gpsConf.LPP_PROFILE);
|
mLocApi->convertLppProfile(gpsConf.LPP_PROFILE);
|
||||||
gnssConfigRequested.aGlonassPositionProtocolMask =
|
gnssConfigRequested.aGlonassPositionProtocolMask =
|
||||||
gpsConf.A_GLONASS_POS_PROTOCOL_SELECT;
|
gpsConf.A_GLONASS_POS_PROTOCOL_SELECT;
|
||||||
}
|
|
||||||
if (gpsConf.LPPE_CP_TECHNOLOGY) {
|
if (gpsConf.LPPE_CP_TECHNOLOGY) {
|
||||||
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
|
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT;
|
||||||
gnssConfigRequested.lppeControlPlaneMask =
|
gnssConfigRequested.lppeControlPlaneMask =
|
||||||
|
@ -811,7 +813,7 @@ GnssAdapter::setConfig()
|
||||||
gnssConfigRequested.blacklistedSvIds.assign(mBlacklistedSvIds.begin(),
|
gnssConfigRequested.blacklistedSvIds.assign(mBlacklistedSvIds.begin(),
|
||||||
mBlacklistedSvIds.end());
|
mBlacklistedSvIds.end());
|
||||||
mLocApi->sendMsg(new LocApiMsg(
|
mLocApi->sendMsg(new LocApiMsg(
|
||||||
[this, gpsConf, sapConf, oldMoServerUrl, gnssConfigRequested] () {
|
[this, gpsConf, sapConf, oldMoServerUrl, gnssConfigRequested] () mutable {
|
||||||
gnssUpdateConfig(oldMoServerUrl, gnssConfigRequested, gnssConfigRequested);
|
gnssUpdateConfig(oldMoServerUrl, gnssConfigRequested, gnssConfigRequested);
|
||||||
|
|
||||||
// set nmea mask type
|
// set nmea mask type
|
||||||
|
@ -856,6 +858,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 ||
|
||||||
|
@ -889,8 +898,7 @@ GnssAdapter::setConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldMoServerUrl,
|
std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldMoServerUrl,
|
||||||
const GnssConfig& gnssConfigRequested,
|
GnssConfig& gnssConfigRequested, GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
|
||||||
const GnssConfig& gnssConfigNeedEngineUpdate, size_t count) {
|
|
||||||
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
|
loc_gps_cfg_s gpsConf = ContextBase::mGps_conf;
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
LocationError err = LOCATION_ERROR_SUCCESS;
|
LocationError err = LOCATION_ERROR_SUCCESS;
|
||||||
|
@ -899,13 +907,20 @@ std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldM
|
||||||
errsList.insert(errsList.begin(), count, LOCATION_ERROR_SUCCESS);
|
errsList.insert(errsList.begin(), count, LOCATION_ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string serverUrl = getServerUrl();
|
std::string serverUrl = getServerUrl();
|
||||||
std::string moServerUrl = getMoServerUrl();
|
std::string moServerUrl = getMoServerUrl();
|
||||||
|
|
||||||
int serverUrlLen = serverUrl.length();
|
int serverUrlLen = serverUrl.length();
|
||||||
int moServerUrlLen = moServerUrl.length();
|
int moServerUrlLen = moServerUrl.length();
|
||||||
|
|
||||||
|
if (!ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
|
||||||
|
LOC_LOGd("AGPS_CONFIG_INJECT is 0. Not setting flags for AGPS configurations");
|
||||||
|
gnssConfigRequested.flags &= ~(GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
|
||||||
|
GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT |
|
||||||
|
GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT |
|
||||||
|
GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
|
if (gnssConfigRequested.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
|
||||||
if (gnssConfigNeedEngineUpdate.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
|
if (gnssConfigNeedEngineUpdate.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
|
||||||
err = mLocApi->setGpsLockSync(gnssConfigRequested.gpsLock);
|
err = mLocApi->setGpsLockSync(gnssConfigRequested.gpsLock);
|
||||||
|
@ -1256,7 +1271,7 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
|
||||||
|
|
||||||
mApi.sendMsg(new LocApiMsg(
|
mApi.sendMsg(new LocApiMsg(
|
||||||
[&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate,
|
[&adapter, gnssConfigRequested, gnssConfigNeedEngineUpdate,
|
||||||
countOfConfigs, configCollectiveResponse, errs] () {
|
countOfConfigs, configCollectiveResponse, errs] () mutable {
|
||||||
std::vector<LocationError> errsList = adapter.gnssUpdateConfig("",
|
std::vector<LocationError> errsList = adapter.gnssUpdateConfig("",
|
||||||
gnssConfigRequested, gnssConfigNeedEngineUpdate, countOfConfigs);
|
gnssConfigRequested, gnssConfigNeedEngineUpdate, countOfConfigs);
|
||||||
|
|
||||||
|
@ -1295,9 +1310,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);
|
||||||
|
@ -1320,9 +1336,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);
|
||||||
|
@ -1476,6 +1493,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;
|
||||||
|
@ -1505,12 +1535,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;
|
||||||
|
@ -1528,6 +1560,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;
|
||||||
}
|
}
|
||||||
|
@ -1542,7 +1596,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1551,41 +1606,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1599,6 +1662,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;
|
||||||
|
@ -1609,6 +1673,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++;
|
||||||
|
@ -1642,12 +1718,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);
|
||||||
}
|
}
|
||||||
|
@ -1708,6 +1790,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) {
|
||||||
|
@ -2094,6 +2182,8 @@ 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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2115,6 +2205,7 @@ GnssAdapter::stopClientSessions(LocationAPI* client)
|
||||||
}
|
}
|
||||||
for (auto key : vTimeBasedTrackingClient) {
|
for (auto key : vTimeBasedTrackingClient) {
|
||||||
stopTimeBasedTrackingMultiplex(key.client, key.id);
|
stopTimeBasedTrackingMultiplex(key.client, key.id);
|
||||||
|
eraseTrackingSession(key.client, key.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Distance-based Tracking */
|
/* Distance-based Tracking */
|
||||||
|
@ -2153,6 +2244,9 @@ 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;
|
||||||
|
@ -2219,7 +2313,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);
|
||||||
}
|
}
|
||||||
|
@ -2232,12 +2327,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;
|
||||||
|
@ -2252,6 +2349,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__);
|
||||||
|
@ -2336,7 +2447,8 @@ 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")
|
||||||
|
@ -3394,15 +3506,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()) {
|
||||||
|
@ -3608,10 +3726,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) {
|
||||||
|
@ -3800,7 +3914,20 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void*
|
||||||
mAdapter.getE911State()) || // older modems
|
mAdapter.getE911State()) || // older modems
|
||||||
(LOC_IN_EMERGENCY_SET == mEmergencyState); // newer modems
|
(LOC_IN_EMERGENCY_SET == mEmergencyState); // newer modems
|
||||||
|
|
||||||
if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type) {
|
if ((mAdapter.mSupportNfwControl || 0 == mAdapter.getAfwControlId()) &&
|
||||||
|
(GNSS_NI_TYPE_SUPL == mNotify.type || GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type)
|
||||||
|
&& !bIsInEmergency &&
|
||||||
|
!(GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT & mNotify.options) &&
|
||||||
|
(GNSS_CONFIG_GPS_LOCK_NI & ContextBase::mGps_conf.GPS_LOCK) &&
|
||||||
|
1 == ContextBase::mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED) {
|
||||||
|
/* If all these conditions are TRUE, then deny the NI Request:
|
||||||
|
-'Q' Lock behavior OR 'P' Lock behavior and GNSS is Locked
|
||||||
|
-NI SUPL Request type or NI SUPL Emergency Request type
|
||||||
|
-NOT in an Emergency Call Session
|
||||||
|
-NOT Privacy Override option
|
||||||
|
-NFW is locked and config item NI_SUPL_DENY_ON_NFW_LOCKED = 1 */
|
||||||
|
mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData);
|
||||||
|
} else if (GNSS_NI_TYPE_EMERGENCY_SUPL == mNotify.type) {
|
||||||
bInformNiAccept = bIsInEmergency ||
|
bInformNiAccept = bIsInEmergency ||
|
||||||
(GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES);
|
(GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO == ContextBase::mGps_conf.SUPL_ES);
|
||||||
|
|
||||||
|
@ -3816,15 +3943,6 @@ GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void*
|
||||||
else {
|
else {
|
||||||
mAdapter.requestNiNotify(mNotify, mData, false);
|
mAdapter.requestNiNotify(mNotify, mData, false);
|
||||||
}
|
}
|
||||||
} else if ((mAdapter.mSupportNfwControl || 0 == mAdapter.getAfwControlId()) &&
|
|
||||||
GNSS_NI_TYPE_SUPL == mNotify.type && !bIsInEmergency &&
|
|
||||||
!(GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT & mNotify.options) &&
|
|
||||||
(GNSS_CONFIG_GPS_LOCK_NI & ContextBase::mGps_conf.GPS_LOCK) &&
|
|
||||||
1 == ContextBase::mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED) {
|
|
||||||
// If 'Q' Lock behavior OR 'P' Lock behavior and GNSS is Locked
|
|
||||||
// If an NI SUPL Request that does not have Privacy Override option comes when
|
|
||||||
// NFW is locked and config item NI_SUPL_DENY_ON_NFW_LOCKED = 1, then deny it
|
|
||||||
mApi.informNiResponse(GNSS_NI_RESPONSE_DENY, mData);
|
|
||||||
} else {
|
} else {
|
||||||
mAdapter.requestNiNotify(mNotify, mData, false);
|
mAdapter.requestNiNotify(mNotify, mData, false);
|
||||||
}
|
}
|
||||||
|
@ -4081,11 +4199,53 @@ 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
|
||||||
|
@ -5207,6 +5367,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);
|
||||||
|
@ -5261,6 +5423,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 =
|
||||||
|
@ -5337,6 +5510,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
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -248,8 +255,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 +303,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)==================================== */
|
||||||
|
@ -319,8 +328,8 @@ public:
|
||||||
void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
|
void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
|
||||||
void gnssUpdateXtraThrottleCommand(const bool enabled);
|
void gnssUpdateXtraThrottleCommand(const bool enabled);
|
||||||
std::vector<LocationError> gnssUpdateConfig(const std::string& oldMoServerUrl,
|
std::vector<LocationError> gnssUpdateConfig(const std::string& oldMoServerUrl,
|
||||||
const GnssConfig& gnssConfigRequested,
|
GnssConfig& gnssConfigRequested,
|
||||||
const GnssConfig& gnssConfigNeedEngineUpdate, size_t count = 0);
|
GnssConfig& gnssConfigNeedEngineUpdate, size_t count = 0);
|
||||||
|
|
||||||
/* ==== GNSS SV TYPE CONFIG ============================================================ */
|
/* ==== GNSS SV TYPE CONFIG ============================================================ */
|
||||||
/* ==== COMMANDS ====(Called from Client Thread)======================================== */
|
/* ==== COMMANDS ====(Called from Client Thread)======================================== */
|
||||||
|
@ -362,6 +371,7 @@ 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)==================================== */
|
||||||
|
@ -404,6 +414,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);
|
||||||
|
|
||||||
|
@ -451,6 +462,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSystemPowerState(PowerStateType systemPowerState);
|
void updateSystemPowerState(PowerStateType systemPowerState);
|
||||||
|
void reportSvPolynomial(const GnssSvPolynomial &svPolynomial);
|
||||||
|
void requestSvPolyForClient(LocationAPI* client,
|
||||||
|
const LocationCallbacks& callbacks);
|
||||||
|
|
||||||
|
|
||||||
/*======== GNSSDEBUG ================================================================*/
|
/*======== GNSSDEBUG ================================================================*/
|
||||||
bool getDebugReport(GnssDebugReport& report);
|
bool getDebugReport(GnssDebugReport& report);
|
||||||
|
@ -479,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);
|
||||||
|
|
|
@ -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 @@ 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
|
||||||
|
@ -453,3 +455,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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -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
|
||||||
|
@ -86,7 +86,9 @@ static bool isGnssClient(LocationCallbacks& locationCallbacks)
|
||||||
locationCallbacks.trackingCb != nullptr ||
|
locationCallbacks.trackingCb != nullptr ||
|
||||||
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)
|
||||||
|
@ -121,7 +123,6 @@ void LocationAPI::onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType)
|
||||||
if ((true == invokeCallback) && (nullptr != destroyCompleteCb)) {
|
if ((true == invokeCallback) && (nullptr != destroyCompleteCb)) {
|
||||||
LOC_LOGd("invoke client destroy cb");
|
LOC_LOGd("invoke client destroy cb");
|
||||||
(destroyCompleteCb) ();
|
(destroyCompleteCb) ();
|
||||||
LOC_LOGd("finish invoke client destroy cb");
|
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +144,7 @@ void onGeofenceRemoveClientCompleteCb (LocationAPI* client)
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationAPI*
|
LocationAPI*
|
||||||
LocationAPI::createInstance(LocationCallbacks& locationCallbacks)
|
LocationAPI::createInstance (LocationCallbacks& locationCallbacks)
|
||||||
{
|
{
|
||||||
if (nullptr == locationCallbacks.capabilitiesCb ||
|
if (nullptr == locationCallbacks.capabilitiesCb ||
|
||||||
nullptr == locationCallbacks.responseCb ||
|
nullptr == locationCallbacks.responseCb ||
|
||||||
|
@ -234,15 +235,12 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
|
||||||
pthread_mutex_lock(&gDataMutex);
|
pthread_mutex_lock(&gDataMutex);
|
||||||
auto it = gData.clientData.find(this);
|
auto it = gData.clientData.find(this);
|
||||||
if (it != gData.clientData.end()) {
|
if (it != gData.clientData.end()) {
|
||||||
bool removeFromGnssInf =
|
bool removeFromGnssInf = (NULL != gData.gnssInterface);
|
||||||
(isGnssClient(it->second) && NULL != gData.gnssInterface);
|
bool removeFromBatchingInf = (NULL != gData.batchingInterface);
|
||||||
bool removeFromBatchingInf =
|
bool removeFromGeofenceInf = (NULL != gData.geofenceInterface);
|
||||||
(isBatchingClient(it->second) && NULL != gData.batchingInterface);
|
|
||||||
bool removeFromGeofenceInf =
|
|
||||||
(isGeofenceClient(it->second) && NULL != gData.geofenceInterface);
|
|
||||||
bool needToWait = (removeFromGnssInf || removeFromBatchingInf || removeFromGeofenceInf);
|
bool needToWait = (removeFromGnssInf || removeFromBatchingInf || removeFromGeofenceInf);
|
||||||
LOC_LOGe("removeFromGnssInf: %d, removeFromBatchingInf: %d, removeFromGeofenceInf: %d,"
|
LOC_LOGe("removeFromGnssInf: %d, removeFromBatchingInf: %d, removeFromGeofenceInf: %d,"
|
||||||
"need %d", removeFromGnssInf, removeFromBatchingInf, removeFromGeofenceInf,
|
"needToWait: %d", removeFromGnssInf, removeFromBatchingInf, removeFromGeofenceInf,
|
||||||
needToWait);
|
needToWait);
|
||||||
|
|
||||||
if ((NULL != destroyCompleteCb) && (true == needToWait)) {
|
if ((NULL != destroyCompleteCb) && (true == needToWait)) {
|
||||||
|
@ -258,7 +256,7 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
|
||||||
destroyCbData.waitAdapterMask |=
|
destroyCbData.waitAdapterMask |=
|
||||||
(removeFromGeofenceInf ? LOCATION_ADAPTER_GEOFENCE_TYPE_BIT : 0);
|
(removeFromGeofenceInf ? LOCATION_ADAPTER_GEOFENCE_TYPE_BIT : 0);
|
||||||
gData.destroyClientData[this] = destroyCbData;
|
gData.destroyClientData[this] = destroyCbData;
|
||||||
LOC_LOGe("destroy data stored in the map: 0x%x", destroyCbData.waitAdapterMask);
|
LOC_LOGi("destroy data stored in the map: 0x%x", destroyCbData.waitAdapterMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeFromGnssInf) {
|
if (removeFromGnssInf) {
|
||||||
|
@ -799,3 +797,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;
|
||||||
|
}
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2018-2019 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
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define GNSS_NI_REQUESTOR_MAX (256)
|
#define GNSS_NI_REQUESTOR_MAX (256)
|
||||||
#define GNSS_NI_MESSAGE_ID_MAX (2048)
|
#define GNSS_NI_MESSAGE_ID_MAX (2048)
|
||||||
#define GNSS_SV_MAX (176)
|
#define GNSS_SV_MAX (128)
|
||||||
#define GNSS_MEASUREMENTS_MAX (128)
|
#define GNSS_MEASUREMENTS_MAX (128)
|
||||||
#define GNSS_UTC_TIME_OFFSET (3657)
|
#define GNSS_UTC_TIME_OFFSET (3657)
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
@ -385,6 +387,7 @@ typedef enum {
|
||||||
GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
|
GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1),
|
||||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
|
GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2),
|
||||||
GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
|
GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3),
|
||||||
|
GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT = (1<<4)
|
||||||
} GnssSvOptionsBits;
|
} GnssSvOptionsBits;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -538,7 +541,7 @@ typedef enum {
|
||||||
GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3),
|
GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3),
|
||||||
GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4),
|
GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4),
|
||||||
GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5),
|
GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5),
|
||||||
GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6)
|
GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6),
|
||||||
} GnssConstellationTypeBits;
|
} GnssConstellationTypeBits;
|
||||||
|
|
||||||
#define GNSS_CONSTELLATION_TYPE_MASK_ALL\
|
#define GNSS_CONSTELLATION_TYPE_MASK_ALL\
|
||||||
|
@ -624,7 +627,7 @@ typedef enum
|
||||||
GNSS_LOC_SV_SYSTEM_QZSS = 6,
|
GNSS_LOC_SV_SYSTEM_QZSS = 6,
|
||||||
/**< QZSS satellite. */
|
/**< QZSS satellite. */
|
||||||
GNSS_LOC_SV_SYSTEM_NAVIC = 7,
|
GNSS_LOC_SV_SYSTEM_NAVIC = 7,
|
||||||
/**< QZSS satellite. */
|
/**< NAVIC satellite. */
|
||||||
GNSS_LOC_SV_SYSTEM_MAX = 7,
|
GNSS_LOC_SV_SYSTEM_MAX = 7,
|
||||||
/**< Max enum of valid SV system. */
|
/**< Max enum of valid SV system. */
|
||||||
} Gnss_LocSvSystemEnumType;
|
} Gnss_LocSvSystemEnumType;
|
||||||
|
@ -882,14 +885,11 @@ typedef struct {
|
||||||
GnssSignalTypeMask gnssSignalType;
|
GnssSignalTypeMask gnssSignalType;
|
||||||
/** Specifies GNSS Constellation Type */
|
/** Specifies GNSS Constellation Type */
|
||||||
Gnss_LocSvSystemEnumType gnssConstellation;
|
Gnss_LocSvSystemEnumType gnssConstellation;
|
||||||
/** GNSS SV ID.
|
/** Unique SV Identifier.
|
||||||
For GPS: 1 to 32
|
* For SV Range of supported constellation, please refer to
|
||||||
For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.
|
* the comment section of svId in GnssSv.
|
||||||
For SBAS: 120 to 151
|
* For GLONASS: When slot-number to SV ID mapping is unknown, set as 255.
|
||||||
For QZSS-L1CA:193 to 197
|
*/
|
||||||
For BDS: 201 to 237
|
|
||||||
For GAL: 301 to 336
|
|
||||||
For NAVIC: 401 to 414 */
|
|
||||||
uint16_t gnssSvId;
|
uint16_t gnssSvId;
|
||||||
} GnssMeasUsageInfo;
|
} GnssMeasUsageInfo;
|
||||||
|
|
||||||
|
@ -1046,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 {
|
||||||
|
@ -1061,9 +1066,40 @@ typedef struct {
|
||||||
char extras[GNSS_NI_MESSAGE_ID_MAX];
|
char extras[GNSS_NI_MESSAGE_ID_MAX];
|
||||||
} GnssNiNotification;
|
} GnssNiNotification;
|
||||||
|
|
||||||
|
// carrier frequency of the signal tracked
|
||||||
|
#define GPS_L1CA_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define GPS_L1C_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define GPS_L2C_L_CARRIER_FREQUENCY (1227600000.0)
|
||||||
|
#define GPS_L5_Q_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
#define GLONASS_G1_CARRIER_FREQUENCY (1602000000.0)
|
||||||
|
#define GLONASS_G2_CARRIER_FREQUENCY (1246000000.0)
|
||||||
|
#define GALILEO_E1_C_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define GALILEO_E5A_Q_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
#define GALILEO_E5B_Q_CARRIER_FREQUENCY (1207140000.0)
|
||||||
|
#define BEIDOU_B1_I_CARRIER_FREQUENCY (1561098000.0)
|
||||||
|
#define BEIDOU_B1C_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define BEIDOU_B2_I_CARRIER_FREQUENCY (1207140000.0)
|
||||||
|
#define BEIDOU_B2A_I_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
#define BEIDOU_B2A_Q_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
#define QZSS_L1CA_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define QZSS_L1S_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define QZSS_L2C_L_CARRIER_FREQUENCY (1227600000.0)
|
||||||
|
#define QZSS_L5_Q_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
#define SBAS_L1_CA_CARRIER_FREQUENCY (1575420000.0)
|
||||||
|
#define NAVIC_L5_CARRIER_FREQUENCY (1176450000.0)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t size; // set to sizeof(GnssSv)
|
uint32_t size; // set to sizeof(GnssSv)
|
||||||
uint16_t svId; // Unique Identifier
|
// Unique SV Identifier.
|
||||||
|
// SV Range for supported constellation is specified as below:
|
||||||
|
// - For GPS: 1 to 32
|
||||||
|
// - For GLONASS: 65 to 96
|
||||||
|
// - For SBAS: 120 to 158 and 183 to 191
|
||||||
|
// - For QZSS: 193 to 197
|
||||||
|
// - For BDS: 201 to 237
|
||||||
|
// - For GAL: 301 to 336
|
||||||
|
// - For NAVIC: 401 to 41
|
||||||
|
uint16_t svId;
|
||||||
GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
|
GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO)
|
||||||
float cN0Dbhz; // signal strength
|
float cN0Dbhz; // signal strength
|
||||||
float elevation; // elevation of SV (in degrees)
|
float elevation; // elevation of SV (in degrees)
|
||||||
|
@ -1091,8 +1127,13 @@ struct GnssConfigSetAssistanceServer {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t size; // set to sizeof(GnssMeasurementsData)
|
// set to sizeof(GnssMeasurementsData)
|
||||||
GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits
|
uint32_t size;
|
||||||
|
// bitwise OR of GnssMeasurementsDataFlagsBits
|
||||||
|
GnssMeasurementsDataFlagsMask flags;
|
||||||
|
// Unique SV Identifier
|
||||||
|
// For SV Range of supported constellation,
|
||||||
|
// please refer to the comment section of svId in GnssSv.
|
||||||
int16_t svId;
|
int16_t svId;
|
||||||
GnssSvType svType;
|
GnssSvType svType;
|
||||||
double timeOffsetNs;
|
double timeOffsetNs;
|
||||||
|
@ -1114,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 {
|
||||||
|
@ -1158,12 +1200,88 @@ 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{
|
||||||
uint32_t size; // set to sizeof(GnssSvIdSource)
|
uint32_t size; // set to sizeof(GnssSvIdSource)
|
||||||
GnssSvType constellation; // constellation for the sv to blacklist
|
GnssSvType constellation; // constellation for the sv to blacklist
|
||||||
GnssSvId svId; // sv id to blacklist
|
GnssSvId svId; // Unique SV Identifier,
|
||||||
|
// For SV Range of supported constellation,
|
||||||
|
// please refer to the comment section of svId in GnssSv.
|
||||||
};
|
};
|
||||||
inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
|
inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
|
||||||
return left.size == right.size &&
|
return left.size == right.size &&
|
||||||
|
@ -1198,6 +1316,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
|
||||||
|
@ -1213,6 +1357,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 &&
|
||||||
|
@ -1227,7 +1372,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;
|
||||||
|
@ -1253,7 +1399,11 @@ typedef struct {
|
||||||
} GnssDebugTime;
|
} GnssDebugTime;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t size; // set to sizeof
|
// set to sizeof
|
||||||
|
uint32_t size;
|
||||||
|
// Unique SV Identifier
|
||||||
|
// For SV Range of supported constellation,
|
||||||
|
// please refer to the comment section of svId in GnssSv.
|
||||||
uint32_t svid;
|
uint32_t svid;
|
||||||
GnssSvType constellation;
|
GnssSvType constellation;
|
||||||
GnssEphemerisType mEphemerisType;
|
GnssEphemerisType mEphemerisType;
|
||||||
|
@ -1494,9 +1644,18 @@ 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
|
||||||
|
@ -1534,6 +1693,7 @@ 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 */
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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 {
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <utils/SystemClock.h>
|
#include <utils/SystemClock.h>
|
||||||
#define uptimeMillis android::uptimeMillis
|
#define uptimeMillis() android::uptimeMillis()
|
||||||
|
#define elapsedRealtime() android::elapsedRealtime()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -37,16 +37,23 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
inline int64_t uptimeMillis()
|
inline int64_t sysTimeMillis(int clock)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
int64_t time_ms = 0;
|
int64_t time_ms = 0;
|
||||||
clock_gettime(CLOCK_BOOTTIME, &ts);
|
clock_gettime(clock, &ts);
|
||||||
time_ms += (ts.tv_sec * 1000000000LL);
|
time_ms += (ts.tv_sec * 1000000000LL);
|
||||||
time_ms += ts.tv_nsec + 500000LL;
|
time_ms += ts.tv_nsec + 500000LL;
|
||||||
return time_ms / 1000000LL;
|
return time_ms / 1000000LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int64_t uptimeMillis() {
|
||||||
|
return sysTimeMillis(CLOCK_MONOTONIC);
|
||||||
|
}
|
||||||
|
inline int64_t elapsedRealtime() {
|
||||||
|
return sysTimeMillis(CLOCK_BOOTTIME);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ LOCAL_SRC_FILES += \
|
||||||
MsgTask.cpp \
|
MsgTask.cpp \
|
||||||
loc_misc_utils.cpp \
|
loc_misc_utils.cpp \
|
||||||
loc_nmea.cpp \
|
loc_nmea.cpp \
|
||||||
LocIpc.cpp
|
LocIpc.cpp \
|
||||||
|
LogBuffer.cpp
|
||||||
|
|
||||||
# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
|
# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
|
||||||
LOCAL_CFLAGS += \
|
LOCAL_CFLAGS += \
|
||||||
|
|
|
@ -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
|
||||||
|
@ -139,8 +139,20 @@ protected:
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
inline LocIpcLocalSender(const char* name) : LocIpcSender(),
|
inline LocIpcLocalSender(const char* name) : LocIpcSender(),
|
||||||
mSock(make_shared<Sock>((nullptr == name) ? -1 : (::socket(AF_UNIX, SOCK_DGRAM, 0)))),
|
mSock(nullptr),
|
||||||
mAddr({.sun_family = AF_UNIX, {}}) {
|
mAddr({.sun_family = AF_UNIX, {}}) {
|
||||||
|
|
||||||
|
int fd = -1;
|
||||||
|
if (nullptr != name) {
|
||||||
|
fd = ::socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||||
|
if (fd >= 0) {
|
||||||
|
timeval timeout;
|
||||||
|
timeout.tv_sec = 2;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mSock.reset(new Sock(fd));
|
||||||
if (mSock != nullptr && mSock->isValid()) {
|
if (mSock != nullptr && mSock->isValid()) {
|
||||||
snprintf(mAddr.sun_path, sizeof(mAddr.sun_path), "%s", name);
|
snprintf(mAddr.sun_path, sizeof(mAddr.sun_path), "%s", name);
|
||||||
}
|
}
|
||||||
|
|
167
gps/utils/LogBuffer.cpp
Normal file
167
gps/utils/LogBuffer.cpp
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
/* Copyright (c) 2019 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation, nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "LogBuffer.h"
|
||||||
|
#include <utils/Log.h>
|
||||||
|
|
||||||
|
#define LOG_TAG "LocSvc_LogBuffer"
|
||||||
|
|
||||||
|
namespace loc_util {
|
||||||
|
|
||||||
|
LogBuffer* LogBuffer::mInstance;
|
||||||
|
struct sigaction LogBuffer::mOriSigAction[NSIG];
|
||||||
|
struct sigaction LogBuffer::mNewSigAction;
|
||||||
|
mutex LogBuffer::sLock;
|
||||||
|
|
||||||
|
LogBuffer* LogBuffer::getInstance() {
|
||||||
|
if (mInstance == nullptr) {
|
||||||
|
lock_guard<mutex> guard(sLock);
|
||||||
|
if (mInstance == nullptr) {
|
||||||
|
mInstance = new LogBuffer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogBuffer::LogBuffer(): mLogList(TOTAL_LOG_LEVELS),
|
||||||
|
mConfigVec(TOTAL_LOG_LEVELS, ConfigsInLevel(TIME_DEPTH_THRESHOLD_MINIMAL_IN_SEC,
|
||||||
|
MAXIMUM_NUM_IN_LIST, 0)) {
|
||||||
|
loc_param_s_type log_buff_config_table[] =
|
||||||
|
{
|
||||||
|
{"E_LEVEL_TIME_DEPTH", &mConfigVec[0].mTimeDepthThres, NULL, 'n'},
|
||||||
|
{"E_LEVEL_MAX_CAPACITY", &mConfigVec[0].mMaxNumThres, NULL, 'n'},
|
||||||
|
{"W_LEVEL_TIME_DEPTH", &mConfigVec[1].mTimeDepthThres, NULL, 'n'},
|
||||||
|
{"W_LEVEL_MAX_CAPACITY", &mConfigVec[1].mMaxNumThres, NULL, 'n'},
|
||||||
|
{"I_LEVEL_TIME_DEPTH", &mConfigVec[2].mTimeDepthThres, NULL, 'n'},
|
||||||
|
{"I_LEVEL_MAX_CAPACITY", &mConfigVec[2].mMaxNumThres, NULL, 'n'},
|
||||||
|
{"D_LEVEL_TIME_DEPTH", &mConfigVec[3].mTimeDepthThres, NULL, 'n'},
|
||||||
|
{"D_LEVEL_MAX_CAPACITY", &mConfigVec[3].mMaxNumThres, NULL, 'n'},
|
||||||
|
{"V_LEVEL_TIME_DEPTH", &mConfigVec[4].mTimeDepthThres, NULL, 'n'},
|
||||||
|
{"V_LEVEL_MAX_CAPACITY", &mConfigVec[4].mMaxNumThres, NULL, 'n'},
|
||||||
|
};
|
||||||
|
loc_read_conf(LOC_PATH_GPS_CONF_STR, log_buff_config_table,
|
||||||
|
sizeof(log_buff_config_table)/sizeof(log_buff_config_table[0]));
|
||||||
|
registerSignalHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::append(string& data, int level, uint64_t timestamp) {
|
||||||
|
lock_guard<mutex> guard(mLock);
|
||||||
|
pair<uint64_t, string> item(timestamp, data);
|
||||||
|
mLogList.append(item, level);
|
||||||
|
mConfigVec[level].mCurrentSize++;
|
||||||
|
|
||||||
|
while ((timestamp - mLogList.front(level).first) > mConfigVec[level].mTimeDepthThres ||
|
||||||
|
mConfigVec[level].mCurrentSize > mConfigVec[level].mMaxNumThres) {
|
||||||
|
mLogList.pop(level);
|
||||||
|
mConfigVec[level].mCurrentSize--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dump the log buffer of specific level, level = -1 to dump all the levels in log buffer.
|
||||||
|
void LogBuffer::dump(std::function<void(stringstream&)> log, int level) {
|
||||||
|
lock_guard<mutex> guard(mLock);
|
||||||
|
list<pair<pair<uint64_t, string>, int>> li;
|
||||||
|
if (-1 == level) {
|
||||||
|
li = mLogList.dump();
|
||||||
|
} else {
|
||||||
|
li = mLogList.dump(level);
|
||||||
|
}
|
||||||
|
ALOGE("Begining of dump, buffer size: %d", (int)li.size());
|
||||||
|
stringstream ln;
|
||||||
|
ln << "dump log buffer, level[" << level << "]" << ", buffer size: " << li.size() << endl;
|
||||||
|
log(ln);
|
||||||
|
for_each (li.begin(), li.end(), [&, this](const pair<pair<uint64_t, string>, int> &item){
|
||||||
|
stringstream line;
|
||||||
|
line << "["<<item.first.first << "] ";
|
||||||
|
line << "Level " << mLevelMap[item.second] << ": ";
|
||||||
|
line << item.first.second << endl;
|
||||||
|
if (log != nullptr) {
|
||||||
|
log(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ALOGE("End of dump");
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::dumpToAdbLogcat() {
|
||||||
|
dump([](stringstream& line){
|
||||||
|
ALOGE("%s", line.str().c_str());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::dumpToLogFile(string filePath) {
|
||||||
|
ALOGE("Dump GPS log buffer to file: %s", filePath.c_str());
|
||||||
|
fstream s;
|
||||||
|
s.open(filePath, std::fstream::out | std::fstream::app);
|
||||||
|
dump([&s](stringstream& line){
|
||||||
|
s << line.str();
|
||||||
|
});
|
||||||
|
s.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::flush() {
|
||||||
|
mLogList.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::registerSignalHandler() {
|
||||||
|
ALOGE("Singal handler registered");
|
||||||
|
mNewSigAction.sa_sigaction = &LogBuffer::signalHandler;
|
||||||
|
mNewSigAction.sa_flags = SA_SIGINFO;
|
||||||
|
sigemptyset(&mNewSigAction.sa_mask);
|
||||||
|
|
||||||
|
sigaction(SIGINT, &mNewSigAction, &mOriSigAction[SIGINT]);
|
||||||
|
sigaction(SIGKILL, &mNewSigAction, &mOriSigAction[SIGKILL]);
|
||||||
|
sigaction(SIGSEGV, &mNewSigAction, &mOriSigAction[SIGSEGV]);
|
||||||
|
sigaction(SIGABRT, &mNewSigAction, &mOriSigAction[SIGABRT]);
|
||||||
|
sigaction(SIGTRAP, &mNewSigAction, &mOriSigAction[SIGTRAP]);
|
||||||
|
sigaction(SIGUSR1, &mNewSigAction, &mOriSigAction[SIGUSR1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBuffer::signalHandler(const int code, siginfo_t *const si, void *const sc) {
|
||||||
|
ALOGE("[Gnss Log buffer]Singal handler, signal ID: %d", code);
|
||||||
|
|
||||||
|
//Dump the log buffer to adb logcat
|
||||||
|
mInstance->dumpToAdbLogcat();
|
||||||
|
|
||||||
|
//Dump the log buffer to file
|
||||||
|
time_t now = time(NULL);
|
||||||
|
struct tm *curr_time = localtime(&now);
|
||||||
|
char path[50];
|
||||||
|
snprintf(path, 50, LOG_BUFFER_FILE_PATH "gpslog_%d%d%d-%d%d%d.log",
|
||||||
|
(1900 + curr_time->tm_year), ( 1 + curr_time->tm_mon), curr_time->tm_mday,
|
||||||
|
curr_time->tm_hour, curr_time->tm_min, curr_time->tm_sec);
|
||||||
|
|
||||||
|
mInstance->dumpToLogFile(path);
|
||||||
|
|
||||||
|
//Process won't be terminated if SIGUSR1 is recieved
|
||||||
|
if (code != SIGUSR1) {
|
||||||
|
mOriSigAction[code].sa_sigaction(code, si, sc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
95
gps/utils/LogBuffer.h
Normal file
95
gps/utils/LogBuffer.h
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/* Copyright (c) 2019 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation, nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LOG_BUFFER_H
|
||||||
|
#define LOG_BUFFER_H
|
||||||
|
|
||||||
|
#include "SkipList.h"
|
||||||
|
#include "log_util.h"
|
||||||
|
#include <loc_cfg.h>
|
||||||
|
#include <loc_pla.h>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <ostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <time.h>
|
||||||
|
#include <mutex>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <thread>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
//default error level time depth threshold,
|
||||||
|
#define TIME_DEPTH_THRESHOLD_MINIMAL_IN_SEC 60
|
||||||
|
//default maximum log buffer size
|
||||||
|
#define MAXIMUM_NUM_IN_LIST 50
|
||||||
|
//file path of dumped log buffer
|
||||||
|
#define LOG_BUFFER_FILE_PATH "/data/vendor/location/"
|
||||||
|
|
||||||
|
namespace loc_util {
|
||||||
|
|
||||||
|
class ConfigsInLevel{
|
||||||
|
public:
|
||||||
|
uint32_t mTimeDepthThres;
|
||||||
|
uint32_t mMaxNumThres;
|
||||||
|
int mCurrentSize;
|
||||||
|
|
||||||
|
ConfigsInLevel(uint32_t time, int num, int size):
|
||||||
|
mTimeDepthThres(time), mMaxNumThres(num), mCurrentSize(size) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class LogBuffer {
|
||||||
|
private:
|
||||||
|
static LogBuffer* mInstance;
|
||||||
|
static struct sigaction mOriSigAction[NSIG];
|
||||||
|
static struct sigaction mNewSigAction;
|
||||||
|
static mutex sLock;
|
||||||
|
|
||||||
|
SkipList<pair<uint64_t, string>> mLogList;
|
||||||
|
vector<ConfigsInLevel> mConfigVec;
|
||||||
|
mutex mLock;
|
||||||
|
|
||||||
|
const vector<string> mLevelMap {"E", "W", "I", "D", "V"};
|
||||||
|
|
||||||
|
public:
|
||||||
|
static LogBuffer* getInstance();
|
||||||
|
void append(string& data, int level, uint64_t timestamp);
|
||||||
|
void dump(std::function<void(stringstream&)> log, int level = -1);
|
||||||
|
void dumpToAdbLogcat();
|
||||||
|
void dumpToLogFile(string filePath);
|
||||||
|
void flush();
|
||||||
|
private:
|
||||||
|
LogBuffer();
|
||||||
|
void registerSignalHandler();
|
||||||
|
static void signalHandler(const int code, siginfo_t *const si, void *const sc);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,6 +23,7 @@ libgps_utils_la_h_sources = \
|
||||||
LocThread.h \
|
LocThread.h \
|
||||||
LocTimer.h \
|
LocTimer.h \
|
||||||
LocIpc.h \
|
LocIpc.h \
|
||||||
|
SkipList.h\
|
||||||
loc_misc_utils.h \
|
loc_misc_utils.h \
|
||||||
loc_nmea.h \
|
loc_nmea.h \
|
||||||
gps_extended_c.h \
|
gps_extended_c.h \
|
||||||
|
@ -42,6 +43,7 @@ libgps_utils_la_c_sources = \
|
||||||
LocTimer.cpp \
|
LocTimer.cpp \
|
||||||
LocThread.cpp \
|
LocThread.cpp \
|
||||||
LocIpc.cpp \
|
LocIpc.cpp \
|
||||||
|
LogBuffer.cpp \
|
||||||
MsgTask.cpp \
|
MsgTask.cpp \
|
||||||
loc_misc_utils.cpp \
|
loc_misc_utils.cpp \
|
||||||
loc_nmea.cpp
|
loc_nmea.cpp
|
||||||
|
|
158
gps/utils/SkipList.h
Normal file
158
gps/utils/SkipList.h
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
/* Copyright (c) 2019 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation, nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LOC_SKIP_LIST_H
|
||||||
|
#define LOC_SKIP_LIST_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace loc_util {
|
||||||
|
|
||||||
|
template <typename T,
|
||||||
|
template<typename elem, typename Allocator = std::allocator<elem>> class container = list>
|
||||||
|
class SkipNode {
|
||||||
|
public:
|
||||||
|
typedef typename container<SkipNode<T, container>>::iterator NodeIterator;
|
||||||
|
|
||||||
|
int mLevel;
|
||||||
|
T mData;
|
||||||
|
NodeIterator mNextInLevel;
|
||||||
|
|
||||||
|
SkipNode(int level, T& data): mLevel(level), mData(data) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class SkipList {
|
||||||
|
using NodeIterator = typename SkipNode<T>::NodeIterator;
|
||||||
|
private:
|
||||||
|
list<SkipNode<T>> mMainList;
|
||||||
|
vector<NodeIterator> mHeadVec;
|
||||||
|
vector<NodeIterator> mTailVec;
|
||||||
|
public:
|
||||||
|
SkipList(int totalLevels);
|
||||||
|
void append(T& data, int level);
|
||||||
|
void pop(int level);
|
||||||
|
void pop();
|
||||||
|
T front(int level);
|
||||||
|
int size();
|
||||||
|
void flush();
|
||||||
|
list<pair<T, int>> dump();
|
||||||
|
list<pair<T, int>> dump(int level);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
SkipList<T>::SkipList(int totalLevels): mHeadVec(totalLevels, mMainList.end()),
|
||||||
|
mTailVec(totalLevels, mMainList.end()) {}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void SkipList<T>::append(T& data, int level) {
|
||||||
|
if ( level < 0 || level >= mHeadVec.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkipNode<T> node(level, data);
|
||||||
|
node.mNextInLevel = mMainList.end();
|
||||||
|
mMainList.push_back(node);
|
||||||
|
auto iter = --mMainList.end();
|
||||||
|
if (mHeadVec[level] == mMainList.end()) {
|
||||||
|
mHeadVec[level] = iter;
|
||||||
|
} else {
|
||||||
|
(*mTailVec[level]).mNextInLevel = iter;
|
||||||
|
}
|
||||||
|
mTailVec[level] = iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void SkipList<T>::pop(int level) {
|
||||||
|
if (mHeadVec[level] == mMainList.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*mHeadVec[level]).mNextInLevel == mMainList.end()) {
|
||||||
|
mTailVec[level] = mMainList.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto tmp_iter = (*mHeadVec[level]).mNextInLevel;
|
||||||
|
mMainList.erase(mHeadVec[level]);
|
||||||
|
mHeadVec[level] = tmp_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void SkipList<T>::pop() {
|
||||||
|
pop(mMainList.front().mLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T SkipList<T>::front(int level) {
|
||||||
|
return (*mHeadVec[level]).mData;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int SkipList<T>::size() {
|
||||||
|
return mMainList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void SkipList<T>::flush() {
|
||||||
|
mMainList.clear();
|
||||||
|
for (int i = 0; i < mHeadVec.size(); i++) {
|
||||||
|
mHeadVec[i] = mMainList.end();
|
||||||
|
mTailVec[i] = mMainList.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
list<pair<T, int>> SkipList<T>::dump() {
|
||||||
|
list<pair<T, int>> li;
|
||||||
|
for_each(mMainList.begin(), mMainList.end(), [&](SkipNode<T> &item) {
|
||||||
|
li.push_back(make_pair(item.mData, item.mLevel));
|
||||||
|
});
|
||||||
|
return li;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
list<pair<T, int>> SkipList<T>::dump(int level) {
|
||||||
|
list<pair<T, int>> li;
|
||||||
|
auto head = mHeadVec[level];
|
||||||
|
while (head != mMainList.end()) {
|
||||||
|
li.push_back(make_pair((*head).mData, (*head).mLevel));
|
||||||
|
head = (*head).mNextInLevel;
|
||||||
|
}
|
||||||
|
return li;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2013-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
|
||||||
|
@ -391,6 +391,19 @@ typedef uint64_t GpsLocationExtendedFlags;
|
||||||
/** GpsLocationExtended has the engine mask that indicates the
|
/** GpsLocationExtended has the engine mask that indicates the
|
||||||
* set of engines contribute to the fix. */
|
* set of engines contribute to the fix. */
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
|
#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
|
||||||
|
/** GpsLocationExtended has dgnss correction source */
|
||||||
|
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000
|
||||||
|
/** GpsLocationExtended has dgnss correction source ID */
|
||||||
|
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000
|
||||||
|
/** GpsLocationExtended has dgnss constellation usage */
|
||||||
|
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000
|
||||||
|
/** GpsLocationExtended has dgnss ref station Id */
|
||||||
|
#define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000
|
||||||
|
/** GpsLocationExtended has dgnss data age */
|
||||||
|
#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 */
|
||||||
|
@ -442,10 +455,10 @@ typedef uint32_t GnssAdditionalSystemInfoMask;
|
||||||
/** GPS PRN Range */
|
/** GPS PRN Range */
|
||||||
#define GPS_SV_PRN_MIN 1
|
#define GPS_SV_PRN_MIN 1
|
||||||
#define GPS_SV_PRN_MAX 32
|
#define GPS_SV_PRN_MAX 32
|
||||||
#define SBAS_SV_PRN_MIN 33
|
|
||||||
#define SBAS_SV_PRN_MAX 64
|
|
||||||
#define GLO_SV_PRN_MIN 65
|
#define GLO_SV_PRN_MIN 65
|
||||||
#define GLO_SV_PRN_MAX 96
|
#define GLO_SV_PRN_MAX 96
|
||||||
|
#define SBAS_SV_PRN_MIN 120
|
||||||
|
#define SBAS_SV_PRN_MAX 191
|
||||||
#define QZSS_SV_PRN_MIN 193
|
#define QZSS_SV_PRN_MIN 193
|
||||||
#define QZSS_SV_PRN_MAX 197
|
#define QZSS_SV_PRN_MAX 197
|
||||||
#define BDS_SV_PRN_MIN 201
|
#define BDS_SV_PRN_MIN 201
|
||||||
|
@ -573,6 +586,13 @@ typedef uint8_t CarrierPhaseAmbiguityType;
|
||||||
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1)
|
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1)
|
||||||
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2)
|
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2)
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */
|
||||||
|
LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */
|
||||||
|
LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */
|
||||||
|
}LocDgnssCorrectionSourceType;
|
||||||
|
|
||||||
typedef uint16_t GnssMeasUsageStatusBitMask;
|
typedef uint16_t GnssMeasUsageStatusBitMask;
|
||||||
/** Used in fix */
|
/** Used in fix */
|
||||||
#define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul)
|
#define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul)
|
||||||
|
@ -602,17 +622,6 @@ 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
|
||||||
|
@ -621,13 +630,15 @@ typedef struct {
|
||||||
/** Specifies GNSS Constellation Type
|
/** Specifies GNSS Constellation Type
|
||||||
Mandatory Field*/
|
Mandatory Field*/
|
||||||
Gnss_LocSvSystemEnumType gnssConstellation;
|
Gnss_LocSvSystemEnumType gnssConstellation;
|
||||||
/** GNSS SV ID.
|
/** Unique SV Identifier.
|
||||||
For GPS: 1 to 32
|
* SV Range for supported constellation is specified as below:
|
||||||
For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255.
|
* - For GPS: 1 to 32
|
||||||
For SBAS: 120 to 151
|
* - For GLONASS: 65 to 96
|
||||||
For QZSS-L1CA:193 to 197
|
* - For SBAS: 120 to 158 and 183 to 191
|
||||||
For BDS: 201 to 237
|
* - For QZSS: 193 to 197
|
||||||
For GAL: 301 to 336 */
|
* - For BDS: 201 to 237
|
||||||
|
* - For GAL: 301 to 336
|
||||||
|
* - For NAVIC: 401 to 414 */
|
||||||
uint16_t gnssSvId;
|
uint16_t gnssSvId;
|
||||||
/** GLONASS frequency number + 7.
|
/** GLONASS frequency number + 7.
|
||||||
Valid only for a GLONASS system and
|
Valid only for a GLONASS system and
|
||||||
|
@ -761,15 +772,40 @@ typedef struct {
|
||||||
/** Sensor calibration confidence percent. Range: 0 - 100 */
|
/** Sensor calibration confidence percent. Range: 0 - 100 */
|
||||||
uint8_t calibrationConfidence;
|
uint8_t calibrationConfidence;
|
||||||
DrCalibrationStatusMask calibrationStatus;
|
DrCalibrationStatusMask calibrationStatus;
|
||||||
/* location engine type. When the fix. when the type is set to
|
/** location engine type. When the fix. when the type is set to
|
||||||
LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
|
LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
|
||||||
reports from all engines running on the system (e.g.:
|
reports from all engines running on the system (e.g.:
|
||||||
DR/SPE/PPE). To check which location engine contributes to
|
DR/SPE/PPE). To check which location engine contributes to
|
||||||
the fused output, check for locOutputEngMask. */
|
the fused output, check for locOutputEngMask. */
|
||||||
LocOutputEngineType locOutputEngType;
|
LocOutputEngineType locOutputEngType;
|
||||||
/* 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;
|
||||||
|
|
||||||
|
/** DGNSS Correction Source for position report: RTCM, 3GPP
|
||||||
|
* etc. */
|
||||||
|
LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
|
||||||
|
|
||||||
|
/** If DGNSS is used, the SourceID is a 32bit number identifying
|
||||||
|
* the DGNSS source ID */
|
||||||
|
uint32_t dgnssCorrectionSourceID;
|
||||||
|
|
||||||
|
/** If DGNSS is used, which constellation was DGNSS used for to
|
||||||
|
* produce the pos report. */
|
||||||
|
GnssConstellationTypeMask dgnssConstellationUsage;
|
||||||
|
|
||||||
|
/** If DGNSS is used, DGNSS Reference station ID used for
|
||||||
|
* position report */
|
||||||
|
uint16_t dgnssRefStationId;
|
||||||
|
|
||||||
|
/** If DGNSS is used, DGNSS data age in milli-seconds */
|
||||||
|
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 {
|
||||||
|
@ -978,14 +1014,9 @@ 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 and Satellite Polynomial
|
** Satellite Measurement Structure definitions
|
||||||
** 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
|
||||||
|
|
||||||
|
@ -1173,20 +1204,26 @@ typedef enum
|
||||||
/**< Satellite Doppler measured */
|
/**< Satellite Doppler measured */
|
||||||
GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020,
|
GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020,
|
||||||
/**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */
|
/**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */
|
||||||
|
GNSS_LOC_MEAS_STATUS_LP_VALID = 0x00000040,
|
||||||
|
/**< TRUE/FALSE -- Lock Point is valid/invalid */
|
||||||
|
GNSS_LOC_MEAS_STATUS_LP_POS_VALID = 0x00000080,
|
||||||
|
/**< TRUE/FALSE -- Lock Point is positive/negative */
|
||||||
GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200,
|
GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200,
|
||||||
/**< Range update from Satellite differences */
|
/**< Range update from Satellite differences */
|
||||||
GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400,
|
GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400,
|
||||||
/**< Doppler update from Satellite differences */
|
/**< Doppler update from Satellite differences */
|
||||||
GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800,
|
GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800,
|
||||||
/**< Don't use measurement if bit is set */
|
/**< Don't use measurement if bit is set */
|
||||||
GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x000001000,
|
GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x00001000,
|
||||||
/**< Don't use measurement if bit is set */
|
/**< Don't use measurement if bit is set */
|
||||||
GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x000002000,
|
GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x00002000,
|
||||||
/**< Don't use measurement if bit is set */
|
/**< Don't use measurement if bit is set */
|
||||||
GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x000004000,
|
GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x00004000,
|
||||||
/**< Don't use measurement if bit is set */
|
/**< Don't use measurement if bit is set */
|
||||||
GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x000008000
|
GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x00008000,
|
||||||
/**< Don't use measurement if bit is set */
|
/**< Don't use measurement if bit is set */
|
||||||
|
GNSS_LOC_MEAS_STATUS_GNSS_FRESH_MEAS = 0x08000000
|
||||||
|
/**< TRUE -- Fresh GNSS measurement observed in last second */
|
||||||
}Gnss_LocSvMeasStatusMaskType;
|
}Gnss_LocSvMeasStatusMaskType;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1249,6 +1286,25 @@ typedef enum
|
||||||
/**< SV is being tracked */
|
/**< SV is being tracked */
|
||||||
}Gnss_LocSvSearchStatusEnumT;
|
}Gnss_LocSvSearchStatusEnumT;
|
||||||
|
|
||||||
|
typedef uint32_t LocSvDgnssMeasStatusMask;
|
||||||
|
#define LOC_MASK_DGNSS_EPOCH_TIME_VALID 0x1 /**< DGNSS Epoch time is valid */
|
||||||
|
#define LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID 0x2 /**< Pseudo Range correction is valid */
|
||||||
|
#define LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID 0x4 /**< Pseudo Range rate correction is valid */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
LocSvDgnssMeasStatusMask dgnssMeasStatus;
|
||||||
|
/**< Bitmask indicating the DGNSS SV measurement status. */
|
||||||
|
|
||||||
|
uint32_t diffDataEpochTimeMsec;
|
||||||
|
/**< Age of differential data in Milli Seconds with respect to the Measurement time. */
|
||||||
|
|
||||||
|
float prCorrMeters;
|
||||||
|
/**< Pseudo Range correction in meters. */
|
||||||
|
|
||||||
|
float prrCorrMetersPerSec;
|
||||||
|
/**< Pseudo Range rate correction in meters per second. */
|
||||||
|
} Gnss_LocDgnssSVMeasurement;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
@ -1256,15 +1312,9 @@ typedef struct
|
||||||
// 0 signal type mask indicates invalid value
|
// 0 signal type mask indicates invalid value
|
||||||
GnssSignalTypeMask gnssSignalTypeMask;
|
GnssSignalTypeMask gnssSignalTypeMask;
|
||||||
uint16_t gnssSvId;
|
uint16_t gnssSvId;
|
||||||
/**< GNSS SV ID.
|
/** Unique SV Identifier.
|
||||||
\begin{itemize1}
|
* For SV Range of supported constellation, please refer to the
|
||||||
\item Range: \begin{itemize1}
|
* comment section of gnssSvId in GpsMeasUsageInfo.
|
||||||
\item For GPS: 1 to 32
|
|
||||||
\item For GLONASS: 1 to 32
|
|
||||||
\item For SBAS: 120 to 151
|
|
||||||
\item For BDS: 201 to 237
|
|
||||||
\end{itemize1} \end{itemize1}
|
|
||||||
The GPS and GLONASS SVs can be disambiguated using the system field.
|
|
||||||
*/
|
*/
|
||||||
uint8_t gloFrequency;
|
uint8_t gloFrequency;
|
||||||
/**< GLONASS frequency number + 7 \n
|
/**< GLONASS frequency number + 7 \n
|
||||||
|
@ -1388,7 +1438,8 @@ typedef struct
|
||||||
|
|
||||||
float carrierPhaseUnc;
|
float carrierPhaseUnc;
|
||||||
|
|
||||||
|
/** < DGNSS Measurements Report for SVs */
|
||||||
|
Gnss_LocDgnssSVMeasurement dgnssSvMeas;
|
||||||
} Gnss_SVMeasurementStructType;
|
} Gnss_SVMeasurementStructType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1420,6 +1471,10 @@ typedef uint64_t GpsSvMeasHeaderFlags;
|
||||||
#define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x01000000
|
#define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x01000000
|
||||||
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x02000000
|
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x02000000
|
||||||
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x04000000
|
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x04000000
|
||||||
|
#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x08000000
|
||||||
|
#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID 0x010000000
|
||||||
|
#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID 0x020000000
|
||||||
|
#define GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS 0x040000000
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -1465,6 +1520,21 @@ typedef struct
|
||||||
Gnss_LocGnssTimeExtStructType gloSystemTimeExt;
|
Gnss_LocGnssTimeExtStructType gloSystemTimeExt;
|
||||||
/** NAVIC system RTC time information. */
|
/** NAVIC system RTC time information. */
|
||||||
Gnss_LocGnssTimeExtStructType navicSystemTimeExt;
|
Gnss_LocGnssTimeExtStructType navicSystemTimeExt;
|
||||||
|
|
||||||
|
/** Receiver tick at frame count */
|
||||||
|
uint64_t refCountTicks;
|
||||||
|
|
||||||
|
/** DGNSS corrections source type RTCM, 3GPP etc, if DGNSS was
|
||||||
|
* used for these measurements. */
|
||||||
|
LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
|
||||||
|
|
||||||
|
/** DGNSS SourceID: 32bit number identifying the DGNSS source
|
||||||
|
* ID, if DGNSS was used for these measurements. */
|
||||||
|
uint32_t dgnssCorrectionSourceID;
|
||||||
|
|
||||||
|
/** DGNSS Ref station ID: 32bit number identifying the DGNSS
|
||||||
|
* ref station ID, if DGNSS was used for these measurements. */
|
||||||
|
uint16_t dgnssRefStationId;
|
||||||
} GnssSvMeasurementHeader;
|
} GnssSvMeasurementHeader;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1505,66 +1575,6 @@ typedef enum
|
||||||
/**< GLONASS String 4 has been received */
|
/**< GLONASS String 4 has been received */
|
||||||
}Gnss_SvPolyStatusMaskType;
|
}Gnss_SvPolyStatusMaskType;
|
||||||
|
|
||||||
|
|
||||||
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 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 */
|
||||||
GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02 = 1, /**<Update ephemeris. Source of ephemeris is OTA */
|
GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02 = 1, /**<Update ephemeris. Source of ephemeris is OTA */
|
||||||
|
@ -1585,15 +1595,10 @@ typedef enum {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t gnssSvId;
|
uint16_t gnssSvId;
|
||||||
/**< GNSS SV ID.
|
/** Unique SV Identifier.
|
||||||
- Type: uint16
|
* For SV Range of supported constellation, please refer to the
|
||||||
\begin{itemize1}
|
* comment section of gnssSvId in GpsMeasUsageInfo.
|
||||||
\item Range: \begin{itemize1}
|
*/
|
||||||
\item For GPS: 1 to 32
|
|
||||||
\item For QZSS: 193 to 197
|
|
||||||
\item For BDS: 201 to 237
|
|
||||||
\item For GAL: 301 to 336
|
|
||||||
\vspace{-0.18in} \end{itemize1} \end{itemize1} */
|
|
||||||
|
|
||||||
GnssEphAction updateAction;
|
GnssEphAction updateAction;
|
||||||
/**< Specifies the action and source of ephemeris. \n
|
/**< Specifies the action and source of ephemeris. \n
|
||||||
|
@ -2222,7 +2227,10 @@ enum PowerStateType {
|
||||||
#define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/"
|
#define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/"
|
||||||
|
|
||||||
#define LOC_CLIENT_NAME_PREFIX "toclient"
|
#define LOC_CLIENT_NAME_PREFIX "toclient"
|
||||||
#define LOC_INTAPI_NAME_PREFIX "toIntapiClient"
|
// Please note that the socket name for all location hal daemon client need
|
||||||
|
// to start with LOC_CLIENT_NAME_PREFIX so that upon hal daemon restarts,
|
||||||
|
// every client can get the notification that hal daemon has restarted.
|
||||||
|
#define LOC_INTAPI_NAME_PREFIX LOC_CLIENT_NAME_PREFIX "_intapi"
|
||||||
|
|
||||||
typedef uint64_t NetworkHandle;
|
typedef uint64_t NetworkHandle;
|
||||||
#define NETWORK_HANDLE_UNKNOWN ~0
|
#define NETWORK_HANDLE_UNKNOWN ~0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011-2015, 2018 The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2011-2015, 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
|
||||||
|
@ -59,6 +59,7 @@ static uint32_t DEBUG_LEVEL = 0xff;
|
||||||
static uint32_t TIMESTAMP = 0;
|
static uint32_t TIMESTAMP = 0;
|
||||||
static uint32_t DATUM_TYPE = 0;
|
static uint32_t DATUM_TYPE = 0;
|
||||||
static bool sVendorEnhanced = true;
|
static bool sVendorEnhanced = true;
|
||||||
|
static uint32_t sLogBufferEnabled = 0;
|
||||||
|
|
||||||
/* Parameter spec table */
|
/* Parameter spec table */
|
||||||
static const loc_param_s_type loc_param_table[] =
|
static const loc_param_s_type loc_param_table[] =
|
||||||
|
@ -66,6 +67,7 @@ static const loc_param_s_type loc_param_table[] =
|
||||||
{"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
|
{"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
|
||||||
{"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
|
{"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
|
||||||
{"DATUM_TYPE", &DATUM_TYPE, NULL, 'n'},
|
{"DATUM_TYPE", &DATUM_TYPE, NULL, 'n'},
|
||||||
|
{"LOG_BUFFER_ENABLED", &sLogBufferEnabled, NULL, 'n'},
|
||||||
};
|
};
|
||||||
static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
|
static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
|
||||||
|
|
||||||
|
@ -241,7 +243,7 @@ int loc_fill_conf_item(char* input_buf,
|
||||||
config_value.param_name = strtok_r(input_buf, "=", &lasts);
|
config_value.param_name = strtok_r(input_buf, "=", &lasts);
|
||||||
/* skip lines that do not contain "=" */
|
/* skip lines that do not contain "=" */
|
||||||
if (config_value.param_name) {
|
if (config_value.param_name) {
|
||||||
config_value.param_str_value = strtok_r(NULL, "=", &lasts);
|
config_value.param_str_value = strtok_r(NULL, "\0", &lasts);
|
||||||
|
|
||||||
/* skip lines that do not contain two operands */
|
/* skip lines that do not contain two operands */
|
||||||
if (config_value.param_str_value) {
|
if (config_value.param_str_value) {
|
||||||
|
@ -429,6 +431,7 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta
|
||||||
{
|
{
|
||||||
FILE *conf_fp = NULL;
|
FILE *conf_fp = NULL;
|
||||||
|
|
||||||
|
log_buffer_init(false);
|
||||||
if((conf_fp = fopen(conf_file_name, "r")) != NULL)
|
if((conf_fp = fopen(conf_file_name, "r")) != NULL)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name);
|
LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name);
|
||||||
|
@ -441,6 +444,7 @@ void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_ta
|
||||||
}
|
}
|
||||||
/* Initialize logging mechanism with parsed data */
|
/* Initialize logging mechanism with parsed data */
|
||||||
loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
|
loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
|
||||||
|
log_buffer_init(sLogBufferEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
#include "loc_log.h"
|
#include "loc_log.h"
|
||||||
#include "msg_q.h"
|
#include "msg_q.h"
|
||||||
#include <loc_pla.h>
|
#include <loc_pla.h>
|
||||||
|
#include "LogBuffer.h"
|
||||||
|
|
||||||
#define BUFFER_SIZE 120
|
#define BUFFER_SIZE 120
|
||||||
|
|
||||||
|
@ -179,35 +181,6 @@ char *loc_get_time(char *time_string, size_t buf_size)
|
||||||
return time_string;
|
return time_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
|
||||||
FUNCTION loc_logger_init
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Initializes the state of DEBUG_LEVEL and TIMESTAMP
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
N/A
|
|
||||||
|
|
||||||
RETURN VALUE
|
|
||||||
None
|
|
||||||
|
|
||||||
SIDE EFFECTS
|
|
||||||
N/A
|
|
||||||
===========================================================================*/
|
|
||||||
void loc_logger_init(unsigned long debug, unsigned long timestamp)
|
|
||||||
{
|
|
||||||
loc_logger.DEBUG_LEVEL = debug;
|
|
||||||
#ifdef TARGET_BUILD_VARIANT_USER
|
|
||||||
// force user builds to 2 or less
|
|
||||||
if (loc_logger.DEBUG_LEVEL > 2) {
|
|
||||||
loc_logger.DEBUG_LEVEL = 2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
loc_logger.TIMESTAMP = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION get_timestamp
|
FUNCTION get_timestamp
|
||||||
|
|
||||||
|
@ -236,3 +209,22 @@ char * get_timestamp(char *str, unsigned long buf_size)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
|
||||||
|
FUNCTION log_buffer_insert
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Insert a log sentence with specific level to the log buffer.
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
N/A
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
void log_buffer_insert(char *str, unsigned long buf_size, int level)
|
||||||
|
{
|
||||||
|
timespec tv;
|
||||||
|
clock_gettime(CLOCK_BOOTTIME, &tv);
|
||||||
|
uint64_t elapsedTime = (uint64_t)tv.tv_sec + (uint64_t)tv.tv_nsec/1000000000;
|
||||||
|
string ss = str;
|
||||||
|
loc_util::LogBuffer::getInstance()->append(ss, level, elapsedTime);
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -143,3 +143,15 @@ void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t getQTimerTickCount()
|
||||||
|
{
|
||||||
|
uint64_t qTimerCount = 0;
|
||||||
|
#if __aarch64__
|
||||||
|
asm volatile("mrs %0, cntvct_el0" : "=r" (qTimerCount));
|
||||||
|
#else
|
||||||
|
asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (qTimerCount));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return qTimerCount;
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -32,7 +32,8 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
FUNCTION loc_split_string
|
FUNCTION loc_split_string
|
||||||
|
|
||||||
|
@ -120,6 +121,27 @@ SIDE EFFECTS
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName);
|
void* dlGetSymFromLib(void*& libHandle, const char* libName, const char* symName);
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
FUNCTION getQTimerTickCount
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
This function is used to read the QTimer ticks count. This value is globally maintained and
|
||||||
|
must be the same across all processors on a target.
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
N/A
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
uint64_t QTimer tick count
|
||||||
|
|
||||||
|
SIDE EFFECTS
|
||||||
|
N/A
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t getQTimerTickCount();
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2012-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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -1036,12 +1039,14 @@ static void loc_nmea_get_fix_quality(const UlpLocation & location,
|
||||||
bool custom_gga_fix_quality,
|
bool custom_gga_fix_quality,
|
||||||
char ggaGpsQuality[3],
|
char ggaGpsQuality[3],
|
||||||
char & rmcModeIndicator,
|
char & rmcModeIndicator,
|
||||||
char & vtgModeIndicator) {
|
char & vtgModeIndicator,
|
||||||
|
char gnsModeIndicator[7]) {
|
||||||
|
|
||||||
ggaGpsQuality[0] = '0'; // 0 means no fix
|
ggaGpsQuality[0] = '0'; // 0 means no fix
|
||||||
rmcModeIndicator = 'N'; // N means no fix
|
rmcModeIndicator = 'N'; // N means no fix
|
||||||
vtgModeIndicator = 'N'; // N means no fix
|
vtgModeIndicator = 'N'; // N means no fix
|
||||||
|
memset(gnsModeIndicator, 'N', 6); // N means no fix
|
||||||
|
gnsModeIndicator[6] = '\0';
|
||||||
do {
|
do {
|
||||||
// GGA fix quality is defined in NMEA spec as below:
|
// GGA fix quality is defined in NMEA spec as below:
|
||||||
// https://www.trimble.com/OEM_ReceiverHelp/V4.44/en/NMEA-0183messages_GGA.html
|
// https://www.trimble.com/OEM_ReceiverHelp/V4.44/en/NMEA-0183messages_GGA.html
|
||||||
|
@ -1063,28 +1068,88 @@ static void loc_nmea_get_fix_quality(const UlpLocation & location,
|
||||||
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
||||||
rmcModeIndicator = 'P'; // P means precise
|
rmcModeIndicator = 'P'; // P means precise
|
||||||
vtgModeIndicator = 'P'; // P means precise
|
vtgModeIndicator = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'P'; // P means precise
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'P'; // P means precise
|
||||||
break;
|
break;
|
||||||
} else if (LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask){
|
} else if (LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask){
|
||||||
ggaGpsQuality[0] = '4'; // 4 means RTK Fixed fix
|
ggaGpsQuality[0] = '4'; // 4 means RTK Fixed fix
|
||||||
rmcModeIndicator = 'R'; // use R (RTK fixed)
|
rmcModeIndicator = 'R'; // use R (RTK fixed)
|
||||||
vtgModeIndicator = 'D'; // use D (differential) as
|
vtgModeIndicator = 'D'; // use D (differential) as
|
||||||
// no RTK fixed defined for VTG in NMEA 183 spec
|
// no RTK fixed defined for VTG in NMEA 183 spec
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'R'; // R means RTK fixed
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'R'; // R means RTK fixed
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'R'; // R means RTK fixed
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'R'; // R means RTK fixed
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'R'; // R means RTK fixed
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'R'; // R means RTK fixed
|
||||||
break;
|
break;
|
||||||
} else if (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask){
|
} else if (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask){
|
||||||
ggaGpsQuality[0] = '5'; // 5 means RTK float fix
|
ggaGpsQuality[0] = '5'; // 5 means RTK float fix
|
||||||
rmcModeIndicator = 'F'; // F means RTK float fix
|
rmcModeIndicator = 'F'; // F means RTK float fix
|
||||||
vtgModeIndicator = 'D'; // use D (differential) as
|
vtgModeIndicator = 'D'; // use D (differential) as
|
||||||
// no RTK float defined for VTG in NMEA 183 spec
|
// no RTK float defined for VTG in NMEA 183 spec
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'F'; // F means RTK float fix
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'F'; // F means RTK float fix
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'F'; // F means RTK float fix
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'F'; // F means RTK float fix
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'F'; // F means RTK float fix
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'F'; // F means RTK float fix
|
||||||
break;
|
break;
|
||||||
} else if (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask){
|
} else if (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask){
|
||||||
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
||||||
rmcModeIndicator = 'D'; // D means differential
|
rmcModeIndicator = 'D'; // D means differential
|
||||||
vtgModeIndicator = 'D'; // D means differential
|
vtgModeIndicator = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'D'; // D means differential
|
||||||
break;
|
break;
|
||||||
} else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask){
|
} else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask){
|
||||||
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
ggaGpsQuality[0] = '2'; // 2 means DGPS fix
|
||||||
rmcModeIndicator = 'D'; // D means differential
|
rmcModeIndicator = 'D'; // D means differential
|
||||||
vtgModeIndicator = 'D'; // D means differential
|
vtgModeIndicator = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'D'; // D means differential
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'D'; // D means differential
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,11 +1159,24 @@ static void loc_nmea_get_fix_quality(const UlpLocation & location,
|
||||||
ggaGpsQuality[0] = '1'; // 1 means GPS
|
ggaGpsQuality[0] = '1'; // 1 means GPS
|
||||||
rmcModeIndicator = 'A'; // A means autonomous
|
rmcModeIndicator = 'A'; // A means autonomous
|
||||||
vtgModeIndicator = 'A'; // A means autonomous
|
vtgModeIndicator = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[0] = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[1] = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[2] = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[3] = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[4] = 'A'; // A means autonomous
|
||||||
|
if (locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask ? 1 : 0)
|
||||||
|
gnsModeIndicator[5] = 'A'; // A means autonomous
|
||||||
break;
|
break;
|
||||||
} else if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
|
} else if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
|
||||||
ggaGpsQuality[0] = '6'; // 6 means estimated (dead reckoning)
|
ggaGpsQuality[0] = '6'; // 6 means estimated (dead reckoning)
|
||||||
rmcModeIndicator = 'E'; // E means estimated (dead reckoning)
|
rmcModeIndicator = 'E'; // E means estimated (dead reckoning)
|
||||||
vtgModeIndicator = 'E'; // E means estimated (dead reckoning)
|
vtgModeIndicator = 'E'; // E means estimated (dead reckoning)
|
||||||
|
memset(gnsModeIndicator, 'E', 6); // E means estimated (dead reckoning)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1255,7 +1333,6 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
if (generate_nmea) {
|
if (generate_nmea) {
|
||||||
char talker[3] = {'G', 'P', '\0'};
|
char talker[3] = {'G', 'P', '\0'};
|
||||||
char modeIndicator[7] = {0};
|
|
||||||
uint32_t svUsedCount = 0;
|
uint32_t svUsedCount = 0;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
loc_nmea_sv_meta sv_meta;
|
loc_nmea_sv_meta sv_meta;
|
||||||
|
@ -1339,8 +1416,9 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
char ggaGpsQuality[3] = {'0', '\0', '\0'};
|
char ggaGpsQuality[3] = {'0', '\0', '\0'};
|
||||||
char rmcModeIndicator = 'N';
|
char rmcModeIndicator = 'N';
|
||||||
char vtgModeIndicator = 'N';
|
char vtgModeIndicator = 'N';
|
||||||
|
char gnsModeIndicator[7] = {'N', 'N', 'N', 'N', 'N', 'N', '\0'};
|
||||||
loc_nmea_get_fix_quality(location, locationExtended, custom_gga_fix_quality,
|
loc_nmea_get_fix_quality(location, locationExtended, custom_gga_fix_quality,
|
||||||
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
|
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator, gnsModeIndicator);
|
||||||
|
|
||||||
// -------------------
|
// -------------------
|
||||||
// ------$--VTG-------
|
// ------$--VTG-------
|
||||||
|
@ -1671,49 +1749,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
if(!(sv_cache_info.gps_used_mask ? 1 : 0))
|
length = snprintf(pMarker, lengthRemaining, "%s,", gnsModeIndicator);
|
||||||
modeIndicator[0] = 'N';
|
|
||||||
else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
|
|
||||||
modeIndicator[0] = 'D';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[0] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[0] = 'A';
|
|
||||||
if(!(sv_cache_info.glo_used_mask ? 1 : 0))
|
|
||||||
modeIndicator[1] = 'N';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[1] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[1] = 'A';
|
|
||||||
if(!(sv_cache_info.gal_used_mask ? 1 : 0))
|
|
||||||
modeIndicator[2] = 'N';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[2] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[2] = 'A';
|
|
||||||
if(!(sv_cache_info.bds_used_mask ? 1 : 0))
|
|
||||||
modeIndicator[3] = 'N';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[3] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[3] = 'A';
|
|
||||||
if(!(sv_cache_info.qzss_used_mask ? 1 : 0))
|
|
||||||
modeIndicator[4] = 'N';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[4] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[4] = 'A';
|
|
||||||
if(!(sv_cache_info.navic_used_mask ? 1 : 0))
|
|
||||||
modeIndicator[5] = 'N';
|
|
||||||
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
|
|
||||||
modeIndicator[5] = 'E';
|
|
||||||
else
|
|
||||||
modeIndicator[5] = 'A';
|
|
||||||
modeIndicator[6] = '\0';
|
|
||||||
for(int index = 5; index > 0 && 'N' == modeIndicator[index]; index--) {
|
|
||||||
modeIndicator[index] = '\0';
|
|
||||||
}
|
|
||||||
length = snprintf(pMarker, lengthRemaining,"%s,", modeIndicator);
|
|
||||||
|
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
@ -1756,17 +1792,51 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
|
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
|
||||||
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
|
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
|
||||||
{
|
{
|
||||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,,",
|
length = snprintf(pMarker, lengthRemaining, "%.1lf,",
|
||||||
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
|
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
length = snprintf(pMarker, lengthRemaining,",,");
|
length = snprintf(pMarker, lengthRemaining, ",");
|
||||||
|
}
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%.1f,",
|
||||||
|
(float)locationExtended.dgnssDataAgeMsec / 1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, ",");
|
||||||
|
}
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%04d",
|
||||||
|
locationExtended.dgnssRefStationId);
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
}
|
||||||
|
|
||||||
// hardcode Navigation Status field to 'V'
|
// hardcode Navigation Status field to 'V'
|
||||||
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
|
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
|
@ -1885,12 +1955,49 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
|
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
|
||||||
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
|
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
|
||||||
{
|
{
|
||||||
length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
|
length = snprintf(pMarker, lengthRemaining, "%.1lf,M,",
|
||||||
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
|
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
length = snprintf(pMarker, lengthRemaining,",,,");
|
length = snprintf(pMarker, lengthRemaining, ",,");
|
||||||
|
}
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%.1f,",
|
||||||
|
(float)locationExtended.dgnssDataAgeMsec / 1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, ",");
|
||||||
|
}
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%04d",
|
||||||
|
locationExtended.dgnssRefStationId);
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));
|
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));
|
||||||
|
|
|
@ -30,9 +30,13 @@
|
||||||
#ifndef __LOG_UTIL_H__
|
#ifndef __LOG_UTIL_H__
|
||||||
#define __LOG_UTIL_H__
|
#define __LOG_UTIL_H__
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
|
#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
|
||||||
// Android and LE targets with logcat support
|
// Android and LE targets with logcat support
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
#elif defined (USE_GLIB)
|
#elif defined (USE_GLIB)
|
||||||
// LE targets with no logcat support
|
// LE targets with no logcat support
|
||||||
|
@ -41,6 +45,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
#ifndef LOG_TAG
|
#ifndef LOG_TAG
|
||||||
#define LOG_TAG "GPS_UTILS"
|
#define LOG_TAG "GPS_UTILS"
|
||||||
|
@ -90,18 +95,20 @@ typedef struct loc_logger_s
|
||||||
{
|
{
|
||||||
unsigned long DEBUG_LEVEL;
|
unsigned long DEBUG_LEVEL;
|
||||||
unsigned long TIMESTAMP;
|
unsigned long TIMESTAMP;
|
||||||
|
bool LOG_BUFFER_ENABLE;
|
||||||
} loc_logger_s_type;
|
} loc_logger_s_type;
|
||||||
|
|
||||||
|
|
||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
*
|
*
|
||||||
* EXTERNAL DATA
|
* EXTERNAL DATA
|
||||||
*
|
*
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
extern loc_logger_s_type loc_logger;
|
|
||||||
|
|
||||||
// Logging Improvements
|
// Logging Improvements
|
||||||
extern const char *loc_logger_boolStr[];
|
extern const char *loc_logger_boolStr[];
|
||||||
|
|
||||||
|
extern loc_logger_s_type loc_logger;
|
||||||
extern const char *boolStr[];
|
extern const char *boolStr[];
|
||||||
extern const char VOID_RET[];
|
extern const char VOID_RET[];
|
||||||
extern const char FROM_AFW[];
|
extern const char FROM_AFW[];
|
||||||
|
@ -117,8 +124,49 @@ extern const char EXIT_ERROR_TAG[];
|
||||||
* MODULE EXPORTED FUNCTIONS
|
* MODULE EXPORTED FUNCTIONS
|
||||||
*
|
*
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
|
inline void loc_logger_init(unsigned long debug, unsigned long timestamp)
|
||||||
|
{
|
||||||
|
loc_logger.DEBUG_LEVEL = debug;
|
||||||
|
#ifdef TARGET_BUILD_VARIANT_USER
|
||||||
|
// force user builds to 2 or less
|
||||||
|
if (loc_logger.DEBUG_LEVEL > 2) {
|
||||||
|
loc_logger.DEBUG_LEVEL = 2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
loc_logger.TIMESTAMP = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void log_buffer_init(bool enabled) {
|
||||||
|
loc_logger.LOG_BUFFER_ENABLE = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
extern char* get_timestamp(char* str, unsigned long buf_size);
|
extern char* get_timestamp(char* str, unsigned long buf_size);
|
||||||
|
extern void log_buffer_insert(char *str, unsigned long buf_size, int level);
|
||||||
|
|
||||||
|
/*=============================================================================
|
||||||
|
*
|
||||||
|
* LOGGING BUFFER MACROS
|
||||||
|
*
|
||||||
|
*============================================================================*/
|
||||||
|
#ifndef LOG_NDEBUG
|
||||||
|
#define LOG_NDEBUG 0
|
||||||
|
#endif
|
||||||
|
#define TOTAL_LOG_LEVELS 5
|
||||||
|
#define LOGGING_BUFFER_MAX_LEN 1024
|
||||||
|
#define IF_LOG_BUFFER_ENABLE if (loc_logger.LOG_BUFFER_ENABLE)
|
||||||
|
#define INSERT_BUFFER(flag, level, format, x...) \
|
||||||
|
{ \
|
||||||
|
IF_LOG_BUFFER_ENABLE { \
|
||||||
|
if (flag == 0) { \
|
||||||
|
char timestr[32]; \
|
||||||
|
get_timestamp(timestr, sizeof(timestr)); \
|
||||||
|
char log_str[LOGGING_BUFFER_MAX_LEN]; \
|
||||||
|
snprintf(log_str, LOGGING_BUFFER_MAX_LEN, "%s %d %ld %s :" format "\n", \
|
||||||
|
timestr, getpid(), syscall(SYS_gettid), LOG_TAG==NULL ? "": LOG_TAG, ##x);\
|
||||||
|
log_buffer_insert(log_str, sizeof(log_str), level); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef DEBUG_DMN_LOC_API
|
#ifndef DEBUG_DMN_LOC_API
|
||||||
|
|
||||||
|
@ -133,11 +181,11 @@ extern char* get_timestamp(char* str, unsigned long buf_size);
|
||||||
#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
|
#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
|
||||||
#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
|
#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
|
||||||
|
|
||||||
#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
|
#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 0, __VA_ARGS__);}
|
||||||
#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
|
#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 1, __VA_ARGS__);}
|
||||||
#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
|
#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 2, __VA_ARGS__);}
|
||||||
#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
|
#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 3, __VA_ARGS__);}
|
||||||
#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
|
#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); INSERT_BUFFER(LOG_NDEBUG, 4, __VA_ARGS__);}
|
||||||
|
|
||||||
#else /* DEBUG_DMN_LOC_API */
|
#else /* DEBUG_DMN_LOC_API */
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Uncomment to log verbose logs
|
||||||
|
#define LOG_NDEBUG 1
|
||||||
#define LOG_TAG "LocSvc_utils_q"
|
#define LOG_TAG "LocSvc_utils_q"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
Loading…
Reference in a new issue