Merge 59496905e8 on remote branch

Change-Id: I6e041d6b97db5633b67e1197c47ebdcd15d96128
This commit is contained in:
Linux Build Service Account 2019-06-30 06:49:05 -07:00
commit f7426acb79
8 changed files with 435 additions and 188 deletions

View file

@ -475,6 +475,16 @@ GnssAdapter::convertLocationInfo(GnssLocationInfoNotification& out,
out.flags |= GNSS_LOCATION_INFO_TIME_UNC_BIT;
out.timeUncMs = locationExtended.timeUncMs;
}
if (GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE & locationExtended.flags) {
out.flags |= GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT;
out.calibrationConfidence = locationExtended.calibrationConfidence;
}
if (GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS & locationExtended.flags) {
out.flags |= GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT;
out.calibrationStatus = locationExtended.calibrationStatus;
}
}
@ -659,7 +669,7 @@ GnssAdapter::setSuplHostServer(const char* server, int port, LocServerType type)
LOC_LOGe("Invalid type=%d", type);
} else {
string& url = (LOC_AGPS_SUPL_SERVER == type) ? getServerUrl() : getMoServerUrl();
if (length > 0 && strncasecmp(url.c_str(), serverUrl, sizeof(serverUrl)) != 0) {
if (length >= 0 && strncasecmp(url.c_str(), serverUrl, sizeof(serverUrl)) != 0) {
url.assign(serverUrl);
if (LOC_AGPS_SUPL_SERVER == type) {
@ -720,10 +730,7 @@ GnssAdapter::setConfigCommand()
GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT |
GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT |
GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT;
gnssConfigRequested.gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
if (0 == adapter.getAfwControlId() || NULL != adapter.mNfwCb) {
gnssConfigRequested.gpsLock = gpsConf.GPS_LOCK;
}
if (gpsConf.AGPS_CONFIG_INJECT) {
gnssConfigRequested.flags |= GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT |
@ -840,7 +847,7 @@ std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldS
GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (gnssConfigNeedEngineUpdate.assistanceServer.type ==
GNSS_ASSISTANCE_TYPE_SUPL) {
if ((serverUrlLen != 0) && (oldServerUrl.compare(serverUrl) !=0)) {
if (0 != oldServerUrl.compare(serverUrl)) {
err = mLocApi->setServerSync(
serverUrl.c_str(), serverUrlLen, LOC_AGPS_SUPL_SERVER);
@ -848,7 +855,7 @@ std::vector<LocationError> GnssAdapter::gnssUpdateConfig(const std::string& oldS
errsList[index] = err;
}
}
if ((moServerUrlLen != 0) && (oldMoServerUrl.compare(moServerUrl) != 0)) {
if (0 != oldMoServerUrl.compare(moServerUrl)) {
LocationError locErr =
mLocApi->setServerSync(moServerUrl.c_str(),
moServerUrlLen,
@ -1075,10 +1082,7 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
if (GNSS_CONFIG_GPS_LOCK_NONE == newGpsLock) {
newGpsLock = GNSS_CONFIG_GPS_LOCK_MO;
}
if (newGpsLock == ContextBase::mGps_conf.GPS_LOCK ||
0 != mAdapter.getAfwControlId() || NULL != adapter.mNfwCb) {
gnssConfigNeedEngineUpdate.flags &= ~(GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT);
}
ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
index++;
}
@ -1636,7 +1640,7 @@ GnssAdapter::gnssSvTypeConfigUpdate(const GnssSvTypeConfig& config)
void
GnssAdapter::gnssSvTypeConfigUpdate(bool sendReset)
{
LOC_LOGd("size %zu constellations blacklisted 0x%" PRIx64 ", enabled 0x%" PRIx64
LOC_LOGd("size %" PRIu32" constellations blacklisted 0x%" PRIx64 ", enabled 0x%" PRIx64
", sendReset %d",
mGnssSvTypeConfig.size, mGnssSvTypeConfig.blacklistedSvTypesMask,
mGnssSvTypeConfig.enabledSvTypesMask, sendReset);
@ -2976,10 +2980,8 @@ GnssAdapter::enableCommand(LocationTechnologyType techType)
mAdapter.setAfwControlId(mSessionId);
GnssConfigGpsLock gpsLock = GNSS_CONFIG_GPS_LOCK_NONE;
if (NULL != mAdapter.mNfwCb) {
ContextBase::mGps_conf.GPS_LOCK &= GNSS_CONFIG_GPS_LOCK_NI;
gpsLock = ContextBase::mGps_conf.GPS_LOCK;
}
mApi.sendMsg(new LocApiMsg([&mApi = mApi, gpsLock]() {
mApi.setGpsLockSync(gpsLock);
}));
@ -3026,10 +3028,8 @@ GnssAdapter::disableCommand(uint32_t id)
mContext.modemPowerVote(false);
mAdapter.setAfwControlId(0);
if (NULL != mAdapter.mNfwCb) {
/* We need to disable MO (AFW) */
ContextBase::mGps_conf.GPS_LOCK |= GNSS_CONFIG_GPS_LOCK_MO;
}
GnssConfigGpsLock gpsLock = ContextBase::mGps_conf.GPS_LOCK;
mApi.sendMsg(new LocApiMsg([&mApi = mApi,gpsLock] () {
mApi.setGpsLockSync(gpsLock);
@ -3332,6 +3332,9 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
case GNSS_SIGNAL_BEIDOU_B2AI:
svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b2ai_sv_used_ids_mask;
break;
case GNSS_SIGNAL_BEIDOU_B2AQ:
svUsedIdMask = mGnssMbSvIdUsedInPosition.bds_b2aq_sv_used_ids_mask;
break;
}
} else {
svUsedIdMask = mGnssSvIdUsedInPosition.bds_sv_used_ids_mask;
@ -3779,6 +3782,7 @@ GnssAdapter::reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurement
{
LOC_LOGD("%s]: msInWeek=%d", __func__, msInWeek);
if (0 != gnssMeasurements.gnssMeasNotification.count) {
struct MsgReportGnssMeasurementData : public LocMsg {
GnssAdapter& mAdapter;
GnssMeasurements mGnssMeasurements;
@ -3799,6 +3803,7 @@ GnssAdapter::reportGnssMeasurementsEvent(const GnssMeasurements& gnssMeasurement
};
sendMsg(new MsgReportGnssMeasurementData(*this, gnssMeasurements, msInWeek));
}
mEngHubProxy->gnssReportSvMeasurement(gnssMeasurements.gnssSvMeasurementSet);
}

View file

@ -172,8 +172,9 @@ typedef enum {
GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),// valid Up Velocity Uncertainty
GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),// valid leap seconds
GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),// valid time uncertainty
GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24) // number of SV used in position
GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24), // number of SV used in position
GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT = (1<<25), // valid sensor cal confidence
GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT = (1<<26), // valid sensor cal status
} GnssLocationInfoFlagBits;
typedef enum {
@ -583,7 +584,9 @@ typedef enum {
/** SBAS L1 RF Band */
GNSS_SIGNAL_SBAS_L1 = (1<<17),
/** NAVIC L5 RF Band */
GNSS_SIGNAL_NAVIC_L5 = (1<<18)
GNSS_SIGNAL_NAVIC_L5 = (1<<18),
/** BEIDOU B2A_Q RF Band */
GNSS_SIGNAL_BEIDOU_B2AQ = (1<<19)
} GnssSignalTypeBits;
#define GNSS_SIGNAL_TYPE_MASK_ALL\
@ -593,12 +596,14 @@ typedef enum {
GNSS_SIGNAL_BEIDOU_B1I | GNSS_SIGNAL_BEIDOU_B1C | GNSS_SIGNAL_BEIDOU_B2I|\
GNSS_SIGNAL_BEIDOU_B2AI | GNSS_SIGNAL_QZSS_L1CA | GNSS_SIGNAL_QZSS_L1S |\
GNSS_SIGNAL_QZSS_L2| GNSS_SIGNAL_QZSS_L5 | GNSS_SIGNAL_SBAS_L1 |\
GNSS_SIGNAL_NAVIC_L5)
GNSS_SIGNAL_NAVIC_L5) | GNSS_SIGNAL_BEIDOU_B2AQ
typedef enum
{
GNSS_LOC_SV_SYSTEM_UNKNOWN = 0,
/** unknown sv system. */
GNSS_LOC_SV_SYSTEM_MIN = 1,
/**< Min enum of valid SV system. */
GNSS_LOC_SV_SYSTEM_GPS = 1,
/**< GPS satellite. */
GNSS_LOC_SV_SYSTEM_GALILEO = 2,
@ -611,8 +616,10 @@ typedef enum
/**< BDS satellite. */
GNSS_LOC_SV_SYSTEM_QZSS = 6,
/**< QZSS satellite. */
GNSS_LOC_SV_SYSTEM_NAVIC = 7
GNSS_LOC_SV_SYSTEM_NAVIC = 7,
/**< QZSS satellite. */
GNSS_LOC_SV_SYSTEM_MAX = 7,
/**< Max enum of valid SV system. */
} Gnss_LocSvSystemEnumType;
typedef enum {
@ -635,7 +642,8 @@ typedef enum {
GNSS_LOC_SIGNAL_TYPE_QZSS_L5_Q = 16, /**< QZSS L5_Q RF Band */
GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA = 17, /**< SBAS L1_CA RF Band */
GNSS_LOC_SIGNAL_TYPE_NAVIC_L5 = 18, /**< NAVIC L5 RF Band */
GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 19 /**< Maximum number of signal types */
GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_Q = 19, /**< BEIDOU B2A_Q RF Band */
GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 20 /**< Maximum number of signal types */
} Gnss_LocSignalEnumType;
typedef uint64_t GnssDataMask;
@ -692,6 +700,20 @@ typedef struct {
GnssAidingDataCommon common; // common aiding data
} GnssAidingData;
typedef uint16_t DrCalibrationStatusMask;
typedef enum {
// Indicate that roll calibration is needed. Need to take more turns on level ground
DR_ROLL_CALIBRATION_NEEDED = (1<<0),
// Indicate that pitch calibration is needed. Need to take more turns on level ground
DR_PITCH_CALIBRATION_NEEDED = (1<<1),
// Indicate that yaw calibration is needed. Need to accelerate in a straight line
DR_YAW_CALIBRATION_NEEDED = (1<<2),
// Indicate that odo calibration is needed. Need to accelerate in a straight line
DR_ODO_CALIBRATION_NEEDED = (1<<3),
// Indicate that gyro calibration is needed. Need to take more turns on level ground
DR_GYRO_CALIBRATION_NEEDED = (1<<4)
} DrCalibrationStatusBits;
typedef struct {
uint32_t size; // set to sizeof(Location)
LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
@ -939,6 +961,7 @@ typedef struct {
typedef struct {
uint32_t size; // set to sizeof(GnssLocationInfo)
Location location; // basic locaiton info, latitude, longitude, and etc
GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity
float altitudeMeanSeaLevel; // altitude wrt mean sea level
float pdop; // position dilusion of precision
@ -971,7 +994,9 @@ typedef struct {
GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info
uint8_t leapSeconds; // leap second
float timeUncMs; // Time uncertainty in milliseconds
Location location;
uint8_t calibrationConfidence; // Sensor calibration confidence percent,
// in range of [0, 100]
DrCalibrationStatusMask calibrationStatus; // Sensor calibration status
} GnssLocationInfoNotification;
typedef struct {

View file

@ -164,7 +164,8 @@ public:
umask(0157);
if (mSock->isValid() && ::bind(mSock->mSid, (struct sockaddr*)&mAddr, sizeof(mAddr)) < 0) {
LOC_LOGe("bind socket error. sock fd: %d, reason: %s", mSock->mSid, strerror(errno));
LOC_LOGe("bind socket error. sock fd: %d: %s, reason: %s", mSock->mSid,
mAddr.sun_path, strerror(errno));
mSock->close();
}
}
@ -177,26 +178,22 @@ public:
}
};
class LocIpcInetTcpSender : public LocIpcSender {
class LocIpcInetSender : public LocIpcSender {
protected:
int mSockType;
shared_ptr<Sock> mSock;
const string mName;
sockaddr_in mAddr;
mutable bool mFirstTime;
inline virtual bool isOperable() const override { return mSock != nullptr && mSock->isValid(); }
inline virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
if (mFirstTime) {
mFirstTime = false;
::connect(mSock->mSid, (const struct sockaddr*)&mAddr, sizeof(mAddr));
}
virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
}
public:
inline LocIpcInetTcpSender(const char* name, int32_t port) : LocIpcSender(),
mSock(make_shared<Sock>((nullptr == name) ? -1 : (::socket(AF_INET, SOCK_STREAM, 0)))),
inline LocIpcInetSender(const char* name, int32_t port, int sockType) : LocIpcSender(),
mSockType(sockType),
mSock(make_shared<Sock>((nullptr == name) ? -1 : (::socket(AF_INET, mSockType, 0)))),
mName((nullptr == name) ? "" : name),
mAddr({.sin_family=AF_INET, .sin_port=htons(port), .sin_addr={htonl(INADDR_ANY)}}),
mFirstTime(true) {
mAddr({.sin_family=AF_INET, .sin_port=htons(port), .sin_addr={htonl(INADDR_ANY)}}) {
if (mSock != nullptr && mSock->isValid() && nullptr != name) {
struct hostent* hp = gethostbyname(name);
if (nullptr != hp) {
@ -206,7 +203,47 @@ public:
}
};
class LocIpcInetTcpRecver : public LocIpcInetTcpSender, public LocIpcRecver {
class LocIpcInetTcpSender : public LocIpcInetSender {
protected:
mutable bool mFirstTime;
virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t /* msgId */) const {
if (mFirstTime) {
mFirstTime = false;
::connect(mSock->mSid, (const struct sockaddr*)&mAddr, sizeof(mAddr));
}
return mSock->send(data, length, 0, (struct sockaddr*)&mAddr, sizeof(mAddr));
}
public:
inline LocIpcInetTcpSender(const char* name, int32_t port) :
LocIpcInetSender(name, port, SOCK_STREAM),
mFirstTime(true) {}
};
class LocIpcInetRecver : public LocIpcInetSender, public LocIpcRecver {
protected:
virtual ssize_t recv() const = 0;
public:
inline LocIpcInetRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
int32_t port, int sockType) :
LocIpcInetSender(name, port, sockType), LocIpcRecver(listener, *this) {
if (mSock->isValid() && ::bind(mSock->mSid, (struct sockaddr*)&mAddr, sizeof(mAddr)) < 0) {
LOC_LOGe("bind socket error. sock fd: %d, reason: %s", mSock->mSid, strerror(errno));
mSock->close();
}
}
inline virtual ~LocIpcInetRecver() {}
inline virtual const char* getName() const override { return mName.data(); };
inline virtual void abort() const override {
if (isSendable()) {
mSock->sendAbort(0, (struct sockaddr*)&mAddr, sizeof(mAddr));
}
}
};
class LocIpcInetTcpRecver : public LocIpcInetRecver {
mutable int32_t mConnFd;
protected:
inline virtual ssize_t recv() const override {
@ -223,21 +260,26 @@ protected:
public:
inline LocIpcInetTcpRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
int32_t port) :
LocIpcInetTcpSender(name, port), LocIpcRecver(listener, *this), mConnFd(-1) {
if (mSock->isValid() && ::bind(mSock->mSid, (struct sockaddr*)&mAddr, sizeof(mAddr)) < 0) {
LOC_LOGe("bind socket error. sock fd: %d, reason: %s", mSock->mSid, strerror(errno));
mSock->close();
}
}
LocIpcInetRecver(listener, name, port, SOCK_STREAM), mConnFd(-1) {}
inline virtual ~LocIpcInetTcpRecver() { if (-1 != mConnFd) ::close(mConnFd);}
inline virtual const char* getName() const override { return mName.data(); };
inline virtual void abort() const override {
if (isSendable()) {
mSock->sendAbort(0, (struct sockaddr*)&mAddr, sizeof(mAddr));
}
}
};
class LocIpcInetUdpRecver : public LocIpcInetRecver {
protected:
inline virtual ssize_t recv() const override {
socklen_t size = sizeof(mAddr);
return mSock->recv(mDataCb, 0, (struct sockaddr*)&mAddr, &size);
}
public:
inline LocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener, const char* name,
int32_t port) :
LocIpcInetRecver(listener, name, port, SOCK_DGRAM) {}
inline virtual ~LocIpcInetUdpRecver() {}
};
#ifdef NOT_DEFINED
class LocIpcQcsiSender : public LocIpcSender {
protected:
@ -368,6 +410,13 @@ unique_ptr<LocIpcRecver> LocIpc::getLocIpcInetTcpRecver(const shared_ptr<ILocIpc
const char* serverName, int32_t port) {
return make_unique<LocIpcInetTcpRecver>(listener, serverName, port);
}
shared_ptr<LocIpcSender> LocIpc::getLocIpcInetUdpSender(const char* serverName, int32_t port) {
return make_shared<LocIpcInetSender>(serverName, port, SOCK_DGRAM);
}
unique_ptr<LocIpcRecver> LocIpc::getLocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener,
const char* serverName, int32_t port) {
return make_unique<LocIpcInetUdpRecver>(listener, serverName, port);
}
pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>>
LocIpc::getLocIpcQmiLocServiceSenderRecverPair(const shared_ptr<ILocIpcListener>& listener, int instance) {
typedef pair<shared_ptr<LocIpcSender>, unique_ptr<LocIpcRecver>> (*creator_t)(const shared_ptr<ILocIpcListener>&, int);

View file

@ -66,6 +66,8 @@ public:
static shared_ptr<LocIpcSender>
getLocIpcLocalSender(const char* localSockName);
static shared_ptr<LocIpcSender>
getLocIpcInetUdpSender(const char* serverName, int32_t port);
static shared_ptr<LocIpcSender>
getLocIpcInetTcpSender(const char* serverName, int32_t port);
static shared_ptr<LocIpcSender>
@ -74,6 +76,9 @@ public:
static unique_ptr<LocIpcRecver>
getLocIpcLocalRecver(const shared_ptr<ILocIpcListener>& listener,
const char* localSockName);
static unique_ptr<LocIpcRecver>
getLocIpcInetUdpRecver(const shared_ptr<ILocIpcListener>& listener,
const char* serverName, int32_t port);
static unique_ptr<LocIpcRecver>
getLocIpcInetTcpRecver(const shared_ptr<ILocIpcListener>& listener,
const char* serverName, int32_t port);
@ -122,6 +127,7 @@ protected:
virtual bool isOperable() const = 0;
virtual ssize_t send(const uint8_t data[], uint32_t length, int32_t msgId) const = 0;
public:
virtual void informRecverRestarted() {}
inline bool isSendable() const { return isOperable(); }
inline bool sendData(const uint8_t data[], uint32_t length, int32_t msgId) const {
return isSendable() && (send(data, length, msgId) > 0);

View file

@ -35,7 +35,12 @@
#include <string.h>
#include <loc_gps.h>
#include <LocationAPI.h>
#include <time.h>
struct timespec32_t {
uint32_t tv_sec; /* seconds */
uint32_t tv_nsec; /* and nanoseconds */
};
/**
* @file
@ -132,7 +137,7 @@ typedef enum {
typedef struct {
/** set to sizeof(UlpLocation) */
size_t size;
uint32_t size;
LocGpsLocation gpsLocation;
/* Provider indicator for HYBRID or GPS */
uint16_t position_source;
@ -142,7 +147,7 @@ typedef struct {
typedef struct {
/** set to sizeof(UlpNmea) */
size_t size;
uint32_t size;
char nmea_str[ULP_MAX_NMEA_STRING_SIZE];
unsigned int len;
} UlpNmea;
@ -208,7 +213,7 @@ typedef struct {
/** GPS extended callback structure. */
typedef struct {
/** set to sizeof(LocGpsCallbacks) */
size_t size;
uint32_t size;
loc_gps_set_capabilities set_capabilities_cb;
loc_gps_acquire_wakelock acquire_wakelock_cb;
loc_gps_release_wakelock release_wakelock_cb;
@ -232,7 +237,7 @@ typedef struct {
/** Represents the status of AGPS. */
typedef struct {
/** set to sizeof(AGpsExtStatus) */
size_t size;
uint32_t size;
AGpsExtType type;
LocAGpsStatusValue status;
@ -376,6 +381,10 @@ typedef uint64_t GpsLocationExtendedFlags;
#define GPS_LOCATION_EXTENDED_HAS_HEADING_RATE 0x200000000
/** GpsLocationExtended has multiband signals **/
#define GPS_LOCATION_EXTENDED_HAS_MULTIBAND 0x400000000
/** GpsLocationExtended has sensor calibration confidence */
#define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE 0x800000000
/** GpsLocationExtended has sensor calibration status */
#define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS 0x1000000000
typedef uint32_t LocNavSolutionMask;
/* Bitmask to specify whether SBAS ionospheric correction is used */
@ -392,6 +401,8 @@ typedef uint32_t LocNavSolutionMask;
#define LOC_NAV_MASK_RTK_CORRECTION ((LocNavSolutionMask)0x0020)
/**< Bitmask to specify whether Position Report is PPP corrected */
#define LOC_NAV_MASK_PPP_CORRECTION ((LocNavSolutionMask)0x0040)
/**< Bitmask to specify whether Position Report is RTK fixed corrected */
#define LOC_NAV_MASK_RTK_FIXED_CORRECTION ((LocNavSolutionMask)0x0080)
typedef uint32_t LocPosDataMask;
/* Bitmask to specify whether Navigation data has Forward Acceleration */
@ -458,7 +469,7 @@ typedef enum {
}LocReliability;
typedef struct {
struct timespec apTimeStamp;
struct timespec32_t apTimeStamp;
/*boottime received from pps-ktimer*/
float apTimeStampUncertaintyMs;
/* timestamp uncertainty in milli seconds */
@ -492,6 +503,7 @@ typedef struct {
uint64_t qzss_l2_sv_used_ids_mask; // QZSS L2
uint64_t qzss_l5_sv_used_ids_mask; // QZSS L5
uint64_t sbas_l1_sv_used_ids_mask; // SBAS L1
uint64_t bds_b2aq_sv_used_ids_mask; // BDS B2AQ
} GnssSvMbUsedInPosition;
/* Body Frame parameters */
@ -600,6 +612,8 @@ typedef uint32_t GnssSignalTypeMask;
#define GNSS_SIGNAL_SBAS_L1 ((GnssSignalTypeMask)0x00020000ul)
/** NAVIC L5 RF Band */
#define GNSS_SIGNAL_NAVIC_L5 ((GnssSignalTypeMask)0x00040000ul)
/** BEIDOU B2A_Q RF Band */
#define GNSS_SIGNAL_BEIDOU_B2AQ ((GnssSignalTypeMask)0x00080000ul)
typedef uint16_t GnssMeasUsageStatusBitMask;
/** Used in fix */
@ -685,7 +699,7 @@ typedef struct {
/** Represents gps location extended. */
typedef struct {
/** set to sizeof(GpsLocationExtended) */
size_t size;
uint32_t size;
/** Contains GpsLocationExtendedFlags bits. */
uint64_t flags;
/** Contains the Altitude wrt mean sea level */
@ -784,6 +798,9 @@ typedef struct {
Range: 0 to 359.999. 946
Unit: Degrees per Seconds */
float headingRateDeg;
/** Sensor calibration confidence percent. Range: 0 - 100 */
uint8_t calibrationConfidence;
DrCalibrationStatusMask calibrationStatus;
} GpsLocationExtended;
enum loc_sess_status {
@ -1058,7 +1075,7 @@ typedef enum
typedef struct
{
size_t size;
uint32_t size;
float clockDrift;
/**< Receiver clock Drift \n
- Units: meter per sec \n
@ -1072,7 +1089,7 @@ typedef struct
typedef struct
{
size_t size;
uint32_t size;
uint8_t leapSec;
/**< GPS time leap second delta to UTC time \n
- Units: sec \n
@ -1093,7 +1110,7 @@ typedef enum
typedef struct
{
size_t size;
uint32_t size;
uint32_t validMask;
/* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */
@ -1110,7 +1127,7 @@ typedef struct
typedef struct {
size_t size;
uint32_t size;
uint8_t systemRtc_valid;
/**< Validity indicator for System RTC */
@ -1156,7 +1173,7 @@ typedef enum
typedef struct
{
size_t size;
uint32_t size;
uint32_t svMs;
/**< Satellite time milisecond.\n
For GPS, BDS, GAL range of 0 thru (604800000-1) \n
@ -1216,7 +1233,7 @@ typedef enum
typedef struct
{
size_t size;
uint32_t size;
Gnss_LocSvSystemEnumType gnssSystem;
// 0 signal type mask indicates invalid value
GnssSignalTypeMask gnssSignalTypeMask;
@ -1389,7 +1406,7 @@ typedef uint64_t GpsSvMeasHeaderFlags;
typedef struct
{
size_t size;
uint32_t size;
// see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX
uint64_t flags;
@ -1433,7 +1450,7 @@ typedef struct
} GnssSvMeasurementHeader;
typedef struct {
size_t size;
uint32_t size;
bool isNhz;
GnssSvMeasurementHeader svMeasSetHeader;
uint32_t svMeasCount;
@ -1473,7 +1490,7 @@ typedef enum
typedef struct
{
size_t size;
uint32_t size;
uint16_t gnssSvId;
/* GPS: 1-32, GLO: 65-96, 0: Invalid,
SBAS: 120-151, BDS:201-237,GAL:301 to 336
@ -2034,7 +2051,7 @@ typedef enum {
typedef struct
{
size_t size;
uint32_t size;
Gnss_SrnTech srnTechType; /* SRN Technology type in request */
bool srnRequest; /* scan - start(true) or stop(false) */
bool e911Mode; /* If in E911 emergency */
@ -2054,7 +2071,7 @@ typedef enum {
/* This SV Type config is injected directly to GNSS Adapter
* bypassing Location API */
typedef struct {
size_t size; // set to sizeof(GnssSvTypeConfig)
uint32_t size; // set to sizeof(GnssSvTypeConfig)
// Enabled Constellations
GnssSvTypesMask enabledSvTypesMask;
// Disabled Constellations
@ -2141,7 +2158,7 @@ enum OdcpiRequestType {
ODCPI_REQUEST_TYPE_STOP
};
struct OdcpiRequestInfo {
size_t size;
uint32_t size;
OdcpiRequestType type;
uint32_t tbfMillis;
bool isEmergencyMode;

View file

@ -622,6 +622,9 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
LOC_LOGD("%s:%d]: Setting SAP to mode: BASIC", __func__, __LINE__);
loc_service_mask |= LOC_FEATURE_MASK_SAP_BASIC;
}
else if(strcmp(conf.feature_sap, "MODEM_DEFAULT") == 0) {
LOC_LOGD("%s:%d]: Setting SAP to mode: MODEM_DEFAULT", __func__, __LINE__);
}
else if(strcmp(conf.feature_sap, "DISABLED") == 0) {
LOC_LOGD("%s:%d]: Setting SAP to mode: DISABLED", __func__, __LINE__);
}

View file

@ -548,7 +548,7 @@ typedef uint8_t LocGnssConstellationType;
/** Represents a location. */
typedef struct {
/** set to sizeof(LocGpsLocation) */
size_t size;
uint32_t size;
/** Contains LocGpsLocationFlags bits. */
uint16_t flags;
/** The spoof mask */

View file

@ -36,6 +36,7 @@
#include <loc_cfg.h>
#define GLONASS_SV_ID_OFFSET 64
#define MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION 64
#define MAX_SATELLITES_IN_USE 12
#define MSEC_IN_ONE_WEEK 604800000ULL
#define UTC_GPS_OFFSET_MSECS 315964800000ULL
@ -109,8 +110,9 @@ typedef struct loc_nmea_sv_meta_s
{
char talker[3];
LocGnssConstellationType svType;
uint32_t mask;
uint64_t mask;
uint32_t svCount;
uint32_t totalSvUsedCount;
uint32_t svIdOffset;
uint32_t signalId;
uint32_t systemId;
@ -118,12 +120,12 @@ typedef struct loc_nmea_sv_meta_s
typedef struct loc_sv_cache_info_s
{
uint32_t gps_used_mask;
uint32_t glo_used_mask;
uint32_t gal_used_mask;
uint32_t qzss_used_mask;
uint32_t bds_used_mask;
uint32_t navic_used_mask;
uint64_t gps_used_mask;
uint64_t glo_used_mask;
uint64_t gal_used_mask;
uint64_t qzss_used_mask;
uint64_t bds_used_mask;
uint64_t navic_used_mask;
uint32_t gps_l1_count;
uint32_t gps_l5_count;
uint32_t glo_g1_count;
@ -324,6 +326,7 @@ static uint32_t convert_signalType_to_signalId(GnssSignalTypeMask signalType)
signalId = SIGNAL_ID_BDS_B2I;
break;
case GNSS_SIGNAL_BEIDOU_B2AI:
case GNSS_SIGNAL_BEIDOU_B2AQ:
signalId = SIGNAL_ID_BDS_B2A;
break;
case GNSS_SIGNAL_NAVIC_L5:
@ -337,6 +340,39 @@ static uint32_t convert_signalType_to_signalId(GnssSignalTypeMask signalType)
}
/*===========================================================================
FUNCTION get_sv_count_from_mask
DESCRIPTION
get the sv count from bit mask
DEPENDENCIES
NONE
RETURN VALUE
value of sv count
SIDE EFFECTS
N/A
===========================================================================*/
static uint32_t get_sv_count_from_mask(uint64_t svMask, int totalSvCount)
{
int index = 0;
uint32_t svCount = 0;
if(totalSvCount > MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION) {
LOC_LOGE("total SV count in this constellation %d exceeded limit %d",
totalSvCount, MAX_SV_COUNT_SUPPORTED_IN_ONE_CONSTELLATION);
}
for(index = 0; index < totalSvCount; index++) {
if(svMask & 0x1)
svCount += 1;
svMask >>= 1;
}
return svCount;
}
/*===========================================================================
FUNCTION loc_nmea_sv_meta_init
@ -438,6 +474,19 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
return NULL;
}
sv_meta.signalId = convert_signalType_to_signalId(signalType);
sv_meta.totalSvUsedCount =
get_sv_count_from_mask(sv_cache_info.gps_used_mask,
GPS_SV_PRN_MAX - GPS_SV_PRN_MIN + 1) +
get_sv_count_from_mask(sv_cache_info.glo_used_mask,
GLO_SV_PRN_MAX - GLO_SV_PRN_MIN + 1) +
get_sv_count_from_mask(sv_cache_info.gal_used_mask,
GAL_SV_PRN_MAX - GAL_SV_PRN_MIN + 1) +
get_sv_count_from_mask(sv_cache_info.qzss_used_mask,
QZSS_SV_PRN_MAX - QZSS_SV_PRN_MIN + 1) +
get_sv_count_from_mask(sv_cache_info.bds_used_mask,
BDS_SV_PRN_MAX - BDS_SV_PRN_MIN + 1) +
get_sv_count_from_mask(sv_cache_info.navic_used_mask,
NAVIC_SV_PRN_MAX - NAVIC_SV_PRN_MIN + 1);
if (needCombine &&
(sv_cache_info.gps_used_mask ? 1 : 0) +
(sv_cache_info.glo_used_mask ? 1 : 0) +
@ -532,27 +581,27 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
int length = 0;
uint32_t svUsedCount = 0;
uint32_t svUsedList[32] = {0};
uint32_t svUsedList[64] = {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;
uint64_t mask = sv_meta_p->mask;
for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
for (uint8_t i = 1; mask > 0 && svUsedCount < 64; i++)
{
if (mask & 1)
svUsedList[svUsedCount++] = i + svIdOffset;
mask = mask >> 1;
}
if (svUsedCount == 0 && GNSS_SV_TYPE_GPS != sv_meta_p->svType)
if (svUsedCount == 0)
return 0;
if (svUsedCount == 0)
if (sv_meta_p->totalSvUsedCount == 0)
fixType = '1'; // no fix
else if (svUsedCount <= 3)
else if (sv_meta_p->totalSvUsedCount <= 3)
fixType = '2'; // 2D fix
else
fixType = '3'; // 3D fix
@ -665,10 +714,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
int svCount = sv_meta_p->svCount;
if (svCount <= 0)
{
// no svs in view, so just send a blank $--GSV sentence
snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,%X", talker, sv_meta_p->signalId);
length = loc_nmea_put_checksum(sentence, bufSize);
nmeaArraystr.push_back(sentence);
LOC_LOGV("No SV in view for talker ID:%s, signal ID:%X", talker, sv_meta_p->signalId);
return;
}
@ -880,7 +926,7 @@ static void loc_nmea_generate_DTM(const LocLla &ref_lla,
}
/*===========================================================================
FUNCTION getUtcTimeWithLeapSecondTransition
FUNCTION get_utctime_with_leapsecond_transition
DESCRIPTION
This function returns true if the position report is generated during
@ -900,10 +946,12 @@ SIDE EFFECTS
N/A
===========================================================================*/
bool getUtcTimeWithLeapSecondTransition(const UlpLocation &location,
static bool get_utctime_with_leapsecond_transition(
const UlpLocation &location,
const GpsLocationExtended &locationExtended,
const LocationSystemInfo &systemInfo,
LocGpsUtcTime &utcPosTimestamp) {
LocGpsUtcTime &utcPosTimestamp)
{
bool inTransition = false;
// position report is not generated during leap second transition,
@ -952,6 +1000,94 @@ bool getUtcTimeWithLeapSecondTransition(const UlpLocation &location,
return inTransition;
}
/*===========================================================================
FUNCTION loc_nmea_get_fix_quality
DESCRIPTION
This function obtains the fix quality for GGA sentence, mode indicator
for RMC and VTG sentence based on nav solution mask and tech mask in
the postion report.
DEPENDENCIES
NONE
Output parameter
ggaGpsQuality: gps quality field in GGA sentence
rmcModeIndicator: mode indicator field in RMC sentence
vtgModeIndicator: mode indicator field in VTG sentence
SIDE EFFECTS
N/A
===========================================================================*/
static void loc_nmea_get_fix_quality(const UlpLocation & location,
const GpsLocationExtended & locationExtended,
char & ggaGpsQuality,
char & rmcModeIndicator,
char & vtgModeIndicator) {
ggaGpsQuality = '0';
rmcModeIndicator = 'N';
vtgModeIndicator = 'N';
do {
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG)){
ggaGpsQuality = '0'; // 0 means no fix
rmcModeIndicator = 'N';
vtgModeIndicator = 'N';
break;
}
// NOTE: Order of the check is important
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK) {
if (LOC_NAV_MASK_PPP_CORRECTION & locationExtended.navSolutionMask) {
ggaGpsQuality = '2'; // 2 means DGPS fix
rmcModeIndicator = 'P'; // P means precise
vtgModeIndicator = 'P'; // P means precise
break;
} else if (LOC_NAV_MASK_RTK_FIXED_CORRECTION & locationExtended.navSolutionMask){
ggaGpsQuality = '4'; // 4 means RTK Fixed fix
rmcModeIndicator = 'R'; // use R (RTK fixed)
vtgModeIndicator = 'D'; // use D (differential) as
// no RTK fixed defined for VTG in NMEA 183 spec
break;
} else if (LOC_NAV_MASK_RTK_CORRECTION & locationExtended.navSolutionMask){
ggaGpsQuality = '5'; // 5 means RTK float fix
rmcModeIndicator = 'F'; // F means RTK float fix
vtgModeIndicator = 'D'; // use D (differential) as
// no RTK float defined for VTG in NMEA 183 spec
break;
} else if (LOC_NAV_MASK_DGNSS_CORRECTION & locationExtended.navSolutionMask){
ggaGpsQuality = '2'; // 2 means DGPS fix
rmcModeIndicator = 'D'; // D means differential
vtgModeIndicator = 'D'; // D means differential
break;
} else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask){
ggaGpsQuality = '2'; // 2 means DGPS fix
rmcModeIndicator = 'D'; // D means differential
vtgModeIndicator = 'D'; // D means differential
break;
}
}
// NOTE: Order of the check is important
if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK) {
if (LOC_POS_TECH_MASK_SATELLITE & locationExtended.tech_mask){
ggaGpsQuality = '1'; // 1 means GPS
rmcModeIndicator = 'A'; // A means autonomous
vtgModeIndicator = 'A'; // A means autonomous
break;
} else if (LOC_POS_TECH_MASK_SENSORS & locationExtended.tech_mask){
ggaGpsQuality = '6'; // 6 means estimated (dead reckoning)
rmcModeIndicator = 'E'; // E means estimated (dead reckoning)
vtgModeIndicator = 'E'; // E means estimated (dead reckoning)
break;
}
}
} while (0);
LOC_LOGv("gps quality: %c, rmc mode indicator: %c, vtg mode indicator: %c",
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
}
/*===========================================================================
FUNCTION loc_nmea_generate_pos
@ -987,7 +1123,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
LocGpsUtcTime utcPosTimestamp = 0;
bool inLsTransition = false;
inLsTransition = getUtcTimeWithLeapSecondTransition
inLsTransition = get_utctime_with_leapsecond_transition
(location, locationExtended, systemInfo, utcPosTimestamp);
time_t utcTime(utcPosTimestamp/1000);
@ -1035,19 +1171,22 @@ void loc_nmea_generate_pos(const UlpLocation &location,
if (GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA & locationExtended.flags) {
sv_cache_info.gps_used_mask =
(uint32_t)locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask;
sv_cache_info.glo_used_mask =
(uint32_t)locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask;
sv_cache_info.gal_used_mask =
(uint32_t)locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
sv_cache_info.qzss_used_mask =
(uint32_t)locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask;
sv_cache_info.bds_used_mask =
(uint32_t)locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask;
sv_cache_info.qzss_used_mask =
locationExtended.gnss_sv_used_ids.qzss_sv_used_ids_mask;
sv_cache_info.navic_used_mask =
locationExtended.gnss_sv_used_ids.navic_sv_used_ids_mask;
}
if (generate_nmea) {
char talker[3] = {'G', 'P', '\0'};
char modeIndicator[7] = {0};
uint32_t svUsedCount = 0;
uint32_t count = 0;
loc_nmea_sv_meta sv_meta;
@ -1093,8 +1232,21 @@ void loc_nmea_generate_pos(const UlpLocation &location,
talker[1] = sv_meta.talker[1];
}
// ----------------------------
// ---$GBGSA/$GNGSA (BEIDOU)---
// ----------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
talker[0] = sv_meta.talker[0];
talker[1] = sv_meta.talker[1];
}
// --------------------------
// ---$PQGSA/$GNGSA (QZSS)---
// ---$GQGSA/$GNGSA (QZSS)---
// --------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
@ -1107,18 +1259,11 @@ void loc_nmea_generate_pos(const UlpLocation &location,
talker[1] = sv_meta.talker[1];
}
// ----------------------------
// ---$PQGSA/$GNGSA (BEIDOU)---
// ----------------------------
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_BEIDOU,
GNSS_SIGNAL_BEIDOU_B1I, true), nmeaArraystr);
if (count > 0)
{
svUsedCount += count;
talker[0] = sv_meta.talker[0];
talker[1] = sv_meta.talker[1];
}
char ggaGpsQuality = '0';
char rmcModeIndicator = 'N';
char vtgModeIndicator = 'N';
loc_nmea_get_fix_quality(location, locationExtended,
ggaGpsQuality, rmcModeIndicator, vtgModeIndicator);
// -------------------
// ------$--VTG-------
@ -1174,17 +1319,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker += length;
lengthRemaining -= length;
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
// N means no fix
length = snprintf(pMarker, lengthRemaining, "%c", 'N');
else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
// D means differential
length = snprintf(pMarker, lengthRemaining, "%c", 'D');
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
// E means estimated (dead reckoning)
length = snprintf(pMarker, lengthRemaining, "%c", 'E');
else // A means autonomous
length = snprintf(pMarker, lengthRemaining, "%c", 'A');
length = snprintf(pMarker, lengthRemaining, "%c", vtgModeIndicator);
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
@ -1372,18 +1507,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker += length;
lengthRemaining -= length;
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
// N means no fix
length = snprintf(pMarker, lengthRemaining, "%c", 'N');
else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
// D means differential
length = snprintf(pMarker, lengthRemaining, "%c", 'D');
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
// E means estimated (dead reckoning)
length = snprintf(pMarker, lengthRemaining, "%c", 'E');
else // A means autonomous
length = snprintf(pMarker, lengthRemaining, "%c", 'A');
length = snprintf(pMarker, lengthRemaining, "%c", rmcModeIndicator);
pMarker += length;
lengthRemaining -= length;
@ -1461,17 +1585,49 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker += length;
lengthRemaining -= length;
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
// N means no fix
length = snprintf(pMarker, lengthRemaining, "%c,", 'N');
if(!(sv_cache_info.gps_used_mask ? 1 : 0))
modeIndicator[0] = 'N';
else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
// D means differential
length = snprintf(pMarker, lengthRemaining, "%c,", 'D');
modeIndicator[0] = 'D';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
// E means estimated (dead reckoning)
length = snprintf(pMarker, lengthRemaining, "%c,", 'E');
else // A means autonomous
length = snprintf(pMarker, lengthRemaining, "%c,", 'A');
modeIndicator[0] = 'E';
else
modeIndicator[0] = 'A';
if(!(sv_cache_info.glo_used_mask ? 1 : 0))
modeIndicator[1] = 'N';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
modeIndicator[1] = 'E';
else
modeIndicator[1] = 'A';
if(!(sv_cache_info.gal_used_mask ? 1 : 0))
modeIndicator[2] = 'N';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
modeIndicator[2] = 'E';
else
modeIndicator[2] = 'A';
if(!(sv_cache_info.bds_used_mask ? 1 : 0))
modeIndicator[3] = 'N';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
modeIndicator[3] = 'E';
else
modeIndicator[3] = 'A';
if(!(sv_cache_info.qzss_used_mask ? 1 : 0))
modeIndicator[4] = 'N';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
modeIndicator[4] = 'E';
else
modeIndicator[4] = 'A';
if(!(sv_cache_info.navic_used_mask ? 1 : 0))
modeIndicator[5] = 'N';
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
modeIndicator[5] = 'E';
else
modeIndicator[5] = 'A';
modeIndicator[6] = '\0';
for(int index = 5; index > 0 && 'N' == modeIndicator[index]; index--) {
modeIndicator[index] = '\0';
}
length = snprintf(pMarker, lengthRemaining,"%s,", modeIndicator);
pMarker += length;
lengthRemaining -= length;
@ -1600,28 +1756,18 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker += length;
lengthRemaining -= length;
char gpsQuality;
if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
gpsQuality = '0'; // 0 means no fix
else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
gpsQuality = '2'; // 2 means DGPS fix
else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
gpsQuality = '6'; // 6 means estimated (dead reckoning)
else
gpsQuality = '1'; // 1 means GPS 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)
{
length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
gpsQuality, svUsedCount, locationExtended.hdop);
ggaGpsQuality, svUsedCount, locationExtended.hdop);
}
else
{ // no hdop
length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
gpsQuality, svUsedCount);
ggaGpsQuality, svUsedCount);
}
if (length < 0 || length >= lengthRemaining)
@ -1687,10 +1833,6 @@ void loc_nmea_generate_pos(const UlpLocation &location,
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GNGSA,A,1,,,,,,,,,,,,,,,,", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
length = loc_nmea_put_checksum(sentence, sizeof(sentence));
nmeaArraystr.push_back(sentence);