Mark SV used_in_fix based on the most recent position report
When SV report comes, mark used_in_fix based on the most recent position report. Change-Id: I98f3f4e7836de86f9025bae446cdeac6d1eb5862 CRs-Fixed: 1080013
This commit is contained in:
parent
c75f2c6908
commit
90a730d179
5 changed files with 105 additions and 5 deletions
|
@ -237,13 +237,18 @@ void LocApiBase::reportPosition(UlpLocation &location,
|
||||||
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
|
LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
|
||||||
"altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
|
"altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
|
||||||
"timestamp: %lld\n rawDataSize: %d\n rawData: %p\n "
|
"timestamp: %lld\n rawDataSize: %d\n rawData: %p\n "
|
||||||
"Session status: %d\n Technology mask: %u",
|
"Session status: %d\n Technology mask: %u\n "
|
||||||
|
"SV used in fix (gps/glo/bds/gal) : (%x/%x/%x/%x)",
|
||||||
location.gpsLocation.flags, location.position_source,
|
location.gpsLocation.flags, location.position_source,
|
||||||
location.gpsLocation.latitude, location.gpsLocation.longitude,
|
location.gpsLocation.latitude, location.gpsLocation.longitude,
|
||||||
location.gpsLocation.altitude, location.gpsLocation.speed,
|
location.gpsLocation.altitude, location.gpsLocation.speed,
|
||||||
location.gpsLocation.bearing, location.gpsLocation.accuracy,
|
location.gpsLocation.bearing, location.gpsLocation.accuracy,
|
||||||
location.gpsLocation.timestamp, location.rawDataSize,
|
location.gpsLocation.timestamp, location.rawDataSize,
|
||||||
location.rawData, status, loc_technology_mask);
|
location.rawData, status, loc_technology_mask,
|
||||||
|
locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
|
||||||
|
locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
|
||||||
|
locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
|
||||||
|
locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask);
|
||||||
// loop through adapters, and deliver to all adapters.
|
// loop through adapters, and deliver to all adapters.
|
||||||
TO_ALL_LOCADAPTERS(
|
TO_ALL_LOCADAPTERS(
|
||||||
mLocAdapters[i]->reportPosition(location,
|
mLocAdapters[i]->reportPosition(location,
|
||||||
|
|
|
@ -262,6 +262,18 @@ typedef uint16_t GpsLocationExtendedFlags;
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400
|
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400
|
||||||
/** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */
|
/** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */
|
||||||
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800
|
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800
|
||||||
|
/** GpsLocationExtended has valid gnss sv used in position data */
|
||||||
|
#define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000
|
||||||
|
|
||||||
|
/** GPS PRN Range */
|
||||||
|
#define GPS_SV_PRN_MIN 1
|
||||||
|
#define GPS_SV_PRN_MAX 32
|
||||||
|
#define GLO_SV_PRN_MIN 65
|
||||||
|
#define GLO_SV_PRN_MAX 96
|
||||||
|
#define BDS_SV_PRN_MIN 201
|
||||||
|
#define BDS_SV_PRN_MAX 235
|
||||||
|
#define GAL_SV_PRN_MIN 301
|
||||||
|
#define GAL_SV_PRN_MAX 336
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOC_RELIABILITY_NOT_SET = 0,
|
LOC_RELIABILITY_NOT_SET = 0,
|
||||||
|
@ -278,6 +290,13 @@ typedef struct {
|
||||||
/* timestamp uncertainty in milli seconds */
|
/* timestamp uncertainty in milli seconds */
|
||||||
}Gnss_ApTimeStampStructType;
|
}Gnss_ApTimeStampStructType;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint64_t gps_sv_used_ids_mask;
|
||||||
|
uint64_t glo_sv_used_ids_mask;
|
||||||
|
uint64_t gal_sv_used_ids_mask;
|
||||||
|
uint64_t bds_sv_used_ids_mask;
|
||||||
|
} GnssSvUsedInPosition;
|
||||||
|
|
||||||
/** Represents gps location extended. */
|
/** Represents gps location extended. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** set to sizeof(GpsLocationExtended) */
|
/** set to sizeof(GpsLocationExtended) */
|
||||||
|
@ -312,6 +331,8 @@ typedef struct {
|
||||||
float horUncEllipseOrientAzimuth;
|
float horUncEllipseOrientAzimuth;
|
||||||
|
|
||||||
Gnss_ApTimeStampStructType timeStamp;
|
Gnss_ApTimeStampStructType timeStamp;
|
||||||
|
/** Gnss sv used in position data */
|
||||||
|
GnssSvUsedInPosition gnss_sv_used_ids;
|
||||||
} GpsLocationExtended;
|
} GpsLocationExtended;
|
||||||
|
|
||||||
enum loc_sess_status {
|
enum loc_sess_status {
|
||||||
|
|
|
@ -81,6 +81,7 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||||
{
|
{
|
||||||
memset(&mFixCriteria, 0, sizeof(mFixCriteria));
|
memset(&mFixCriteria, 0, sizeof(mFixCriteria));
|
||||||
mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
|
mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
|
||||||
|
clearGnssSvUsedListData();
|
||||||
LOC_LOGD("LocEngAdapter created");
|
LOC_LOGD("LocEngAdapter created");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,9 @@ class LocEngAdapter : public LocAdapterBase {
|
||||||
unsigned int mPowerVote;
|
unsigned int mPowerVote;
|
||||||
static const unsigned int POWER_VOTE_RIGHT = 0x20;
|
static const unsigned int POWER_VOTE_RIGHT = 0x20;
|
||||||
static const unsigned int POWER_VOTE_VALUE = 0x10;
|
static const unsigned int POWER_VOTE_VALUE = 0x10;
|
||||||
|
/** Gnss sv used in position data */
|
||||||
|
GnssSvUsedInPosition mGnssSvIdUsedInPosition;
|
||||||
|
bool mGnssSvIdUsedInPosAvail;
|
||||||
public:
|
public:
|
||||||
bool mSupportsAgpsRequests;
|
bool mSupportsAgpsRequests;
|
||||||
bool mSupportsPositionInjection;
|
bool mSupportsPositionInjection;
|
||||||
|
@ -111,6 +113,25 @@ public:
|
||||||
}
|
}
|
||||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||||
|
|
||||||
|
inline void clearGnssSvUsedListData() {
|
||||||
|
mGnssSvIdUsedInPosAvail = false;
|
||||||
|
memset(&mGnssSvIdUsedInPosition, 0, sizeof (GnssSvUsedInPosition));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setGnssSvUsedListData(GnssSvUsedInPosition gnssSvUsedIds) {
|
||||||
|
mGnssSvIdUsedInPosAvail = true;
|
||||||
|
memcpy(&mGnssSvIdUsedInPosition, &gnssSvUsedIds,
|
||||||
|
sizeof(GnssSvUsedInPosition));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline GnssSvUsedInPosition getGnssSvUsedListData() {
|
||||||
|
return mGnssSvIdUsedInPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isGnssSvIdUsedInPosAvail() {
|
||||||
|
return mGnssSvIdUsedInPosAvail;
|
||||||
|
}
|
||||||
|
|
||||||
inline enum loc_api_adapter_err
|
inline enum loc_api_adapter_err
|
||||||
startFix()
|
startFix()
|
||||||
{
|
{
|
||||||
|
|
|
@ -290,6 +290,7 @@ LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
|
||||||
inline void LocEngStopFix::proc() const
|
inline void LocEngStopFix::proc() const
|
||||||
{
|
{
|
||||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
|
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
|
||||||
|
mAdapter->clearGnssSvUsedListData();
|
||||||
loc_eng_stop_handler(*locEng);
|
loc_eng_stop_handler(*locEng);
|
||||||
}
|
}
|
||||||
inline void LocEngStopFix::locallog() const
|
inline void LocEngStopFix::locallog() const
|
||||||
|
@ -806,6 +807,10 @@ void LocEngReportPosition::proc() const {
|
||||||
(gps_conf.ACCURACY_THRES != 0) &&
|
(gps_conf.ACCURACY_THRES != 0) &&
|
||||||
(mLocation.gpsLocation.accuracy >
|
(mLocation.gpsLocation.accuracy >
|
||||||
gps_conf.ACCURACY_THRES)))) {
|
gps_conf.ACCURACY_THRES)))) {
|
||||||
|
if (mLocationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA)
|
||||||
|
{
|
||||||
|
adapter->setGnssSvUsedListData(mLocationExtended.gnss_sv_used_ids);
|
||||||
|
}
|
||||||
locEng->location_cb((UlpLocation*)&(mLocation),
|
locEng->location_cb((UlpLocation*)&(mLocation),
|
||||||
(void*)mLocationExt);
|
(void*)mLocationExt);
|
||||||
reported = true;
|
reported = true;
|
||||||
|
@ -880,14 +885,61 @@ void LocEngReportSv::proc() const {
|
||||||
|
|
||||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||||
{
|
{
|
||||||
|
GnssSvStatus gnssSvStatus;
|
||||||
|
memcpy(&gnssSvStatus,&mSvStatus,sizeof(GnssSvStatus));
|
||||||
|
if (adapter->isGnssSvIdUsedInPosAvail())
|
||||||
|
{
|
||||||
|
GnssSvUsedInPosition gnssSvIdUsedInPosition =
|
||||||
|
adapter->getGnssSvUsedListData();
|
||||||
|
int numSv = gnssSvStatus.num_svs;
|
||||||
|
int16_t gnssSvId = 0;
|
||||||
|
int prnMin = 0;
|
||||||
|
uint64_t svUsedIdMask = 0;
|
||||||
|
for (int i=0; i < numSv; i++)
|
||||||
|
{
|
||||||
|
gnssSvId = gnssSvStatus.gnss_sv_list[i].svid;
|
||||||
|
if (gnssSvId <= GPS_SV_PRN_MAX)
|
||||||
|
{
|
||||||
|
svUsedIdMask = gnssSvIdUsedInPosition.gps_sv_used_ids_mask;
|
||||||
|
prnMin = GPS_SV_PRN_MIN;
|
||||||
|
}
|
||||||
|
else if ((gnssSvId >= GLO_SV_PRN_MIN) && (gnssSvId <= GLO_SV_PRN_MAX))
|
||||||
|
{
|
||||||
|
svUsedIdMask = gnssSvIdUsedInPosition.glo_sv_used_ids_mask;
|
||||||
|
prnMin = GLO_SV_PRN_MIN;
|
||||||
|
}
|
||||||
|
else if ((gnssSvId >= BDS_SV_PRN_MIN) && (gnssSvId <= BDS_SV_PRN_MAX))
|
||||||
|
{
|
||||||
|
svUsedIdMask = gnssSvIdUsedInPosition.bds_sv_used_ids_mask;
|
||||||
|
prnMin = BDS_SV_PRN_MIN;
|
||||||
|
}
|
||||||
|
else if ((gnssSvId >= GAL_SV_PRN_MIN) && (gnssSvId <= GAL_SV_PRN_MAX))
|
||||||
|
{
|
||||||
|
svUsedIdMask = gnssSvIdUsedInPosition.gal_sv_used_ids_mask;
|
||||||
|
prnMin = GAL_SV_PRN_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If SV ID was used in previous position fix, then set USED_IN_FIX
|
||||||
|
// flag, else clear the USED_IN_FIX flag.
|
||||||
|
if (svUsedIdMask & (1 << (gnssSvId - prnMin)))
|
||||||
|
{
|
||||||
|
gnssSvStatus.gnss_sv_list[i].flags |= GNSS_SV_FLAGS_USED_IN_FIX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gnssSvStatus.gnss_sv_list[i].flags &= ~GNSS_SV_FLAGS_USED_IN_FIX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (locEng->gnss_sv_status_cb != NULL) {
|
if (locEng->gnss_sv_status_cb != NULL) {
|
||||||
LOC_LOGE("Calling gnss_sv_status_cb");
|
LOC_LOGE("Calling gnss_sv_status_cb");
|
||||||
locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
|
locEng->gnss_sv_status_cb((GnssSvStatus*)&(gnssSvStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locEng->generateNmea)
|
if (locEng->generateNmea)
|
||||||
{
|
{
|
||||||
loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
|
loc_eng_nmea_generate_sv(locEng, gnssSvStatus, mLocationExtended);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue