Skip to content

Commit

Permalink
gps: Update to CAF LA.UM.5.5.r1-04000-8x96.0
Browse files Browse the repository at this point in the history
Change-Id: Ib3939c5beb8d60888a72371469646ff8e4746bf1
  • Loading branch information
kerneltoast authored and SubhrajyotiSen committed Jun 18, 2017
1 parent 2360ce9 commit 3b4b385
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 10 deletions.
9 changes: 7 additions & 2 deletions gps/core/LocApiBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,18 @@ void LocApiBase::reportPosition(UlpLocation &location,
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 "
"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.latitude, location.gpsLocation.longitude,
location.gpsLocation.altitude, location.gpsLocation.speed,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
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.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,
Expand Down
21 changes: 21 additions & 0 deletions gps/core/gps_extended_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ typedef uint16_t GpsLocationExtendedFlags;
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400
/** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */
#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 {
LOC_RELIABILITY_NOT_SET = 0,
Expand All @@ -269,6 +281,13 @@ typedef struct {
/* timestamp uncertainty in milli seconds */
}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. */
typedef struct {
/** set to sizeof(GpsLocationExtended) */
Expand Down Expand Up @@ -303,6 +322,8 @@ typedef struct {
float horUncEllipseOrientAzimuth;

Gnss_ApTimeStampStructType timeStamp;
/** Gnss sv used in position data */
GnssSvUsedInPosition gnss_sv_used_ids;
} GpsLocationExtended;

enum loc_sess_status {
Expand Down
9 changes: 4 additions & 5 deletions gps/loc_api/libloc_api_50001/LocEngAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
{
memset(&mFixCriteria, 0, sizeof(mFixCriteria));
mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
clearGnssSvUsedListData();
LOC_LOGD("LocEngAdapter created");
}

Expand Down Expand Up @@ -194,11 +195,9 @@ void LocEngAdapter::setXtraUserAgent() {
fclose(file);

// remove trailing spaces
char *s;
s = buf + strlen(buf);
while (--s >= buf) {
if (!isspace(*s)) break;
*s = 0;
size_t len = strlen(buf);
while (--len >= 0 && isspace(buf[len])) {
buf[len] = '\0';
}
}

Expand Down
23 changes: 22 additions & 1 deletion gps/loc_api/libloc_api_50001/LocEngAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class LocEngAdapter : public LocAdapterBase {
unsigned int mPowerVote;
static const unsigned int POWER_VOTE_RIGHT = 0x20;
static const unsigned int POWER_VOTE_VALUE = 0x10;

/** Gnss sv used in position data */
GnssSvUsedInPosition mGnssSvIdUsedInPosition;
bool mGnssSvIdUsedInPosAvail;
public:
bool mSupportsAgpsRequests;
bool mSupportsPositionInjection;
Expand Down Expand Up @@ -110,6 +112,25 @@ class LocEngAdapter : public LocAdapterBase {
}
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
startFix()
{
Expand Down
52 changes: 50 additions & 2 deletions gps/loc_api/libloc_api_50001/loc_eng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
inline void LocEngStopFix::proc() const
{
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
mAdapter->clearGnssSvUsedListData();
loc_eng_stop_handler(*locEng);
}
inline void LocEngStopFix::locallog() const
Expand Down Expand Up @@ -806,6 +807,10 @@ void LocEngReportPosition::proc() const {
(gps_conf.ACCURACY_THRES != 0) &&
(mLocation.gpsLocation.accuracy >
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),
(void*)mLocationExt);
reported = true;
Expand Down Expand Up @@ -880,14 +885,57 @@ void LocEngReportSv::proc() const {

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;
uint64_t svUsedIdMask = 0;
for (int i=0; i < numSv; i++)
{
gnssSvId = gnssSvStatus.gnss_sv_list[i].svid;
switch(gnssSvStatus.gnss_sv_list[i].constellation) {
case GNSS_CONSTELLATION_GPS:
svUsedIdMask = gnssSvIdUsedInPosition.gps_sv_used_ids_mask;
break;
case GNSS_CONSTELLATION_GLONASS:
svUsedIdMask = gnssSvIdUsedInPosition.glo_sv_used_ids_mask;
break;
case GNSS_CONSTELLATION_BEIDOU:
svUsedIdMask = gnssSvIdUsedInPosition.bds_sv_used_ids_mask;
break;
case GNSS_CONSTELLATION_GALILEO:
svUsedIdMask = gnssSvIdUsedInPosition.gal_sv_used_ids_mask;
break;
default:
svUsedIdMask = 0;
break;
}

// 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 - 1)))
{
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) {
LOC_LOGE("Calling gnss_sv_status_cb");
locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
locEng->gnss_sv_status_cb((GnssSvStatus*)&(gnssSvStatus));
}

if (locEng->generateNmea)
{
loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
loc_eng_nmea_generate_sv(locEng, gnssSvStatus, mLocationExtended);
}
}
}
Expand Down

0 comments on commit 3b4b385

Please sign in to comment.