sdm660-common: Downgrade gps hal to LA.UM.9.6.2.r1-03300-89xx.0
This is a combination of 3 commits: ------------------------------------- * Revert "sdm660-common: Import gps configs from LA.UM.9.6.2.r1-03600-89xx.0" This reverts commit1977da527c
. * Revert "sdm660-common: Checkout gps hal from LA.UM.9.6.2.r1-03600-89xx.0" This reverts commit15d9c83201
. * sdm660-common: Checkout gps config from LA.UM.9.6.2.r1-03300-89xx.0
This commit is contained in:
parent
53931a7bb5
commit
105be64c3f
35 changed files with 465 additions and 1060 deletions
|
@ -30,7 +30,6 @@
|
||||||
#define LOG_NDEBUG 0
|
#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ void BatchingAPIClient::flushBatchedLocations()
|
||||||
|
|
||||||
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#define LOG_TAG "LocSvc_GnssAPIClient"
|
#define LOG_TAG "LocSvc_GnssAPIClient"
|
||||||
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -300,7 +299,7 @@ void GnssAPIClient::requestCapabilities() {
|
||||||
// callbacks
|
// callbacks
|
||||||
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
mLocationCapabilitiesCached = true;
|
mLocationCapabilitiesCached = true;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define LOG_NDEBUG 0
|
#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ void BatchingAPIClient::flushBatchedLocations()
|
||||||
|
|
||||||
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#define LOG_TAG "LocSvc_GnssAPIClient"
|
#define LOG_TAG "LocSvc_GnssAPIClient"
|
||||||
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -300,7 +299,7 @@ void GnssAPIClient::requestCapabilities() {
|
||||||
// callbacks
|
// callbacks
|
||||||
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
mLocationCapabilitiesCached = true;
|
mLocationCapabilitiesCached = true;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define LOG_NDEBUG 0
|
#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -192,7 +191,7 @@ void BatchingAPIClient::flushBatchedLocations()
|
||||||
|
|
||||||
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#define LOG_TAG "LocSvc_GnssAPIClient"
|
#define LOG_TAG "LocSvc_GnssAPIClient"
|
||||||
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -350,7 +349,7 @@ void GnssAPIClient::requestCapabilities() {
|
||||||
// callbacks
|
// callbacks
|
||||||
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
mLocationCapabilitiesCached = true;
|
mLocationCapabilitiesCached = true;
|
||||||
|
|
||||||
|
|
|
@ -84,22 +84,109 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos)
|
||||||
|
{
|
||||||
|
struct timespec sinceBootTime;
|
||||||
|
struct timespec sinceBootTimeTest;
|
||||||
|
bool clockGetTimeSuccess = false;
|
||||||
|
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
||||||
|
const uint32_t MAX_GET_TIME_COUNT = 20;
|
||||||
|
/* 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 */
|
||||||
|
for (uint32_t i = 0; i < MAX_GET_TIME_COUNT; i++) {
|
||||||
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
if (clock_gettime(CLOCK_REALTIME, ¤tTime) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
sinceBootTimeNanos = sinceBootTime.tv_sec * 1000000000 + sinceBootTime.tv_nsec;
|
||||||
|
int64_t sinceBootTimeTestNanos =
|
||||||
|
sinceBootTimeTest.tv_sec * 1000000000 + sinceBootTimeTest.tv_nsec;
|
||||||
|
int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
|
||||||
|
|
||||||
|
/* sinceBootTime and sinceBootTimeTest should have a close value if there was no
|
||||||
|
interruption or context switch between clock_gettime for CLOCK_BOOTIME and
|
||||||
|
clock_gettime for CLOCK_REALTIME */
|
||||||
|
if (sinceBootTimeDeltaNanos < MAX_TIME_DELTA_VALUE_NANOS) {
|
||||||
|
clockGetTimeSuccess = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
LOC_LOGd("Delta:%" PRIi64 "ns time too large, retry number #%u...",
|
||||||
|
sinceBootTimeDeltaNanos, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return clockGetTimeSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
||||||
convertGnssLocation(in, out.v1_0);
|
convertGnssLocation(in, out.v1_0);
|
||||||
|
|
||||||
if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
|
struct timespec currentTime;
|
||||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
int64_t sinceBootTimeNanos;
|
||||||
out.elapsedRealtime.timestampNs = in.elapsedRealTime;
|
|
||||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
||||||
out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
|
if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
|
||||||
LOC_LOGd("out.elapsedRealtime.timestampNs=%" PRIi64 ""
|
uint64_t qtimerDiff = 0;
|
||||||
" out.elapsedRealtime.timeUncertaintyNs=%" PRIi64 ""
|
uint64_t qTimerTickCount = getQTimerTickCount();
|
||||||
" out.elapsedRealtime.flags=0x%X",
|
if (qTimerTickCount >= in.elapsedRealTime) {
|
||||||
out.elapsedRealtime.timestampNs,
|
qtimerDiff = qTimerTickCount - in.elapsedRealTime;
|
||||||
out.elapsedRealtime.timeUncertaintyNs, out.elapsedRealtime.flags);
|
}
|
||||||
|
LOC_LOGv("sinceBootTimeNanos:%" PRIi64 " in.elapsedRealTime=%" PRIi64 ""
|
||||||
|
" qTimerTickCount=%" PRIi64 " qtimerDiff=%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, in.elapsedRealTime, qTimerTickCount, qtimerDiff);
|
||||||
|
uint64_t qTimerDiffNanos = qTimerTicksToNanos(double(qtimerDiff));
|
||||||
|
|
||||||
|
/* If the time difference between Qtimer on modem side and Qtimer on AP side
|
||||||
|
is greater than one second we assume this is a dual-SoC device such as
|
||||||
|
Kona and will try to get Qtimer on modem side and on AP side and
|
||||||
|
will adjust our difference accordingly */
|
||||||
|
if (qTimerDiffNanos > 1000000000) {
|
||||||
|
uint64_t qtimerDelta = getQTimerDeltaNanos();
|
||||||
|
if (qTimerDiffNanos >= qtimerDelta) {
|
||||||
|
qTimerDiffNanos -= qtimerDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sinceBootTimeNanos >= qTimerDiffNanos) {
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - qTimerDiffNanos;
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
|
||||||
|
int64_t locationTimeNanos = in.timestamp*1000000;
|
||||||
|
LOC_LOGv("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
" locationTimeNanos:%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, currentTimeNanos, locationTimeNanos);
|
||||||
|
if (currentTimeNanos >= locationTimeNanos) {
|
||||||
|
int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos;
|
||||||
|
LOC_LOGv("ageTimeNanos:%" PRIi64 ")", ageTimeNanos);
|
||||||
|
// the max trusted propagation time 100ms for ageTimeNanos to avoid user setting
|
||||||
|
// wrong time, it will affect elapsedRealtimeNanos
|
||||||
|
if (ageTimeNanos <= 100000000) {
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
// time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
|
||||||
|
// verify if user change the sys time
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs =
|
||||||
|
std::max(ageTimeNanos, (int64_t)100000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOC_LOGv("out.elapsedRealtime.timestampNs=%" PRIi64 ""
|
||||||
|
" out.elapsedRealtime.timeUncertaintyNs=%" PRIi64 ""
|
||||||
|
" out.elapsedRealtime.flags=0x%X",
|
||||||
|
out.elapsedRealtime.timestampNs,
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs, out.elapsedRealtime.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out)
|
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out)
|
||||||
|
|
|
@ -51,6 +51,7 @@ 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
|
||||||
|
|
|
@ -437,16 +437,78 @@ static void convertGnssData_2_0(GnssMeasurementsNotification& in,
|
||||||
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
|
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
|
||||||
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
|
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
|
||||||
{
|
{
|
||||||
if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
|
struct timespec currentTime;
|
||||||
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
int64_t sinceBootTimeNanos;
|
||||||
elapsedRealtime.timestampNs = in.clock.elapsedRealTime;
|
|
||||||
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
||||||
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
|
if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
|
||||||
LOC_LOGd("elapsedRealtime.timestampNs=%" PRIi64 ""
|
uint64_t qtimerDiff = 0;
|
||||||
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
|
uint64_t qTimerTickCount = getQTimerTickCount();
|
||||||
elapsedRealtime.timestampNs,
|
if (qTimerTickCount >= in.clock.elapsedRealTime) {
|
||||||
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
|
qtimerDiff = qTimerTickCount - in.clock.elapsedRealTime;
|
||||||
|
}
|
||||||
|
LOC_LOGv("sinceBootTimeNanos:%" PRIi64 " in.clock.elapsedRealTime=%" PRIi64 ""
|
||||||
|
" qTimerTickCount=%" PRIi64 " qtimerDiff=%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, in.clock.elapsedRealTime, qTimerTickCount, qtimerDiff);
|
||||||
|
uint64_t qTimerDiffNanos = qTimerTicksToNanos(double(qtimerDiff));
|
||||||
|
|
||||||
|
/* If the time difference between Qtimer on modem side and Qtimer on AP side
|
||||||
|
is greater than one second we assume this is a dual-SoC device such as
|
||||||
|
Kona and will try to get Qtimer on modem side and on AP side and
|
||||||
|
will adjust our difference accordingly */
|
||||||
|
if (qTimerDiffNanos > 1000000000) {
|
||||||
|
uint64_t qtimerDelta = getQTimerDeltaNanos();
|
||||||
|
if (qTimerDiffNanos >= qtimerDelta) {
|
||||||
|
qTimerDiffNanos -= qtimerDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sinceBootTimeNanos >= qTimerDiffNanos) {
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
elapsedRealtime.timestampNs = sinceBootTimeNanos - qTimerDiffNanos;
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const uint32_t UTC_TO_GPS_SECONDS = 315964800;
|
||||||
|
|
||||||
|
if (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_LOGv("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
" measTimeNanos:%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, currentTimeNanos, measTimeNanos);
|
||||||
|
if (currentTimeNanos >= measTimeNanos) {
|
||||||
|
int64_t ageTimeNanos = currentTimeNanos - measTimeNanos;
|
||||||
|
LOC_LOGv("ageTimeNanos:%" PRIi64 ")", ageTimeNanos);
|
||||||
|
// the max trusted propagation time 100ms for ageTimeNanos to avoid user
|
||||||
|
// setting wrong time, it will affect elapsedRealtimeNanos
|
||||||
|
if (ageTimeNanos <= 100000000) {
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||||
|
elapsedRealtime.flags |=
|
||||||
|
V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
// time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms,
|
||||||
|
// to verify if user change the sys time
|
||||||
|
elapsedRealtime.timeUncertaintyNs =
|
||||||
|
std::max(ageTimeNanos, (int64_t)100000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOC_LOGv("elapsedRealtime.timestampNs=%" PRIi64 ""
|
||||||
|
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
|
||||||
|
elapsedRealtime.timestampNs,
|
||||||
|
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
|
static void convertGnssMeasurementsCodeType(GnssMeasurementsCodeType& in,
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define LOG_NDEBUG 0
|
#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
#define LOG_TAG "LocSvc_BatchingAPIClient"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -192,7 +191,7 @@ void BatchingAPIClient::flushBatchedLocations()
|
||||||
|
|
||||||
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#define LOG_TAG "LocSvc_GnssAPIClient"
|
#define LOG_TAG "LocSvc_GnssAPIClient"
|
||||||
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
#define SINGLE_SHOT_MIN_TRACKING_INTERVAL_MSEC (590 * 60 * 60 * 1000) // 590 hours
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
|
|
||||||
|
@ -381,7 +380,7 @@ void GnssAPIClient::requestCapabilities() {
|
||||||
// callbacks
|
// callbacks
|
||||||
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
||||||
{
|
{
|
||||||
LOC_LOGD("%s]: (%" PRIu64 ")", __FUNCTION__, capabilitiesMask);
|
LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
|
||||||
mLocationCapabilitiesMask = capabilitiesMask;
|
mLocationCapabilitiesMask = capabilitiesMask;
|
||||||
mLocationCapabilitiesCached = true;
|
mLocationCapabilitiesCached = true;
|
||||||
|
|
||||||
|
|
|
@ -85,22 +85,109 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos)
|
||||||
|
{
|
||||||
|
struct timespec sinceBootTime;
|
||||||
|
struct timespec sinceBootTimeTest;
|
||||||
|
bool clockGetTimeSuccess = false;
|
||||||
|
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
||||||
|
const uint32_t MAX_GET_TIME_COUNT = 20;
|
||||||
|
/* 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 */
|
||||||
|
for (uint32_t i = 0; i < MAX_GET_TIME_COUNT; i++) {
|
||||||
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
if (clock_gettime(CLOCK_REALTIME, ¤tTime) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
sinceBootTimeNanos = sinceBootTime.tv_sec * 1000000000 + sinceBootTime.tv_nsec;
|
||||||
|
int64_t sinceBootTimeTestNanos =
|
||||||
|
sinceBootTimeTest.tv_sec * 1000000000 + sinceBootTimeTest.tv_nsec;
|
||||||
|
int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
|
||||||
|
|
||||||
|
/* sinceBootTime and sinceBootTimeTest should have a close value if there was no
|
||||||
|
interruption or context switch between clock_gettime for CLOCK_BOOTIME and
|
||||||
|
clock_gettime for CLOCK_REALTIME */
|
||||||
|
if (sinceBootTimeDeltaNanos < MAX_TIME_DELTA_VALUE_NANOS) {
|
||||||
|
clockGetTimeSuccess = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
LOC_LOGd("Delta:%" PRIi64 "ns time too large, retry number #%u...",
|
||||||
|
sinceBootTimeDeltaNanos, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return clockGetTimeSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
||||||
{
|
{
|
||||||
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
memset(&out, 0, sizeof(V2_0::GnssLocation));
|
||||||
convertGnssLocation(in, out.v1_0);
|
convertGnssLocation(in, out.v1_0);
|
||||||
|
|
||||||
if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
|
struct timespec currentTime;
|
||||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
int64_t sinceBootTimeNanos;
|
||||||
out.elapsedRealtime.timestampNs = in.elapsedRealTime;
|
|
||||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
||||||
out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
|
if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
|
||||||
LOC_LOGd("out.elapsedRealtime.timestampNs=%" PRIi64 ""
|
uint64_t qtimerDiff = 0;
|
||||||
" out.elapsedRealtime.timeUncertaintyNs=%" PRIi64 ""
|
uint64_t qTimerTickCount = getQTimerTickCount();
|
||||||
" out.elapsedRealtime.flags=0x%X",
|
if (qTimerTickCount >= in.elapsedRealTime) {
|
||||||
out.elapsedRealtime.timestampNs,
|
qtimerDiff = qTimerTickCount - in.elapsedRealTime;
|
||||||
out.elapsedRealtime.timeUncertaintyNs, out.elapsedRealtime.flags);
|
}
|
||||||
|
LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " in.elapsedRealTime=%" PRIi64 ""
|
||||||
|
" qTimerTickCount=%" PRIi64 " qtimerDiff=%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, in.elapsedRealTime, qTimerTickCount, qtimerDiff);
|
||||||
|
uint64_t qTimerDiffNanos = qTimerTicksToNanos(double(qtimerDiff));
|
||||||
|
|
||||||
|
/* If the time difference between Qtimer on modem side and Qtimer on AP side
|
||||||
|
is greater than one second we assume this is a dual-SoC device such as
|
||||||
|
Kona and will try to get Qtimer on modem side and on AP side and
|
||||||
|
will adjust our difference accordingly */
|
||||||
|
if (qTimerDiffNanos > 1000000000) {
|
||||||
|
uint64_t qtimerDelta = getQTimerDeltaNanos();
|
||||||
|
if (qTimerDiffNanos >= qtimerDelta) {
|
||||||
|
qTimerDiffNanos -= qtimerDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sinceBootTimeNanos >= qTimerDiffNanos) {
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - qTimerDiffNanos;
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs = in.elapsedRealTimeUnc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
|
||||||
|
int64_t locationTimeNanos = in.timestamp*1000000;
|
||||||
|
LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
" locationTimeNanos:%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, currentTimeNanos, locationTimeNanos);
|
||||||
|
if (currentTimeNanos >= locationTimeNanos) {
|
||||||
|
int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos;
|
||||||
|
LOC_LOGd("ageTimeNanos:%" PRIi64 ")", ageTimeNanos);
|
||||||
|
// the max trusted propagation time 100ms for ageTimeNanos to avoid user setting
|
||||||
|
// wrong time, it will affect elapsedRealtimeNanos
|
||||||
|
if (ageTimeNanos <= 100000000) {
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||||
|
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
// time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
|
||||||
|
// verify if user change the sys time
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs =
|
||||||
|
std::max(ageTimeNanos, (int64_t)100000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOC_LOGd("out.elapsedRealtime.timestampNs=%" PRIi64 ""
|
||||||
|
" out.elapsedRealtime.timeUncertaintyNs=%" PRIi64 ""
|
||||||
|
" out.elapsedRealtime.flags=0x%X",
|
||||||
|
out.elapsedRealtime.timestampNs,
|
||||||
|
out.elapsedRealtime.timeUncertaintyNs, out.elapsedRealtime.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out)
|
void convertGnssLocation(const V1_0::GnssLocation& in, Location& out)
|
||||||
|
|
|
@ -56,6 +56,7 @@ 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);
|
||||||
void convertSingleSatCorrections(const SingleSatCorrection& in, GnssSingleSatCorrection& out);
|
void convertSingleSatCorrections(const SingleSatCorrection& in, GnssSingleSatCorrection& out);
|
||||||
void convertMeasurementCorrections(const MeasurementCorrectionsV1_0& in,
|
void convertMeasurementCorrections(const MeasurementCorrectionsV1_0& in,
|
||||||
GnssMeasurementCorrections& out);
|
GnssMeasurementCorrections& out);
|
||||||
|
|
|
@ -623,16 +623,80 @@ static void convertGnssData_2_1(GnssMeasurementsNotification& in,
|
||||||
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
|
static void convertElapsedRealtimeNanos(GnssMeasurementsNotification& in,
|
||||||
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
|
::android::hardware::gnss::V2_0::ElapsedRealtime& elapsedRealtime)
|
||||||
{
|
{
|
||||||
if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
|
struct timespec currentTime;
|
||||||
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
int64_t sinceBootTimeNanos;
|
||||||
elapsedRealtime.timestampNs = in.clock.elapsedRealTime;
|
|
||||||
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
||||||
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
|
if (in.clock.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT) {
|
||||||
LOC_LOGd("elapsedRealtime.timestampNs=%" PRIi64 ""
|
uint64_t qtimerDiff = 0;
|
||||||
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
|
uint64_t qTimerTickCount = getQTimerTickCount();
|
||||||
elapsedRealtime.timestampNs,
|
if (qTimerTickCount >= in.clock.elapsedRealTime) {
|
||||||
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
|
qtimerDiff = qTimerTickCount - in.clock.elapsedRealTime;
|
||||||
|
}
|
||||||
|
LOC_LOGv("sinceBootTimeNanos:%" PRIi64 " in.clock.elapsedRealTime=%" PRIi64 ""
|
||||||
|
" qTimerTickCount=%" PRIi64 " qtimerDiff=%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, in.clock.elapsedRealTime, qTimerTickCount, qtimerDiff);
|
||||||
|
uint64_t qTimerDiffNanos = qTimerTicksToNanos(double(qtimerDiff));
|
||||||
|
|
||||||
|
/* If the time difference between Qtimer on modem side and Qtimer on AP side
|
||||||
|
is greater than one second we assume this is a dual-SoC device such as
|
||||||
|
Kona and will try to get Qtimer on modem side and on AP side and
|
||||||
|
will adjust our difference accordingly */
|
||||||
|
if (qTimerDiffNanos > 1000000000) {
|
||||||
|
uint64_t qtimerDelta = getQTimerDeltaNanos();
|
||||||
|
if (qTimerDiffNanos >= qtimerDelta) {
|
||||||
|
qTimerDiffNanos -= qtimerDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sinceBootTimeNanos >= qTimerDiffNanos) {
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
elapsedRealtime.timestampNs = sinceBootTimeNanos - qTimerDiffNanos;
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||||
|
elapsedRealtime.timeUncertaintyNs = in.clock.elapsedRealTimeUnc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const uint32_t UTC_TO_GPS_SECONDS = 315964800;
|
||||||
|
|
||||||
|
if (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_LOGv("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
||||||
|
" measTimeNanos:%" PRIi64 "",
|
||||||
|
sinceBootTimeNanos, currentTimeNanos, measTimeNanos);
|
||||||
|
if (currentTimeNanos >= measTimeNanos) {
|
||||||
|
int64_t ageTimeNanos = currentTimeNanos - measTimeNanos;
|
||||||
|
LOC_LOGv("ageTimeNanos:%" PRIi64 ")", ageTimeNanos);
|
||||||
|
// the max trusted propagation time 100ms for ageTimeNanos to avoid user
|
||||||
|
// setting wrong time, it will affect elapsedRealtimeNanos
|
||||||
|
if (ageTimeNanos <= 100000000) {
|
||||||
|
elapsedRealtime.flags |= V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||||
|
elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||||
|
elapsedRealtime.flags |=
|
||||||
|
V2_0::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 verify if user change the sys time
|
||||||
|
elapsedRealtime.timeUncertaintyNs =
|
||||||
|
std::max(ageTimeNanos, (int64_t)100000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOC_LOGe("Failed to calculate elapsedRealtimeNanos timestamp");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LOC_LOGv("elapsedRealtime.timestampNs=%" PRIi64 ""
|
||||||
|
" elapsedRealtime.timeUncertaintyNs=%" PRIi64 " elapsedRealtime.flags=0x%X",
|
||||||
|
elapsedRealtime.timestampNs,
|
||||||
|
elapsedRealtime.timeUncertaintyNs, elapsedRealtime.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
|
|
|
@ -50,7 +50,6 @@ uint64_t ContextBase::sSupportedMsgMask = 0;
|
||||||
bool ContextBase::sGnssMeasurementSupported = false;
|
bool ContextBase::sGnssMeasurementSupported = false;
|
||||||
uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
|
uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
|
||||||
GnssNMEARptRate ContextBase::sNmeaReportRate = GNSS_NMEA_REPORT_RATE_NHZ;
|
GnssNMEARptRate ContextBase::sNmeaReportRate = GNSS_NMEA_REPORT_RATE_NHZ;
|
||||||
LocationCapabilitiesMask ContextBase::sQwesFeatureMask = 0;
|
|
||||||
|
|
||||||
const loc_param_s_type ContextBase::mGps_conf_table[] =
|
const loc_param_s_type ContextBase::mGps_conf_table[] =
|
||||||
{
|
{
|
||||||
|
@ -93,7 +92,6 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
|
||||||
{"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
|
{"GNSS_DEPLOYMENT", &mGps_conf.GNSS_DEPLOYMENT, NULL, 'n'},
|
||||||
{"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
|
{"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
|
||||||
&mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
|
&mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
|
||||||
{"NMEA_TAG_BLOCK_GROUPING_ENABLED", &mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED, NULL, 'n'},
|
|
||||||
{"NI_SUPL_DENY_ON_NFW_LOCKED", &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
|
{"NI_SUPL_DENY_ON_NFW_LOCKED", &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
|
||||||
{"ENABLE_NMEA_PRINT", &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'}
|
{"ENABLE_NMEA_PRINT", &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'}
|
||||||
};
|
};
|
||||||
|
@ -193,8 +191,6 @@ void ContextBase::readConfig()
|
||||||
/* default configuration QTI GNSS H/W */
|
/* default configuration QTI GNSS H/W */
|
||||||
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 NMEA Tag Block Grouping is disabled */
|
|
||||||
mGps_conf.NMEA_TAG_BLOCK_GROUPING_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 = 1;
|
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
|
||||||
/* By default NMEA Printing is disabled */
|
/* By default NMEA Printing is disabled */
|
||||||
|
|
|
@ -35,11 +35,6 @@
|
||||||
#include <LocApiBase.h>
|
#include <LocApiBase.h>
|
||||||
#include <LBSProxyBase.h>
|
#include <LBSProxyBase.h>
|
||||||
#include <loc_cfg.h>
|
#include <loc_cfg.h>
|
||||||
#ifdef NO_UNORDERED_SET_OR_MAP
|
|
||||||
#include <map>
|
|
||||||
#else
|
|
||||||
#include <unordered_map>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GPS.conf support */
|
/* GPS.conf support */
|
||||||
/* NOTE: the implementaiton of the parser casts number
|
/* NOTE: the implementaiton of the parser casts number
|
||||||
|
@ -82,7 +77,6 @@ typedef struct loc_gps_cfg_s
|
||||||
uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
|
uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
|
||||||
uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
|
uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
|
||||||
uint32_t ENABLE_NMEA_PRINT;
|
uint32_t ENABLE_NMEA_PRINT;
|
||||||
uint32_t NMEA_TAG_BLOCK_GROUPING_ENABLED;
|
|
||||||
} loc_gps_cfg_s_type;
|
} loc_gps_cfg_s_type;
|
||||||
|
|
||||||
/* NOTE: the implementation of the parser casts number
|
/* NOTE: the implementation of the parser casts number
|
||||||
|
@ -166,7 +160,6 @@ public:
|
||||||
static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
|
static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
|
||||||
static bool sGnssMeasurementSupported;
|
static bool sGnssMeasurementSupported;
|
||||||
static GnssNMEARptRate sNmeaReportRate;
|
static GnssNMEARptRate sNmeaReportRate;
|
||||||
static LocationCapabilitiesMask sQwesFeatureMask;
|
|
||||||
|
|
||||||
void readConfig();
|
void readConfig();
|
||||||
static uint32_t getCarrierCapabilities();
|
static uint32_t getCarrierCapabilities();
|
||||||
|
@ -199,118 +192,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool gnssConstellationConfig();
|
static bool gnssConstellationConfig();
|
||||||
|
|
||||||
/*
|
|
||||||
set QWES feature status info
|
|
||||||
*/
|
|
||||||
static inline void setQwesFeatureStatus(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
|
|
||||||
std::unordered_map<LocationQwesFeatureType, bool>::const_iterator itr;
|
|
||||||
static LocationQwesFeatureType locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_MAX];
|
|
||||||
for (itr = featureMap.begin(); itr != featureMap.end(); ++itr) {
|
|
||||||
LOC_LOGi("Feature : %d isValid: %d", itr->first, itr->second);
|
|
||||||
locQwesFeatType[itr->first] = itr->second;
|
|
||||||
switch (itr->first) {
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_CARRIER_PHASE:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_SV_POLYNOMIAL:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_GNSS_SINGLE_FREQUENCY:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_SV_EPH:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_GNSS_MULTI_FREQUENCY:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_PPE:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_PPE;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_PPE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_QDR2:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR2;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_QDR3:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_QDR3;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_QDR3;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LOCATION_QWES_FEATURE_TYPE_VPE:
|
|
||||||
if (itr->second) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_VPE;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_VPE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set CV2X basic when time freq and tunc is set
|
|
||||||
// CV2X_BASIC = LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY &
|
|
||||||
// LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY
|
|
||||||
|
|
||||||
// Set CV2X premium when time freq and tunc is set
|
|
||||||
// CV2X_PREMIUM = CV2X_BASIC & LOCATION_QWES_FEATURE_TYPE_QDR3 &
|
|
||||||
// LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE
|
|
||||||
|
|
||||||
bool cv2xBasicEnabled = (1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY]) &&
|
|
||||||
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY]);
|
|
||||||
bool cv2xPremiumEnabled = cv2xBasicEnabled &&
|
|
||||||
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_QDR3]) &&
|
|
||||||
(1 == locQwesFeatType[LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE]);
|
|
||||||
|
|
||||||
LOC_LOGd("CV2X_BASIC:%d, CV2X_PREMIUM:%d", cv2xBasicEnabled, cv2xPremiumEnabled);
|
|
||||||
if (cv2xBasicEnabled) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC;
|
|
||||||
}
|
|
||||||
if (cv2xPremiumEnabled) {
|
|
||||||
sQwesFeatureMask |= LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
|
|
||||||
} else {
|
|
||||||
sQwesFeatureMask &= ~LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
get QWES feature status info
|
|
||||||
*/
|
|
||||||
static inline LocationCapabilitiesMask getQwesFeatureStatus() {
|
|
||||||
return (ContextBase::sQwesFeatureMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LocApiResponse: LocMsg {
|
struct LocApiResponse: LocMsg {
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
*/
|
*/
|
||||||
#ifndef ENGINE_HUB_PROXY_BASE_H
|
#ifndef ENGINE_HUB_PROXY_BASE_H
|
||||||
#define ENGINE_HUB_PROXY_BASE_H
|
#define ENGINE_HUB_PROXY_BASE_H
|
||||||
#ifdef NO_UNORDERED_SET_OR_MAP
|
|
||||||
#include <map>
|
|
||||||
#else
|
|
||||||
#include <unordered_map>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
|
||||||
|
@ -119,13 +114,6 @@ public:
|
||||||
(void) dreConfig;
|
(void) dreConfig;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline virtual bool configEngineRunState(
|
|
||||||
PositioningEngineMask engType, LocEngineRunState engState) {
|
|
||||||
(void) engType;
|
|
||||||
(void) engState;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<void(int count, EngineLocationInfo* locationArr)>
|
typedef std::function<void(int count, EngineLocationInfo* locationArr)>
|
||||||
|
@ -141,9 +129,6 @@ typedef std::function<void(const GnssAidingDataSvMask& svDataMask)>
|
||||||
typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)>
|
typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)>
|
||||||
GnssAdapterUpdateNHzRequirementCb;
|
GnssAdapterUpdateNHzRequirementCb;
|
||||||
|
|
||||||
typedef std::function<void(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)>
|
|
||||||
GnssAdapterUpdateQwesFeatureStatusCb;
|
|
||||||
|
|
||||||
// potential parameters: message queue: MsgTask * msgTask;
|
// potential parameters: message queue: MsgTask * msgTask;
|
||||||
// callback function to report back dr and ppe position and sv report
|
// callback function to report back dr and ppe position and sv report
|
||||||
typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
||||||
|
@ -152,8 +137,7 @@ typedef EngineHubProxyBase* (getEngHubProxyFn)(
|
||||||
GnssAdapterReportEnginePositionsEventCb positionEventCb,
|
GnssAdapterReportEnginePositionsEventCb positionEventCb,
|
||||||
GnssAdapterReportSvEventCb svEventCb,
|
GnssAdapterReportSvEventCb svEventCb,
|
||||||
GnssAdapterReqAidingDataCb reqAidingDataCb,
|
GnssAdapterReqAidingDataCb reqAidingDataCb,
|
||||||
GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb,
|
GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb);
|
||||||
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb);
|
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
||||||
|
|
|
@ -428,12 +428,4 @@ LocAdapterBase::requestCapabilitiesCommand(LocationAPI* client)
|
||||||
sendMsg(new MsgRequestCapabilities(*this, client));
|
sendMsg(new MsgRequestCapabilities(*this, client));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
LocAdapterBase::reportLatencyInfoEvent(const GnssLatencyInfo& /*gnssLatencyInfo*/)
|
|
||||||
DEFAULT_IMPL()
|
|
||||||
|
|
||||||
bool LocAdapterBase::
|
|
||||||
reportQwesCapabilities(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
|
|
||||||
DEFAULT_IMPL(false)
|
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -236,9 +236,6 @@ public:
|
||||||
removeClientCompleteCallback rmClientCb);
|
removeClientCompleteCallback rmClientCb);
|
||||||
void requestCapabilitiesCommand(LocationAPI* client);
|
void requestCapabilitiesCommand(LocationAPI* client);
|
||||||
|
|
||||||
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
|
|
||||||
virtual bool reportQwesCapabilities(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <LocAdapterBase.h>
|
#include <LocAdapterBase.h>
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#include <LocContext.h>
|
#include <LocContext.h>
|
||||||
#include <loc_misc_utils.h>
|
|
||||||
|
|
||||||
namespace loc_core {
|
namespace loc_core {
|
||||||
|
|
||||||
|
@ -484,14 +483,6 @@ void LocApiBase::reportLocationSystemInfo(const LocationSystemInfo& locationSyst
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLocationSystemInfoEvent(locationSystemInfo));
|
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLocationSystemInfoEvent(locationSystemInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocApiBase::reportQwesCapabilities
|
|
||||||
(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// loop through adapters, and deliver to all adapters.
|
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportQwesCapabilities(featureMap));
|
|
||||||
}
|
|
||||||
void LocApiBase::requestXtraData()
|
void LocApiBase::requestXtraData()
|
||||||
{
|
{
|
||||||
// loop through adapters, and deliver to the first handling adapter.
|
// loop through adapters, and deliver to the first handling adapter.
|
||||||
|
@ -609,12 +600,6 @@ void LocApiBase::reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConf
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssConfigEvent(sessionId, gnssConfig));
|
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssConfigEvent(sessionId, gnssConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocApiBase::reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo)
|
|
||||||
{
|
|
||||||
// loop through adapters, and deliver to the first handling adapter.
|
|
||||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLatencyInfoEvent(gnssLatencyInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
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*/)
|
||||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
@ -928,142 +913,4 @@ DEFAULT_IMPL()
|
||||||
void LocApiBase::
|
void LocApiBase::
|
||||||
getConstellationMultiBandConfig(uint32_t sessionId, LocApiResponse* /*adapterResponse*/)
|
getConstellationMultiBandConfig(uint32_t sessionId, LocApiResponse* /*adapterResponse*/)
|
||||||
DEFAULT_IMPL()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
int64_t ElapsedRealtimeEstimator::getElapsedRealtimeEstimateNanos(int64_t curDataTimeNanos,
|
|
||||||
bool isCurDataTimeTrustable, uint32_t tbf) {
|
|
||||||
//The algorithm works follow below steps:
|
|
||||||
//When isCurDataTimeTrustable is meet (means Modem timestamp is already stable),
|
|
||||||
//1, Wait for mFixTimeStablizationThreshold fixes; While waiting for modem time
|
|
||||||
// stable, we set the traveltime to a default value;
|
|
||||||
//2, When the mFixTimeStablizationThreshold fix comes, we think now the mode time
|
|
||||||
// is already stable, calculate the initial AP-Modem clock diff(mCurrentClockDiff)
|
|
||||||
// using formula:
|
|
||||||
// mCurrentClockDiff = currentTimeNanos - locationTimeNanos - currentTravelTimeNanos
|
|
||||||
//3, since then, when the nth fix comes,
|
|
||||||
// 3.1 First update mCurrentClockDiff using below formula:
|
|
||||||
// mCurrentClockDiff = mCurrentClockDiff + (currentTimeNanos - sinceBootTimeNanos)
|
|
||||||
// - (mPrevUtcTimeNanos - mPrevBootTimeNanos)
|
|
||||||
// 3.2 Calculate currentTravelTimeNanos:
|
|
||||||
// currentTravelTimeNanos = currentTimeNanos - locationTimeNanos - mCurrentClockDiff
|
|
||||||
//4, It is possible that locationTimeNanos will jump,
|
|
||||||
// reset mFixTimeStablizationThreshold to default value, jump to step 2 to continue.
|
|
||||||
|
|
||||||
int64_t currentTravelTimeNanos = mInitialTravelTime;
|
|
||||||
struct timespec currentTime;
|
|
||||||
int64_t sinceBootTimeNanos;
|
|
||||||
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
|
||||||
if (isCurDataTimeTrustable) {
|
|
||||||
if (tbf > 0 && tbf != curDataTimeNanos - mPrevDataTimeNanos) {
|
|
||||||
mFixTimeStablizationThreshold = 5;
|
|
||||||
}
|
|
||||||
int64_t currentTimeNanos = currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
|
|
||||||
LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " currentTimeNanos:%" PRIi64 ""
|
|
||||||
" locationTimeNanos:%" PRIi64 "",
|
|
||||||
sinceBootTimeNanos, currentTimeNanos, curDataTimeNanos);
|
|
||||||
if (mFixTimeStablizationThreshold == 0) {
|
|
||||||
currentTravelTimeNanos = mInitialTravelTime;
|
|
||||||
mCurrentClockDiff = currentTimeNanos - curDataTimeNanos - currentTravelTimeNanos;
|
|
||||||
} else if (mFixTimeStablizationThreshold < 0) {
|
|
||||||
mCurrentClockDiff = mCurrentClockDiff + (currentTimeNanos - sinceBootTimeNanos)
|
|
||||||
- (mPrevUtcTimeNanos - mPrevBootTimeNanos);
|
|
||||||
currentTravelTimeNanos = currentTimeNanos - curDataTimeNanos - mCurrentClockDiff;
|
|
||||||
}
|
|
||||||
|
|
||||||
mPrevUtcTimeNanos = currentTimeNanos;
|
|
||||||
mPrevBootTimeNanos = sinceBootTimeNanos;
|
|
||||||
mPrevDataTimeNanos = curDataTimeNanos;
|
|
||||||
mFixTimeStablizationThreshold--;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
LOC_LOGd("Estimated travel time: %" PRIi64 "", currentTravelTimeNanos);
|
|
||||||
return (sinceBootTimeNanos - currentTravelTimeNanos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ElapsedRealtimeEstimator::reset() {
|
|
||||||
mCurrentClockDiff = 0;
|
|
||||||
mPrevDataTimeNanos = 0;
|
|
||||||
mPrevUtcTimeNanos = 0;
|
|
||||||
mPrevBootTimeNanos = 0;
|
|
||||||
mFixTimeStablizationThreshold = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t ElapsedRealtimeEstimator::getElapsedRealtimeQtimer(int64_t qtimerTicksAtOrigin) {
|
|
||||||
struct timespec currentTime;
|
|
||||||
int64_t sinceBootTimeNanos;
|
|
||||||
int64_t elapsedRealTimeNanos;
|
|
||||||
|
|
||||||
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
|
|
||||||
uint64_t qtimerDiff = 0;
|
|
||||||
uint64_t qTimerTickCount = getQTimerTickCount();
|
|
||||||
if (qTimerTickCount >= qtimerTicksAtOrigin) {
|
|
||||||
qtimerDiff = qTimerTickCount - qtimerTicksAtOrigin;
|
|
||||||
}
|
|
||||||
LOC_LOGd("sinceBootTimeNanos:%" PRIi64 " qtimerTicksAtOrigin=%" PRIi64 ""
|
|
||||||
" qTimerTickCount=%" PRIi64 " qtimerDiff=%" PRIi64 "",
|
|
||||||
sinceBootTimeNanos, qtimerTicksAtOrigin, qTimerTickCount, qtimerDiff);
|
|
||||||
uint64_t qTimerDiffNanos = qTimerTicksToNanos(double(qtimerDiff));
|
|
||||||
|
|
||||||
/* If the time difference between Qtimer on modem side and Qtimer on AP side
|
|
||||||
is greater than one second we assume this is a dual-SoC device such as
|
|
||||||
Kona and will try to get Qtimer on modem side and on AP side and
|
|
||||||
will adjust our difference accordingly */
|
|
||||||
if (qTimerDiffNanos > 1000000000) {
|
|
||||||
uint64_t qtimerDelta = getQTimerDeltaNanos();
|
|
||||||
if (qTimerDiffNanos >= qtimerDelta) {
|
|
||||||
qTimerDiffNanos -= qtimerDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOC_LOGd("Qtimer travel time: %" PRIi64 "", qTimerDiffNanos);
|
|
||||||
if (sinceBootTimeNanos >= qTimerDiffNanos) {
|
|
||||||
elapsedRealTimeNanos = sinceBootTimeNanos - qTimerDiffNanos;
|
|
||||||
} else {
|
|
||||||
elapsedRealTimeNanos = -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
elapsedRealTimeNanos = -1;
|
|
||||||
}
|
|
||||||
return elapsedRealTimeNanos;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ElapsedRealtimeEstimator::getCurrentTime(
|
|
||||||
struct timespec& currentTime, int64_t& sinceBootTimeNanos)
|
|
||||||
{
|
|
||||||
struct timespec sinceBootTime;
|
|
||||||
struct timespec sinceBootTimeTest;
|
|
||||||
bool clockGetTimeSuccess = false;
|
|
||||||
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
|
||||||
const uint32_t MAX_GET_TIME_COUNT = 20;
|
|
||||||
/* 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 */
|
|
||||||
for (uint32_t i = 0; i < MAX_GET_TIME_COUNT; i++) {
|
|
||||||
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTime) != 0) {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
if (clock_gettime(CLOCK_REALTIME, ¤tTime) != 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (clock_gettime(CLOCK_BOOTTIME, &sinceBootTimeTest) != 0) {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
sinceBootTimeNanos = sinceBootTime.tv_sec * 1000000000 + sinceBootTime.tv_nsec;
|
|
||||||
int64_t sinceBootTimeTestNanos =
|
|
||||||
sinceBootTimeTest.tv_sec * 1000000000 + sinceBootTimeTest.tv_nsec;
|
|
||||||
int64_t sinceBootTimeDeltaNanos = sinceBootTimeTestNanos - sinceBootTimeNanos;
|
|
||||||
|
|
||||||
/* sinceBootTime and sinceBootTimeTest should have a close value if there was no
|
|
||||||
interruption or context switch between clock_gettime for CLOCK_BOOTIME and
|
|
||||||
clock_gettime for CLOCK_REALTIME */
|
|
||||||
if (sinceBootTimeDeltaNanos < MAX_TIME_DELTA_VALUE_NANOS) {
|
|
||||||
clockGetTimeSuccess = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
LOC_LOGd("Delta:%" PRIi64 "ns time too large, retry number #%u...",
|
|
||||||
sinceBootTimeDeltaNanos, i + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return clockGetTimeSuccess;
|
|
||||||
}
|
|
||||||
} // namespace loc_core
|
} // namespace loc_core
|
||||||
|
|
|
@ -36,13 +36,6 @@
|
||||||
#include <MsgTask.h>
|
#include <MsgTask.h>
|
||||||
#include <LocSharedLock.h>
|
#include <LocSharedLock.h>
|
||||||
#include <log_util.h>
|
#include <log_util.h>
|
||||||
#ifdef NO_UNORDERED_SET_OR_MAP
|
|
||||||
#include <map>
|
|
||||||
#else
|
|
||||||
#include <unordered_map>
|
|
||||||
#endif
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
using namespace loc_util;
|
using namespace loc_util;
|
||||||
|
|
||||||
|
@ -201,11 +194,6 @@ public:
|
||||||
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
|
void reportGnssAdditionalSystemInfo(GnssAdditionalSystemInfo& additionalSystemInfo);
|
||||||
void sendNfwNotification(GnssNfwNotification& notification);
|
void sendNfwNotification(GnssNfwNotification& notification);
|
||||||
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
|
void reportGnssConfig(uint32_t sessionId, const GnssConfig& gnssConfig);
|
||||||
void reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo);
|
|
||||||
void reportQwesCapabilities
|
|
||||||
(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
|
||||||
);
|
|
||||||
|
|
||||||
void geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
|
void geofenceBreach(size_t count, uint32_t* hwIds, Location& location,
|
||||||
GeofenceBreachType breachType, uint64_t timestamp);
|
GeofenceBreachType breachType, uint64_t timestamp);
|
||||||
|
@ -346,27 +334,6 @@ public:
|
||||||
LocApiResponse* adapterResponse=nullptr);
|
LocApiResponse* adapterResponse=nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ElapsedRealtimeEstimator {
|
|
||||||
private:
|
|
||||||
int64_t mCurrentClockDiff;
|
|
||||||
int64_t mPrevUtcTimeNanos;
|
|
||||||
int64_t mPrevBootTimeNanos;
|
|
||||||
int64_t mFixTimeStablizationThreshold;
|
|
||||||
int64_t mInitialTravelTime;
|
|
||||||
int64_t mPrevDataTimeNanos;
|
|
||||||
public:
|
|
||||||
|
|
||||||
ElapsedRealtimeEstimator(int64_t travelTimeNanosEstimate):
|
|
||||||
mInitialTravelTime(travelTimeNanosEstimate) {reset();}
|
|
||||||
int64_t getElapsedRealtimeEstimateNanos(int64_t curDataTimeNanos,
|
|
||||||
bool isCurDataTimeTrustable, uint32_t tbf);
|
|
||||||
inline int64_t getElapsedRealtimeUncNanos() { return 5000000;}
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
static int64_t getElapsedRealtimeQtimer(int64_t qtimerTicksAtOrigin);
|
|
||||||
static bool getCurrentTime(struct timespec& currentTime, int64_t& sinceBootTimeNanos);
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||||
ContextBase *context);
|
ContextBase *context);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ XTRA_CA_PATH=/usr/lib/ssl-1.1/certs
|
||||||
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
|
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
|
||||||
# 4 - Debug, 5 - Verbose
|
# 4 - Debug, 5 - Verbose
|
||||||
# If DEBUG_LEVEL is commented, Android's logging levels will be used
|
# If DEBUG_LEVEL is commented, Android's logging levels will be used
|
||||||
DEBUG_LEVEL = 3
|
DEBUG_LEVEL = 2
|
||||||
|
|
||||||
# Intermediate position report, 1=enable, 0=disable
|
# Intermediate position report, 1=enable, 0=disable
|
||||||
INTERMEDIATE_POS=0
|
INTERMEDIATE_POS=0
|
||||||
|
@ -95,15 +95,6 @@ DATUM_TYPE = 0
|
||||||
# NMEA provider (1=Modem Processor, 0=Application Processor)
|
# NMEA provider (1=Modem Processor, 0=Application Processor)
|
||||||
NMEA_PROVIDER=0
|
NMEA_PROVIDER=0
|
||||||
|
|
||||||
################################
|
|
||||||
# NMEA TAG BLOCK GROUPING
|
|
||||||
################################
|
|
||||||
# NMEA tag block grouping is only applicable to GSA
|
|
||||||
# Default is disabled
|
|
||||||
# 0 - disabled
|
|
||||||
# 1 - enabled
|
|
||||||
NMEA_TAG_BLOCK_GROUPING_ENABLED = 0
|
|
||||||
|
|
||||||
# Customized NMEA GGA fix quality that can be used to tell
|
# Customized NMEA GGA fix quality that can be used to tell
|
||||||
# whether SENSOR contributed to the fix.
|
# whether SENSOR contributed to the fix.
|
||||||
#
|
#
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
# Log level
|
# Log level
|
||||||
# EL_LOG_OFF = 0, EL_ERROR = 1, EL_WARNING = 2, EL_INFO = 3, EL_DEBUG = 4, EL_VERBOSE = 5, EL_LOG_ALL = 100
|
# EL_LOG_OFF = 0, EL_ERROR = 1, EL_WARNING = 2, EL_INFO = 3, EL_DEBUG = 4, EL_VERBOSE = 5, EL_LOG_ALL = 100
|
||||||
LOWI_LOG_LEVEL = 4
|
LOWI_LOG_LEVEL = 2
|
||||||
LOWI_USE_LOWI_LP = 0
|
LOWI_USE_LOWI_LP = 0
|
||||||
|
|
||||||
|
|
|
@ -77,15 +77,6 @@ static void agpsCloseResultCb (bool isSuccess, AGpsExtType agpsType, void* userD
|
||||||
|
|
||||||
typedef const CdfwInterface* (*getCdfwInterface)();
|
typedef const CdfwInterface* (*getCdfwInterface)();
|
||||||
|
|
||||||
inline bool GnssReportLoggerUtil::isLogEnabled() {
|
|
||||||
return (mLogLatency != nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void GnssReportLoggerUtil::log(const GnssLatencyInfo& gnssLatencyMeasInfo) {
|
|
||||||
if (mLogLatency != nullptr) {
|
|
||||||
mLogLatency(gnssLatencyMeasInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GnssAdapter::GnssAdapter() :
|
GnssAdapter::GnssAdapter() :
|
||||||
LocAdapterBase(0,
|
LocAdapterBase(0,
|
||||||
|
@ -119,9 +110,8 @@ GnssAdapter::GnssAdapter() :
|
||||||
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
|
mSystemStatus(SystemStatus::getInstance(mMsgTask)),
|
||||||
mServerUrl(":"),
|
mServerUrl(":"),
|
||||||
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask),
|
mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask),
|
||||||
mBlockCPIInfo{},
|
|
||||||
mDreIntEnabled(false),
|
|
||||||
mLocSystemInfo{},
|
mLocSystemInfo{},
|
||||||
|
mBlockCPIInfo{},
|
||||||
mNfwCb(NULL),
|
mNfwCb(NULL),
|
||||||
mPowerOn(false),
|
mPowerOn(false),
|
||||||
mAllowFlpNetworkFixes(0),
|
mAllowFlpNetworkFixes(0),
|
||||||
|
@ -660,11 +650,6 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out,
|
||||||
out.flags |= GNSS_LOCATION_INFO_DR_SOLUTION_STATUS_MASK_BIT;
|
out.flags |= GNSS_LOCATION_INFO_DR_SOLUTION_STATUS_MASK_BIT;
|
||||||
out.drSolutionStatusMask = locationExtended.drSolutionStatusMask;
|
out.drSolutionStatusMask = locationExtended.drSolutionStatusMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GPS_LOCATION_EXTENDED_HAS_ALTITUDE_ASSUMED & locationExtended.flags) {
|
|
||||||
out.flags |= GNSS_LOCATION_INFO_ALTITUDE_ASSUMED_BIT;
|
|
||||||
out.altitudeAssumed = locationExtended.altitudeAssumed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t
|
inline uint32_t
|
||||||
|
@ -856,9 +841,6 @@ GnssAdapter::setConfig()
|
||||||
uint32_t mask = 0;
|
uint32_t mask = 0;
|
||||||
if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
|
if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
|
||||||
mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
|
mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
|
||||||
if (ContextBase::mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
|
|
||||||
mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
|
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
|
||||||
mask |= LOC_NMEA_MASK_DEBUG_V02;
|
mask |= LOC_NMEA_MASK_DEBUG_V02;
|
||||||
|
@ -938,9 +920,6 @@ GnssAdapter::setConfig()
|
||||||
uint32_t mask = 0;
|
uint32_t mask = 0;
|
||||||
if (NMEA_PROVIDER_MP == gpsConf.NMEA_PROVIDER) {
|
if (NMEA_PROVIDER_MP == gpsConf.NMEA_PROVIDER) {
|
||||||
mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
|
mask |= LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK;
|
||||||
if (gpsConf.NMEA_TAG_BLOCK_GROUPING_ENABLED) {
|
|
||||||
mask |= LOC_NMEA_MASK_TAGBLOCK_V02;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
|
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
|
||||||
mask |= LOC_NMEA_MASK_DEBUG_V02;
|
mask |= LOC_NMEA_MASK_DEBUG_V02;
|
||||||
|
@ -1557,8 +1536,8 @@ GnssAdapter::gnssGetConfigCommand(GnssConfigFlagsMask configMask) {
|
||||||
mAdapter(adapter),
|
mAdapter(adapter),
|
||||||
mApi(api),
|
mApi(api),
|
||||||
mConfigMask(configMask),
|
mConfigMask(configMask),
|
||||||
mCount(count),
|
mIds(nullptr),
|
||||||
mIds(nullptr) {
|
mCount(count) {
|
||||||
if (mCount > 0) {
|
if (mCount > 0) {
|
||||||
mIds = new uint32_t[count];
|
mIds = new uint32_t[count];
|
||||||
if (mIds) {
|
if (mIds) {
|
||||||
|
@ -2479,10 +2458,7 @@ GnssAdapter::stopClientSessions(LocationAPI* client)
|
||||||
void
|
void
|
||||||
GnssAdapter::updateClientsEventMask()
|
GnssAdapter::updateClientsEventMask()
|
||||||
{
|
{
|
||||||
// need to register for leap second info
|
LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
|
||||||
// for proper nmea generation
|
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T mask = LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO |
|
|
||||||
LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
|
|
||||||
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
||||||
if (it->second.trackingCb != nullptr ||
|
if (it->second.trackingCb != nullptr ||
|
||||||
it->second.gnssLocationInfoCb != nullptr ||
|
it->second.gnssLocationInfoCb != nullptr ||
|
||||||
|
@ -2517,6 +2493,8 @@ GnssAdapter::updateClientsEventMask()
|
||||||
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
|
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
|
||||||
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
|
mask |= LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT;
|
||||||
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT;
|
mask |= LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT;
|
||||||
|
mask |= LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO;
|
||||||
|
mask |= LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO;
|
||||||
|
|
||||||
// Nhz measurement bit is set based on callback from loc eng hub
|
// Nhz measurement bit is set based on callback from loc eng hub
|
||||||
// for Nhz engines.
|
// for Nhz engines.
|
||||||
|
@ -2541,13 +2519,6 @@ GnssAdapter::updateClientsEventMask()
|
||||||
// always register for NI NOTIFY VERIFY to handle internally in HAL
|
// always register for NI NOTIFY VERIFY to handle internally in HAL
|
||||||
mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
|
mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
|
||||||
|
|
||||||
// Enable the latency report
|
|
||||||
if (mask & LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT) {
|
|
||||||
if (mLogger.isLogEnabled()) {
|
|
||||||
mask |= LOC_API_ADAPTER_BIT_LATENCY_INFORMATION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2672,48 +2643,6 @@ void GnssAdapter::checkAndRestartTimeBasedSession()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationCapabilitiesMask
|
|
||||||
GnssAdapter::getCapabilities()
|
|
||||||
{
|
|
||||||
LocationCapabilitiesMask mask = 0;
|
|
||||||
uint32_t carrierCapabilities = ContextBase::getCarrierCapabilities();
|
|
||||||
// time based tracking always supported
|
|
||||||
mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT;
|
|
||||||
// geofence always supported
|
|
||||||
mask |= LOCATION_CAPABILITIES_GEOFENCE_BIT;
|
|
||||||
if (carrierCapabilities & LOC_GPS_CAPABILITY_MSB) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_GNSS_MSB_BIT;
|
|
||||||
}
|
|
||||||
if (LOC_GPS_CAPABILITY_MSA & carrierCapabilities) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_GNSS_MSA_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT |
|
|
||||||
LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isMessageSupported(LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::gnssConstellationConfig()) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_DEBUG_NMEA_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT;
|
|
||||||
}
|
|
||||||
if (ContextBase::isFeatureSupported(LOC_SUPPORTED_FEATURE_AGPM_V02)) {
|
|
||||||
mask |= LOCATION_CAPABILITIES_AGPM_BIT;
|
|
||||||
}
|
|
||||||
//Get QWES feature status mask
|
|
||||||
mask |= ContextBase::getQwesFeatureStatus();
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GnssAdapter::notifyClientOfCachedLocationSystemInfo(
|
GnssAdapter::notifyClientOfCachedLocationSystemInfo(
|
||||||
LocationAPI* client, const LocationCallbacks& callbacks) {
|
LocationAPI* client, const LocationCallbacks& callbacks) {
|
||||||
|
@ -3885,62 +3814,6 @@ bool GnssAdapter::needToGenerateNmeaReport(const uint32_t &gpsTimeOfWeekMs,
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
GnssAdapter::logLatencyInfo()
|
|
||||||
{
|
|
||||||
if (0 == mGnssLatencyInfoQueue.size()) {
|
|
||||||
LOC_LOGv("mGnssLatencyInfoQueue.size is 0");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer5 = getQTimerTickCount();
|
|
||||||
if (0 == mGnssLatencyInfoQueue.front().hlosQtimer3) {
|
|
||||||
/* if SPE from engine hub is not reported then hlosQtimer3 = 0, set it
|
|
||||||
equal to hlosQtimer2 to make sense */
|
|
||||||
LOC_LOGv("hlosQtimer3 is 0, setting it to hlosQtimer2");
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer3 = mGnssLatencyInfoQueue.front().hlosQtimer2;
|
|
||||||
}
|
|
||||||
if (0 == mGnssLatencyInfoQueue.front().hlosQtimer4) {
|
|
||||||
/* if PPE from engine hub is not reported then hlosQtimer4 = 0, set it
|
|
||||||
equal to hlosQtimer3 to make sense */
|
|
||||||
LOC_LOGv("hlosQtimer4 is 0, setting it to hlosQtimer3");
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer4 = mGnssLatencyInfoQueue.front().hlosQtimer3;
|
|
||||||
}
|
|
||||||
if (mGnssLatencyInfoQueue.front().hlosQtimer4 < mGnssLatencyInfoQueue.front().hlosQtimer3) {
|
|
||||||
/* hlosQtimer3 is timestamped when SPE from engine hub is reported,
|
|
||||||
and hlosQtimer4 is timestamped when PPE from engine hub is reported.
|
|
||||||
The order is random though, hence making sure the timestamps are sorted */
|
|
||||||
LOC_LOGv("hlosQtimer4 is < hlosQtimer3, swapping them");
|
|
||||||
std::swap(mGnssLatencyInfoQueue.front().hlosQtimer3,
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer4);
|
|
||||||
}
|
|
||||||
LOC_LOGv("meQtimer1=%" PRIi64 " "
|
|
||||||
"meQtimer2=%" PRIi64 " "
|
|
||||||
"meQtimer3=%" PRIi64 " "
|
|
||||||
"peQtimer1=%" PRIi64 " "
|
|
||||||
"peQtimer2=%" PRIi64 " "
|
|
||||||
"peQtimer3=%" PRIi64 " "
|
|
||||||
"smQtimer1=%" PRIi64 " "
|
|
||||||
"smQtimer2=%" PRIi64 " "
|
|
||||||
"smQtimer3=%" PRIi64 " "
|
|
||||||
"locMwQtimer=%" PRIi64 " "
|
|
||||||
"hlosQtimer1=%" PRIi64 " "
|
|
||||||
"hlosQtimer2=%" PRIi64 " "
|
|
||||||
"hlosQtimer3=%" PRIi64 " "
|
|
||||||
"hlosQtimer4=%" PRIi64 " "
|
|
||||||
"hlosQtimer5=%" PRIi64 " ",
|
|
||||||
mGnssLatencyInfoQueue.front().meQtimer1, mGnssLatencyInfoQueue.front().meQtimer2,
|
|
||||||
mGnssLatencyInfoQueue.front().meQtimer3, mGnssLatencyInfoQueue.front().peQtimer1,
|
|
||||||
mGnssLatencyInfoQueue.front().peQtimer2, mGnssLatencyInfoQueue.front().peQtimer3,
|
|
||||||
mGnssLatencyInfoQueue.front().smQtimer1, mGnssLatencyInfoQueue.front().smQtimer2,
|
|
||||||
mGnssLatencyInfoQueue.front().smQtimer3, mGnssLatencyInfoQueue.front().locMwQtimer,
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer1, mGnssLatencyInfoQueue.front().hlosQtimer2,
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer3, mGnssLatencyInfoQueue.front().hlosQtimer4,
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer5);
|
|
||||||
mLogger.log(mGnssLatencyInfoQueue.front());
|
|
||||||
mGnssLatencyInfoQueue.pop();
|
|
||||||
LOC_LOGv("mGnssLatencyInfoQueue.size after pop=%zu", mGnssLatencyInfoQueue.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// only fused report (when engine hub is enabled) or
|
// only fused report (when engine hub is enabled) or
|
||||||
// SPE report (when engine hub is disabled) will reach this function
|
// SPE report (when engine hub is disabled) will reach this function
|
||||||
void
|
void
|
||||||
|
@ -3956,14 +3829,14 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
|
||||||
GnssLocationInfoNotification locationInfo = {};
|
GnssLocationInfoNotification locationInfo = {};
|
||||||
convertLocationInfo(locationInfo, locationExtended);
|
convertLocationInfo(locationInfo, locationExtended);
|
||||||
convertLocation(locationInfo.location, ulpLocation, locationExtended);
|
convertLocation(locationInfo.location, ulpLocation, locationExtended);
|
||||||
logLatencyInfo();
|
|
||||||
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
||||||
if ((reportToFlpClient && isFlpClient(it->second)) ||
|
if ((reportToFlpClient && isFlpClient(it->second)) ||
|
||||||
(reportToGnssClient && !isFlpClient(it->second))) {
|
(reportToGnssClient && !isFlpClient(it->second))) {
|
||||||
if (nullptr != it->second.gnssLocationInfoCb) {
|
if (nullptr != it->second.gnssLocationInfoCb) {
|
||||||
it->second.gnssLocationInfoCb(locationInfo);
|
it->second.gnssLocationInfoCb(locationInfo);
|
||||||
} else if ((nullptr != it->second.engineLocationsInfoCb) &&
|
} else if ((nullptr != it->second.engineLocationsInfoCb) &&
|
||||||
(false == initEngHubProxy())) {
|
(false == initEngHubProxy())) {
|
||||||
// if engine hub is disabled, this is SPE fix from modem
|
// if engine hub is disabled, this is SPE fix from modem
|
||||||
// we need to mark one copy marked as fused and one copy marked as PPE
|
// we need to mark one copy marked as fused and one copy marked as PPE
|
||||||
// and dispatch it to the engineLocationsInfoCb
|
// and dispatch it to the engineLocationsInfoCb
|
||||||
|
@ -4016,12 +3889,10 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
|
||||||
(LOC_RELIABILITY_NOT_SET == locationExtended.horizontal_reliability));
|
(LOC_RELIABILITY_NOT_SET == locationExtended.horizontal_reliability));
|
||||||
uint8_t generate_nmea = (reportToGnssClient && status != LOC_SESS_FAILURE && !blank_fix);
|
uint8_t generate_nmea = (reportToGnssClient && status != LOC_SESS_FAILURE && !blank_fix);
|
||||||
bool custom_nmea_gga = (1 == ContextBase::mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED);
|
bool custom_nmea_gga = (1 == ContextBase::mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED);
|
||||||
bool isTagBlockGroupingEnabled =
|
|
||||||
(1 == ContextBase::mGps_conf.NMEA_TAG_BLOCK_GROUPING_ENABLED);
|
|
||||||
std::vector<std::string> nmeaArraystr;
|
std::vector<std::string> nmeaArraystr;
|
||||||
int indexOfGGA = -1;
|
int indexOfGGA = -1;
|
||||||
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo, generate_nmea,
|
loc_nmea_generate_pos(ulpLocation, locationExtended, mLocSystemInfo,
|
||||||
custom_nmea_gga, nmeaArraystr, indexOfGGA, isTagBlockGroupingEnabled);
|
generate_nmea, custom_nmea_gga, nmeaArraystr, indexOfGGA);
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
|
for (auto itor = nmeaArraystr.begin(); itor != nmeaArraystr.end(); ++itor) {
|
||||||
ss << *itor;
|
ss << *itor;
|
||||||
|
@ -4040,25 +3911,6 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
GnssAdapter::reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo)
|
|
||||||
{
|
|
||||||
struct MsgReportLatencyInfo : public LocMsg {
|
|
||||||
GnssAdapter& mAdapter;
|
|
||||||
GnssLatencyInfo mGnssLatencyInfo;
|
|
||||||
inline MsgReportLatencyInfo(GnssAdapter& adapter,
|
|
||||||
const GnssLatencyInfo& gnssLatencyInfo) :
|
|
||||||
mGnssLatencyInfo(gnssLatencyInfo),
|
|
||||||
mAdapter(adapter) {}
|
|
||||||
inline virtual void proc() const {
|
|
||||||
mAdapter.mGnssLatencyInfoQueue.push(mGnssLatencyInfo);
|
|
||||||
LOC_LOGv("mGnssLatencyInfoQueue.size after push=%zu",
|
|
||||||
mAdapter.mGnssLatencyInfoQueue.size());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
sendMsg(new MsgReportLatencyInfo(*this, gnssLatencyInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GnssAdapter::reportEnginePositions(unsigned int count,
|
GnssAdapter::reportEnginePositions(unsigned int count,
|
||||||
const EngineLocationInfo* locationArr)
|
const EngineLocationInfo* locationArr)
|
||||||
|
@ -4091,22 +3943,6 @@ GnssAdapter::reportEnginePositions(unsigned int count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const EngineLocationInfo* engLocation = locationArr;
|
|
||||||
LOC_LOGv("engLocation->locationExtended.locOutputEngType=%d",
|
|
||||||
engLocation->locationExtended.locOutputEngType);
|
|
||||||
|
|
||||||
if (0 != mGnssLatencyInfoQueue.size()) {
|
|
||||||
if ((GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & engLocation->locationExtended.flags) &&
|
|
||||||
(LOC_OUTPUT_ENGINE_SPE == engLocation->locationExtended.locOutputEngType)) {
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer3 = getQTimerTickCount();
|
|
||||||
LOC_LOGv("SPE hlosQtimer3=%" PRIi64 " ", mGnssLatencyInfoQueue.front().hlosQtimer3);
|
|
||||||
}
|
|
||||||
if ((GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE & engLocation->locationExtended.flags) &&
|
|
||||||
(LOC_OUTPUT_ENGINE_PPE == engLocation->locationExtended.locOutputEngType)) {
|
|
||||||
mGnssLatencyInfoQueue.front().hlosQtimer4 = getQTimerTickCount();
|
|
||||||
LOC_LOGv("PPE hlosQtimer4=%" PRIi64 " ", mGnssLatencyInfoQueue.front().hlosQtimer4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (needReportEnginePositions) {
|
if (needReportEnginePositions) {
|
||||||
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
|
||||||
if (nullptr != it->second.engineLocationsInfoCb) {
|
if (nullptr != it->second.engineLocationsInfoCb) {
|
||||||
|
@ -4873,33 +4709,8 @@ bool GnssAdapter::reportGnssAdditionalSystemInfoEvent(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GnssAdapter::reportQwesCapabilities(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)
|
|
||||||
{
|
|
||||||
struct MsgReportQwesFeatureStatus : public LocMsg {
|
|
||||||
GnssAdapter& mAdapter;
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> mFeatureMap;
|
|
||||||
inline MsgReportQwesFeatureStatus(GnssAdapter& adapter,
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) :
|
|
||||||
LocMsg(),
|
|
||||||
mAdapter(adapter),
|
|
||||||
mFeatureMap(std::move(featureMap)) {}
|
|
||||||
inline virtual void proc() const {
|
|
||||||
LOC_LOGi("ReportQwesFeatureStatus before caps %" PRIx64 " ",
|
|
||||||
mAdapter.getCapabilities());
|
|
||||||
ContextBase::setQwesFeatureStatus(mFeatureMap);
|
|
||||||
LOC_LOGi("ReportQwesFeatureStatus After caps %" PRIx64 " ",
|
|
||||||
mAdapter.getCapabilities());
|
|
||||||
mAdapter.broadcastCapabilities(mAdapter.getCapabilities());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sendMsg(new MsgReportQwesFeatureStatus(*this, featureMap));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback,
|
void GnssAdapter::initOdcpiCommand(const OdcpiRequestCallback& callback,
|
||||||
OdcpiPrioritytype priority)
|
OdcpiPrioritytype priority)
|
||||||
{
|
{
|
||||||
struct MsgInitOdcpi : public LocMsg {
|
struct MsgInitOdcpi : public LocMsg {
|
||||||
GnssAdapter& mAdapter;
|
GnssAdapter& mAdapter;
|
||||||
|
@ -6115,7 +5926,7 @@ GnssAdapter::configLeverArmCommand(const LeverArmConfigInfo& configInfo) {
|
||||||
mSessionId(sessionId),
|
mSessionId(sessionId),
|
||||||
mConfigInfo(configInfo) {}
|
mConfigInfo(configInfo) {}
|
||||||
inline virtual void proc() const {
|
inline virtual void proc() const {
|
||||||
// save the lever ARM config info for translating position from GNSS antenna based
|
// save the lever ARM config info for translate position from GNSS antenna based
|
||||||
// to VRP based
|
// to VRP based
|
||||||
if (mConfigInfo.leverArmValidMask & LEVER_ARM_TYPE_GNSS_TO_VRP_BIT) {
|
if (mConfigInfo.leverArmValidMask & LEVER_ARM_TYPE_GNSS_TO_VRP_BIT) {
|
||||||
mAdapter.mLocConfigInfo.leverArmConfigInfo.leverArmValidMask |=
|
mAdapter.mLocConfigInfo.leverArmConfigInfo.leverArmValidMask |=
|
||||||
|
@ -6370,47 +6181,6 @@ uint32_t GnssAdapter::configDeadReckoningEngineParamsCommand(
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GnssAdapter::configEngineRunStateCommand(
|
|
||||||
PositioningEngineMask engType, LocEngineRunState engState) {
|
|
||||||
|
|
||||||
// generated session id will be none-zero
|
|
||||||
uint32_t sessionId = generateSessionId();
|
|
||||||
LOC_LOGe("session id %u, eng type 0x%x, eng state %d, dre enabled %d",
|
|
||||||
sessionId, engType, engState, mDreIntEnabled);
|
|
||||||
|
|
||||||
struct MsgConfigEngineRunState : public LocMsg {
|
|
||||||
GnssAdapter& mAdapter;
|
|
||||||
uint32_t mSessionId;
|
|
||||||
PositioningEngineMask mEngType;
|
|
||||||
LocEngineRunState mEngState;
|
|
||||||
|
|
||||||
inline MsgConfigEngineRunState(GnssAdapter& adapter,
|
|
||||||
uint32_t sessionId,
|
|
||||||
PositioningEngineMask engType,
|
|
||||||
LocEngineRunState engState) :
|
|
||||||
LocMsg(),
|
|
||||||
mAdapter(adapter),
|
|
||||||
mSessionId(sessionId),
|
|
||||||
mEngType(engType),
|
|
||||||
mEngState(engState) {}
|
|
||||||
inline virtual void proc() const {
|
|
||||||
LocationError err = LOCATION_ERROR_NOT_SUPPORTED;
|
|
||||||
// Currently, only DR engine supports pause/resume request
|
|
||||||
if ((mEngType == DEAD_RECKONING_ENGINE) &&
|
|
||||||
(mAdapter.mDreIntEnabled == true)) {
|
|
||||||
if (true == mAdapter.mEngHubProxy->configEngineRunState(mEngType, mEngState)) {
|
|
||||||
err = LOCATION_ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mAdapter.reportResponse(err, mSessionId);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sendMsg(new MsgConfigEngineRunState(*this, sessionId, engType, engState));
|
|
||||||
|
|
||||||
return sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GnssAdapter::reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig)
|
void GnssAdapter::reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig)
|
||||||
{
|
{
|
||||||
struct MsgReportGnssConfig : public LocMsg {
|
struct MsgReportGnssConfig : public LocMsg {
|
||||||
|
@ -6485,12 +6255,7 @@ GnssAdapter::initEngHubProxy() {
|
||||||
strlen(PROCESS_NAME_ENGINE_SERVICE)) == 0) &&
|
strlen(PROCESS_NAME_ENGINE_SERVICE)) == 0) &&
|
||||||
(processInfoList[i].proc_status == ENABLED)) {
|
(processInfoList[i].proc_status == ENABLED)) {
|
||||||
pluginDaemonEnabled = true;
|
pluginDaemonEnabled = true;
|
||||||
// check if this is DRE-INT engine
|
break;
|
||||||
if ((processInfoList[i].args[1]!= nullptr) &&
|
|
||||||
(strncmp(processInfoList[i].args[1], "DRE-INT", sizeof("DRE-INT")) == 0)) {
|
|
||||||
mDreIntEnabled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6550,20 +6315,14 @@ GnssAdapter::initEngHubProxy() {
|
||||||
mNHzNeeded = nHzNeeded;
|
mNHzNeeded = nHzNeeded;
|
||||||
checkAndRestartSPESession();
|
checkAndRestartSPESession();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb =
|
|
||||||
[this] (const std::unordered_map<LocationQwesFeatureType, bool> &featureMap) {
|
|
||||||
reportQwesCapabilities(featureMap);
|
|
||||||
};
|
|
||||||
|
|
||||||
getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");
|
getEngHubProxyFn* getter = (getEngHubProxyFn*) dlsym(handle, "getEngHubProxy");
|
||||||
if(getter != nullptr) {
|
if(getter != nullptr) {
|
||||||
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
|
EngineHubProxyBase* hubProxy = (*getter) (mMsgTask, mSystemStatus->getOsObserver(),
|
||||||
reportPositionEventCb,
|
reportPositionEventCb,
|
||||||
reportSvEventCb, reqAidingDataCb,
|
reportSvEventCb, reqAidingDataCb,
|
||||||
updateNHzRequirementCb,
|
updateNHzRequirementCb);
|
||||||
updateQwesFeatureStatusCb);
|
|
||||||
if (hubProxy != nullptr) {
|
if (hubProxy != nullptr) {
|
||||||
mEngHubProxy = hubProxy;
|
mEngHubProxy = hubProxy;
|
||||||
engHubLoadSuccessful = true;
|
engHubLoadSuccessful = true;
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
#include <XtraSystemStatusObserver.h>
|
#include <XtraSystemStatusObserver.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <loc_misc_utils.h>
|
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
#define MAX_URL_LEN 256
|
#define MAX_URL_LEN 256
|
||||||
#define NMEA_SENTENCE_MAX_LENGTH 200
|
#define NMEA_SENTENCE_MAX_LENGTH 200
|
||||||
|
@ -179,23 +177,6 @@ typedef uint16_t DGnssStateBitMask;
|
||||||
#define DGNSS_STATE_NO_NMEA_PENDING 0X02
|
#define DGNSS_STATE_NO_NMEA_PENDING 0X02
|
||||||
#define DGNSS_STATE_NTRIP_SESSION_STARTED 0X04
|
#define DGNSS_STATE_NTRIP_SESSION_STARTED 0X04
|
||||||
|
|
||||||
class GnssReportLoggerUtil {
|
|
||||||
public:
|
|
||||||
typedef void (*LogGnssLatency)(const GnssLatencyInfo& gnssLatencyMeasInfo);
|
|
||||||
|
|
||||||
GnssReportLoggerUtil() : mLogLatency(nullptr) {
|
|
||||||
const char* libname = "liblocdiagiface.so";
|
|
||||||
void* libHandle = nullptr;
|
|
||||||
mLogLatency = (LogGnssLatency)dlGetSymFromLib(libHandle, libname, "LogGnssLatency");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLogEnabled();
|
|
||||||
void log(const GnssLatencyInfo& gnssLatencyMeasInfo);
|
|
||||||
|
|
||||||
private:
|
|
||||||
LogGnssLatency mLogLatency;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GnssAdapter : public LocAdapterBase {
|
class GnssAdapter : public LocAdapterBase {
|
||||||
|
|
||||||
/* ==== Engine Hub ===================================================================== */
|
/* ==== Engine Hub ===================================================================== */
|
||||||
|
@ -277,9 +258,6 @@ class GnssAdapter : public LocAdapterBase {
|
||||||
BlockCPIInfo mBlockCPIInfo;
|
BlockCPIInfo mBlockCPIInfo;
|
||||||
bool mPowerOn;
|
bool mPowerOn;
|
||||||
uint32_t mAllowFlpNetworkFixes;
|
uint32_t mAllowFlpNetworkFixes;
|
||||||
std::queue<GnssLatencyInfo> mGnssLatencyInfoQueue;
|
|
||||||
GnssReportLoggerUtil mLogger;
|
|
||||||
bool mDreIntEnabled;
|
|
||||||
|
|
||||||
/* === Misc callback from QMI LOC API ============================================== */
|
/* === Misc callback from QMI LOC API ============================================== */
|
||||||
GnssEnergyConsumedCallback mGnssEnergyConsumedCb;
|
GnssEnergyConsumedCallback mGnssEnergyConsumedCb;
|
||||||
|
@ -312,8 +290,6 @@ protected:
|
||||||
/* ==== CLIENT ========================================================================= */
|
/* ==== CLIENT ========================================================================= */
|
||||||
virtual void updateClientsEventMask();
|
virtual void updateClientsEventMask();
|
||||||
virtual void stopClientSessions(LocationAPI* client);
|
virtual void stopClientSessions(LocationAPI* client);
|
||||||
inline void setNmeaReportRateConfig();
|
|
||||||
void logLatencyInfo();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -458,8 +434,6 @@ public:
|
||||||
inline void antennaInfoCloseCommand() { mIsAntennaInfoInterfaceOpened = false; }
|
inline void antennaInfoCloseCommand() { mIsAntennaInfoInterfaceOpened = false; }
|
||||||
uint32_t configMinGpsWeekCommand(uint16_t minGpsWeek);
|
uint32_t configMinGpsWeekCommand(uint16_t minGpsWeek);
|
||||||
uint32_t configDeadReckoningEngineParamsCommand(const DeadReckoningEngineConfig& dreConfig);
|
uint32_t configDeadReckoningEngineParamsCommand(const DeadReckoningEngineConfig& dreConfig);
|
||||||
uint32_t configEngineRunStateCommand(PositioningEngineMask engType,
|
|
||||||
LocEngineRunState engState);
|
|
||||||
|
|
||||||
/* ========= ODCPI ===================================================================== */
|
/* ========= ODCPI ===================================================================== */
|
||||||
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
|
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
|
||||||
|
@ -515,11 +489,6 @@ public:
|
||||||
virtual bool reportGnssAdditionalSystemInfoEvent(
|
virtual bool reportGnssAdditionalSystemInfoEvent(
|
||||||
GnssAdditionalSystemInfo& additionalSystemInfo);
|
GnssAdditionalSystemInfo& additionalSystemInfo);
|
||||||
virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
|
virtual void reportNfwNotificationEvent(GnssNfwNotification& notification);
|
||||||
virtual void reportLatencyInfoEvent(const GnssLatencyInfo& gnssLatencyInfo);
|
|
||||||
virtual bool reportQwesCapabilities
|
|
||||||
(
|
|
||||||
const std::unordered_map<LocationQwesFeatureType, bool> &featureMap
|
|
||||||
);
|
|
||||||
|
|
||||||
/* ======== UTILITIES ================================================================= */
|
/* ======== UTILITIES ================================================================= */
|
||||||
bool needReportForGnssClient(const UlpLocation& ulpLocation,
|
bool needReportForGnssClient(const UlpLocation& ulpLocation,
|
||||||
|
@ -620,7 +589,6 @@ public:
|
||||||
void setSuplHostServer(const char* server, int port, LocServerType type);
|
void setSuplHostServer(const char* server, int port, LocServerType type);
|
||||||
void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
|
void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
|
||||||
const LocationCallbacks& callbacks);
|
const LocationCallbacks& callbacks);
|
||||||
LocationCapabilitiesMask getCapabilities();
|
|
||||||
void updateSystemPowerStateCommand(PowerStateType systemPowerState);
|
void updateSystemPowerStateCommand(PowerStateType systemPowerState);
|
||||||
|
|
||||||
/*==== DGnss Usable Report Flag ====================================================*/
|
/*==== DGnss Usable Report Flag ====================================================*/
|
||||||
|
|
|
@ -103,7 +103,6 @@ static bool measCorrSetCorrections(const GnssMeasurementCorrections gnssMeasCorr
|
||||||
static void measCorrClose();
|
static void measCorrClose();
|
||||||
static uint32_t antennaInfoInit(const antennaInfoCb antennaInfoCallback);
|
static uint32_t antennaInfoInit(const antennaInfoCb antennaInfoCallback);
|
||||||
static void antennaInfoClose();
|
static void antennaInfoClose();
|
||||||
static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState);
|
|
||||||
|
|
||||||
static const GnssInterface gGnssInterface = {
|
static const GnssInterface gGnssInterface = {
|
||||||
sizeof(GnssInterface),
|
sizeof(GnssInterface),
|
||||||
|
@ -161,8 +160,7 @@ static const GnssInterface gGnssInterface = {
|
||||||
disablePPENtripStream,
|
disablePPENtripStream,
|
||||||
gnssUpdateSecondaryBandConfig,
|
gnssUpdateSecondaryBandConfig,
|
||||||
gnssGetSecondaryBandConfig,
|
gnssGetSecondaryBandConfig,
|
||||||
resetNetworkInfo,
|
resetNetworkInfo
|
||||||
configEngineRunState
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DEBUG_X86
|
#ifndef DEBUG_X86
|
||||||
|
@ -582,11 +580,3 @@ static void disablePPENtripStream(){
|
||||||
gGnssAdapter->disablePPENtripStreamCommand();
|
gGnssAdapter->disablePPENtripStreamCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState) {
|
|
||||||
if (NULL != gGnssAdapter) {
|
|
||||||
return gGnssAdapter->configEngineRunStateCommand(engType, engState);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -363,44 +363,6 @@ public:
|
||||||
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
|
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
|
||||||
*/
|
*/
|
||||||
virtual uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig)=0;
|
virtual uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig)=0;
|
||||||
|
|
||||||
/** @brief
|
|
||||||
This API is used to instruct the specified engine to be in
|
|
||||||
the pause/resume state. <br/>
|
|
||||||
|
|
||||||
When the engine is placed in paused state, the engine will
|
|
||||||
stop. If there is an on-going session, engine will no longer
|
|
||||||
produce fixes. In the paused state, calling API to delete
|
|
||||||
aiding data from the paused engine may not have effect.
|
|
||||||
Request to delete Aiding data shall be issued after
|
|
||||||
engine resume. <br/>
|
|
||||||
|
|
||||||
Currently, only DRE engine will support pause/resume
|
|
||||||
request. responseCb() will return not supported when request
|
|
||||||
is made to pause/resume none-DRE engine. <br/>
|
|
||||||
|
|
||||||
Request to pause/resume DRE engine can be made with or
|
|
||||||
without an on-going session. With QDR engine, on resume,
|
|
||||||
GNSS position & heading re-acquisition is needed for DR
|
|
||||||
engine to engage. If DR engine is already in the requested
|
|
||||||
state, the request will be no-op. <br/>
|
|
||||||
|
|
||||||
@param
|
|
||||||
engType: the engine that is instructed to change its run
|
|
||||||
state. <br/>
|
|
||||||
|
|
||||||
engState: the new engine run state that the engine is
|
|
||||||
instructed to be in. <br/>
|
|
||||||
|
|
||||||
@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 configEngineRunState(PositioningEngineMask engType,
|
|
||||||
LocEngineRunState engState) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ILOCATIONAPI_H */
|
#endif /* ILOCATIONAPI_H */
|
||||||
|
|
|
@ -857,18 +857,3 @@ uint32_t LocationControlAPI::configDeadReckoningEngineParams(
|
||||||
pthread_mutex_unlock(&gDataMutex);
|
pthread_mutex_unlock(&gDataMutex);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t LocationControlAPI::configEngineRunState(
|
|
||||||
PositioningEngineMask engType, LocEngineRunState engState) {
|
|
||||||
uint32_t id = 0;
|
|
||||||
pthread_mutex_lock(&gDataMutex);
|
|
||||||
|
|
||||||
if (gData.gnssInterface != NULL) {
|
|
||||||
id = gData.gnssInterface->configEngineRunState(engType, engState);
|
|
||||||
} else {
|
|
||||||
LOC_LOGe("No gnss interface available for Location Control API");
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&gDataMutex);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
|
@ -442,44 +442,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual uint32_t configDeadReckoningEngineParams(
|
virtual uint32_t configDeadReckoningEngineParams(
|
||||||
const DeadReckoningEngineConfig& dreConfig) override;
|
const DeadReckoningEngineConfig& dreConfig) override;
|
||||||
|
|
||||||
/** @brief
|
|
||||||
This API is used to instruct the specified engine to be in
|
|
||||||
the pause/resume state. <br/>
|
|
||||||
|
|
||||||
When the engine is placed in paused state, the engine will
|
|
||||||
stop. If there is an on-going session, engine will no longer
|
|
||||||
produce fixes. In the paused state, calling API to delete
|
|
||||||
aiding data from the paused engine may not have effect.
|
|
||||||
Request to delete Aiding data shall be issued after
|
|
||||||
engine resume. <br/>
|
|
||||||
|
|
||||||
Currently, only DRE engine will support pause/resume
|
|
||||||
request. responseCb() will return not supported when request
|
|
||||||
is made to pause/resume none-DRE engine. <br/>
|
|
||||||
|
|
||||||
Request to pause/resume DRE engine can be made with or
|
|
||||||
without an on-going session. With QDR engine, on resume, GNSS
|
|
||||||
position & heading re-acquisition is needed for DR engine to
|
|
||||||
engage. If DR engine is already in the requested state, the
|
|
||||||
request will be no-op. <br/>
|
|
||||||
|
|
||||||
@param
|
|
||||||
engType: the engine that is instructed to change its run
|
|
||||||
state. <br/>
|
|
||||||
|
|
||||||
engState: the new engine run state that the engine is
|
|
||||||
instructed to be in. <br/>
|
|
||||||
|
|
||||||
@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 configEngineRunState(PositioningEngineMask engType,
|
|
||||||
LocEngineRunState engState) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LOCATIONAPI_H */
|
#endif /* LOCATIONAPI_H */
|
||||||
|
|
|
@ -209,8 +209,7 @@ typedef enum {
|
||||||
GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<28), // conformity index
|
GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT = (1<<28), // conformity index
|
||||||
GNSS_LOCATION_INFO_LLA_VRP_BASED_BIT = (1<<29), // VRP-based lat/long/alt
|
GNSS_LOCATION_INFO_LLA_VRP_BASED_BIT = (1<<29), // VRP-based lat/long/alt
|
||||||
GNSS_LOCATION_INFO_ENU_VELOCITY_VRP_BASED_BIT = (1<<30), // VRP-based east/north/up vel
|
GNSS_LOCATION_INFO_ENU_VELOCITY_VRP_BASED_BIT = (1<<30), // VRP-based east/north/up vel
|
||||||
GNSS_LOCATION_INFO_DR_SOLUTION_STATUS_MASK_BIT = (1ULL<<31), // Valid DR solution status
|
GNSS_LOCATION_INFO_DR_SOLUTION_STATUS_MASK_BIT = (1ULL<<31), // DR solution status
|
||||||
GNSS_LOCATION_INFO_ALTITUDE_ASSUMED_BIT = (1ULL<<32), // Valid altitude assumed
|
|
||||||
} GnssLocationInfoFlagBits;
|
} GnssLocationInfoFlagBits;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -234,8 +233,7 @@ typedef enum {
|
||||||
GEOFENCE_STATUS_AVAILABILE_YES,
|
GEOFENCE_STATUS_AVAILABILE_YES,
|
||||||
} GeofenceStatusAvailable;
|
} GeofenceStatusAvailable;
|
||||||
|
|
||||||
// Set of masks for Modem and QWES capabilities.
|
typedef uint32_t LocationCapabilitiesMask;
|
||||||
typedef uint64_t LocationCapabilitiesMask;
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// supports startTracking API with minInterval param
|
// supports startTracking API with minInterval param
|
||||||
LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0),
|
LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0),
|
||||||
|
@ -269,86 +267,8 @@ typedef enum {
|
||||||
LOCATION_CAPABILITIES_CONFORMITY_INDEX_BIT = (1<<14),
|
LOCATION_CAPABILITIES_CONFORMITY_INDEX_BIT = (1<<14),
|
||||||
// support precise location edgnss
|
// support precise location edgnss
|
||||||
LOCATION_CAPABILITIES_EDGNSS_BIT = (1<<15),
|
LOCATION_CAPABILITIES_EDGNSS_BIT = (1<<15),
|
||||||
// Modem supports Carrier Phase for Precise Positioning
|
|
||||||
// Measurement Engine (PPME).
|
|
||||||
LOCATION_CAPABILITIES_QWES_CARRIER_PHASE_BIT = (1<<16),
|
|
||||||
// Modem supports SV Polynomial for tightly coupled external
|
|
||||||
// DR support. This is a Standalone Feature.
|
|
||||||
LOCATION_CAPABILITIES_QWES_SV_POLYNOMIAL_BIT = (1<<17),
|
|
||||||
// Modem supports SV Ephemeris for tightly coupled external
|
|
||||||
// PPE engines. This is a Standalone Feature.
|
|
||||||
LOCATION_CAPABILITIES_QWES_SV_EPHEMERIS_BIT = (1<<18),
|
|
||||||
// Modem supports GNSS Single Frequency feature. This is a
|
|
||||||
// Standalone Feature.
|
|
||||||
LOCATION_CAPABILITIES_QWES_GNSS_SINGLE_FREQUENCY = (1<<19),
|
|
||||||
// Modem supports GNSS Multi Frequency feature. Multi Frequency
|
|
||||||
// enables Single frequency also.
|
|
||||||
LOCATION_CAPABILITIES_QWES_GNSS_MULTI_FREQUENCY = (1<<20),
|
|
||||||
// This mask indicates VPe license bundle is enabled. VEPP
|
|
||||||
// bundle include Carrier Phase and SV Polynomial features.
|
|
||||||
LOCATION_CAPABILITIES_QWES_VPE = (1<<21),
|
|
||||||
// This mask indicates support for CV2X Location basic features.
|
|
||||||
// This bundle includes features for GTS Time & Freq, C-TUNC
|
|
||||||
// (Constrained Time uncertainity.
|
|
||||||
LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_BASIC = (1<<22),
|
|
||||||
// This mask indicates support for CV2X Location premium features.
|
|
||||||
// This bundle includes features for CV2X Location Basic features,
|
|
||||||
// QDR3 feature, and PACE. (Position Assisted Clock Estimator.
|
|
||||||
LOCATION_CAPABILITIES_QWES_CV2X_LOCATION_PREMIUM = (1<<23),
|
|
||||||
// This mask indicates that PPE (Precise Positioning Engine)
|
|
||||||
// library is enabled or Precise Positioning Framework (PPF)
|
|
||||||
// is available. This bundle includes features for Carrier
|
|
||||||
// Phase and SV Ephermeris.
|
|
||||||
LOCATION_CAPABILITIES_QWES_PPE = (1<<24),
|
|
||||||
// This mask indicates QDR2_C license bundle is enabled. This
|
|
||||||
// bundle includes features for SV Polynomial.
|
|
||||||
LOCATION_CAPABILITIES_QWES_QDR2 = (1<<25),
|
|
||||||
// This mask indicates QDR3_C license bundle is enabled. This
|
|
||||||
// bundle includes features for SV Polynomial.
|
|
||||||
LOCATION_CAPABILITIES_QWES_QDR3 = (1<<26),
|
|
||||||
} LocationCapabilitiesBits;
|
} LocationCapabilitiesBits;
|
||||||
|
|
||||||
typedef uint8_t LocationQwesFeatureType;
|
|
||||||
typedef enum {
|
|
||||||
// Modem supports Carrier Phase for Precise Positioning
|
|
||||||
// Measurement Engine (PPME).
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_CARRIER_PHASE = 1,
|
|
||||||
// Modem supports SV Polynomial for tightly coupled external
|
|
||||||
// DR support. This is a Standalone Feature.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_SV_POLYNOMIAL,
|
|
||||||
// Modem supports SV Ephemeris for tightly coupled external
|
|
||||||
// PPE support. This is a Standalone Feature.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_SV_EPH,
|
|
||||||
// Modem supports GNSS Single Frequency feature. This is a
|
|
||||||
// Standalone Feature.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_GNSS_SINGLE_FREQUENCY,
|
|
||||||
// Modem supports GNSS Multi Frequency feature. Multi Frequency
|
|
||||||
// enables Single frequency also.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_GNSS_MULTI_FREQUENCY,
|
|
||||||
// This indicates Time and Frequency status.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_TIME_FREQUENCY,
|
|
||||||
// This indicates Time Uncertainty status.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_TIME_UNCERTAINTY,
|
|
||||||
// This indicates Clock Estimate status.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_CLOCK_ESTIMATE,
|
|
||||||
// This mask indicates that PPE (Precise Positioning Engine)
|
|
||||||
// library is enabled or Precise Positioning Framework (PPF)
|
|
||||||
// is available. This bundle includes features for Carrier
|
|
||||||
// Phase and SV Ephermeris.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_PPE,
|
|
||||||
// This indicates QDR2_C license bundle is enabled. This
|
|
||||||
// bundle includes features for SV Polynomial.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_QDR2,
|
|
||||||
// This indicates QDR3_C license bundle is enabled. This
|
|
||||||
// bundle includes features for SV Polynomial.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_QDR3,
|
|
||||||
// This indicates VEPP license bundle is enabled. VEPP
|
|
||||||
// bundle include Carrier Phase and SV Polynomial features.
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_VPE,
|
|
||||||
// Max value
|
|
||||||
LOCATION_QWES_FEATURE_TYPE_MAX
|
|
||||||
} LocationQwesFeatureTypes;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
|
LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
|
||||||
} LocationTechnologyType;
|
} LocationTechnologyType;
|
||||||
|
@ -807,16 +727,6 @@ typedef enum {
|
||||||
(STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE| \
|
(STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE| \
|
||||||
PRECISE_POSITIONING_ENGINE|VP_POSITIONING_ENGINE)
|
PRECISE_POSITIONING_ENGINE|VP_POSITIONING_ENGINE)
|
||||||
|
|
||||||
/** Specify the position engine running state. <br/> */
|
|
||||||
enum LocEngineRunState {
|
|
||||||
/** Request the position engine to be put into resume state.
|
|
||||||
* <br/> */
|
|
||||||
LOC_ENGINE_RUN_STATE_PAUSE = 1,
|
|
||||||
/** Request the position engine to be put into resume state.
|
|
||||||
* <br/> */
|
|
||||||
LOC_ENGINE_RUN_STATE_RESUME = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef uint64_t GnssDataMask;
|
typedef uint64_t GnssDataMask;
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// Jammer Indicator is available
|
// Jammer Indicator is available
|
||||||
|
@ -1241,8 +1151,6 @@ typedef struct {
|
||||||
// VRR-based east, north, and up velocity
|
// VRR-based east, north, and up velocity
|
||||||
float enuVelocityVRPBased[3];
|
float enuVelocityVRPBased[3];
|
||||||
DrSolutionStatusMask drSolutionStatusMask;
|
DrSolutionStatusMask drSolutionStatusMask;
|
||||||
// true: altitude is assumed, false: altitude is calculated
|
|
||||||
bool altitudeAssumed;
|
|
||||||
} GnssLocationInfoNotification;
|
} GnssLocationInfoNotification;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -2032,23 +1940,4 @@ typedef struct {
|
||||||
uint32_t port;
|
uint32_t port;
|
||||||
bool useSSL;
|
bool useSSL;
|
||||||
} GnssNtripConnectionParams;
|
} GnssNtripConnectionParams;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t meQtimer1;
|
|
||||||
uint64_t meQtimer2;
|
|
||||||
uint64_t meQtimer3;
|
|
||||||
uint64_t peQtimer1;
|
|
||||||
uint64_t peQtimer2;
|
|
||||||
uint64_t peQtimer3;
|
|
||||||
uint64_t smQtimer1;
|
|
||||||
uint64_t smQtimer2;
|
|
||||||
uint64_t smQtimer3;
|
|
||||||
uint64_t locMwQtimer;
|
|
||||||
uint64_t hlosQtimer1;
|
|
||||||
uint64_t hlosQtimer2;
|
|
||||||
uint64_t hlosQtimer3;
|
|
||||||
uint64_t hlosQtimer4;
|
|
||||||
uint64_t hlosQtimer5;
|
|
||||||
} GnssLatencyInfo;
|
|
||||||
|
|
||||||
#endif /* LOCATIONDATATYPES_H */
|
#endif /* LOCATIONDATATYPES_H */
|
||||||
|
|
|
@ -109,8 +109,6 @@ struct GnssInterface {
|
||||||
uint32_t (*gnssUpdateSecondaryBandConfig)(const GnssSvTypeConfig& secondaryBandConfig);
|
uint32_t (*gnssUpdateSecondaryBandConfig)(const GnssSvTypeConfig& secondaryBandConfig);
|
||||||
uint32_t (*gnssGetSecondaryBandConfig)();
|
uint32_t (*gnssGetSecondaryBandConfig)();
|
||||||
void (*resetNetworkInfo)();
|
void (*resetNetworkInfo)();
|
||||||
uint32_t (*configEngineRunState)(PositioningEngineMask engType,
|
|
||||||
LocEngineRunState engState);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BatchingInterface {
|
struct BatchingInterface {
|
||||||
|
|
|
@ -415,12 +415,8 @@ typedef uint64_t GpsLocationExtendedFlags;
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_LLA_VRP_BASED 0x200000000000
|
#define GPS_LOCATION_EXTENDED_HAS_LLA_VRP_BASED 0x200000000000
|
||||||
/** GpsLocationExtended has the velocityVRPased. */
|
/** GpsLocationExtended has the velocityVRPased. */
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_ENU_VELOCITY_LLA_VRP_BASED 0x400000000000
|
#define GPS_LOCATION_EXTENDED_HAS_ENU_VELOCITY_LLA_VRP_BASED 0x400000000000
|
||||||
/** GpsLocationExtended has upperTriangleFullCovMatrix. */
|
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_UPPER_TRIANGLE_FULL_COV_MATRIX 0x800000000000
|
#define GPS_LOCATION_EXTENDED_HAS_UPPER_TRIANGLE_FULL_COV_MATRIX 0x800000000000
|
||||||
/** GpsLocationExtended has drSolutionStatusMask. */
|
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_DR_SOLUTION_STATUS_MASK 0x1000000000000
|
#define GPS_LOCATION_EXTENDED_HAS_DR_SOLUTION_STATUS_MASK 0x1000000000000
|
||||||
/** GpsLocationExtended has altitudeAssumed. */
|
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_ASSUMED 0x2000000000000
|
|
||||||
|
|
||||||
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 */
|
||||||
|
@ -871,12 +867,6 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
float upperTriangleFullCovMatrix[COV_MATRIX_SIZE];
|
float upperTriangleFullCovMatrix[COV_MATRIX_SIZE];
|
||||||
DrSolutionStatusMask drSolutionStatusMask;
|
DrSolutionStatusMask drSolutionStatusMask;
|
||||||
/** When this field is valid, it will indicates whether altitude
|
|
||||||
* is assumed or calculated.
|
|
||||||
* false: Altitude is calculated.
|
|
||||||
* true: Altitude is assumed; there may not be enough
|
|
||||||
* satellites to determine the precise altitude. */
|
|
||||||
bool altitudeAssumed;
|
|
||||||
} GpsLocationExtended;
|
} GpsLocationExtended;
|
||||||
|
|
||||||
enum loc_sess_status {
|
enum loc_sess_status {
|
||||||
|
@ -925,7 +915,6 @@ typedef uint32_t NmeaSentenceTypesMask;
|
||||||
#define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
|
#define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */
|
||||||
#define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
|
#define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */
|
||||||
#define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
|
#define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */
|
||||||
#define LOC_NMEA_MASK_TAGBLOCK_V02 ((NmeaSentenceTypesMask)0x80000000) /**< Enable TAGBLOCK type */
|
|
||||||
|
|
||||||
|
|
||||||
// all bitmasks of general supported NMEA sentenses - debug is not part of this
|
// all bitmasks of general supported NMEA sentenses - debug is not part of this
|
||||||
|
@ -1020,7 +1009,6 @@ enum loc_api_adapter_event_index {
|
||||||
LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event
|
LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event
|
||||||
LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report
|
LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report
|
||||||
LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info
|
LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info
|
||||||
LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT, // Latency information report
|
|
||||||
LOC_API_ADAPTER_EVENT_MAX
|
LOC_API_ADAPTER_EVENT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1063,7 +1051,6 @@ enum loc_api_adapter_event_index {
|
||||||
#define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO)
|
#define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO)
|
||||||
#define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
|
#define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT)
|
||||||
#define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
|
#define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO)
|
||||||
#define LOC_API_ADAPTER_BIT_LATENCY_INFORMATION (1ULL<<LOC_API_ADAPTER_LATENCY_INFORMATION_REPORT)
|
|
||||||
|
|
||||||
typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
|
typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T;
|
||||||
|
|
||||||
|
|
|
@ -307,15 +307,15 @@ void loc_convert_lla_gnss_to_vrp(double lla[3], float rollPitchYaw[3],
|
||||||
float rn = A6DOF_WGS_B * sf * sfr + lla[2];
|
float rn = A6DOF_WGS_B * sf * sfr + lla[2];
|
||||||
float re = A6DOF_WGS_A * sfr + lla[2];
|
float re = A6DOF_WGS_A * sfr + lla[2];
|
||||||
|
|
||||||
float deltaNEU[3];
|
float deltaNED[3];
|
||||||
|
|
||||||
// gps_pos_lla = imu_pos_lla + Cbn*la_b .* [1/geo.Rn; 1/(geo.Re*geo.cL); -1];
|
// gps_pos_lla = imu_pos_lla + Cbn*la_b .* [1/geo.Rn; 1/(geo.Re*geo.cL); -1];
|
||||||
Matrix_MxV(cnb, leverArm, deltaNEU);
|
Matrix_MxV(cnb, leverArm, deltaNED);
|
||||||
|
|
||||||
// NED to lla conversion
|
// NED to lla conversion
|
||||||
lla[0] = lla[0] + deltaNEU[0] / rn;
|
lla[0] = lla[0] + deltaNED[0] / rn;
|
||||||
lla[1] = lla[1] + deltaNEU[1] / (re * cl);
|
lla[1] = lla[1] + deltaNED[1] / (re * cl);
|
||||||
lla[2] = lla[2] + deltaNEU[2];
|
lla[2] = lla[2] - deltaNED[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for convert velocity from GSNS based to VRP based
|
// Used for convert velocity from GSNS based to VRP based
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#define MAX_SATELLITES_IN_USE 12
|
#define MAX_SATELLITES_IN_USE 12
|
||||||
#define MSEC_IN_ONE_WEEK 604800000ULL
|
#define MSEC_IN_ONE_WEEK 604800000ULL
|
||||||
#define UTC_GPS_OFFSET_MSECS 315964800000ULL
|
#define UTC_GPS_OFFSET_MSECS 315964800000ULL
|
||||||
#define MAX_TAG_BLOCK_GROUP_CODE (99999)
|
|
||||||
|
|
||||||
// GNSS system id according to NMEA spec
|
// GNSS system id according to NMEA spec
|
||||||
#define SYSTEM_ID_GPS 1
|
#define SYSTEM_ID_GPS 1
|
||||||
|
@ -564,28 +563,23 @@ SIDE EFFECTS
|
||||||
N/A
|
N/A
|
||||||
|
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
static int loc_nmea_put_checksum(char *pNmea, int maxSize, bool isTagBlock)
|
static int loc_nmea_put_checksum(char *pNmea, int maxSize)
|
||||||
{
|
{
|
||||||
uint8_t checksum = 0;
|
uint8_t checksum = 0;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
int checksumLength = 0;
|
|
||||||
if(NULL == pNmea)
|
if(NULL == pNmea)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pNmea++; //skip the $ or / for Tag Block
|
pNmea++; //skip the $
|
||||||
while (*pNmea != '\0')
|
while (*pNmea != '\0')
|
||||||
{
|
{
|
||||||
checksum ^= *pNmea++;
|
checksum ^= *pNmea++;
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTagBlock) {
|
// length now contains nmea sentence string length not including $ sign.
|
||||||
// length now contains tag block sentence string length not including / sign.
|
int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
|
||||||
checksumLength = snprintf(pNmea, (maxSize-length-1), "*%02X\\", checksum);
|
|
||||||
} else {
|
|
||||||
// length now contains nmea sentence string length not including $ sign.
|
|
||||||
checksumLength = snprintf(pNmea, (maxSize-length-1), "*%02X\r\n", checksum);
|
|
||||||
}
|
|
||||||
// total length of nmea sentence is length of nmea sentence inc $ sign plus
|
// total length of nmea sentence is length of nmea sentence inc $ sign plus
|
||||||
// length of checksum (+1 is to cover the $ character in the length).
|
// length of checksum (+1 is to cover the $ character in the length).
|
||||||
return (length + checksumLength + 1);
|
return (length + checksumLength + 1);
|
||||||
|
@ -616,8 +610,7 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
|
||||||
char* sentence,
|
char* sentence,
|
||||||
int bufSize,
|
int bufSize,
|
||||||
loc_nmea_sv_meta* sv_meta_p,
|
loc_nmea_sv_meta* sv_meta_p,
|
||||||
std::vector<std::string> &nmeaArraystr,
|
std::vector<std::string> &nmeaArraystr)
|
||||||
bool isTagBlockGroupingEnabled)
|
|
||||||
{
|
{
|
||||||
if (!sentence || bufSize <= 0 || !sv_meta_p)
|
if (!sentence || bufSize <= 0 || !sv_meta_p)
|
||||||
{
|
{
|
||||||
|
@ -628,14 +621,9 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
|
||||||
char* pMarker = sentence;
|
char* pMarker = sentence;
|
||||||
int lengthRemaining = bufSize;
|
int lengthRemaining = bufSize;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
int lengthTagBlock = 0;
|
|
||||||
|
|
||||||
uint32_t svUsedCount = 0;
|
uint32_t svUsedCount = 0;
|
||||||
uint32_t svUsedList[64] = {0};
|
uint32_t svUsedList[64] = {0};
|
||||||
uint32_t sentenceCount = 0;
|
|
||||||
uint32_t sentenceNumber = 1;
|
|
||||||
size_t svNumber = 1;
|
|
||||||
static uint32_t code = 1;
|
|
||||||
|
|
||||||
char fixType = '\0';
|
char fixType = '\0';
|
||||||
|
|
||||||
|
@ -654,98 +642,77 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svUsedCount == 0) {
|
if (svUsedCount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
sentenceNumber = 1;
|
|
||||||
sentenceCount = svUsedCount / 12 + (svUsedCount % 12 != 0);
|
|
||||||
svNumber = 1;
|
|
||||||
}
|
|
||||||
while (sentenceNumber <= sentenceCount) {
|
|
||||||
pMarker = sentence;
|
|
||||||
lengthRemaining = bufSize;
|
|
||||||
if (svUsedCount > 12 && isTagBlockGroupingEnabled) {
|
|
||||||
lengthTagBlock = snprintf(pMarker, lengthRemaining, "\\g:%d-%d-%d", sentenceNumber,
|
|
||||||
sentenceCount, code);
|
|
||||||
if (MAX_TAG_BLOCK_GROUP_CODE == code) {
|
|
||||||
code = 1;
|
|
||||||
}
|
|
||||||
lengthTagBlock = loc_nmea_put_checksum(sentence, bufSize, true);
|
|
||||||
pMarker += lengthTagBlock;
|
|
||||||
lengthRemaining -= lengthTagBlock;
|
|
||||||
}
|
|
||||||
if (sv_meta_p->totalSvUsedCount == 0)
|
|
||||||
fixType = '1'; // no fix
|
|
||||||
else if (sv_meta_p->totalSvUsedCount <= 3)
|
|
||||||
fixType = '2'; // 2D fix
|
|
||||||
else
|
|
||||||
fixType = '3'; // 3D fix
|
|
||||||
|
|
||||||
// Start printing the sentence
|
if (sv_meta_p->totalSvUsedCount == 0)
|
||||||
// Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v,s*cc
|
fixType = '1'; // no fix
|
||||||
// a : Mode : A : Automatic, allowed to automatically switch 2D/3D
|
else if (sv_meta_p->totalSvUsedCount <= 3)
|
||||||
// x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
|
fixType = '2'; // 2D fix
|
||||||
// xx : 12 SV ID
|
else
|
||||||
// p.p : Position DOP (Dilution of Precision)
|
fixType = '3'; // 3D fix
|
||||||
// h.h : Horizontal DOP
|
|
||||||
// v.v : Vertical DOP
|
// Start printing the sentence
|
||||||
// s : GNSS System Id
|
// Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v,s*cc
|
||||||
// cc : Checksum value
|
// a : Mode : A : Automatic, allowed to automatically switch 2D/3D
|
||||||
length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType);
|
// x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
|
||||||
if (length < 0 || length >= lengthRemaining) {
|
// xx : 12 SV ID
|
||||||
|
// p.p : Position DOP (Dilution of Precision)
|
||||||
|
// h.h : Horizontal DOP
|
||||||
|
// v.v : Vertical DOP
|
||||||
|
// s : GNSS System Id
|
||||||
|
// cc : Checksum value
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType);
|
||||||
|
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
// Add first 12 satellite IDs
|
||||||
|
for (uint8_t i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
if (i < svUsedCount)
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[i]);
|
||||||
|
else
|
||||||
|
length = snprintf(pMarker, lengthRemaining, ",");
|
||||||
|
|
||||||
|
if (length < 0 || length >= lengthRemaining)
|
||||||
|
{
|
||||||
LOC_LOGE("NMEA Error in string formatting");
|
LOC_LOGE("NMEA Error in string formatting");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
// Add 12 satellite IDs
|
|
||||||
for (uint8_t i = 0; i < 12; i++, svNumber++)
|
|
||||||
{
|
|
||||||
if (svNumber <= svUsedCount)
|
|
||||||
length = snprintf(pMarker, lengthRemaining, "%02d,", svUsedList[svNumber - 1]);
|
|
||||||
else
|
|
||||||
length = snprintf(pMarker, lengthRemaining, ",");
|
|
||||||
|
|
||||||
if (length < 0 || length >= lengthRemaining) {
|
|
||||||
LOC_LOGE("NMEA Error in string formatting");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
pMarker += length;
|
|
||||||
lengthRemaining -= length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the position/horizontal/vertical DOP values
|
|
||||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
|
|
||||||
{
|
|
||||||
length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f,",
|
|
||||||
locationExtended.pdop,
|
|
||||||
locationExtended.hdop,
|
|
||||||
locationExtended.vdop);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // no dop
|
|
||||||
length = snprintf(pMarker, lengthRemaining, ",,,");
|
|
||||||
}
|
|
||||||
pMarker += length;
|
|
||||||
lengthRemaining -= length;
|
|
||||||
|
|
||||||
// system id
|
|
||||||
length = snprintf(pMarker, lengthRemaining, "%d", sv_meta_p->systemId);
|
|
||||||
pMarker += length;
|
|
||||||
lengthRemaining -= length;
|
|
||||||
|
|
||||||
/* Sentence is ready, add checksum and broadcast */
|
|
||||||
length = loc_nmea_put_checksum(sentence + lengthTagBlock, bufSize - lengthTagBlock, false);
|
|
||||||
nmeaArraystr.push_back(sentence);
|
|
||||||
sentenceNumber++;
|
|
||||||
if (!isTagBlockGroupingEnabled) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (svUsedCount > 12 && isTagBlockGroupingEnabled) {
|
|
||||||
code++;
|
// Add the position/horizontal/vertical DOP values
|
||||||
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
|
||||||
|
{
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f,",
|
||||||
|
locationExtended.pdop,
|
||||||
|
locationExtended.hdop,
|
||||||
|
locationExtended.vdop);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{ // no dop
|
||||||
|
length = snprintf(pMarker, lengthRemaining, ",,,");
|
||||||
|
}
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
// system id
|
||||||
|
length = snprintf(pMarker, lengthRemaining, "%d", sv_meta_p->systemId);
|
||||||
|
pMarker += length;
|
||||||
|
lengthRemaining -= length;
|
||||||
|
|
||||||
|
/* Sentence is ready, add checksum and broadcast */
|
||||||
|
length = loc_nmea_put_checksum(sentence, bufSize);
|
||||||
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
return svUsedCount;
|
return svUsedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,7 +862,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence, bufSize, false);
|
length = loc_nmea_put_checksum(sentence, bufSize);
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
sentenceNumber++;
|
sentenceNumber++;
|
||||||
|
|
||||||
|
@ -1004,7 +971,7 @@ static void loc_nmea_generate_DTM(const LocLla &ref_lla,
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence, bufSize, false);
|
length = loc_nmea_put_checksum(sentence, bufSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
@ -1320,8 +1287,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
unsigned char generate_nmea,
|
unsigned char generate_nmea,
|
||||||
bool custom_gga_fix_quality,
|
bool custom_gga_fix_quality,
|
||||||
std::vector<std::string> &nmeaArraystr,
|
std::vector<std::string> &nmeaArraystr,
|
||||||
int& indexOfGGA,
|
int& indexOfGGA)
|
||||||
bool isTagBlockGroupingEnabled)
|
|
||||||
{
|
{
|
||||||
ENTRY_LOG();
|
ENTRY_LOG();
|
||||||
|
|
||||||
|
@ -1402,7 +1368,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
|
||||||
GNSS_SIGNAL_GPS_L1CA, true), nmeaArraystr, isTagBlockGroupingEnabled);
|
GNSS_SIGNAL_GPS_L1CA, true), nmeaArraystr);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
svUsedCount += count;
|
svUsedCount += count;
|
||||||
|
@ -1416,7 +1382,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GLONASS,
|
||||||
GNSS_SIGNAL_GLONASS_G1, true), nmeaArraystr, isTagBlockGroupingEnabled);
|
GNSS_SIGNAL_GLONASS_G1, true), nmeaArraystr);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
svUsedCount += count;
|
svUsedCount += count;
|
||||||
|
@ -1430,7 +1396,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
|
||||||
GNSS_SIGNAL_GALILEO_E1, true), nmeaArraystr, isTagBlockGroupingEnabled);
|
GNSS_SIGNAL_GALILEO_E1, true), nmeaArraystr);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
svUsedCount += count;
|
svUsedCount += count;
|
||||||
|
@ -1443,7 +1409,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
|
||||||
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr, isTagBlockGroupingEnabled);
|
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
svUsedCount += count;
|
svUsedCount += count;
|
||||||
|
@ -1457,7 +1423,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
|
||||||
GNSS_SIGNAL_QZSS_L1CA, true), nmeaArraystr, isTagBlockGroupingEnabled);
|
GNSS_SIGNAL_QZSS_L1CA, true), nmeaArraystr);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
svUsedCount += count;
|
svUsedCount += count;
|
||||||
|
@ -1469,7 +1435,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
// in this case, generate an empty GSA sentence
|
// in this case, generate an empty GSA sentence
|
||||||
if (svUsedCount == 0) {
|
if (svUsedCount == 0) {
|
||||||
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
|
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1492,7 +1458,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
float magTrack = location.gpsLocation.bearing;
|
float magTrack = location.gpsLocation.bearing;
|
||||||
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
|
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_MAG_DEV)
|
||||||
{
|
{
|
||||||
magTrack = location.gpsLocation.bearing - locationExtended.magneticDeviation;
|
float magTrack = location.gpsLocation.bearing - locationExtended.magneticDeviation;
|
||||||
if (magTrack < 0.0)
|
if (magTrack < 0.0)
|
||||||
magTrack += 360.0;
|
magTrack += 360.0;
|
||||||
else if (magTrack > 360.0)
|
else if (magTrack > 360.0)
|
||||||
|
@ -1536,7 +1502,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
|
|
||||||
length = snprintf(pMarker, lengthRemaining, "%c", vtgModeIndicator);
|
length = snprintf(pMarker, lengthRemaining, "%c", vtgModeIndicator);
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
memset(&ecef_w84, 0, sizeof(ecef_w84));
|
memset(&ecef_w84, 0, sizeof(ecef_w84));
|
||||||
|
@ -1740,7 +1706,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
// hardcode Navigation Status field to 'V'
|
// hardcode Navigation Status field to 'V'
|
||||||
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
|
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC), false);
|
length = loc_nmea_put_checksum(sentence_RMC, sizeof(sentence_RMC));
|
||||||
|
|
||||||
// -------------------
|
// -------------------
|
||||||
// ------$--GNS-------
|
// ------$--GNS-------
|
||||||
|
@ -1902,7 +1868,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
pMarker += length;
|
pMarker += length;
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence_GNS, sizeof(sentence_GNS), false);
|
length = loc_nmea_put_checksum(sentence_GNS, sizeof(sentence_GNS));
|
||||||
|
|
||||||
// -------------------
|
// -------------------
|
||||||
// ------$--GGA-------
|
// ------$--GGA-------
|
||||||
|
@ -2059,7 +2025,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
lengthRemaining -= length;
|
lengthRemaining -= length;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA), false);
|
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));
|
||||||
|
|
||||||
// ------$--DTM-------
|
// ------$--DTM-------
|
||||||
nmeaArraystr.push_back(sentence_DTM);
|
nmeaArraystr.push_back(sentence_DTM);
|
||||||
|
@ -2082,27 +2048,27 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
//Send blank NMEA reports for non-final fixes
|
//Send blank NMEA reports for non-final fixes
|
||||||
else {
|
else {
|
||||||
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
|
strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
|
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPDTM,,,,,,,,", sizeof(sentence));
|
strlcpy(sentence, "$GPDTM,,,,,,,,", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence));
|
strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N,V", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPGNS,,,,,,N,,,,,,,V", sizeof(sentence));
|
strlcpy(sentence, "$GPGNS,,,,,,N,,,,,,,V", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
|
strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
|
||||||
length = loc_nmea_put_checksum(sentence, sizeof(sentence), false);
|
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
nmeaArraystr.push_back(sentence);
|
nmeaArraystr.push_back(sentence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2185,14 +2151,6 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
||||||
}
|
}
|
||||||
else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svOffset].type)
|
else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svOffset].type)
|
||||||
{
|
{
|
||||||
// cache the used in fix mask, as it will be needed to send $PQGSA
|
|
||||||
// during the position report
|
|
||||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
|
||||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
|
||||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
|
||||||
{
|
|
||||||
setSvMask(sv_cache_info.bds_used_mask, svNotify.gnssSvs[svOffset].svId);
|
|
||||||
}
|
|
||||||
if ((GNSS_SIGNAL_BEIDOU_B2AI == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) ||
|
if ((GNSS_SIGNAL_BEIDOU_B2AI == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) ||
|
||||||
(GNSS_SIGNAL_BEIDOU_B2AQ == svNotify.gnssSvs[svOffset].gnssSignalTypeMask)) {
|
(GNSS_SIGNAL_BEIDOU_B2AQ == svNotify.gnssSvs[svOffset].gnssSignalTypeMask)) {
|
||||||
sv_cache_info.bds_b2_count++;
|
sv_cache_info.bds_b2_count++;
|
||||||
|
@ -2309,7 +2267,6 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
// ------$GBGSV (BEIDOU:B1C)----
|
// ------$GBGSV (BEIDOU:B1C)----
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
|
||||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
|
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
|
||||||
GNSS_SIGNAL_BEIDOU_B1C, false), nmeaArraystr);
|
GNSS_SIGNAL_BEIDOU_B1C, false), nmeaArraystr);
|
||||||
|
|
|
@ -81,8 +81,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
||||||
unsigned char generate_nmea,
|
unsigned char generate_nmea,
|
||||||
bool custom_gga_fix_quality,
|
bool custom_gga_fix_quality,
|
||||||
std::vector<std::string> &nmeaArraystr,
|
std::vector<std::string> &nmeaArraystr,
|
||||||
int& indexOfGGA,
|
int& indexOfGGA);
|
||||||
bool isTagBlockGroupingEnabled);
|
|
||||||
|
|
||||||
#define DEBUG_NMEA_MINSIZE 6
|
#define DEBUG_NMEA_MINSIZE 6
|
||||||
#define DEBUG_NMEA_MAXSIZE 4096
|
#define DEBUG_NMEA_MAXSIZE 4096
|
||||||
|
|
Loading…
Reference in a new issue