Promotion of location.lnx.1.0-00025.
CRs Change ID Subject -------------------------------------------------------------------------------------------------------------- 978745 I7ab0e92c7ed4ce73be11909eefe0d570a1a0fc1e Adding a new NMEA sentence : $GNGSA. 989476 I2eaba5a89e64088e3383b962dceaaa7e975e997a Enabling CLANG compilation and fixing all resulting erro Change-Id: I42005bade478892728a78b2613f41bb5b29980aa CRs-Fixed: 989476, 978745
This commit is contained in:
commit
8ef6c3cc1a
8 changed files with 173 additions and 17 deletions
|
@ -43,6 +43,10 @@ class LBSProxyBase {
|
||||||
getLocApi(const MsgTask* msgTask,
|
getLocApi(const MsgTask* msgTask,
|
||||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||||
ContextBase* context) const {
|
ContextBase* context) const {
|
||||||
|
|
||||||
|
(void)msgTask;
|
||||||
|
(void)exMask;
|
||||||
|
(void)context;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
|
@ -50,11 +54,21 @@ protected:
|
||||||
public:
|
public:
|
||||||
inline virtual ~LBSProxyBase() {}
|
inline virtual ~LBSProxyBase() {}
|
||||||
inline virtual void requestUlp(LocAdapterBase* adapter,
|
inline virtual void requestUlp(LocAdapterBase* adapter,
|
||||||
unsigned long capabilities) const {}
|
unsigned long capabilities) const {
|
||||||
|
|
||||||
|
(void)adapter;
|
||||||
|
(void)capabilities;
|
||||||
|
}
|
||||||
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
|
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
|
||||||
inline virtual bool hasCPIExtendedCapabilities() const { return false; }
|
inline virtual bool hasCPIExtendedCapabilities() const { return false; }
|
||||||
inline virtual void modemPowerVote(bool power) const {}
|
inline virtual void modemPowerVote(bool power) const {
|
||||||
virtual void injectFeatureConfig(ContextBase* context) const {}
|
|
||||||
|
(void)power;
|
||||||
|
}
|
||||||
|
virtual void injectFeatureConfig(ContextBase* context) const {
|
||||||
|
|
||||||
|
(void)context;
|
||||||
|
}
|
||||||
inline virtual IzatDevId_t getIzatDevId() const { return 0; }
|
inline virtual IzatDevId_t getIzatDevId() const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,16 @@ public:
|
||||||
|
|
||||||
// This will be overridden by the individual adapters
|
// This will be overridden by the individual adapters
|
||||||
// if necessary.
|
// if necessary.
|
||||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
inline virtual void setUlpProxy(UlpProxyBase* ulp) {
|
||||||
|
|
||||||
|
(void)ulp;
|
||||||
|
}
|
||||||
virtual void handleEngineUpEvent();
|
virtual void handleEngineUpEvent();
|
||||||
virtual void handleEngineDownEvent();
|
virtual void handleEngineDownEvent();
|
||||||
inline virtual void setPositionModeInt(LocPosMode& posMode) {}
|
inline virtual void setPositionModeInt(LocPosMode& posMode) {
|
||||||
|
|
||||||
|
(void)posMode;
|
||||||
|
}
|
||||||
virtual void startFixInt() {}
|
virtual void startFixInt() {}
|
||||||
virtual void stopFixInt() {}
|
virtual void stopFixInt() {}
|
||||||
virtual void getZppInt() {}
|
virtual void getZppInt() {}
|
||||||
|
|
|
@ -61,6 +61,11 @@ public:
|
||||||
GpsLocationExtended &locationExtended,
|
GpsLocationExtended &locationExtended,
|
||||||
enum loc_sess_status status,
|
enum loc_sess_status status,
|
||||||
LocPosTechMask loc_technology_mask) {
|
LocPosTechMask loc_technology_mask) {
|
||||||
|
|
||||||
|
(void)location;
|
||||||
|
(void)locationExtended;
|
||||||
|
(void)status;
|
||||||
|
(void)loc_technology_mask;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -214,9 +214,15 @@ public:
|
||||||
virtual void installAGpsCert(const DerEncodedCertificate* pData,
|
virtual void installAGpsCert(const DerEncodedCertificate* pData,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t slotBitMask);
|
uint32_t slotBitMask);
|
||||||
inline virtual void setInSession(bool inSession) {}
|
inline virtual void setInSession(bool inSession) {
|
||||||
|
|
||||||
|
(void)inSession;
|
||||||
|
}
|
||||||
inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
|
inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
|
||||||
if (msgID > (sizeof(mSupportedMsg) << 3)) {
|
|
||||||
|
// confirm if msgID is not larger than the number of bits in
|
||||||
|
// mSupportedMsg
|
||||||
|
if ((uint64_t)msgID > (sizeof(mSupportedMsg) << 3)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
uint32_t messageChecker = 1 << msgID;
|
uint32_t messageChecker = 1 << msgID;
|
||||||
|
|
|
@ -57,24 +57,45 @@ public:
|
||||||
void* locationExt,
|
void* locationExt,
|
||||||
enum loc_sess_status status,
|
enum loc_sess_status status,
|
||||||
LocPosTechMask loc_technology_mask) {
|
LocPosTechMask loc_technology_mask) {
|
||||||
|
(void)location;
|
||||||
|
(void)locationExtended;
|
||||||
|
(void)locationExt;
|
||||||
|
(void)status;
|
||||||
|
(void)loc_technology_mask;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline virtual bool reportSv(GnssSvStatus &svStatus,
|
inline virtual bool reportSv(GnssSvStatus &svStatus,
|
||||||
GpsLocationExtended &locationExtended,
|
GpsLocationExtended &locationExtended,
|
||||||
void* svExt) {
|
void* svExt) {
|
||||||
|
(void)svStatus;
|
||||||
|
(void)locationExtended;
|
||||||
|
(void)svExt;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline virtual bool reportStatus(GpsStatusValue status) {
|
inline virtual bool reportStatus(GpsStatusValue status) {
|
||||||
|
|
||||||
|
(void)status;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline virtual void setAdapter(LocAdapterBase* adapter) {}
|
inline virtual void setAdapter(LocAdapterBase* adapter) {
|
||||||
inline virtual void setCapabilities(unsigned long capabilities) {}
|
|
||||||
|
(void)adapter;
|
||||||
|
}
|
||||||
|
inline virtual void setCapabilities(unsigned long capabilities) {
|
||||||
|
|
||||||
|
(void)capabilities;
|
||||||
|
}
|
||||||
inline virtual bool reportBatchingSession(FlpExtBatchOptions &options,
|
inline virtual bool reportBatchingSession(FlpExtBatchOptions &options,
|
||||||
bool active) {
|
bool active) {
|
||||||
|
|
||||||
|
(void)options;
|
||||||
|
(void)active;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline virtual bool reportPositions(const FlpExtLocation* locations,
|
inline virtual bool reportPositions(const FlpExtLocation* locations,
|
||||||
int32_t number_of_locations) {
|
int32_t number_of_locations) {
|
||||||
|
(void)locations;
|
||||||
|
(void)number_of_locations;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -119,7 +119,8 @@ typedef struct loc_eng_data_s
|
||||||
|
|
||||||
// For nmea generation
|
// For nmea generation
|
||||||
boolean generateNmea;
|
boolean generateNmea;
|
||||||
uint32_t sv_used_mask;
|
uint32_t gps_used_mask;
|
||||||
|
uint32_t glo_used_mask;
|
||||||
float hdop;
|
float hdop;
|
||||||
float pdop;
|
float pdop;
|
||||||
float vdop;
|
float vdop;
|
||||||
|
|
|
@ -101,6 +101,12 @@ FUNCTION loc_eng_nmea_generate_pos
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Generate NMEA sentences generated based on position report
|
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
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
NONE
|
NONE
|
||||||
|
@ -144,7 +150,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
|
||||||
|
|
||||||
uint32_t svUsedCount = 0;
|
uint32_t svUsedCount = 0;
|
||||||
uint32_t svUsedList[32] = {0};
|
uint32_t svUsedList[32] = {0};
|
||||||
uint32_t mask = loc_eng_data_p->sv_used_mask;
|
uint32_t mask = loc_eng_data_p->gps_used_mask;
|
||||||
for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
|
for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
|
||||||
{
|
{
|
||||||
if (mask & 1)
|
if (mask & 1)
|
||||||
|
@ -152,7 +158,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
// clear the cache so they can't be used again
|
// clear the cache so they can't be used again
|
||||||
loc_eng_data_p->sv_used_mask = 0;
|
loc_eng_data_p->gps_used_mask = 0;
|
||||||
|
|
||||||
char fixType;
|
char fixType;
|
||||||
if (svUsedCount == 0)
|
if (svUsedCount == 0)
|
||||||
|
@ -210,6 +216,99 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
|
||||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
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------
|
// ------$GPVTG------
|
||||||
// ------------------
|
// ------------------
|
||||||
|
@ -565,6 +664,10 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
|
||||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||||
|
|
||||||
|
strlcpy(sentence, "$GNGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
|
||||||
|
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
|
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||||
|
|
||||||
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
|
strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
|
||||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||||
|
@ -790,9 +893,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
||||||
|
|
||||||
}//if
|
}//if
|
||||||
|
|
||||||
// cache the used in fix mask, as it will be needed to send $GPGSA
|
// cache the used in fix mask, as it will be needed to send $GPGSA/$GNGSA
|
||||||
// during the position report
|
// during the position report
|
||||||
loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask;
|
loc_eng_data_p->gps_used_mask = svStatus.gps_used_in_fix_mask;
|
||||||
|
loc_eng_data_p->glo_used_mask = svStatus.glo_used_in_fix_mask;
|
||||||
|
|
||||||
// For RPC, the DOP are sent during sv report, so cache them
|
// For RPC, the DOP are sent during sv report, so cache them
|
||||||
// now to be sent during position report.
|
// now to be sent during position report.
|
||||||
|
|
|
@ -25,10 +25,10 @@ LOCAL_SRC_FILES += \
|
||||||
MsgTask.cpp \
|
MsgTask.cpp \
|
||||||
loc_misc_utils.cpp
|
loc_misc_utils.cpp
|
||||||
|
|
||||||
|
# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
|
||||||
LOCAL_CFLAGS += \
|
LOCAL_CFLAGS += \
|
||||||
-fno-short-enums \
|
-fno-short-enums \
|
||||||
-D_ANDROID_ \
|
-D_ANDROID_
|
||||||
-std=c++11
|
|
||||||
|
|
||||||
ifeq ($(TARGET_BUILD_VARIANT),user)
|
ifeq ($(TARGET_BUILD_VARIANT),user)
|
||||||
LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
|
LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
|
||||||
|
@ -60,7 +60,6 @@ LOCAL_COPY_HEADERS:= \
|
||||||
loc_misc_utils.h
|
loc_misc_utils.h
|
||||||
|
|
||||||
LOCAL_MODULE := libgps.utils
|
LOCAL_MODULE := libgps.utils
|
||||||
LOCAL_CLANG := false
|
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue