msmcobalt: Update to 07.00.00.253.024
Change-Id: If16e28bcf316bd6c157be551cc1c5dba72f01fd8
diff --git a/msmcobalt/core/ContextBase.cpp b/msmcobalt/core/ContextBase.cpp
index c429c2d..1ae8482 100644
--- a/msmcobalt/core/ContextBase.cpp
+++ b/msmcobalt/core/ContextBase.cpp
@@ -88,28 +88,31 @@
{
LocApiBase* locApi = NULL;
- // first if can not be MPQ
- if (TARGET_MPQ != loc_get_target()) {
+ // Check the target
+ if (TARGET_NO_GNSS != loc_get_target()){
+
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
void *handle = NULL;
//try to see if LocApiV02 is present
- if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
- getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
- if(getter != NULL) {
- LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ if (getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
+ __LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
}
}
// only RPC is the option now
else {
LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
- __func__, __LINE__);
+ __func__, __LINE__);
handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
if (NULL != handle) {
- getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
if (NULL != getter) {
- LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, __LINE__);
+ LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
+ __LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
}
}
diff --git a/msmcobalt/core/ContextBase.h b/msmcobalt/core/ContextBase.h
index debdc11..87d2acf 100644
--- a/msmcobalt/core/ContextBase.h
+++ b/msmcobalt/core/ContextBase.h
@@ -62,6 +62,7 @@
uint32_t AGPS_CONFIG_INJECT;
uint32_t LPPE_CP_TECHNOLOGY;
uint32_t LPPE_UP_TECHNOLOGY;
+ uint32_t EXTERNAL_DR_ENABLED;
} loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number
diff --git a/msmcobalt/core/LocAdapterBase.cpp b/msmcobalt/core/LocAdapterBase.cpp
index d3082e2..6a3f969 100644
--- a/msmcobalt/core/LocAdapterBase.cpp
+++ b/msmcobalt/core/LocAdapterBase.cpp
@@ -85,6 +85,13 @@
void* svExt)
DEFAULT_IMPL()
+void LocAdapterBase::
+ reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+DEFAULT_IMPL()
void LocAdapterBase::
reportStatus(GpsStatusValue status)
diff --git a/msmcobalt/core/LocAdapterBase.h b/msmcobalt/core/LocAdapterBase.h
index 2c7a2e8..af25138 100644
--- a/msmcobalt/core/LocAdapterBase.h
+++ b/msmcobalt/core/LocAdapterBase.h
@@ -105,6 +105,8 @@
virtual void reportSv(GnssSvStatus &svStatus,
GpsLocationExtended &locationExtended,
void* svExt);
+ virtual void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
+ virtual void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
virtual void reportStatus(GpsStatusValue status);
virtual void reportNmea(const char* nmea, int length);
virtual bool reportXtraServer(const char* url1, const char* url2,
diff --git a/msmcobalt/core/LocApiBase.cpp b/msmcobalt/core/LocApiBase.cpp
index bda3dfd..fdfc537 100644
--- a/msmcobalt/core/LocApiBase.cpp
+++ b/msmcobalt/core/LocApiBase.cpp
@@ -258,23 +258,50 @@
GpsLocationExtended &locationExtended,
void* svExt)
{
+ const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
+ "QZSS", "BEIDOU", "GALILEO" };
+
// print the SV info before delivering
- LOC_LOGV("num sv: %d", svStatus.num_svs);
+ LOC_LOGV("num sv: %d\n"
+ " sv: constellation svid cN0"
+ " elevation azimuth flags",
+ svStatus.num_svs);
for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) {
- LOC_LOGV(" %03d: %02d %d %f %f %f 0x%02X",
- i,
- svStatus.gnss_sv_list[i].svid,
- svStatus.gnss_sv_list[i].constellation,
- svStatus.gnss_sv_list[i].c_n0_dbhz,
- svStatus.gnss_sv_list[i].elevation,
- svStatus.gnss_sv_list[i].azimuth,
- svStatus.gnss_sv_list[i].flags);
+ if (svStatus.gnss_sv_list[i].constellation >
+ sizeof(constellationString) / sizeof(constellationString[0]) - 1) {
+ svStatus.gnss_sv_list[i].constellation = 0;
+ }
+ LOC_LOGV(" %03d: %*s %02d %f %f %f 0x%02X",
+ i,
+ 13,
+ constellationString[svStatus.gnss_sv_list[i].constellation],
+ svStatus.gnss_sv_list[i].svid,
+ svStatus.gnss_sv_list[i].c_n0_dbhz,
+ svStatus.gnss_sv_list[i].elevation,
+ svStatus.gnss_sv_list[i].azimuth,
+ svStatus.gnss_sv_list[i].flags);
}
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportSv(svStatus,
- locationExtended,
- svExt)
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvMeasurement(svMeasurementSet)
+ );
+}
+
+void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvPolynomial(svPolynomial)
);
}
@@ -489,10 +516,6 @@
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setExtPowerConfig(int isBatteryCharging)
-DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-
-enum loc_api_adapter_err LocApiBase::
setAGLONASSProtocol(unsigned long aGlonassProtocol)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
@@ -553,11 +576,6 @@
setXtraVersionCheck(enum xtra_version_check check)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-int LocApiBase::
- updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
- loc_registration_mask_status isEnabled)
-DEFAULT_IMPL(-1)
-
bool LocApiBase::
gnssConstellationConfig()
DEFAULT_IMPL(false)
diff --git a/msmcobalt/core/LocApiBase.h b/msmcobalt/core/LocApiBase.h
index 372fc74..066695c 100644
--- a/msmcobalt/core/LocApiBase.h
+++ b/msmcobalt/core/LocApiBase.h
@@ -118,6 +118,8 @@
void reportSv(GnssSvStatus &svStatus,
GpsLocationExtended &locationExtended,
void* svExt);
+ void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
+ void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
void reportStatus(GpsStatusValue status);
void reportNmea(const char* nmea, int length);
void reportXtraServer(const char* url1, const char* url2,
@@ -203,8 +205,6 @@
int gyroBatchesPerSecHigh,
int algorithmConfig);
virtual enum loc_api_adapter_err
- setExtPowerConfig(int isBatteryCharging);
- virtual enum loc_api_adapter_err
setAGLONASSProtocol(unsigned long aGlonassProtocol);
virtual enum loc_api_adapter_err
setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP);
@@ -255,11 +255,6 @@
virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check);
/*
- Update gps reporting events
- */
- virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
- loc_registration_mask_status isEnabled);
- /*
Check if the modem support the service
*/
virtual bool gnssConstellationConfig();
diff --git a/msmcobalt/core/UlpProxyBase.h b/msmcobalt/core/UlpProxyBase.h
index c5cf972..5d93e2b 100644
--- a/msmcobalt/core/UlpProxyBase.h
+++ b/msmcobalt/core/UlpProxyBase.h
@@ -71,6 +71,16 @@
(void)svExt;
return false;
}
+ inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
+ (void)svMeasurementSet;
+ return false;
+ }
+
+ inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+ {
+ (void)svPolynomial;
+ return false;
+ }
inline virtual bool reportStatus(GpsStatusValue status) {
(void)status;
@@ -97,6 +107,11 @@
(void)number_of_locations;
return false;
}
+ inline virtual bool reportDeleteAidingData(GpsAidingData aidingData)
+ {
+ (void)aidingData;
+ return false;
+ }
};
} // namespace loc_core
diff --git a/msmcobalt/core/gps_extended.h b/msmcobalt/core/gps_extended.h
index b6d7a41..9460d4e 100644
--- a/msmcobalt/core/gps_extended.h
+++ b/msmcobalt/core/gps_extended.h
@@ -50,15 +50,17 @@
uint32_t min_interval;
uint32_t preferred_accuracy;
uint32_t preferred_time;
+ bool share_position;
char credentials[14];
char provider[8];
LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
uint32_t gap, uint32_t accu, uint32_t time,
- const char* cred, const char* prov) :
+ bool sp, const char* cred, const char* prov) :
mode(m), recurrence(recr),
min_interval(gap < GPS_MIN_POSSIBLE_FIX_INTERVAL_MS ?
- GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap),
- preferred_accuracy(accu), preferred_time(time) {
+ GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap),
+ preferred_accuracy(accu), preferred_time(time),
+ share_position(sp) {
memset(credentials, 0, sizeof(credentials));
memset(provider, 0, sizeof(provider));
if (NULL != cred) {
@@ -73,7 +75,8 @@
mode(LOC_POSITION_MODE_MS_BASED),
recurrence(GPS_POSITION_RECURRENCE_PERIODIC),
min_interval(GPS_DEFAULT_FIX_INTERVAL_MS),
- preferred_accuracy(50), preferred_time(120000) {
+ preferred_accuracy(50), preferred_time(120000),
+ share_position(true) {
memset(credentials, 0, sizeof(credentials));
memset(provider, 0, sizeof(provider));
}
diff --git a/msmcobalt/core/gps_extended_c.h b/msmcobalt/core/gps_extended_c.h
index e969d74..46be08b 100644
--- a/msmcobalt/core/gps_extended_c.h
+++ b/msmcobalt/core/gps_extended_c.h
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <hardware/gps.h>
+#include <time.h>
/**
* @file
@@ -73,6 +74,8 @@
#define ULP_LOCATION_IS_FROM_NLP 0x0020
/** Position is from PIP */
#define ULP_LOCATION_IS_FROM_PIP 0x0040
+/** Position is from external DR solution*/
+#define ULP_LOCATION_IS_FROM_EXT_DR 0X0080
#define ULP_MIN_INTERVAL_INVALID 0xffffffff
@@ -259,6 +262,13 @@
LOC_RELIABILITY_HIGH = 4
}LocReliability;
+typedef struct {
+ struct timespec apTimeStamp;
+ /*boottime received from pps-ktimer*/
+ float apTimeStampUncertaintyMs;
+ /* timestamp uncertainty in milli seconds */
+}Gnss_ApTimeStampStructType;
+
/** Represents gps location extended. */
typedef struct {
/** set to sizeof(GpsLocationExtended) */
@@ -291,6 +301,8 @@
float horUncEllipseSemiMinor;
/* Elliptical Horizontal Uncertainty Azimuth */
float horUncEllipseOrientAzimuth;
+
+ Gnss_ApTimeStampStructType timeStamp;
} GpsLocationExtended;
enum loc_sess_status {
@@ -400,6 +412,8 @@
LOC_API_ADAPTER_BATCH_FULL, // Batching on full
LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix
LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, //
+ LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, //GNSS Measurement Report
+ LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, //GNSS SV Polynomial Report
LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request
LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request
LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report
@@ -430,6 +444,8 @@
#define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA)
#define LOC_API_ADAPTER_BIT_BATCH_FULL (1<<LOC_API_ADAPTER_BATCH_FULL)
#define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT)
+#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT)
+#define LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT (1<<LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT)
#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ)
#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ)
#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
@@ -457,6 +473,594 @@
#define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2))
#define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3)
+/*++ ***********************************************
+** Satellite Measurement and Satellite Polynomial
+** Structure definitions
+** ***********************************************
+--*/
+#define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12
+#define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3
+#define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9
+#define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4
+#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 16
+
+enum ulp_gnss_sv_measurement_valid_flags{
+
+ ULP_GNSS_SV_MEAS_GPS_TIME = 0,
+ ULP_GNSS_SV_MEAS_PSUEDO_RANGE,
+ ULP_GNSS_SV_MEAS_MS_IN_WEEK,
+ ULP_GNSS_SV_MEAS_SUB_MSEC,
+ ULP_GNSS_SV_MEAS_CARRIER_PHASE,
+ ULP_GNSS_SV_MEAS_DOPPLER_SHIFT,
+ ULP_GNSS_SV_MEAS_CNO,
+ ULP_GNSS_SV_MEAS_LOSS_OF_LOCK,
+
+ ULP_GNSS_SV_MEAS_MAX_VALID_FLAGS
+};
+
+#define ULP_GNSS_SV_MEAS_BIT_GPS_TIME (1<<ULP_GNSS_SV_MEAS_GPS_TIME)
+#define ULP_GNSS_SV_MEAS_BIT_PSUEDO_RANGE (1<<ULP_GNSS_SV_MEAS_PSUEDO_RANGE)
+#define ULP_GNSS_SV_MEAS_BIT_MS_IN_WEEK (1<<ULP_GNSS_SV_MEAS_MS_IN_WEEK)
+#define ULP_GNSS_SV_MEAS_BIT_SUB_MSEC (1<<ULP_GNSS_SV_MEAS_SUB_MSEC)
+#define ULP_GNSS_SV_MEAS_BIT_CARRIER_PHASE (1<<ULP_GNSS_SV_MEAS_CARRIER_PHASE)
+#define ULP_GNSS_SV_MEAS_BIT_DOPPLER_SHIFT (1<<ULP_GNSS_SV_MEAS_DOPPLER_SHIFT)
+#define ULP_GNSS_SV_MEAS_BIT_CNO (1<<ULP_GNSS_SV_MEAS_CNO)
+#define ULP_GNSS_SV_MEAS_BIT_LOSS_OF_LOCK (1<<ULP_GNSS_SV_MEAS_LOSS_OF_LOCK)
+
+enum ulp_gnss_sv_poly_valid_flags{
+
+ ULP_GNSS_SV_POLY_GLO_FREQ = 0,
+ ULP_GNSS_SV_POLY_T0,
+ ULP_GNSS_SV_POLY_IODE,
+ ULP_GNSS_SV_POLY_FLAG,
+ ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0,
+ ULP_GNSS_SV_POLY_POLYCOEFF_XYZN,
+ ULP_GNSS_SV_POLY_POLYCOEFF_OTHER,
+ ULP_GNSS_SV_POLY_SV_POSUNC,
+ ULP_GNSS_SV_POLY_IONODELAY,
+ ULP_GNSS_SV_POLY_IONODOT,
+ ULP_GNSS_SV_POLY_SBAS_IONODELAY,
+ ULP_GNSS_SV_POLY_SBAS_IONODOT,
+ ULP_GNSS_SV_POLY_TROPODELAY,
+ ULP_GNSS_SV_POLY_ELEVATION,
+ ULP_GNSS_SV_POLY_ELEVATIONDOT,
+ ULP_GNSS_SV_POLY_ELEVATIONUNC,
+ ULP_GNSS_SV_POLY_VELO_COEFF,
+ ULP_GNSS_SV_POLY_ENHANCED_IOD,
+
+ ULP_GNSS_SV_POLY_VALID_FLAGS
+
+};
+
+#define ULP_GNSS_SV_POLY_BIT_GLO_FREQ (1<<ULP_GNSS_SV_POLY_GLO_FREQ)
+#define ULP_GNSS_SV_POLY_BIT_T0 (1<<ULP_GNSS_SV_POLY_T0)
+#define ULP_GNSS_SV_POLY_BIT_IODE (1<<ULP_GNSS_SV_POLY_IODE)
+#define ULP_GNSS_SV_POLY_BIT_FLAG (1<<ULP_GNSS_SV_POLY_FLAG)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0 (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZN)
+#define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER (1<<ULP_GNSS_SV_POLY_POLYCOEFF_OTHER)
+#define ULP_GNSS_SV_POLY_BIT_SV_POSUNC (1<<ULP_GNSS_SV_POLY_SV_POSUNC)
+#define ULP_GNSS_SV_POLY_BIT_IONODELAY (1<<ULP_GNSS_SV_POLY_IONODELAY)
+#define ULP_GNSS_SV_POLY_BIT_IONODOT (1<<ULP_GNSS_SV_POLY_IONODOT)
+#define ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY (1<<ULP_GNSS_SV_POLY_SBAS_IONODELAY)
+#define ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT (1<<ULP_GNSS_SV_POLY_SBAS_IONODOT)
+#define ULP_GNSS_SV_POLY_BIT_TROPODELAY (1<<ULP_GNSS_SV_POLY_TROPODELAY)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATION (1<<ULP_GNSS_SV_POLY_ELEVATION)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT (1<<ULP_GNSS_SV_POLY_ELEVATIONDOT)
+#define ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC (1<<ULP_GNSS_SV_POLY_ELEVATIONUNC)
+#define ULP_GNSS_SV_POLY_BIT_VELO_COEFF (1<<ULP_GNSS_SV_POLY_VELO_COEFF)
+#define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD (1<<ULP_GNSS_SV_POLY_ENHANCED_IOD)
+
+
+typedef enum
+{
+ GNSS_LOC_SV_SYSTEM_GPS = 1,
+ /**< GPS satellite. */
+ GNSS_LOC_SV_SYSTEM_GALILEO = 2,
+ /**< GALILEO satellite. */
+ GNSS_LOC_SV_SYSTEM_SBAS = 3,
+ /**< SBAS satellite. */
+ GNSS_LOC_SV_SYSTEM_COMPASS = 4,
+ /**< COMPASS satellite. */
+ GNSS_LOC_SV_SYSTEM_GLONASS = 5,
+ /**< GLONASS satellite. */
+ GNSS_LOC_SV_SYSTEM_BDS = 6
+ /**< BDS satellite. */
+} Gnss_LocSvSystemEnumType;
+
+typedef enum
+{
+ GNSS_LOC_FREQ_SOURCE_INVALID = 0,
+ /**< Source of the frequency is invalid */
+ GNSS_LOC_FREQ_SOURCE_EXTERNAL = 1,
+ /**< Source of the frequency is from external injection */
+ GNSS_LOC_FREQ_SOURCE_PE_CLK_REPORT = 2,
+ /**< Source of the frequency is from Navigation engine */
+ GNSS_LOC_FREQ_SOURCE_UNKNOWN = 3
+ /**< Source of the frequency is unknown */
+} Gnss_LocSourceofFreqEnumType;
+
+typedef struct
+{
+ size_t size;
+ float clockDrift;
+ /**< Receiver clock Drift \n
+ - Units: meter per sec \n
+ */
+ float clockDriftUnc;
+ /**< Receiver clock Drift uncertainty \n
+ - Units: meter per sec \n
+ */
+ Gnss_LocSourceofFreqEnumType sourceOfFreq;
+}Gnss_LocRcvrClockFrequencyInfoStructType;
+
+typedef struct
+{
+ size_t size;
+ uint8_t leapSec;
+ /**< GPS time leap second delta to UTC time \n
+ - Units: sec \n
+ */
+ uint8_t leapSecUnc;
+ /**< Uncertainty for GPS leap second \n
+ - Units: sec \n
+ */
+}Gnss_LeapSecondInfoStructType;
+
+typedef enum
+{
+ GNSS_LOC_SYS_TIME_BIAS_VALID = 0x01,
+ /**< System time bias valid */
+ GNSS_LOC_SYS_TIME_BIAS_UNC_VALID = 0x02,
+ /**< System time bias uncertainty valid */
+}Gnss_LocInterSystemBiasValidMaskType;
+
+typedef struct
+{
+ size_t size;
+ uint32_t validMask;
+ /* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */
+
+ float timeBias;
+ /**< System-1 to System-2 Time Bias \n
+ - Units: msec \n
+ */
+ float timeBiasUnc;
+ /**< System-1 to System-2 Time Bias uncertainty \n
+ - Units: msec \n
+ */
+}Gnss_InterSystemBiasStructType;
+
+
+typedef struct
+{
+ size_t size;
+ uint16_t systemWeek;
+ /**< System week number for GPS, BDS and GAL satellite systems. \n
+ Set to 65535 when invalid or not available. \n
+ Not valid for GLONASS system. \n
+ */
+
+ uint32_t systemMsec;
+ /**< System time msec. Time of Week for GPS, BDS, GAL and
+ Time of Day for GLONASS.
+ - Units: msec \n
+ */
+ float systemClkTimeBias;
+ /**< System clock time bias \n
+ - Units: msec \n
+ System time = systemMsec - systemClkTimeBias \n
+ */
+ float systemClkTimeUncMs;
+ /**< Single sided maximum time bias uncertainty \n
+ - Units: msec \n
+ */
+}Gnss_LocSystemTimeStructType;
+
+typedef struct {
+
+ size_t size;
+ uint8_t gloFourYear;
+ /**< GLONASS four year number from 1996. Refer to GLONASS ICD.\n
+ Applicable only for GLONASS and shall be ignored for other constellations. \n
+ If unknown shall be set to 255
+ */
+
+ uint16_t gloDays;
+ /**< GLONASS day number in four years. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations. \n
+ If unknown shall be set to 65535
+ */
+
+ uint32_t gloMsec;
+ /**< GLONASS time of day in msec. Refer to GLONASS ICD.
+ - Units: msec \n
+ */
+
+ float gloClkTimeBias;
+ /**< System clock time bias (sub-millisecond) \n
+ - Units: msec \n
+ System time = systemMsec - systemClkTimeBias \n
+ */
+
+ float gloClkTimeUncMs;
+ /**< Single sided maximum time bias uncertainty \n
+ - Units: msec \n
+ */
+}Gnss_LocGloTimeStructType; /* Type */
+
+typedef struct {
+
+ size_t size;
+ uint32_t refFCount;
+ /**< Receiver frame counter value at reference tick */
+
+ uint8_t systemRtc_valid;
+ /**< Validity indicator for System RTC */
+
+ uint64_t systemRtcMs;
+ /**< Platform system RTC value \n
+ - Units: msec \n
+ */
+
+ uint32_t sourceOfTime;
+ /**< Source of time information */
+
+}Gnss_LocGnssTimeExtStructType;
+
+
+
+typedef enum
+{
+ GNSS_LOC_MEAS_STATUS_NULL = 0x00000000,
+ /**< No information state */
+ GNSS_LOC_MEAS_STATUS_SM_VALID = 0x00000001,
+ /**< Code phase is known */
+ GNSS_LOC_MEAS_STATUS_SB_VALID = 0x00000002,
+ /**< Sub-bit time is known */
+ GNSS_LOC_MEAS_STATUS_MS_VALID = 0x00000004,
+ /**< Satellite time is known */
+ GNSS_LOC_MEAS_STATUS_BE_CONFIRM = 0x00000008,
+ /**< Bit edge is confirmed from signal */
+ GNSS_LOC_MEAS_STATUS_VELOCITY_VALID = 0x00000010,
+ /**< Satellite Doppler measured */
+ GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020,
+ /**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */
+ GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200,
+ /**< Range update from Satellite differences */
+ GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400,
+ /**< Doppler update from Satellite differences */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x000001000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x000002000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x000004000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x000008000
+ /**< Don't use measurement if bit is set */
+}Gnss_LocSvMeasStatusMaskType;
+
+typedef struct
+{
+ size_t size;
+ uint32_t svMs;
+ /**< Satellite time milisecond.\n
+ For GPS, BDS, GAL range of 0 thru (604800000-1) \n
+ For GLONASS range of 0 thru (86400000-1) \n
+ Valid when PD_LOC_MEAS_STATUS_MS_VALID bit is set in measurement status \n
+ Note: All SV times in the current measurement block are alredy propagated to common reference time epoch. \n
+ - Units: msec \n
+ */
+ float svSubMs;
+ /**<Satellite time sub-millisecond. \n
+ Total SV Time = svMs + svSubMs \n
+ - Units: msec \n
+ */
+ float svTimeUncMs;
+ /**< Satellite Time uncertainty \n
+ - Units: msec \n
+ */
+ float dopplerShift;
+ /**< Satellite Doppler \n
+ - Units: meter per sec \n
+ */
+ float dopplerShiftUnc;
+ /**< Satellite Doppler uncertainty\n
+ - Units: meter per sec \n
+ */
+}Gnss_LocSVTimeSpeedStructType;
+
+typedef enum
+{
+ GNSS_SV_STATE_IDLE = 0,
+ GNSS_SV_STATE_SEARCH = 1,
+ GNSS_SV_STATE_SEARCH_VERIFY = 2,
+ GNSS_SV_STATE_BIT_EDGE = 3,
+ GNSS_SV_STATE_VERIFY_TRACK = 4,
+ GNSS_SV_STATE_TRACK = 5,
+ GNSS_SV_STATE_RESTART = 6,
+ GNSS_SV_STATE_DPO_TRACK = 7
+} Gnss_LocSVStateEnumType;
+
+typedef enum
+{
+ GNSS_LOC_SVINFO_MASK_HAS_EPHEMERIS = 0x01,
+ /**< Ephemeris is available for this SV */
+ GNSS_LOC_SVINFO_MASK_HAS_ALMANAC = 0x02
+ /**< Almanac is available for this SV */
+}Gnss_LocSvInfoMaskT;
+
+typedef enum
+{
+ GNSS_LOC_SV_SRCH_STATUS_IDLE = 1,
+ /**< SV is not being actively processed */
+ GNSS_LOC_SV_SRCH_STATUS_SEARCH = 2,
+ /**< The system is searching for this SV */
+ GNSS_LOC_SV_SRCH_STATUS_TRACK = 3
+ /**< SV is being tracked */
+}Gnss_LocSvSearchStatusEnumT;
+
+
+typedef struct
+{
+ size_t size;
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.
+ \begin{itemize1}
+ \item Range: \begin{itemize1}
+ \item For GPS: 1 to 32
+ \item For GLONASS: 1 to 32
+ \item For SBAS: 120 to 151
+ \item For BDS: 201 to 237
+ \end{itemize1} \end{itemize1}
+ The GPS and GLONASS SVs can be disambiguated using the system field.
+ */
+ uint8_t gloFrequency;
+ /**< GLONASS frequency number + 7 \n
+ Valid only for GLONASS System \n
+ Shall be ignored for all other systems \n
+ - Range: 1 to 14 \n
+ */
+ Gnss_LocSvSearchStatusEnumT svStatus;
+ /**< Satellite search state \n
+ @ENUM()
+ */
+ bool healthStatus_valid;
+ /**< SV Health Status validity flag\n
+ - 0: Not valid \n
+ - 1: Valid \n
+ */
+ uint8_t healthStatus;
+ /**< Health status.
+ \begin{itemize1}
+ \item Range: 0 to 1; 0 = unhealthy, \n 1 = healthy, 2 = unknown
+ \vspace{-0.18in} \end{itemize1}
+ */
+ Gnss_LocSvInfoMaskT svInfoMask;
+ /**< Indicates whether almanac and ephemeris information is available. \n
+ @MASK()
+ */
+ uint64_t measurementStatus;
+ /**< Bitmask indicating SV measurement status.
+ Valid bitmasks: \n
+ @MASK()
+ */
+ uint16_t CNo;
+ /**< Carrier to Noise ratio \n
+ - Units: 0.1 dBHz \n
+ */
+ uint16_t gloRfLoss;
+ /**< GLONASS Rf loss reference to Antenna. \n
+ - Units: dB, Scale: 0.1 \n
+ */
+ bool lossOfLock;
+ /**< Loss of signal lock indicator \n
+ - 0: Signal in continuous track \n
+ - 1: Signal not in track \n
+ */
+ int16_t measLatency;
+ /**< Age of the measurement. Positive value means measurement precedes ref time. \n
+ - Units: msec \n
+ */
+ Gnss_LocSVTimeSpeedStructType svTimeSpeed;
+ /**< Unfiltered SV Time and Speed information
+ */
+ float dopplerAccel;
+ /**< Satellite Doppler Accelertion\n
+ - Units: Hz/s \n
+ */
+ bool multipathEstValid;
+ /**< Multipath estimate validity flag\n
+ - 0: Multipath estimate not valid \n
+ - 1: Multipath estimate valid \n
+ */
+ float multipathEstimate;
+ /**< Estimate of multipath in measurement\n
+ - Units: Meters \n
+ */
+ bool fineSpeedValid;
+ /**< Fine speed validity flag\n
+ - 0: Fine speed not valid \n
+ - 1: Fine speed valid \n
+ */
+ float fineSpeed;
+ /**< Carrier phase derived speed \n
+ - Units: m/s \n
+ */
+ bool fineSpeedUncValid;
+ /**< Fine speed uncertainty validity flag\n
+ - 0: Fine speed uncertainty not valid \n
+ - 1: Fine speed uncertainty valid \n
+ */
+ float fineSpeedUnc;
+ /**< Carrier phase derived speed \n
+ - Units: m/s \n
+ */
+ bool carrierPhaseValid;
+ /**< Carrier Phase measurement validity flag\n
+ - 0: Carrier Phase not valid \n
+ - 1: Carrier Phase valid \n
+ */
+ double carrierPhase;
+ /**< Carrier phase measurement [L1 cycles] \n
+ */
+ bool cycleSlipCountValid;
+ /**< Cycle slup count validity flag\n
+ - 0: Not valid \n
+ - 1: Valid \n
+ */
+ uint8_t cycleSlipCount;
+ /**< Increments when a CSlip is detected */
+
+ bool svDirectionValid;
+ /**< Validity flag for SV direction */
+
+ float svAzimuth;
+ /**< Satellite Azimuth
+ - Units: radians \n
+ */
+ float svElevation;
+ /**< Satellite Elevation
+ - Units: radians \n
+ */
+} Gnss_SVMeasurementStructType;
+
+/**< Maximum number of satellites in measurement block for given system. */
+
+typedef struct
+{
+ size_t size;
+ Gnss_LocSvSystemEnumType system;
+ /**< Specifies the Satellite System Type
+ */
+ bool isSystemTimeValid;
+ /**< Indicates whether System Time is Valid:\n
+ - 0x01 (TRUE) -- System Time is valid \n
+ - 0x00 (FALSE) -- System Time is not valid
+ */
+ Gnss_LocSystemTimeStructType systemTime;
+ /**< System Time Information \n
+ */
+ bool isGloTime_valid;
+ Gnss_LocGloTimeStructType gloTime;
+
+ bool isSystemTimeExt_valid;
+ Gnss_LocGnssTimeExtStructType systemTimeExt;
+
+ uint8_t numSvs;
+ /* Number of SVs in this report block */
+
+ Gnss_SVMeasurementStructType svMeasurement[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
+ /**< Satellite measurement Information \n
+ */
+} Gnss_ClockMeasurementStructType;
+
+
+typedef struct
+{
+ size_t size;
+ uint8_t seqNum;
+ /**< Current message Number */
+ uint8_t maxMessageNum;
+ /**< Maximum number of message that will be sent for present time epoch. */
+
+ bool leapSecValid;
+ Gnss_LeapSecondInfoStructType leapSec;
+
+ Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
+
+ Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
+
+ Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType galGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType galBdsInterSystemBias;
+
+ bool clockFreqValid;
+ Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */
+ bool gnssMeasValid;
+ Gnss_ClockMeasurementStructType gnssMeas;
+ Gnss_ApTimeStampStructType timeStamp;
+
+} GnssSvMeasurementSet;
+
+typedef enum
+{
+ GNSS_SV_POLY_COEFF_VALID = 0x01,
+ /**< SV position in orbit coefficients are valid */
+ GNSS_SV_POLY_IONO_VALID = 0x02,
+ /**< Iono estimates are valid */
+
+ GNSS_SV_POLY_TROPO_VALID = 0x04,
+ /**< Tropo estimates are valid */
+
+ GNSS_SV_POLY_ELEV_VALID = 0x08,
+ /**< Elevation, rate, uncertainty are valid */
+
+ GNSS_SV_POLY_SRC_ALM_CORR = 0x10,
+ /**< Polynomials based on XTRA */
+
+ GNSS_SV_POLY_SBAS_IONO_VALID = 0x20,
+ /**< SBAS IONO and rate are valid */
+
+ GNSS_SV_POLY_GLO_STR4 = 0x40
+ /**< GLONASS String 4 has been received */
+}Gnss_SvPolyStatusMaskType;
+
+
+typedef struct
+{
+ size_t size;
+ uint16_t gnssSvId;
+ /* GPS: 1-32, GLO: 65-96, 0: Invalid,
+ SBAS: 120-151, BDS:201-237,GAL:301 to 336
+ All others are reserved
+ */
+ int8_t freqNum;
+ /* Freq index, only valid if u_SysInd is GLO */
+
+ uint8_t svPolyFlags;
+ /* Indicate the validity of the elements
+ as per Gnss_SvPolyStatusMaskType
+ */
+
+ uint32_t is_valid;
+
+ uint16_t iode;
+ /* Ephemeris reference time
+ GPS:Issue of Data Ephemeris used [unitless].
+ GLO: Tb 7-bit, refer to ICD02
+ */
+ double T0;
+ /* Reference time for polynominal calculations
+ GPS: Secs in week.
+ GLO: Full secs since Jan/01/96
+ */
+ double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
+ /* C0X, C0Y, C0Z */
+ double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
+ /* C1X, C2X ... C2Z, C3Z */
+ float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
+ /* C0T, C1T, C2T, C3T */
+ float svPosUnc; /* SV position uncertainty [m]. */
+ float ionoDelay; /* Ionospheric delay at d_T0 [m]. */
+ float ionoDot; /* Iono delay rate [m/s]. */
+ float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
+ float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */
+ float tropoDelay; /* Tropospheric delay [m]. */
+ float elevation; /* Elevation [rad] at d_T0 */
+ float elevationDot; /* Elevation rate [rad/s] */
+ float elevationUnc; /* SV elevation [rad] uncertainty */
+ double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
+ /* Coefficients of velocity poly */
+ uint32_t enhancedIOD; /* Enhanced Reference Time */
+} GnssSvPolynomial;
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/msmcobalt/etc/gps.conf b/msmcobalt/etc/gps.conf
index d1781c8..c74e826 100644
--- a/msmcobalt/etc/gps.conf
+++ b/msmcobalt/etc/gps.conf
@@ -43,7 +43,7 @@
#Choose PDN for Emergency SUPL
#1 - Use emergency PDN
#0 - Use regular SUPL PDN for Emergency SUPL
-USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1
+USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0
#SUPL_MODE is a bit mask set in config.xml per carrier by default.
#If it is uncommented here, this value will overwrite the value from
@@ -138,3 +138,43 @@
# 0: disable
# 1: enable
AGPS_CONFIG_INJECT = 1
+# AP Coarse Timestamp Uncertainty
+##################################################
+# default : 10
+# or as per clock uncertainty of product
+AP_TIMESTAMP_UNCERTAINTY = 10
+
+#####################################
+# GNSS PPS settings
+#####################################
+#AP DR engine availability status
+# 0 : NO AP DR (default)
+# 1 : AP DR enabled
+#EXTERNAL_DR_ENABLED = 0
+
+#####################################
+#DR_SYNC Pulse Availability
+#####################################
+# 0 : DR_SYNC pulse not available (default)
+# 1 : DR_SYNC pulse available
+DR_SYNC_ENABLED = 0
+
+#####################################
+#PPS Device name
+#####################################
+PPS_DEVICENAME = /dev/pps0
+
+#####################################
+#AP Clock Accuracy
+#####################################
+AP_CLOCK_PPM = 100
+
+#####################################
+#MAX ms difference to detect missing pulse
+#####################################
+MISSING_PULSE_TIME_DELTA = 900
+
+#####################################
+#Propagation time uncertainty
+#####################################
+PROPAGATION_TIME_UNCERTAINTY = 1
diff --git a/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.cpp
index 4229929..2d9eeac 100644
--- a/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.cpp
+++ b/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -395,6 +395,23 @@
}
}
+
+void LocEngAdapter::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
+{
+ // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
+ if (! mUlp->reportSvMeasurement(svMeasurementSet)) {
+ //Send to Internal Adapter later if needed by LA
+ }
+}
+
+void LocEngAdapter::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+{
+ // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
+ if (! mUlp->reportSvPolynomial(svPolynomial)) {
+ //Send to Internal Adapter later if needed by LA
+ }
+}
+
void LocEngAdapter::setInSession(bool inSession)
{
mNavigating = inSession;
@@ -532,9 +549,8 @@
if (mSupportsTimeInjection) {
LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
result = mLocApi->setTime(time, timeReference, uncertainty);
- } else {
- mSupportsTimeInjection = true;
}
+
return result;
}
@@ -571,22 +587,6 @@
}
/*
- Update Registration Mask
- */
-void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
- loc_registration_mask_status isEnabled)
-{
- LOC_LOGD("entering %s", __func__);
- int result = LOC_API_ADAPTER_ERR_FAILURE;
- result = mLocApi->updateRegistrationMask(event, isEnabled);
- if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
- LOC_LOGD("%s] update registration mask succeed.", __func__);
- } else {
- LOC_LOGE("%s] update registration mask failed.", __func__);
- }
-}
-
-/*
Set Gnss Constellation Config
*/
bool LocEngAdapter::gnssConstellationConfig()
diff --git a/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.h b/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.h
index fe79f77..416e4b7 100644
--- a/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.h
+++ b/msmcobalt/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -230,11 +230,6 @@
algorithmConfig);
}
inline virtual enum loc_api_adapter_err
- setExtPowerConfig(int isBatteryCharging)
- {
- return mLocApi->setExtPowerConfig(isBatteryCharging);
- }
- inline virtual enum loc_api_adapter_err
setAGLONASSProtocol(unsigned long aGlonassProtocol)
{
return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
@@ -285,6 +280,8 @@
virtual void reportSv(GnssSvStatus &svStatus,
GpsLocationExtended &locationExtended,
void* svExt);
+ virtual void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
+ virtual void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
virtual void reportStatus(GpsStatusValue status);
virtual void reportNmea(const char* nmea, int length);
virtual bool reportXtraServer(const char* url1, const char* url2,
@@ -350,12 +347,6 @@
}
/*
- Update Registration Mask
- */
- void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
- loc_registration_mask_status isEnabled);
-
- /*
Set Gnss Constellation Config
*/
bool gnssConstellationConfig();
diff --git a/msmcobalt/loc_api/libloc_api_50001/loc.cpp b/msmcobalt/loc_api/libloc_api_50001/loc.cpp
index ca9760d..222d5da 100644
--- a/msmcobalt/loc_api/libloc_api_50001/loc.cpp
+++ b/msmcobalt/loc_api/libloc_api_50001/loc.cpp
@@ -44,6 +44,7 @@
#include <errno.h>
#include <LocDualContext.h>
#include <platform_lib_includes.h>
+#include <cutils/properties.h>
using namespace loc_core;
@@ -282,6 +283,7 @@
static int loc_init(GpsCallbacks* callbacks)
{
int retVal = -1;
+ unsigned int target = (unsigned int) -1;
ENTRY_LOG();
LOC_API_ADAPTER_EVENT_MASK_T event;
@@ -301,6 +303,17 @@
LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+ target = loc_get_target();
+
+ /* If platform is "auto" and external dr enabled then enable
+ ** Measurement report and SV Polynomial report
+ */
+ if((1 == gps_conf.EXTERNAL_DR_ENABLED))
+ {
+ event |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT |
+ LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT;
+ }
+
LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
callbacks->status_cb, /* status_cb */
local_sv_cb, /* sv_status_cb */
@@ -322,7 +335,8 @@
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
- loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities()
+ && !loc_afw_data.adapter->hasNativeXtraClient();
loc_afw_data.adapter->setGpsLockMsg(0);
loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities());
loc_afw_data.adapter->setXtraUserAgent();
@@ -460,8 +474,12 @@
break;
}
+ // set position sharing option to true
+ bool sharePosition = true;
+
LocPosMode params(locMode, recurrence, min_interval,
- preferred_accuracy, preferred_time, NULL, NULL);
+ preferred_accuracy, preferred_time,
+ sharePosition, NULL, NULL);
ret_val = loc_eng_set_position_mode(loc_afw_data, params);
EXIT_LOG(%d, ret_val);
@@ -578,10 +596,14 @@
}
dlerror(); /* Clear any existing error */
get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
- if ((error = dlerror()) != NULL || NULL == get_gps_geofence_interface) {
+ if ((error = dlerror()) != NULL) {
LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
goto exit;
- }
+ }
+ if (NULL == get_gps_geofence_interface) {
+ LOC_LOGE ("%s, get_gps_geofence_interface is NULL\n", __func__);
+ goto exit;
+ }
geofence_interface = get_gps_geofence_interface();
diff --git a/msmcobalt/loc_api/libloc_api_50001/loc_eng.cpp b/msmcobalt/loc_api/libloc_api_50001/loc_eng.cpp
index ea08d8d..bd4f8ea 100644
--- a/msmcobalt/loc_api/libloc_api_50001/loc_eng.cpp
+++ b/msmcobalt/loc_api/libloc_api_50001/loc_eng.cpp
@@ -101,6 +101,7 @@
{"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
{"AGPS_CONFIG_INJECT", &gps_conf.AGPS_CONFIG_INJECT, NULL, 'n'},
+ {"EXTERNAL_DR_ENABLED", &gps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'},
};
static const loc_param_s_type sap_conf_table[] =
@@ -756,29 +757,6 @@
}
};
-// case LOC_ENG_MSG_EXT_POWER_CONFIG:
-struct LocEngExtPowerConfig : public LocMsg {
- LocEngAdapter* mAdapter;
- const int mIsBatteryCharging;
- inline LocEngExtPowerConfig(LocEngAdapter* adapter,
- int isBatteryCharging) :
- LocMsg(), mAdapter(adapter),
- mIsBatteryCharging(isBatteryCharging)
- {
- locallog();
- }
- inline virtual void proc() const {
- mAdapter->setExtPowerConfig(mIsBatteryCharging);
- }
- inline void locallog() const {
- LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
- mIsBatteryCharging);
- }
- inline virtual void log() const {
- locallog();
- }
-};
-
// case LOC_ENG_MSG_REPORT_POSITION:
LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
UlpLocation &loc,
@@ -1665,29 +1643,6 @@
}
};
-struct LocEngUpdateRegistrationMask : public LocMsg {
- loc_eng_data_s_type* mLocEng;
- LOC_API_ADAPTER_EVENT_MASK_T mMask;
- loc_registration_mask_status mIsEnabled;
- inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
- LOC_API_ADAPTER_EVENT_MASK_T mask,
- loc_registration_mask_status isEnabled) :
- LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
- locallog();
- }
- inline virtual void proc() const {
- loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
- locEng->adapter->updateRegistrationMask(mMask,
- mIsEnabled);
- }
- void locallog() const {
- LOC_LOGV("LocEngUpdateRegistrationMask\n");
- }
- virtual void log() const {
- locallog();
- }
-};
-
struct LocEngGnssConstellationConfig : public LocMsg {
LocEngAdapter* mAdapter;
inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
@@ -2069,7 +2024,6 @@
int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
if (loc_eng_data.adapter->isInSession()) {
-
ret_val = loc_eng_data.adapter->stopFix();
loc_eng_data.adapter->setInSession(FALSE);
}
@@ -2230,6 +2184,9 @@
ENTRY_LOG_CALLFLOW();
INIT_CHECK(loc_eng_data.adapter, return);
+ //report delete aiding data to ULP to send to DRPlugin
+ loc_eng_data.adapter->getUlpProxy()->reportDeleteAidingData(f);
+
loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
EXIT_LOG(%s, VOID_RET);
@@ -2975,8 +2932,9 @@
if (loc_eng_data.adapter->isInSession()) {
// This sets the copy in adapter to modem
loc_eng_data.adapter->setInSession(false);
- loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ loc_eng_start_handler(loc_eng_data);
}
+
EXIT_LOG(%s, VOID_RET);
}
@@ -3049,10 +3007,7 @@
// updated the mask
LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
- loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
- &loc_eng_data,
- event,
- LOC_REGISTRATION_MASK_ENABLED));
+ loc_eng_data.adapter->updateEvtMask(event, LOC_REGISTRATION_MASK_ENABLED);
// set up the callback
loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
LOC_LOGD ("%s, event masks updated successfully", __func__);
@@ -3084,10 +3039,7 @@
// updated the mask
LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
- loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
- &loc_eng_data,
- event,
- LOC_REGISTRATION_MASK_DISABLED));
+ loc_eng_data.adapter->updateEvtMask(event, LOC_REGISTRATION_MASK_DISABLED);
// set up the callback
loc_eng_data.gnss_measurement_cb = NULL;
EXIT_LOG(%d, 0);
diff --git a/msmcobalt/loc_api/libloc_api_50001/loc_eng.h b/msmcobalt/loc_api/libloc_api_50001/loc_eng.h
index c402fac..dc39f60 100644
--- a/msmcobalt/loc_api/libloc_api_50001/loc_eng.h
+++ b/msmcobalt/loc_api/libloc_api_50001/loc_eng.h
@@ -123,6 +123,7 @@
boolean generateNmea;
uint32_t gps_used_mask;
uint32_t glo_used_mask;
+ uint32_t gal_used_mask;
float hdop;
float pdop;
float vdop;
@@ -142,7 +143,6 @@
loc_ext_parser sv_ext_parser;
} loc_eng_data_s_type;
-
//loc_eng functions
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
LocCallbacks* callbacks,
diff --git a/msmcobalt/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msmcobalt/loc_api/libloc_api_50001/loc_eng_nmea.cpp
index 3d2336f..ac057c1 100644
--- a/msmcobalt/loc_api/libloc_api_50001/loc_eng_nmea.cpp
+++ b/msmcobalt/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -34,6 +34,105 @@
#include <math.h>
#include <platform_lib_includes.h>
+#define GLONASS_SV_ID_OFFSET 64
+#define MAX_SATELLITES_IN_USE 12
+typedef struct loc_nmea_sv_meta_s
+{
+ char talker[3];
+ GnssConstellationType svType;
+ uint32_t mask;
+ uint32_t svIdOffset;
+} loc_nmea_sv_meta;
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_sv_meta_init
+
+DESCRIPTION
+ Init loc_nmea_sv_meta passed in
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Pointer to loc_nmea_sv_meta
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_eng_data_s_type *loc_eng_data_p,
+ loc_nmea_sv_meta& sv_meta, GnssConstellationType svType, bool needCombine)
+{
+ if (!loc_eng_data_p)
+ return NULL;
+
+ memset(&sv_meta, 0, sizeof(sv_meta));
+ sv_meta.svType = svType;
+ sv_meta.talker[0] = 'G';
+
+ switch (svType)
+ {
+ case GNSS_CONSTELLATION_GPS:
+ sv_meta.talker[1] = 'P';
+ sv_meta.mask = loc_eng_data_p->gps_used_mask;
+ break;
+ case GNSS_CONSTELLATION_GLONASS:
+ sv_meta.talker[1] = 'L';
+ sv_meta.mask = loc_eng_data_p->glo_used_mask;
+ // GLONASS SV ids are from 65-96
+ sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
+ break;
+ case GNSS_CONSTELLATION_GALILEO:
+ sv_meta.talker[1] = 'A';
+ sv_meta.mask = loc_eng_data_p->gal_used_mask;
+ break;
+ default:
+ LOC_LOGE("NMEA Error unknow constellation type: %d", svType);
+ return NULL;
+ }
+ if (needCombine &&
+ (loc_eng_data_p->gps_used_mask ? 1 : 0) +
+ (loc_eng_data_p->glo_used_mask ? 1 : 0) +
+ (loc_eng_data_p->gal_used_mask ? 1 : 0) > 1)
+ {
+ // If GPS, GLONASS, Galileo etc. are combined
+ // to obtain the reported position solution,
+ // talker shall be set to GN, to indicate that
+ // the satellites are used in a combined solution
+ sv_meta.talker[1] = 'N';
+ }
+ return &sv_meta;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_count_bits
+
+DESCRIPTION
+ Count how many bits are set in mask
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Bits number set in mask
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static uint32_t loc_eng_nmea_count_bits(uint32_t mask)
+{
+ uint32_t count = 0;
+ while (mask)
+ {
+ if (mask & 1)
+ count++;
+ mask = mask >> 1;
+ }
+ return count;
+}
+
+
/*===========================================================================
FUNCTION loc_eng_nmea_send
@@ -97,16 +196,261 @@
}
/*===========================================================================
+FUNCTION loc_eng_nmea_generate_GSA
+
+DESCRIPTION
+ Generate NMEA GSA sentences generated based on position report
+ Currently below sentences are generated:
+ - $GPGSA : GPS DOP and active SVs
+ - $GLGSA : GLONASS DOP and active SVs
+ - $GAGSA : GALILEO DOP and active SVs
+ - $GNGSA : GNSS DOP and active SVs
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Number of SVs used
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+uint32_t loc_eng_nmea_generate_GSA(loc_eng_data_s_type *loc_eng_data_p,
+ const GpsLocationExtended &locationExtended,
+ char* sentence,
+ int bufSize,
+ loc_nmea_sv_meta* sv_meta_p)
+{
+ if (!loc_eng_data_p || !sentence || bufSize <= 0 || !sv_meta_p)
+ {
+ LOC_LOGE("NMEA Error invalid arguments.");
+ return 0;
+ }
+
+ char* pMarker = sentence;
+ int lengthRemaining = bufSize;
+ int length = 0;
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+
+ char fixType = '\0';
+
+ const char* talker = sv_meta_p->talker;
+ uint32_t svIdOffset = sv_meta_p->svIdOffset;
+ uint32_t mask = sv_meta_p->mask;
+
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i + svIdOffset;
+ mask = mask >> 1;
+ }
+
+ if (svUsedCount == 0 && GNSS_CONSTELLATION_GPS != sv_meta_p->svType)
+ return 0;
+
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ // Start printing the sentence
+ // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc
+ // a : Mode : A : Automatic, allowed to automatically switch 2D/3D
+ // x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
+ // xx : 12 SV ID
+ // p.p : Position DOP (Dilution of Precision)
+ // h.h : Horizontal DOP
+ // v.v : Vertical DOP
+ // 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");
+ return 0;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ // Add the position/horizontal/vertical DOP values
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ /* Sentence is ready, add checksum and broadcast */
+ length = loc_eng_nmea_put_checksum(sentence, bufSize);
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ return svUsedCount;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_GSV
+
+DESCRIPTION
+ Generate NMEA GSV sentences generated based on sv report
+ Currently below sentences are generated:
+ - $GPGSV: GPS Satellites in View
+ - $GNGSV: GLONASS Satellites in View
+ - $GAGSV: GALILEO Satellites in View
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ NONE
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_GSV(loc_eng_data_s_type *loc_eng_data_p,
+ const GnssSvStatus &svStatus,
+ char* sentence,
+ int bufSize,
+ loc_nmea_sv_meta* sv_meta_p)
+{
+ if (!loc_eng_data_p || !sentence || bufSize <= 0)
+ {
+ LOC_LOGE("NMEA Error invalid argument.");
+ return;
+ }
+
+ char* pMarker = sentence;
+ int lengthRemaining = bufSize;
+ int length = 0;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+
+ const char* talker = sv_meta_p->talker;
+ uint32_t svIdOffset = sv_meta_p->svIdOffset;
+ uint32_t mask = sv_meta_p->mask;
+ uint32_t svCount = loc_eng_nmea_count_bits(mask);
+
+
+ if (svCount <= 0)
+ {
+ // no svs in view, so just send a blank $--GSV sentence
+ snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,", talker);
+ length = loc_eng_nmea_put_checksum(sentence, bufSize);
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ return;
+ }
+
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = svCount / 4 + (svCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = bufSize;
+
+ length = snprintf(pMarker, lengthRemaining, "$%sGSV,%d,%d,%02d",
+ talker, sentenceCount, sentenceNumber, svCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svStatus.num_svs) && (i < 4); svNumber++)
+ {
+ if (sv_meta_p->svType == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.gnss_sv_list[svNumber - 1].svid,
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, bufSize);
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+}
+
+/*===========================================================================
FUNCTION loc_eng_nmea_generate_pos
DESCRIPTION
Generate NMEA sentences generated based on position report
Currently below sentences are generated within this function:
- $GPGSA : GPS DOP and active SVs
- - $GNGSA : GLONASS DOP and active SVs
- - $GPVTG : Track made good and ground speed
- - $GPRMC : Recommended minimum navigation information
- - $GPGGA : Time, position and fix related data
+ - $GLGSA : GLONASS DOP and active SVs
+ - $GAGSA : GALILEO DOP and active SVs
+ - $GNGSA : GNSS DOP and active SVs
+ - $--VTG : Track made good and ground speed
+ - $--RMC : Recommended minimum navigation information
+ - $--GGA : Time, position and fix related data
DEPENDENCIES
NONE
@@ -144,174 +488,49 @@
int utcMSeconds = (location.gpsLocation.timestamp)%1000;
if (generate_nmea) {
- // ------------------
- // ------$GPGSA------
- // ------------------
-
+ char talker[3] = {'G', 'P', '\0'};
uint32_t svUsedCount = 0;
- uint32_t svUsedList[32] = {0};
- uint32_t mask = loc_eng_data_p->gps_used_mask;
- for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ uint32_t count = 0;
+ loc_nmea_sv_meta sv_meta;
+ // -------------------
+ // ---$GPGSA/$GNGSA---
+ // -------------------
+
+ count = loc_eng_nmea_generate_GSA(loc_eng_data_p, locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GPS, true));
+ if (count > 0)
{
- if (mask & 1)
- svUsedList[svUsedCount++] = i;
- mask = mask >> 1;
+ svUsedCount += count;
+ talker[1] = sv_meta.talker[1];
}
- // clear the cache so they can't be used again
- loc_eng_data_p->gps_used_mask = 0;
- char fixType;
- if (svUsedCount == 0)
- fixType = '1'; // no fix
- else if (svUsedCount <= 3)
- fixType = '2'; // 2D fix
- else
- fixType = '3'; // 3D fix
+ // -------------------
+ // ---$GLGSA/$GNGSA---
+ // -------------------
- length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
-
- if (length < 0 || length >= lengthRemaining)
+ count = loc_eng_nmea_generate_GSA(loc_eng_data_p, locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GLONASS, true));
+ if (count > 0)
{
- LOC_LOGE("NMEA Error in string formatting");
- return;
+ svUsedCount += count;
+ talker[1] = sv_meta.talker[1];
}
- pMarker += length;
- lengthRemaining -= length;
- for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ // -------------------
+ // ---$GAGSA/$GNGSA---
+ // -------------------
+
+ count = loc_eng_nmea_generate_GSA(loc_eng_data_p, locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GALILEO, true));
+ if (count > 0)
{
- 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");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
+ svUsedCount += count;
+ talker[1] = sv_meta.talker[1];
}
- if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
- { // dop is in locationExtended, (QMI)
- length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
- locationExtended.pdop,
- locationExtended.hdop,
- locationExtended.vdop);
- }
- else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
- { // dop was cached from sv report (RPC)
- length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
- loc_eng_data_p->pdop,
- loc_eng_data_p->hdop,
- loc_eng_data_p->vdop);
- }
- else
- { // no dop
- length = snprintf(pMarker, lengthRemaining, ",,");
- }
-
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
-
- // ------------------
- // ------$GNGSA------
- // ------------------
- uint32_t gloUsedCount = 0;
- uint32_t gloUsedList[32] = {0};
-
- // Reset locals for GNGSA sentence generation
- pMarker = sentence;
- lengthRemaining = sizeof(sentence);
- mask = loc_eng_data_p->glo_used_mask;
- fixType = '\0';
-
- // Parse the glonass sv mask, and fetch glo sv ids
- // Mask corresponds to the offset.
- // GLONASS SV ids are from 65-96
- const int GLONASS_SV_ID_OFFSET = 64;
- for (uint8_t i = 1; mask > 0 && gloUsedCount < 32; i++)
- {
- if (mask & 1)
- gloUsedList[gloUsedCount++] = i + GLONASS_SV_ID_OFFSET;
- mask = mask >> 1;
- }
- // clear the cache so they can't be used again
- loc_eng_data_p->glo_used_mask = 0;
-
- if (gloUsedCount == 0)
- fixType = '1'; // no fix
- else if (gloUsedCount <= 3)
- fixType = '2'; // 2D fix
- else
- fixType = '3'; // 3D fix
-
- // Start printing the sentence
- // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc
- // GNGSA : for glonass SVs
- // a : Mode : A : Automatic, allowed to automatically switch 2D/3D
- // x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
- // xx : 12 SV ID
- // p.p : Position DOP (Dilution of Precision)
- // h.h : Horizontal DOP
- // v.v : Vertical DOP
- // cc : Checksum value
- length = snprintf(pMarker, lengthRemaining, "$GNGSA,A,%c,", fixType);
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
-
- // Add first 12 GLONASS satellite IDs
- for (uint8_t i = 0; i < 12; i++)
- {
- if (i < gloUsedCount)
- length = snprintf(pMarker, lengthRemaining, "%02d,", gloUsedList[i]);
- else
- length = snprintf(pMarker, lengthRemaining, ",");
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
- }
-
- // Add the position/horizontal/vertical DOP values
- if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
- { // dop is in locationExtended, (QMI)
- length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
- locationExtended.pdop,
- locationExtended.hdop,
- locationExtended.vdop);
- }
- else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
- { // dop was cached from sv report (RPC)
- length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
- loc_eng_data_p->pdop,
- loc_eng_data_p->hdop,
- loc_eng_data_p->vdop);
- }
- else
- { // no dop
- length = snprintf(pMarker, lengthRemaining, ",,");
- }
-
- /* Sentence is ready, add checksum and broadcast */
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
-
- // ------------------
- // ------$GPVTG------
- // ------------------
+ // -------------------
+ // ------$--VTG-------
+ // -------------------
pMarker = sentence;
lengthRemaining = sizeof(sentence);
@@ -328,11 +547,11 @@
magTrack -= 360.0;
}
- length = snprintf(pMarker, lengthRemaining, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ length = snprintf(pMarker, lengthRemaining, "$%sVTG,%.1lf,T,%.1lf,M,", talker, location.gpsLocation.bearing, magTrack);
}
else
{
- length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ length = snprintf(pMarker, lengthRemaining, "$%sVTG,,T,,M,", talker);
}
if (length < 0 || length >= lengthRemaining)
@@ -373,15 +592,15 @@
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- // ------------------
- // ------$GPRMC------
- // ------------------
+ // -------------------
+ // ------$--RMC-------
+ // -------------------
pMarker = sentence;
lengthRemaining = sizeof(sentence);
- length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d.%02d,A," ,
- utcHours, utcMinutes, utcSeconds,utcMSeconds/10);
+ length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A," ,
+ talker, utcHours, utcMinutes, utcSeconds,utcMSeconds/10);
if (length < 0 || length >= lengthRemaining)
{
@@ -526,15 +745,15 @@
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- // ------------------
- // ------$GPGGA------
- // ------------------
+ // -------------------
+ // ------$--GGA-------
+ // -------------------
pMarker = sentence;
lengthRemaining = sizeof(sentence);
- length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d.%02d," ,
- utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
+ length = snprintf(pMarker, lengthRemaining, "$%sGGA,%02d%02d%02d.%02d," ,
+ talker, utcHours, utcMinutes, utcSeconds, utcMSeconds/10);
if (length < 0 || length >= lengthRemaining)
{
@@ -601,6 +820,9 @@
else
gpsQuality = '2'; // 2 means DGPS fix
+ // Number of satellites in use, 00-12
+ if (svUsedCount > MAX_SATELLITES_IN_USE)
+ svUsedCount = MAX_SATELLITES_IN_USE;
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
{ // dop is in locationExtended, (QMI)
length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
@@ -657,6 +879,10 @@
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ // clear the cache so they can't be used again
+ loc_eng_data_p->gps_used_mask = 0;
+ loc_eng_data_p->glo_used_mask = 0;
+ loc_eng_data_p->gal_used_mask = 0;
}
//Send blank NMEA reports for non-final fixes
else {
@@ -719,13 +945,12 @@
int sentenceCount = 0;
int sentenceNumber = 1;
int svNumber = 1;
- int gpsCount = 0;
- int glnCount = 0;
//Count GPS SVs for saparating GPS from GLONASS and throw others
loc_eng_data_p->gps_used_mask = 0;
loc_eng_data_p->glo_used_mask = 0;
+ loc_eng_data_p->gal_used_mask = 0;
for(svNumber=1; svNumber <= svCount; svNumber++) {
if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
{
@@ -735,7 +960,6 @@
{
loc_eng_data_p->gps_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
}
- gpsCount++;
}
else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
{
@@ -745,164 +969,40 @@
{
loc_eng_data_p->glo_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
}
- glnCount++;
+ }
+ else if (GNSS_CONSTELLATION_GALILEO == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ // cache the used in fix mask, as it will be needed to send $GAGSA
+ // during the position report
+ if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
+ {
+ loc_eng_data_p->gal_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
+ }
}
}
+ loc_nmea_sv_meta sv_meta;
// ------------------
// ------$GPGSV------
// ------------------
- if (gpsCount <= 0)
- {
- // no svs in view, so just send a blank $GPGSV sentence
- strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- }
- else
- {
- svNumber = 1;
- sentenceNumber = 1;
- sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
-
- while (sentenceNumber <= sentenceCount)
- {
- pMarker = sentence;
- lengthRemaining = sizeof(sentence);
-
- length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
- sentenceCount, sentenceNumber, gpsCount);
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
-
- for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
- {
- if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
- {
- length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
- svStatus.gnss_sv_list[svNumber-1].svid,
- (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int
- (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
-
- if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
- {
- length = snprintf(pMarker, lengthRemaining,"%02d",
- (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
- }
-
- i++;
- }
-
- }
-
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- sentenceNumber++;
-
- } //while
-
- } //if
+ loc_eng_nmea_generate_GSV(loc_eng_data_p, svStatus, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GPS, false));
// ------------------
// ------$GLGSV------
// ------------------
- if (glnCount <= 0)
- {
- // no svs in view, so just send a blank $GLGSV sentence
- strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- }
- else
- {
- svNumber = 1;
- sentenceNumber = 1;
- sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+ loc_eng_nmea_generate_GSV(loc_eng_data_p, svStatus, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GLONASS, false));
- while (sentenceNumber <= sentenceCount)
- {
- pMarker = sentence;
- lengthRemaining = sizeof(sentence);
+ // ------------------
+ // ------$GAGSV------
+ // ------------------
- length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
- sentenceCount, sentenceNumber, glnCount);
+ loc_eng_nmea_generate_GSV(loc_eng_data_p, svStatus, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(loc_eng_data_p, sv_meta, GNSS_CONSTELLATION_GALILEO, false));
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
-
- for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
- {
- if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
- {
-
- length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
- svStatus.gnss_sv_list[svNumber - 1].svid,
- (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
- (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
-
- if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
- {
- length = snprintf(pMarker, lengthRemaining,"%02d",
- (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
-
- if (length < 0 || length >= lengthRemaining)
- {
- LOC_LOGE("NMEA Error in string formatting");
- return;
- }
- pMarker += length;
- lengthRemaining -= length;
- }
-
- i++;
- }
-
- }
-
- length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
- loc_eng_nmea_send(sentence, length, loc_eng_data_p);
- sentenceNumber++;
-
- } //while
-
- }//if
// For RPC, the DOP are sent during sv report, so cache them
// now to be sent during position report.
diff --git a/msmcobalt/utils/LocThread.cpp b/msmcobalt/utils/LocThread.cpp
index e8e8392..685841e 100644
--- a/msmcobalt/utils/LocThread.cpp
+++ b/msmcobalt/utils/LocThread.cpp
@@ -85,7 +85,10 @@
if (mThandle) {
// set thread name
char lname[16];
- strlcpy(lname, threadName, sizeof(lname));
+ int len = (sizeof(lname)>sizeof(threadName)) ?
+ (sizeof(threadName) -1):(sizeof(lname) - 1);
+ memcpy(lname, threadName, len);
+ lname[len] = 0;
// set the thread name here
pthread_setname_np(mThandle, lname);
diff --git a/msmcobalt/utils/loc_target.cpp b/msmcobalt/utils/loc_target.cpp
index 92bdca6..2da2fea 100644
--- a/msmcobalt/utils/loc_target.cpp
+++ b/msmcobalt/utils/loc_target.cpp
@@ -49,11 +49,12 @@
#define APQ8074_ID_1 "184"
#define LINE_LEN 100
-#define STR_LIQUID "Liquid"
-#define STR_SURF "Surf"
-#define STR_MTP "MTP"
-#define STR_APQ "apq"
-#define STR_AUTO "auto"
+#define STR_LIQUID "Liquid"
+#define STR_SURF "Surf"
+#define STR_MTP "MTP"
+#define STR_APQ "apq"
+#define STR_APQ_NO_WGR "baseband_apq_nowgr"
+#define STR_AUTO "auto"
#define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r')
#define LENGTH(s) (sizeof(s) - 1)
#define GPS_CHECK_NO_ERROR 0
@@ -231,11 +232,18 @@
gTarget = TARGET_AUTO;
goto detected;
}
+
+ if( !memcmp(baseband, STR_APQ_NO_WGR, LENGTH(STR_APQ_NO_WGR)) ){
+
+ gTarget = TARGET_NO_GNSS;
+ goto detected;
+ }
+
if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
&& IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
- gTarget = TARGET_MPQ;
+ gTarget = TARGET_NO_GNSS;
else
gTarget = TARGET_APQ_SA;
}
diff --git a/msmcobalt/utils/loc_target.h b/msmcobalt/utils/loc_target.h
index b76ed88..69395db 100644
--- a/msmcobalt/utils/loc_target.h
+++ b/msmcobalt/utils/loc_target.h
@@ -32,7 +32,7 @@
#define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC)
#define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC)
#define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC)
-#define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_NO_GNSS TARGET_SET(GNSS_NONE, NO_SSC)
#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC)
#define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC)
diff --git a/msmcobalt/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/msmcobalt/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
index 4c2d494..5989c64 100644
--- a/msmcobalt/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
+++ b/msmcobalt/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
@@ -158,6 +158,12 @@
} \
} while(0)
+#define LOC_LOG_HEAD(tag,fmt) "%s:%d][" tag "] " fmt "\n"
+#define LOC_LOGv(tag,fmt,...) LOC_LOGV(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(tag,fmt,...) LOC_LOGW(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(tag,fmt,...) LOC_LOGD(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(tag,fmt,...) LOC_LOGE(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+
#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)