mirror of
https://github.com/team-infusion-developers/android_device_samsung_msm8976-common.git
synced 2024-11-07 06:19:20 +00:00
msm8976-common: Update GPS HAL from upstream
* CAF release: LA.BR.1.3.6_rb1.10 Change-Id: I05b378f4493e19860b47e0d596c3e0515cd963fb
This commit is contained in:
parent
12ac3a2044
commit
6cc4bf65e0
28 changed files with 746 additions and 372 deletions
|
@ -40,6 +40,27 @@
|
|||
|
||||
namespace loc_core {
|
||||
|
||||
loc_gps_cfg_s_type ContextBase::mGps_conf {0};
|
||||
loc_sap_cfg_s_type ContextBase::mSap_conf {0};
|
||||
|
||||
uint32_t ContextBase::getCarrierCapabilities() {
|
||||
#define carrierMSA (uint32_t)0x2
|
||||
#define carrierMSB (uint32_t)0x1
|
||||
#define gpsConfMSA (uint32_t)0x4
|
||||
#define gpsConfMSB (uint32_t)0x2
|
||||
uint32_t capabilities = mGps_conf.CAPABILITIES;
|
||||
if ((mGps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
|
||||
capabilities &= ~gpsConfMSA;
|
||||
}
|
||||
if ((mGps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
|
||||
capabilities &= ~gpsConfMSB;
|
||||
}
|
||||
|
||||
LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
|
||||
mGps_conf.CAPABILITIES, mGps_conf.SUPL_MODE, capabilities);
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
|
||||
{
|
||||
LBSProxyBase* proxy = NULL;
|
||||
|
|
|
@ -35,6 +35,67 @@
|
|||
#include <LocApiBase.h>
|
||||
#include <LBSProxyBase.h>
|
||||
|
||||
#define MAX_XTRA_SERVER_URL_LENGTH 256
|
||||
|
||||
/* GPS.conf support */
|
||||
/* NOTE: the implementaiton of the parser casts number
|
||||
fields to 32 bit. To ensure all 'n' fields working,
|
||||
they must all be 32 bit fields. */
|
||||
typedef struct loc_gps_cfg_s
|
||||
{
|
||||
uint32_t INTERMEDIATE_POS;
|
||||
uint32_t ACCURACY_THRES;
|
||||
uint32_t SUPL_VER;
|
||||
uint32_t SUPL_MODE;
|
||||
uint32_t SUPL_ES;
|
||||
uint32_t CAPABILITIES;
|
||||
uint32_t LPP_PROFILE;
|
||||
uint32_t XTRA_VERSION_CHECK;
|
||||
char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
|
||||
uint32_t NMEA_PROVIDER;
|
||||
uint32_t GPS_LOCK;
|
||||
uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
|
||||
uint32_t AGPS_CERT_WRITABLE_MASK;
|
||||
uint32_t LPPE_CP_TECHNOLOGY;
|
||||
uint32_t LPPE_UP_TECHNOLOGY;
|
||||
} loc_gps_cfg_s_type;
|
||||
|
||||
/* NOTE: the implementaiton of the parser casts number
|
||||
fields to 32 bit. To ensure all 'n' fields working,
|
||||
they must all be 32 bit fields. */
|
||||
/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
|
||||
fields are double. Rigid as they are, it is the
|
||||
the status quo, until the parsing mechanism is
|
||||
change, that is. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
|
||||
double GYRO_BIAS_RANDOM_WALK;
|
||||
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
|
||||
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
|
||||
uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
|
||||
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
|
||||
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
|
||||
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
|
||||
uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
|
||||
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
|
||||
uint32_t SENSOR_CONTROL_MODE;
|
||||
uint32_t SENSOR_USAGE;
|
||||
uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
|
||||
uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint32_t SENSOR_PROVIDER;
|
||||
} loc_sap_cfg_s_type;
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
class LocAdapterBase;
|
||||
|
@ -58,6 +119,7 @@ public:
|
|||
inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
|
||||
inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
|
||||
inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
|
||||
inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
|
||||
inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
|
||||
inline void requestUlp(LocAdapterBase* adapter,
|
||||
unsigned long capabilities) {
|
||||
|
@ -67,6 +129,12 @@ public:
|
|||
return mLBSProxy->getIzatDevId();
|
||||
}
|
||||
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
|
||||
|
||||
static loc_gps_cfg_s_type mGps_conf;
|
||||
static loc_sap_cfg_s_type mSap_conf;
|
||||
|
||||
static uint32_t getCarrierCapabilities();
|
||||
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -43,6 +43,10 @@ class LBSProxyBase {
|
|||
getLocApi(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
ContextBase* context) const {
|
||||
|
||||
(void)msgTask;
|
||||
(void)exMask;
|
||||
(void)context;
|
||||
return NULL;
|
||||
}
|
||||
protected:
|
||||
|
@ -50,11 +54,22 @@ protected:
|
|||
public:
|
||||
inline virtual ~LBSProxyBase() {}
|
||||
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 hasCPIExtendedCapabilities() const { return false; }
|
||||
inline virtual void modemPowerVote(bool power) const {}
|
||||
virtual void injectFeatureConfig(ContextBase* context) const {}
|
||||
inline virtual void modemPowerVote(bool power) const {
|
||||
|
||||
(void)power;
|
||||
}
|
||||
virtual void injectFeatureConfig(ContextBase* context) const {
|
||||
|
||||
(void)context;
|
||||
}
|
||||
inline virtual bool hasNativeXtraClient() const { return false; }
|
||||
inline virtual IzatDevId_t getIzatDevId() const { return 0; }
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void LocAdapterBase::
|
|||
}
|
||||
|
||||
void LocAdapterBase::
|
||||
reportSv(QcomSvStatus &svStatus,
|
||||
reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
DEFAULT_IMPL()
|
||||
|
@ -137,6 +137,6 @@ bool LocAdapterBase::
|
|||
DEFAULT_IMPL(false)
|
||||
|
||||
void LocAdapterBase::
|
||||
reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
DEFAULT_IMPL()
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014,2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -78,12 +78,22 @@ public:
|
|||
mLocApi->updateEvtMask();
|
||||
}
|
||||
|
||||
inline bool isFeatureSupported(uint8_t featureVal) {
|
||||
return mLocApi->isFeatureSupported(featureVal);
|
||||
}
|
||||
|
||||
// This will be overridden by the individual adapters
|
||||
// if necessary.
|
||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
|
||||
inline virtual void setUlpProxy(UlpProxyBase* ulp) {
|
||||
|
||||
(void)ulp;
|
||||
}
|
||||
virtual void handleEngineUpEvent();
|
||||
virtual void handleEngineDownEvent();
|
||||
inline virtual void setPositionModeInt(LocPosMode& posMode) {}
|
||||
inline virtual void setPositionModeInt(LocPosMode& posMode) {
|
||||
|
||||
(void)posMode;
|
||||
}
|
||||
virtual void startFixInt() {}
|
||||
virtual void stopFixInt() {}
|
||||
virtual void getZppInt() {}
|
||||
|
@ -92,7 +102,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QcomSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -111,7 +121,7 @@ public:
|
|||
const void* data);
|
||||
inline virtual bool isInSession() { return false; }
|
||||
ContextBase* getContext() const { return mContext; }
|
||||
virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -46,21 +46,26 @@ protected:
|
|||
inline virtual ~LocAdapterProxyBase() {
|
||||
delete mLocAdapterBase;
|
||||
}
|
||||
ContextBase* getContext() const {
|
||||
return mLocAdapterBase->getContext();
|
||||
}
|
||||
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
|
||||
loc_registration_mask_status isEnabled) {
|
||||
mLocAdapterBase->updateEvtMask(event,isEnabled);
|
||||
}
|
||||
|
||||
public:
|
||||
inline ContextBase* getContext() const {
|
||||
return mLocAdapterBase->getContext();
|
||||
}
|
||||
inline virtual void handleEngineUpEvent() {};
|
||||
inline virtual void handleEngineDownEvent() {};
|
||||
inline virtual bool reportPosition(UlpLocation &location,
|
||||
GpsLocationExtended &locationExtended,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask) {
|
||||
|
||||
(void)location;
|
||||
(void)locationExtended;
|
||||
(void)status;
|
||||
(void)loc_technology_mask;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014,2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -132,6 +132,7 @@ LocApiBase::LocApiBase(const MsgTask* msgTask,
|
|||
mMask(0), mSupportedMsg(0), mContext(context)
|
||||
{
|
||||
memset(mLocAdapters, 0, sizeof(mLocAdapters));
|
||||
memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
|
||||
}
|
||||
|
||||
LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
|
||||
|
@ -253,23 +254,21 @@ void LocApiBase::reportPosition(UlpLocation &location,
|
|||
);
|
||||
}
|
||||
|
||||
void LocApiBase::reportSv(QcomSvStatus &svStatus,
|
||||
void LocApiBase::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
{
|
||||
// print the SV info before delivering
|
||||
LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n gps/glo/bds in use"
|
||||
" mask: %x/%x/%x\n sv: prn snr elevation azimuth",
|
||||
svStatus.num_svs, svStatus.ephemeris_mask,
|
||||
svStatus.almanac_mask, svStatus.gps_used_in_fix_mask,
|
||||
svStatus.glo_used_in_fix_mask, svStatus.bds_used_in_fix_mask);
|
||||
for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" %d: %d %f %f %f",
|
||||
LOC_LOGV("num sv: %d", 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.sv_list[i].prn,
|
||||
svStatus.sv_list[i].snr,
|
||||
svStatus.sv_list[i].elevation,
|
||||
svStatus.sv_list[i].azimuth);
|
||||
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);
|
||||
}
|
||||
// loop through adapters, and deliver to all adapters.
|
||||
TO_ALL_LOCADAPTERS(
|
||||
|
@ -358,16 +357,21 @@ void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
|
|||
mSupportedMsg = supportedMsgList;
|
||||
}
|
||||
|
||||
void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
|
||||
{
|
||||
memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
|
||||
}
|
||||
|
||||
void* LocApiBase :: getSibling()
|
||||
DEFAULT_IMPL(NULL)
|
||||
|
||||
LocApiProxyBase* LocApiBase :: getLocApiProxy()
|
||||
DEFAULT_IMPL(NULL)
|
||||
|
||||
void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
void LocApiBase::reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
{
|
||||
// loop through adapters, and deliver to all adapters.
|
||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
|
||||
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementData(gnssMeasurementData));
|
||||
}
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
|
@ -445,6 +449,10 @@ enum loc_api_adapter_err LocApiBase::
|
|||
setSUPLVersion(uint32_t version)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
setNMEATypes (uint32_t typesMask)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
setLPPConfig(uint32_t profile)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
@ -481,12 +489,12 @@ enum loc_api_adapter_err LocApiBase::
|
|||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
setExtPowerConfig(int isBatteryCharging)
|
||||
setAGLONASSProtocol(unsigned long aGlonassProtocol)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
setAGLONASSProtocol(unsigned long aGlonassProtocol)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
getWwanZppFix(GpsLocation& zppLoc)
|
||||
|
@ -550,4 +558,14 @@ bool LocApiBase::
|
|||
gnssConstellationConfig()
|
||||
DEFAULT_IMPL(false)
|
||||
|
||||
bool LocApiBase::
|
||||
isFeatureSupported(uint8_t featureVal)
|
||||
{
|
||||
uint8_t arrayIndex = featureVal >> 3;
|
||||
uint8_t bitPos = featureVal & 7;
|
||||
|
||||
if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
|
||||
return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
|
||||
}
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -44,6 +44,7 @@ int decodeAddress(char *addr_string, int string_size,
|
|||
const char *data, int data_size);
|
||||
|
||||
#define MAX_ADAPTERS 10
|
||||
#define MAX_FEATURE_LENGTH 100
|
||||
|
||||
#define TO_ALL_ADAPTERS(adapters, call) \
|
||||
for (int i = 0; i < MAX_ADAPTERS && NULL != (adapters)[i]; i++) { \
|
||||
|
@ -81,6 +82,7 @@ class LocApiBase {
|
|||
ContextBase *mContext;
|
||||
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
|
||||
uint64_t mSupportedMsg;
|
||||
uint8_t mFeaturesSupported[MAX_FEATURE_LENGTH];
|
||||
|
||||
protected:
|
||||
virtual enum loc_api_adapter_err
|
||||
|
@ -113,7 +115,7 @@ public:
|
|||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask =
|
||||
LOC_POS_TECH_MASK_DEFAULT);
|
||||
void reportSv(QcomSvStatus &svStatus,
|
||||
void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
void reportStatus(GpsStatusValue status);
|
||||
|
@ -130,7 +132,8 @@ public:
|
|||
void reportDataCallClosed();
|
||||
void requestNiNotify(GpsNiNotification ¬ify, const void* data);
|
||||
void saveSupportedMsgList(uint64_t supportedMsgList);
|
||||
void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
void saveSupportedFeatureList(uint8_t *featureList);
|
||||
|
||||
// downward calls
|
||||
// All below functions are to be defined by adapter specific modules:
|
||||
|
@ -171,6 +174,8 @@ public:
|
|||
informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
|
||||
virtual enum loc_api_adapter_err
|
||||
setSUPLVersion(uint32_t version);
|
||||
virtual enum loc_api_adapter_err
|
||||
setNMEATypes (uint32_t typesMask);
|
||||
virtual enum loc_api_adapter_err
|
||||
setLPPConfig(uint32_t profile);
|
||||
virtual enum loc_api_adapter_err
|
||||
|
@ -197,10 +202,10 @@ public:
|
|||
int gyroSamplesPerBatchHigh,
|
||||
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);
|
||||
virtual enum loc_api_adapter_err
|
||||
getWwanZppFix(GpsLocation & zppLoc);
|
||||
virtual enum loc_api_adapter_err
|
||||
|
@ -214,9 +219,15 @@ public:
|
|||
virtual void installAGpsCert(const DerEncodedCertificate* pData,
|
||||
size_t length,
|
||||
uint32_t slotBitMask);
|
||||
inline virtual void setInSession(bool inSession) {}
|
||||
inline virtual void setInSession(bool inSession) {
|
||||
|
||||
(void)inSession;
|
||||
}
|
||||
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;
|
||||
} else {
|
||||
uint32_t messageChecker = 1 << msgID;
|
||||
|
@ -250,6 +261,11 @@ public:
|
|||
Check if the modem support the service
|
||||
*/
|
||||
virtual bool gnssConstellationConfig();
|
||||
|
||||
/*
|
||||
Check if a feature is supported
|
||||
*/
|
||||
bool isFeatureSupported(uint8_t featureVal);
|
||||
};
|
||||
|
||||
typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -59,24 +59,45 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask) {
|
||||
(void)location;
|
||||
(void)locationExtended;
|
||||
(void)locationExt;
|
||||
(void)status;
|
||||
(void)loc_technology_mask;
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportSv(QcomSvStatus &svStatus,
|
||||
inline virtual bool reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt) {
|
||||
(void)svStatus;
|
||||
(void)locationExtended;
|
||||
(void)svExt;
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportStatus(GpsStatusValue status) {
|
||||
|
||||
(void)status;
|
||||
return false;
|
||||
}
|
||||
inline virtual void setAdapter(LocAdapterBase* adapter) {}
|
||||
inline virtual void setCapabilities(unsigned long capabilities) {}
|
||||
inline virtual void setAdapter(LocAdapterBase* adapter) {
|
||||
|
||||
(void)adapter;
|
||||
}
|
||||
inline virtual void setCapabilities(unsigned long capabilities) {
|
||||
|
||||
(void)capabilities;
|
||||
}
|
||||
inline virtual bool reportBatchingSession(FlpExtBatchOptions &options,
|
||||
bool active) {
|
||||
|
||||
(void)options;
|
||||
(void)active;
|
||||
return false;
|
||||
}
|
||||
inline virtual bool reportPositions(const struct FlpExtLocation_s* locations,
|
||||
int32_t number_of_locations) {
|
||||
(void)locations;
|
||||
(void)number_of_locations;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2015, 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -82,6 +82,11 @@ enum loc_registration_mask_status {
|
|||
LOC_REGISTRATION_MASK_DISABLED
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */
|
||||
LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02 /**< Support Wifi AP data inject version 2 feature */
|
||||
} loc_supported_feature_enum;
|
||||
|
||||
typedef struct {
|
||||
/** set to sizeof(UlpLocation) */
|
||||
size_t size;
|
||||
|
@ -165,14 +170,14 @@ typedef struct {
|
|||
} AGpsExtCallbacks;
|
||||
|
||||
|
||||
typedef void (*loc_ni_notify_callback)(GpsNiNotification *notification, bool esEnalbed);
|
||||
/** GPS NI callback structure. */
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* Sends the notification request from HAL to GPSLocationProvider.
|
||||
*/
|
||||
gps_ni_notify_callback notify_cb;
|
||||
gps_create_thread create_thread_cb;
|
||||
loc_ni_notify_callback notify_cb;
|
||||
} GpsNiExtCallbacks;
|
||||
|
||||
typedef enum loc_server_type {
|
||||
|
@ -217,6 +222,12 @@ typedef uint16_t GpsLocationExtendedFlags;
|
|||
#define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080
|
||||
/** GpsLocationExtended has valid vertical reliability */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100
|
||||
/** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */
|
||||
#define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200
|
||||
/** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
|
||||
#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
|
||||
|
||||
typedef enum {
|
||||
LOC_RELIABILITY_NOT_SET = 0,
|
||||
|
@ -252,49 +263,14 @@ typedef struct {
|
|||
LocReliability horizontal_reliability;
|
||||
/** vertical reliability. */
|
||||
LocReliability vertical_reliability;
|
||||
/* Horizontal Elliptical Uncertainty (Semi-Major Axis) */
|
||||
float horUncEllipseSemiMajor;
|
||||
/* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */
|
||||
float horUncEllipseSemiMinor;
|
||||
/* Elliptical Horizontal Uncertainty Azimuth */
|
||||
float horUncEllipseOrientAzimuth;
|
||||
} GpsLocationExtended;
|
||||
|
||||
/** Represents SV status. */
|
||||
typedef struct {
|
||||
/** set to sizeof(QcomSvStatus) */
|
||||
size_t size;
|
||||
|
||||
/** Number of SVs currently visible. */
|
||||
int num_svs;
|
||||
|
||||
/** Contains an array of SV information. */
|
||||
GpsSvInfo sv_list[GPS_MAX_SVS];
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have ephemeris data.
|
||||
*/
|
||||
uint32_t ephemeris_mask;
|
||||
|
||||
/** Represents a bit mask indicating which SVs
|
||||
* have almanac data.
|
||||
*/
|
||||
uint32_t almanac_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which GPS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t gps_used_in_fix_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which GLONASS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint32_t glo_used_in_fix_mask;
|
||||
|
||||
/**
|
||||
* Represents a bit mask indicating which BDS SVs
|
||||
* were used for computing the most recent position fix.
|
||||
*/
|
||||
uint64_t bds_used_in_fix_mask;
|
||||
|
||||
} QcomSvStatus;
|
||||
|
||||
enum loc_sess_status {
|
||||
LOC_SESS_SUCCESS,
|
||||
LOC_SESS_INTERMEDIATE,
|
||||
|
@ -312,6 +288,34 @@ typedef uint32_t LocPosTechMask;
|
|||
#define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040)
|
||||
#define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080)
|
||||
|
||||
// Nmea sentence types mask
|
||||
typedef uint32_t NmeaSentenceTypesMask;
|
||||
#define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */
|
||||
#define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */
|
||||
#define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */
|
||||
#define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */
|
||||
#define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */
|
||||
#define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */
|
||||
#define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */
|
||||
#define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */
|
||||
#define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */
|
||||
#define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */
|
||||
#define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */
|
||||
#define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */
|
||||
#define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */
|
||||
#define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */
|
||||
#define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */
|
||||
#define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */
|
||||
#define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */
|
||||
#define LOC_NMEA_ALL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \
|
||||
LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \
|
||||
LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \
|
||||
LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \
|
||||
LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \
|
||||
LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 )
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0,
|
||||
LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
|
||||
|
|
|
@ -67,9 +67,11 @@ protected:
|
|||
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
|
||||
virtual enum loc_api_adapter_err
|
||||
close();
|
||||
LocApiRpc(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask);
|
||||
|
||||
public:
|
||||
LocApiRpc(const MsgTask* msgTask,
|
||||
static LocApiRpc* createLocApiRpc(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask);
|
||||
~LocApiRpc();
|
||||
|
||||
|
|
|
@ -132,6 +132,17 @@ const rpc_loc_event_mask_type LocApiRpc::locBits[] =
|
|||
RPC_LOC_EVENT_WPS_NEEDED_REQUEST
|
||||
};
|
||||
|
||||
LocApiRpc*
|
||||
LocApiRpc::createLocApiRpc(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
ContextBase* context)
|
||||
{
|
||||
if (NULL == msgTask) {
|
||||
return NULL;
|
||||
}
|
||||
return new LocApiRpc(msgTask, exMask, context);
|
||||
}
|
||||
|
||||
// constructor
|
||||
LocApiRpc::LocApiRpc(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
|
@ -797,7 +808,7 @@ void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_re
|
|||
|
||||
void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
|
||||
{
|
||||
GnssSvStatus SvStatus = {0};
|
||||
QtiGnssSvStatus SvStatus = {0};
|
||||
GpsLocationExtended locationExtended = {0};
|
||||
locationExtended.size = sizeof(locationExtended);
|
||||
int num_svs_max = 0;
|
||||
|
|
|
@ -88,6 +88,10 @@ LOCAL_CFLAGS += \
|
|||
-fno-short-enums \
|
||||
-D_ANDROID_ \
|
||||
|
||||
ifeq ($(TARGET_BUILD_VARIANT),user)
|
||||
LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_USES_QCOM_BSP), true)
|
||||
LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
|
||||
endif
|
||||
|
|
|
@ -377,14 +377,14 @@ void LocEngAdapter::reportPosition(UlpLocation &location,
|
|||
}
|
||||
}
|
||||
|
||||
void LocInternalAdapter::reportSv(QcomSvStatus &svStatus,
|
||||
void LocInternalAdapter::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt){
|
||||
sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
|
||||
locationExtended, svExt));
|
||||
}
|
||||
|
||||
void LocEngAdapter::reportSv(QcomSvStatus &svStatus,
|
||||
void LocEngAdapter::reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt)
|
||||
{
|
||||
|
@ -534,9 +534,8 @@ enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
|
|||
if (mSupportsTimeInjection) {
|
||||
LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
|
||||
result = mLocApi->setTime(time, timeReference, uncertainty);
|
||||
} else {
|
||||
mSupportsTimeInjection = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -566,10 +565,10 @@ enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
|
||||
void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData)
|
||||
{
|
||||
sendMsg(new LocEngReportGpsMeasurement(mOwner,
|
||||
gpsMeasurementData));
|
||||
sendMsg(new LocEngReportGnssMeasurement(mOwner,
|
||||
gnssMeasurementData));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QcomSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -85,6 +85,7 @@ public:
|
|||
bool mSupportsAgpsRequests;
|
||||
bool mSupportsPositionInjection;
|
||||
bool mSupportsTimeInjection;
|
||||
GnssSystemInfo mGnssInfo;
|
||||
|
||||
LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
|
||||
void* owner, ContextBase* context,
|
||||
|
@ -105,6 +106,9 @@ public:
|
|||
inline bool hasCPIExtendedCapabilities() {
|
||||
return mContext->hasCPIExtendedCapabilities();
|
||||
}
|
||||
inline bool hasNativeXtraClient() {
|
||||
return mContext->hasNativeXtraClient();
|
||||
}
|
||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||
|
||||
inline enum loc_api_adapter_err
|
||||
|
@ -186,6 +190,11 @@ public:
|
|||
{
|
||||
return mLocApi->setSUPLVersion(version);
|
||||
}
|
||||
inline enum loc_api_adapter_err
|
||||
setNMEATypes (uint32_t typesMask)
|
||||
{
|
||||
return mLocApi->setNMEATypes(typesMask);
|
||||
}
|
||||
inline enum loc_api_adapter_err
|
||||
setLPPConfig(uint32_t profile)
|
||||
{
|
||||
|
@ -221,16 +230,16 @@ public:
|
|||
gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
|
||||
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);
|
||||
}
|
||||
inline virtual enum loc_api_adapter_err
|
||||
setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP)
|
||||
{
|
||||
return mLocApi->setLPPeProtocol(lppeCP, lppeUP);
|
||||
}
|
||||
inline virtual int initDataServiceClient()
|
||||
{
|
||||
return mLocApi->initDataServiceClient();
|
||||
|
@ -269,7 +278,7 @@ public:
|
|||
void* locationExt,
|
||||
enum loc_sess_status status,
|
||||
LocPosTechMask loc_technology_mask);
|
||||
virtual void reportSv(QcomSvStatus &svStatus,
|
||||
virtual void reportSv(GnssSvStatus &svStatus,
|
||||
GpsLocationExtended &locationExtended,
|
||||
void* svExt);
|
||||
virtual void reportStatus(GpsStatusValue status);
|
||||
|
@ -284,7 +293,7 @@ public:
|
|||
virtual bool requestSuplES(int connHandle);
|
||||
virtual bool reportDataCallOpened();
|
||||
virtual bool reportDataCallClosed();
|
||||
virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
|
||||
virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
|
||||
|
||||
inline const LocPosMode& getPositionMode() const
|
||||
{return mFixCriteria;}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -52,9 +52,15 @@ using namespace loc_core;
|
|||
//Globals defns
|
||||
static gps_location_callback gps_loc_cb = NULL;
|
||||
static gps_sv_status_callback gps_sv_cb = NULL;
|
||||
static gps_ni_notify_callback gps_ni_cb = NULL;
|
||||
|
||||
static void local_loc_cb(UlpLocation* location, void* locExt);
|
||||
static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
|
||||
static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed);
|
||||
|
||||
GpsNiExtCallbacks sGpsNiExtCallbacks = {
|
||||
local_ni_cb
|
||||
};
|
||||
|
||||
static const GpsGeofencingInterface* get_geofence_interface(void);
|
||||
|
||||
|
@ -285,6 +291,7 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
}
|
||||
|
||||
event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
|
||||
LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT |
|
||||
LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
|
||||
LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
|
||||
LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
|
||||
|
@ -304,6 +311,8 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
NULL, /* location_ext_parser */
|
||||
NULL, /* sv_ext_parser */
|
||||
callbacks->request_utc_time_cb, /* request_utc_time_cb */
|
||||
callbacks->set_system_info_cb, /* set_system_info_cb */
|
||||
callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */
|
||||
};
|
||||
|
||||
gps_loc_cb = callbacks->location_cb;
|
||||
|
@ -312,9 +321,10 @@ static int loc_init(GpsCallbacks* callbacks)
|
|||
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(getCarrierCapabilities());
|
||||
loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities());
|
||||
loc_afw_data.adapter->setXtraUserAgent();
|
||||
|
||||
if(retVal) {
|
||||
|
@ -538,7 +548,10 @@ SIDE EFFECTS
|
|||
static void loc_delete_aiding_data(GpsAidingData f)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
||||
#ifndef TARGET_BUILD_VARIANT_USER
|
||||
loc_eng_delete_aiding_data(loc_afw_data, f);
|
||||
#endif
|
||||
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
@ -730,7 +743,7 @@ static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
|
|||
bearerType = AGPS_APN_BEARER_IPV4V6;
|
||||
break;
|
||||
default:
|
||||
bearerType = AGPS_APN_BEARER_INVALID;
|
||||
bearerType = AGPS_APN_BEARER_IPV4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -960,7 +973,8 @@ SIDE EFFECTS
|
|||
void loc_ni_init(GpsNiCallbacks *callbacks)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
|
||||
gps_ni_cb = callbacks->notify_cb;
|
||||
loc_eng_ni_init(loc_afw_data, &sGpsNiExtCallbacks);
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
|
@ -1075,3 +1089,10 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
|
|||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
||||
static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed)
|
||||
{
|
||||
if (NULL != gps_ni_cb) {
|
||||
gps_ni_cb(notification);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ typedef struct {
|
|||
loc_ext_parser location_ext_parser;
|
||||
loc_ext_parser sv_ext_parser;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
gnss_set_system_info set_system_info_cb;
|
||||
gnss_sv_status_callback gnss_sv_status_cb;
|
||||
} LocCallbacks;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -90,8 +90,6 @@ using namespace loc_core;
|
|||
|
||||
boolean configAlreadyRead = false;
|
||||
unsigned int agpsStatus = 0;
|
||||
loc_gps_cfg_s_type gps_conf;
|
||||
loc_sap_cfg_s_type sap_conf;
|
||||
|
||||
/* Parameter spec table */
|
||||
static const loc_param_s_type gps_conf_table[] =
|
||||
|
@ -100,8 +98,11 @@ static const loc_param_s_type gps_conf_table[] =
|
|||
{"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
|
||||
{"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
|
||||
{"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
|
||||
{"LPPE_CP_TECHNOLOGY", &gps_conf.LPPE_CP_TECHNOLOGY, NULL, 'n'},
|
||||
{"LPPE_UP_TECHNOLOGY", &gps_conf.LPPE_UP_TECHNOLOGY, NULL, 'n'},
|
||||
{"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
|
||||
{"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'},
|
||||
{"SUPL_ES", &gps_conf.SUPL_ES, NULL, 'n'},
|
||||
{"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
|
||||
{"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
|
||||
{"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
|
||||
|
@ -143,6 +144,7 @@ static void loc_default_parameters(void)
|
|||
gps_conf.GPS_LOCK = 0;
|
||||
gps_conf.SUPL_VER = 0x10000;
|
||||
gps_conf.SUPL_MODE = 0x3;
|
||||
gps_conf.SUPL_ES = 0;
|
||||
gps_conf.CAPABILITIES = 0x7;
|
||||
/* LTE Positioning Profile configuration is disable by default*/
|
||||
gps_conf.LPP_PROFILE = 0;
|
||||
|
@ -152,6 +154,10 @@ static void loc_default_parameters(void)
|
|||
gps_conf.XTRA_VERSION_CHECK=0;
|
||||
/*Use emergency PDN by default*/
|
||||
gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
|
||||
/* By default no LPPe CP technology is enabled*/
|
||||
gps_conf.LPPE_CP_TECHNOLOGY = 0;
|
||||
/* By default no LPPe UP technology is enabled*/
|
||||
gps_conf.LPPE_UP_TECHNOLOGY = 0;
|
||||
|
||||
/*Defaults for sap.conf*/
|
||||
sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
|
||||
|
@ -208,6 +214,7 @@ static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
|
|||
static void deleteAidingData(loc_eng_data_s_type &logEng);
|
||||
static AgpsStateMachine*
|
||||
getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
|
||||
static void createAgnssNifs(loc_eng_data_s_type& locEng);
|
||||
static int dataCallCb(void *cb_data);
|
||||
static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
|
||||
if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
|
||||
|
@ -470,6 +477,29 @@ struct LocEngAGlonassProtocol : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
struct LocEngLPPeProtocol : public LocMsg {
|
||||
LocEngAdapter* mAdapter;
|
||||
const unsigned long mLPPeCP;
|
||||
const unsigned long mLPPeUP;
|
||||
inline LocEngLPPeProtocol(LocEngAdapter* adapter,
|
||||
unsigned long lppeCP, unsigned long lppeUP) :
|
||||
LocMsg(), mAdapter(adapter), mLPPeCP(lppeCP), mLPPeUP(lppeUP)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mAdapter->setLPPeProtocol(mLPPeCP, mLPPeUP);
|
||||
}
|
||||
inline void locallog() const {
|
||||
LOC_LOGV("LPPe CP: 0x%lx LPPe UP: 0x%1x", mLPPeCP, mLPPeUP);
|
||||
}
|
||||
inline virtual void log() const {
|
||||
locallog();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// case LOC_ENG_MSG_SUPL_VERSION:
|
||||
struct LocEngSuplVer : public LocMsg {
|
||||
LocEngAdapter* mAdapter;
|
||||
|
@ -500,7 +530,7 @@ struct LocEngSuplMode : public LocMsg {
|
|||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mUlp->setCapabilities(getCarrierCapabilities());
|
||||
mUlp->setCapabilities(ContextBase::getCarrierCapabilities());
|
||||
}
|
||||
inline void locallog() const {
|
||||
}
|
||||
|
@ -509,6 +539,31 @@ struct LocEngSuplMode : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
// case LOC_ENG_MSG_SET_NMEA_TYPE:
|
||||
struct LocEngSetNmeaTypes : public LocMsg {
|
||||
LocEngAdapter* mAdapter;
|
||||
uint32_t nmeaTypesMask;
|
||||
inline LocEngSetNmeaTypes(LocEngAdapter* adapter,
|
||||
uint32_t typesMask) :
|
||||
LocMsg(), mAdapter(adapter), nmeaTypesMask(typesMask)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
// set the nmea types
|
||||
mAdapter->setNMEATypes(nmeaTypesMask);
|
||||
}
|
||||
inline void locallog() const
|
||||
{
|
||||
LOC_LOGV("LocEngSetNmeaTypes %u\n",nmeaTypesMask);
|
||||
}
|
||||
inline virtual void log() const
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// case LOC_ENG_MSG_LPP_CONFIG:
|
||||
struct LocEngLppConfig : public LocMsg {
|
||||
LocEngAdapter* mAdapter;
|
||||
|
@ -699,29 +754,6 @@ struct LocEngSensorPerfControlConfig : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
// 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,
|
||||
|
@ -828,7 +860,7 @@ void LocEngReportPosition::send() const {
|
|||
|
||||
// case LOC_ENG_MSG_REPORT_SV:
|
||||
LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
|
||||
QcomSvStatus &sv,
|
||||
GnssSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExt) :
|
||||
LocMsg(), mAdapter(adapter), mSvStatus(sv),
|
||||
|
@ -845,9 +877,9 @@ void LocEngReportSv::proc() const {
|
|||
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||
{
|
||||
if (locEng->sv_status_cb != NULL) {
|
||||
locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
|
||||
(void*)mSvExt);
|
||||
if (locEng->gnss_sv_status_cb != NULL) {
|
||||
LOC_LOGE("Calling gnss_sv_status_cb");
|
||||
locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
|
||||
}
|
||||
|
||||
if (locEng->generateNmea)
|
||||
|
@ -1089,7 +1121,7 @@ LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
|
|||
}
|
||||
void LocEngRequestSuplEs::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
if (locEng->ds_nif) {
|
||||
if (locEng->ds_nif && gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
|
||||
AgpsStateMachine* sm = locEng->ds_nif;
|
||||
DSSubscriber s(sm, mID);
|
||||
sm->subscribeRsrc((Subscriber*)&s);
|
||||
|
@ -1213,16 +1245,7 @@ LocEngReqRelWifi::~LocEngReqRelWifi() {
|
|||
}
|
||||
void LocEngReqRelWifi::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
|
||||
if (locEng->wifi_nif) {
|
||||
WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
|
||||
if (mIsReq) {
|
||||
locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
|
||||
} else {
|
||||
locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
|
||||
}
|
||||
} else {
|
||||
locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
|
||||
}
|
||||
locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
|
||||
}
|
||||
inline void LocEngReqRelWifi::locallog() const {
|
||||
LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
|
||||
|
@ -1376,6 +1399,32 @@ struct LocEngSetCapabilities : public LocMsg {
|
|||
}
|
||||
};
|
||||
|
||||
struct LocEngSetSystemInfo : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) :
|
||||
LocMsg(), mLocEng(locEng)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
if (NULL != mLocEng->set_system_info_cb) {
|
||||
LOC_LOGV("calling set_system_info_cb 0x%x",
|
||||
mLocEng->adapter->mGnssInfo.year_of_hw);
|
||||
mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo));
|
||||
}
|
||||
else {
|
||||
LOC_LOGV("set_system_info_cb is NULL.\n");
|
||||
}
|
||||
}
|
||||
inline void locallog() const
|
||||
{
|
||||
LOC_LOGV("LocEngSetSystemInfo");
|
||||
}
|
||||
inline virtual void log() const
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
};
|
||||
// case LOC_ENG_MSG_LOC_INIT:
|
||||
struct LocEngInit : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
|
@ -1388,6 +1437,7 @@ struct LocEngInit : public LocMsg {
|
|||
loc_eng_reinit(*mLocEng);
|
||||
// set the capabilities
|
||||
mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
|
||||
mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng));
|
||||
}
|
||||
inline void locallog() const
|
||||
{
|
||||
|
@ -1404,16 +1454,18 @@ struct LocEngInit : public LocMsg {
|
|||
|
||||
// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
|
||||
struct LocEngAtlOpenSuccess : public LocMsg {
|
||||
AgpsStateMachine* mStateMachine;
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
const AGpsExtType mAgpsType;
|
||||
const int mLen;
|
||||
char* mAPN;
|
||||
const AGpsBearerType mBearerType;
|
||||
inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
|
||||
inline LocEngAtlOpenSuccess(loc_eng_data_s_type* locEng,
|
||||
const AGpsExtType agpsType,
|
||||
const char* name,
|
||||
int len,
|
||||
AGpsBearerType btype) :
|
||||
LocMsg(),
|
||||
mStateMachine(statemachine), mLen(len),
|
||||
mLocEng(locEng), mAgpsType(agpsType), mLen(len),
|
||||
mAPN(new char[len+1]), mBearerType(btype)
|
||||
{
|
||||
memcpy((void*)mAPN, (void*)name, len);
|
||||
|
@ -1425,14 +1477,15 @@ struct LocEngAtlOpenSuccess : public LocMsg {
|
|||
delete[] mAPN;
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mStateMachine->setBearer(mBearerType);
|
||||
mStateMachine->setAPN(mAPN, mLen);
|
||||
mStateMachine->onRsrcEvent(RSRC_GRANTED);
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType);
|
||||
sm->setBearer(mBearerType);
|
||||
sm->setAPN(mAPN, mLen);
|
||||
sm->onRsrcEvent(RSRC_GRANTED);
|
||||
}
|
||||
inline void locallog() const {
|
||||
LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
|
||||
" bearer type: %s",
|
||||
loc_get_agps_type_name(mStateMachine->getType()),
|
||||
loc_get_agps_type_name(mAgpsType),
|
||||
mAPN,
|
||||
loc_get_agps_bear_name(mBearerType));
|
||||
}
|
||||
|
@ -1443,13 +1496,16 @@ struct LocEngAtlOpenSuccess : public LocMsg {
|
|||
|
||||
// case LOC_ENG_MSG_ATL_CLOSED:
|
||||
struct LocEngAtlClosed : public LocMsg {
|
||||
AgpsStateMachine* mStateMachine;
|
||||
inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
|
||||
LocMsg(), mStateMachine(statemachine) {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
const AGpsExtType mAgpsType;
|
||||
inline LocEngAtlClosed(loc_eng_data_s_type* locEng,
|
||||
const AGpsExtType agpsType) :
|
||||
LocMsg(), mLocEng(locEng), mAgpsType(agpsType) {
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mStateMachine->onRsrcEvent(RSRC_RELEASED);
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType);
|
||||
sm->onRsrcEvent(RSRC_RELEASED);
|
||||
}
|
||||
inline void locallog() const {
|
||||
LOC_LOGV("LocEngAtlClosed");
|
||||
|
@ -1461,13 +1517,16 @@ struct LocEngAtlClosed : public LocMsg {
|
|||
|
||||
// case LOC_ENG_MSG_ATL_OPEN_FAILED:
|
||||
struct LocEngAtlOpenFailed : public LocMsg {
|
||||
AgpsStateMachine* mStateMachine;
|
||||
inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
|
||||
LocMsg(), mStateMachine(statemachine) {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
const AGpsExtType mAgpsType;
|
||||
inline LocEngAtlOpenFailed(loc_eng_data_s_type* locEng,
|
||||
const AGpsExtType agpsType) :
|
||||
LocMsg(), mLocEng(locEng), mAgpsType(agpsType) {
|
||||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mStateMachine->onRsrcEvent(RSRC_DENIED);
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType);
|
||||
sm->onRsrcEvent(RSRC_DENIED);
|
||||
}
|
||||
inline void locallog() const {
|
||||
LOC_LOGV("LocEngAtlOpenFailed");
|
||||
|
@ -1509,22 +1568,17 @@ inline void LocEngUp::log() const {
|
|||
locallog();
|
||||
}
|
||||
|
||||
struct LocEngDataClientInit : public LocMsg {
|
||||
struct LocEngAgnssNifInit : public LocMsg {
|
||||
loc_eng_data_s_type* mLocEng;
|
||||
inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
|
||||
inline LocEngAgnssNifInit(loc_eng_data_s_type* locEng) :
|
||||
LocMsg(), mLocEng(locEng) {
|
||||
locallog();
|
||||
}
|
||||
virtual void proc() const {
|
||||
loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
|
||||
if(!locEng->adapter->initDataServiceClient()) {
|
||||
locEng->ds_nif = new DSStateMachine(servicerTypeExt,
|
||||
(void *)dataCallCb,
|
||||
locEng->adapter);
|
||||
}
|
||||
createAgnssNifs(*mLocEng);
|
||||
}
|
||||
void locallog() const {
|
||||
LOC_LOGV("LocEngDataClientInit\n");
|
||||
LOC_LOGV("LocEngAgnssNifInit\n");
|
||||
}
|
||||
virtual void log() const {
|
||||
locallog();
|
||||
|
@ -1607,10 +1661,13 @@ struct LocEngGnssConstellationConfig : public LocMsg {
|
|||
locallog();
|
||||
}
|
||||
inline virtual void proc() const {
|
||||
mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo);
|
||||
if (mAdapter->gnssConstellationConfig()) {
|
||||
LOC_LOGV("Modem supports GNSS measurements\n");
|
||||
gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
|
||||
mAdapter->mGnssInfo.year_of_hw = 2016;
|
||||
} else {
|
||||
mAdapter->mGnssInfo.year_of_hw = 2015;
|
||||
LOC_LOGV("Modem does not support GNSS measurements\n");
|
||||
}
|
||||
}
|
||||
|
@ -1623,50 +1680,59 @@ struct LocEngGnssConstellationConfig : public LocMsg {
|
|||
};
|
||||
|
||||
// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
|
||||
LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
|
||||
GpsData &gpsData) :
|
||||
LocMsg(), mLocEng(locEng), mGpsData(gpsData)
|
||||
LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng,
|
||||
GnssData &gnssData) :
|
||||
LocMsg(), mLocEng(locEng), mGnssData(gnssData)
|
||||
{
|
||||
locallog();
|
||||
}
|
||||
void LocEngReportGpsMeasurement::proc() const {
|
||||
void LocEngReportGnssMeasurement::proc() const {
|
||||
loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
|
||||
if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
|
||||
{
|
||||
if (locEng->gps_measurement_cb != NULL) {
|
||||
locEng->gps_measurement_cb((GpsData*)&(mGpsData));
|
||||
if (locEng->gnss_measurement_cb != NULL) {
|
||||
LOC_LOGV("Calling gnss_measurement_cb");
|
||||
locEng->gnss_measurement_cb((GnssData*)&(mGnssData));
|
||||
}
|
||||
}
|
||||
}
|
||||
void LocEngReportGpsMeasurement::locallog() const {
|
||||
void LocEngReportGnssMeasurement::locallog() const {
|
||||
IF_LOC_LOGV {
|
||||
LOC_LOGV("%s:%d]: Received in GPS HAL."
|
||||
"GNSS Measurements count: %d \n",
|
||||
__func__, __LINE__, mGpsData.measurement_count);
|
||||
for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
|
||||
__func__, __LINE__, mGnssData.measurement_count);
|
||||
for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) {
|
||||
LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
|
||||
" GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
|
||||
" received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
|
||||
" GPS_HAL => Measurement ID | svid | time_offset_ns | state |"
|
||||
" c_n0_dbhz | pseudorange_rate_mps |"
|
||||
" pseudorange_rate_uncertainty_mps |"
|
||||
" accumulated_delta_range_state | flags \n"
|
||||
" GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
|
||||
" GPS_HAL => %d | %d | %f | %d | %f | %f | %f | %d | %d \n",
|
||||
i,
|
||||
mGpsData.measurements[i].prn,
|
||||
mGpsData.measurements[i].time_offset_ns,
|
||||
mGpsData.measurements[i].state,
|
||||
mGpsData.measurements[i].received_gps_tow_ns,
|
||||
mGpsData.measurements[i].c_n0_dbhz,
|
||||
mGpsData.measurements[i].pseudorange_rate_mps,
|
||||
mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
|
||||
mGpsData.measurements[i].accumulated_delta_range_state,
|
||||
mGpsData.measurements[i].flags);
|
||||
mGnssData.measurements[i].svid,
|
||||
mGnssData.measurements[i].time_offset_ns,
|
||||
mGnssData.measurements[i].state,
|
||||
mGnssData.measurements[i].c_n0_dbhz,
|
||||
mGnssData.measurements[i].pseudorange_rate_mps,
|
||||
mGnssData.measurements[i].pseudorange_rate_uncertainty_mps,
|
||||
mGnssData.measurements[i].accumulated_delta_range_state,
|
||||
mGnssData.measurements[i].flags);
|
||||
}
|
||||
LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
|
||||
" GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
|
||||
mGpsData.clock.time_ns);
|
||||
LOC_LOGV(" GPS_HAL => Clocks Info: \n"
|
||||
" time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | "
|
||||
" drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags"
|
||||
" GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n",
|
||||
mGnssData.clock.time_ns,
|
||||
mGnssData.clock.full_bias_ns,
|
||||
mGnssData.clock.bias_ns,
|
||||
mGnssData.clock.bias_uncertainty_ns,
|
||||
mGnssData.clock.drift_nsps,
|
||||
mGnssData.clock.drift_uncertainty_nsps,
|
||||
mGnssData.clock.hw_clock_discontinuity_count,
|
||||
mGnssData.clock.flags);
|
||||
}
|
||||
}
|
||||
inline void LocEngReportGpsMeasurement::log() const {
|
||||
inline void LocEngReportGnssMeasurement::log() const {
|
||||
locallog();
|
||||
}
|
||||
|
||||
|
@ -1683,24 +1749,6 @@ inline void LocEngReportGpsMeasurement::log() const {
|
|||
}
|
||||
#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
|
||||
|
||||
uint32_t getCarrierCapabilities() {
|
||||
#define carrierMSA (uint32_t)0x2
|
||||
#define carrierMSB (uint32_t)0x1
|
||||
#define gpsConfMSA (uint32_t)0x4
|
||||
#define gpsConfMSB (uint32_t)0x2
|
||||
uint32_t capabilities = gps_conf.CAPABILITIES;
|
||||
if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
|
||||
capabilities &= ~gpsConfMSA;
|
||||
}
|
||||
if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
|
||||
capabilities &= ~gpsConfMSB;
|
||||
}
|
||||
|
||||
LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
|
||||
gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities);
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_eng_init
|
||||
|
||||
|
@ -1746,6 +1794,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
|
||||
loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
|
||||
loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
|
||||
loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb;
|
||||
loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb;
|
||||
loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
|
||||
callbacks->location_ext_parser : noProc;
|
||||
loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
|
||||
|
@ -1761,7 +1811,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
|
||||
loc_eng_data.generateNmea = true;
|
||||
}
|
||||
else
|
||||
else if (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_MP)
|
||||
{
|
||||
loc_eng_data.generateNmea = false;
|
||||
}
|
||||
|
@ -1770,6 +1820,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
|
|||
new LocEngAdapter(event, &loc_eng_data, context,
|
||||
(LocThread::tCreate)callbacks->create_thread_cb);
|
||||
|
||||
loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo);
|
||||
loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015;
|
||||
LOC_LOGD("loc_eng_init created client, id = %p\n",
|
||||
loc_eng_data.adapter);
|
||||
loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
|
||||
|
@ -1790,6 +1842,15 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
|
|||
adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
|
||||
sap_conf.SENSOR_PROVIDER));
|
||||
adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
|
||||
adapter->sendMsg(new LocEngLPPeProtocol(adapter, gps_conf.LPPE_CP_TECHNOLOGY,
|
||||
gps_conf.LPPE_UP_TECHNOLOGY));
|
||||
|
||||
if (!loc_eng_data.generateNmea)
|
||||
{
|
||||
NmeaSentenceTypesMask typesMask = LOC_NMEA_ALL_SUPPORTED_MASK;
|
||||
LOC_LOGD("loc_eng_init setting nmea types, mask = %u\n",typesMask);
|
||||
adapter->sendMsg(new LocEngSetNmeaTypes(adapter,typesMask));
|
||||
}
|
||||
|
||||
/* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
|
||||
if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
|
||||
|
@ -1974,7 +2035,6 @@ static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
|
|||
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);
|
||||
}
|
||||
|
@ -2296,28 +2356,9 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call
|
|||
LocEngAdapter* adapter = loc_eng_data.adapter;
|
||||
loc_eng_data.agps_status_cb = callbacks->status_cb;
|
||||
|
||||
loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
|
||||
(void *)loc_eng_data.agps_status_cb,
|
||||
AGPS_TYPE_WWAN_ANY,
|
||||
false);
|
||||
loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
|
||||
(void *)loc_eng_data.agps_status_cb,
|
||||
AGPS_TYPE_WIFI,
|
||||
true);
|
||||
|
||||
if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
|
||||
(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
|
||||
loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
|
||||
(void *)loc_eng_data.agps_status_cb,
|
||||
AGPS_TYPE_SUPL,
|
||||
false);
|
||||
|
||||
if (NULL != adapter) {
|
||||
if (adapter->mSupportsAgpsRequests) {
|
||||
if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
|
||||
loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
|
||||
}
|
||||
loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
|
||||
NULL, NULL, &loc_eng_data);
|
||||
adapter->sendMsg(new LocEngAgnssNifInit(&loc_eng_data));
|
||||
}
|
||||
loc_eng_agps_reinit(loc_eng_data);
|
||||
}
|
||||
|
@ -2333,23 +2374,55 @@ static void deleteAidingData(loc_eng_data_s_type &logEng) {
|
|||
}
|
||||
}
|
||||
|
||||
// must be called under msg handler context
|
||||
static void createAgnssNifs(loc_eng_data_s_type& locEng) {
|
||||
bool agpsCapable = ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
|
||||
(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB));
|
||||
LocEngAdapter* adapter = locEng.adapter;
|
||||
if (NULL != adapter && adapter->mSupportsAgpsRequests) {
|
||||
if (NULL == locEng.internet_nif) {
|
||||
locEng.internet_nif= new AgpsStateMachine(servicerTypeAgps,
|
||||
(void *)locEng.agps_status_cb,
|
||||
AGPS_TYPE_WWAN_ANY,
|
||||
false);
|
||||
}
|
||||
if (agpsCapable) {
|
||||
if (NULL == locEng.agnss_nif) {
|
||||
locEng.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
|
||||
(void *)locEng.agps_status_cb,
|
||||
AGPS_TYPE_SUPL,
|
||||
false);
|
||||
}
|
||||
if (NULL == locEng.ds_nif &&
|
||||
gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL &&
|
||||
0 == adapter->initDataServiceClient()) {
|
||||
locEng.ds_nif = new DSStateMachine(servicerTypeExt,
|
||||
(void *)dataCallCb,
|
||||
locEng.adapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// must be called under msg handler context
|
||||
static AgpsStateMachine*
|
||||
getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
|
||||
AgpsStateMachine* stateMachine;
|
||||
switch (agpsType) {
|
||||
case AGPS_TYPE_WIFI: {
|
||||
stateMachine = locEng.wifi_nif;
|
||||
break;
|
||||
}
|
||||
case AGPS_TYPE_INVALID:
|
||||
case AGPS_TYPE_SUPL: {
|
||||
stateMachine = locEng.agnss_nif;
|
||||
break;
|
||||
}
|
||||
case AGPS_TYPE_SUPL_ES: {
|
||||
locEng.ds_nif ?
|
||||
stateMachine = locEng.ds_nif:
|
||||
if (gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
|
||||
if (NULL == locEng.ds_nif) {
|
||||
createAgnssNifs(locEng);
|
||||
}
|
||||
stateMachine = locEng.ds_nif;
|
||||
} else {
|
||||
stateMachine = locEng.agnss_nif;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -2391,10 +2464,9 @@ int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
|
|||
LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
|
||||
|
||||
int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
|
||||
|
||||
loc_eng_data.adapter->sendMsg(
|
||||
new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
|
||||
new LocEngAtlOpenSuccess(&loc_eng_data, agpsType,
|
||||
apn, apn_len, bearerType));
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
return 0;
|
||||
|
@ -2423,8 +2495,8 @@ int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
|
|||
INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
|
||||
return -1);
|
||||
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
|
||||
loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
|
||||
loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(&loc_eng_data,
|
||||
agpsType));
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
return 0;
|
||||
|
@ -2453,8 +2525,8 @@ int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agps
|
|||
INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
|
||||
return -1);
|
||||
|
||||
AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
|
||||
loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
|
||||
loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(&loc_eng_data,
|
||||
agpsType));
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
return 0;
|
||||
|
@ -2730,12 +2802,20 @@ void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
|
|||
if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) {
|
||||
adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy()));
|
||||
}
|
||||
// we always update lock mask, this is because if this is dsds device, we would not
|
||||
// know if modem has switched dds, if so, lock mask may also need to be updated.
|
||||
// if we have power vote, HAL is on, lock mask 0; else gps_conf.GPS_LOCK.
|
||||
adapter->setGpsLockMsg(adapter->getPowerVote() ? 0 : gps_conf.GPS_LOCK);
|
||||
}
|
||||
|
||||
gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
|
||||
gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
|
||||
gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
|
||||
gps_conf_tmp.SUPL_MODE = gps_conf.SUPL_MODE;
|
||||
gps_conf_tmp.SUPL_ES = gps_conf.SUPL_ES;
|
||||
gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
|
||||
gps_conf_tmp.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL =
|
||||
gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
|
||||
gps_conf = gps_conf_tmp;
|
||||
}
|
||||
|
||||
|
@ -2856,8 +2936,9 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -2941,8 +3022,8 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
|
|||
{
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
|
||||
STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
|
||||
"gps measurement already initialized",
|
||||
STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb),
|
||||
"gnss measurement already initialized",
|
||||
return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
|
||||
STATE_CHECK((callbacks != NULL),
|
||||
"callbacks can not be NULL",
|
||||
|
@ -2958,7 +3039,7 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
|
|||
event,
|
||||
LOC_REGISTRATION_MASK_ENABLED));
|
||||
// set up the callback
|
||||
loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
|
||||
loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
|
||||
LOC_LOGD ("%s, event masks updated successfully", __func__);
|
||||
|
||||
return GPS_MEASUREMENT_OPERATION_SUCCESS;
|
||||
|
@ -2993,6 +3074,6 @@ void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
|
|||
event,
|
||||
LOC_REGISTRATION_MASK_DISABLED));
|
||||
// set up the callback
|
||||
loc_eng_data.gps_measurement_cb = NULL;
|
||||
loc_eng_data.gnss_measurement_cb = NULL;
|
||||
EXIT_LOG(%d, 0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2009-2014, 2016 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -67,7 +67,8 @@ typedef unsigned char boolean;
|
|||
#define FAILURE FALSE
|
||||
#define INVALID_ATL_CONNECTION_HANDLE -1
|
||||
|
||||
#define MAX_XTRA_SERVER_URL_LENGTH 256
|
||||
#define gps_conf ContextBase::mGps_conf
|
||||
#define sap_conf ContextBase::mSap_conf
|
||||
|
||||
enum loc_nmea_provider_e_type {
|
||||
NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
|
||||
|
@ -89,12 +90,14 @@ typedef struct loc_eng_data_s
|
|||
loc_sv_status_cb_ext sv_status_cb;
|
||||
agps_status_extended agps_status_cb;
|
||||
gps_nmea_callback nmea_cb;
|
||||
gps_ni_notify_callback ni_notify_cb;
|
||||
loc_ni_notify_callback ni_notify_cb;
|
||||
gps_set_capabilities set_capabilities_cb;
|
||||
gps_acquire_wakelock acquire_wakelock_cb;
|
||||
gps_release_wakelock release_wakelock_cb;
|
||||
gps_request_utc_time request_utc_time_cb;
|
||||
gps_measurement_callback gps_measurement_cb;
|
||||
gnss_set_system_info set_system_info_cb;
|
||||
gnss_sv_status_callback gnss_sv_status_cb;
|
||||
gnss_measurement_callback gnss_measurement_cb;
|
||||
boolean intermediateFix;
|
||||
AGpsStatusValue agps_status;
|
||||
loc_eng_xtra_data_s_type xtra_module_data;
|
||||
|
@ -103,7 +106,6 @@ typedef struct loc_eng_data_s
|
|||
// AGPS state machines
|
||||
AgpsStateMachine* agnss_nif;
|
||||
AgpsStateMachine* internet_nif;
|
||||
AgpsStateMachine* wifi_nif;
|
||||
//State machine for Data Services
|
||||
AgpsStateMachine* ds_nif;
|
||||
|
||||
|
@ -119,7 +121,8 @@ typedef struct loc_eng_data_s
|
|||
|
||||
// For nmea generation
|
||||
boolean generateNmea;
|
||||
uint32_t sv_used_mask;
|
||||
uint32_t gps_used_mask;
|
||||
uint32_t glo_used_mask;
|
||||
float hdop;
|
||||
float pdop;
|
||||
float vdop;
|
||||
|
@ -139,67 +142,6 @@ typedef struct loc_eng_data_s
|
|||
loc_ext_parser sv_ext_parser;
|
||||
} loc_eng_data_s_type;
|
||||
|
||||
/* GPS.conf support */
|
||||
/* NOTE: the implementaiton of the parser casts number
|
||||
fields to 32 bit. To ensure all 'n' fields working,
|
||||
they must all be 32 bit fields. */
|
||||
typedef struct loc_gps_cfg_s
|
||||
{
|
||||
uint32_t INTERMEDIATE_POS;
|
||||
uint32_t ACCURACY_THRES;
|
||||
uint32_t SUPL_VER;
|
||||
uint32_t SUPL_MODE;
|
||||
uint32_t CAPABILITIES;
|
||||
uint32_t LPP_PROFILE;
|
||||
uint32_t XTRA_VERSION_CHECK;
|
||||
char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
|
||||
uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
|
||||
uint32_t NMEA_PROVIDER;
|
||||
uint32_t GPS_LOCK;
|
||||
uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
|
||||
uint32_t AGPS_CERT_WRITABLE_MASK;
|
||||
} loc_gps_cfg_s_type;
|
||||
|
||||
/* NOTE: the implementaiton of the parser casts number
|
||||
fields to 32 bit. To ensure all 'n' fields working,
|
||||
they must all be 32 bit fields. */
|
||||
/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
|
||||
fields are double. Rigid as they are, it is the
|
||||
the status quo, until the parsing mechanism is
|
||||
change, that is. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
|
||||
double GYRO_BIAS_RANDOM_WALK;
|
||||
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
|
||||
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
|
||||
uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
|
||||
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
|
||||
uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
|
||||
uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
|
||||
uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
|
||||
uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
|
||||
uint32_t SENSOR_CONTROL_MODE;
|
||||
uint32_t SENSOR_USAGE;
|
||||
uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
|
||||
uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
|
||||
double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
|
||||
uint32_t SENSOR_PROVIDER;
|
||||
} loc_sap_cfg_s_type;
|
||||
|
||||
extern loc_gps_cfg_s_type gps_conf;
|
||||
extern loc_sap_cfg_s_type sap_conf;
|
||||
|
||||
|
||||
uint32_t getCarrierCapabilities();
|
||||
|
||||
//loc_eng functions
|
||||
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
|
||||
|
|
|
@ -105,11 +105,11 @@ struct LocEngReportPosition : public LocMsg {
|
|||
|
||||
struct LocEngReportSv : public LocMsg {
|
||||
LocAdapterBase* mAdapter;
|
||||
const QcomSvStatus mSvStatus;
|
||||
const GnssSvStatus mSvStatus;
|
||||
const GpsLocationExtended mLocationExtended;
|
||||
const void* mSvExt;
|
||||
LocEngReportSv(LocAdapterBase* adapter,
|
||||
QcomSvStatus &sv,
|
||||
GnssSvStatus &sv,
|
||||
GpsLocationExtended &locExtended,
|
||||
void* svExtended);
|
||||
virtual void proc() const;
|
||||
|
@ -289,11 +289,11 @@ struct LocEngGetZpp : public LocMsg {
|
|||
void send() const;
|
||||
};
|
||||
|
||||
struct LocEngReportGpsMeasurement : public LocMsg {
|
||||
struct LocEngReportGnssMeasurement : public LocMsg {
|
||||
void* mLocEng;
|
||||
const GpsData mGpsData;
|
||||
LocEngReportGpsMeasurement(void* locEng,
|
||||
GpsData &gpsData);
|
||||
const GnssData mGnssData;
|
||||
LocEngReportGnssMeasurement(void* locEng,
|
||||
GnssData &gnssData);
|
||||
virtual void proc() const;
|
||||
void locallog() const;
|
||||
virtual void log() const;
|
||||
|
|
|
@ -189,7 +189,7 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
|
|||
}
|
||||
|
||||
CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
|
||||
loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
|
||||
loc_eng_data.ni_notify_cb((GpsNiNotification*)notif, gps_conf.SUPL_ES != 0);
|
||||
}
|
||||
EXIT_LOG(%s, VOID_RET);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012, 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
@ -29,10 +29,6 @@
|
|||
|
||||
#define LOG_NDDEBUG 0
|
||||
#define LOG_TAG "LocSvc_eng_nmea"
|
||||
#define GPS_PRN_START 1
|
||||
#define GPS_PRN_END 32
|
||||
#define GLONASS_PRN_START 65
|
||||
#define GLONASS_PRN_END 96
|
||||
#include <loc_eng.h>
|
||||
#include <loc_eng_nmea.h>
|
||||
#include <math.h>
|
||||
|
@ -92,8 +88,12 @@ int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
|
|||
length++;
|
||||
}
|
||||
|
||||
// length now contains nmea sentence string length not including $ sign.
|
||||
int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
|
||||
return (length + checksumLength);
|
||||
|
||||
// total length of nmea sentence is length of nmea sentence inc $ sign plus
|
||||
// length of checksum (+1 is to cover the $ character in the length).
|
||||
return (length + checksumLength + 1);
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
|
@ -101,6 +101,12 @@ 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
|
||||
|
||||
DEPENDENCIES
|
||||
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 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++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
// 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;
|
||||
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));
|
||||
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------
|
||||
// ------------------
|
||||
|
@ -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));
|
||||
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));
|
||||
length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
|
||||
loc_eng_nmea_send(sentence, length, loc_eng_data_p);
|
||||
|
@ -604,7 +707,7 @@ SIDE EFFECTS
|
|||
|
||||
===========================================================================*/
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
||||
const QcomSvStatus &svStatus, const GpsLocationExtended &locationExtended)
|
||||
const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
|
||||
{
|
||||
ENTRY_LOG();
|
||||
|
||||
|
@ -621,15 +724,27 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
//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;
|
||||
for(svNumber=1; svNumber <= svCount; svNumber++) {
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
|
||||
if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GPGSA
|
||||
// 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->gps_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
|
||||
}
|
||||
gpsCount++;
|
||||
}
|
||||
else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
|
||||
else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GNGSA
|
||||
// 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->glo_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
|
||||
}
|
||||
glnCount++;
|
||||
}
|
||||
}
|
||||
|
@ -669,13 +784,12 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
|
||||
{
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
|
||||
if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
|
||||
svStatus.sv_list[svNumber-1].prn,
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
|
||||
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)
|
||||
{
|
||||
|
@ -685,10 +799,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (svStatus.sv_list[svNumber-1].snr > 0)
|
||||
if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,"%02d",
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -747,13 +861,13 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
|
||||
{
|
||||
if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
|
||||
(svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) {
|
||||
if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
|
||||
{
|
||||
|
||||
length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
|
||||
svStatus.sv_list[svNumber-1].prn,
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
|
||||
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)
|
||||
{
|
||||
|
@ -763,10 +877,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
pMarker += length;
|
||||
lengthRemaining -= length;
|
||||
|
||||
if (svStatus.sv_list[svNumber-1].snr > 0)
|
||||
if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
|
||||
{
|
||||
length = snprintf(pMarker, lengthRemaining,"%02d",
|
||||
(int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
|
||||
(int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
|
||||
|
||||
if (length < 0 || length >= lengthRemaining)
|
||||
{
|
||||
|
@ -790,10 +904,6 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
|
|||
|
||||
}//if
|
||||
|
||||
// cache the used in fix mask, as it will be needed to send $GPGSA
|
||||
// during the position report
|
||||
loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask;
|
||||
|
||||
// For RPC, the DOP are sent during sv report, so cache them
|
||||
// now to be sent during position report.
|
||||
// For QMI, the DOP will be in position report.
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
|
||||
int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const QcomSvStatus &svStatus, const GpsLocationExtended &locationExtended);
|
||||
void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
|
||||
void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
|
||||
|
||||
#endif // LOC_ENG_NMEA_H
|
||||
|
|
|
@ -124,6 +124,13 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
|
|||
loc_eng_xtra_data_s_type *xtra_module_data_ptr;
|
||||
ENTRY_LOG();
|
||||
|
||||
if(!loc_eng_data.adapter->mSupportsTimeInjection
|
||||
|| loc_eng_data.adapter->hasNativeXtraClient()) {
|
||||
LOC_LOGD("XTRA is already supported. disable it here.\n");
|
||||
EXIT_LOG(%d, 1); // return 1 denote failure
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(callbacks == NULL) {
|
||||
LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
|
||||
} else {
|
||||
|
|
|
@ -24,10 +24,10 @@ LOCAL_SRC_FILES += \
|
|||
MsgTask.cpp \
|
||||
loc_misc_utils.cpp
|
||||
|
||||
# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
|
||||
LOCAL_CFLAGS += \
|
||||
-fno-short-enums \
|
||||
-D_ANDROID_ \
|
||||
-std=c++11
|
||||
-D_ANDROID_
|
||||
|
||||
ifeq ($(TARGET_BUILD_VARIANT),user)
|
||||
LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
|
||||
|
@ -59,7 +59,6 @@ LOCAL_COPY_HEADERS:= \
|
|||
loc_misc_utils.h
|
||||
|
||||
LOCAL_MODULE := libgps.utils
|
||||
LOCAL_CLANG := false
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
|
|
|
@ -84,9 +84,7 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
|
|||
if (mThandle) {
|
||||
// set thread name
|
||||
char lname[16];
|
||||
int len = sizeof(lname) - 1;
|
||||
memcpy(lname, threadName, len);
|
||||
lname[len] = 0;
|
||||
strlcpy(lname, threadName, sizeof(lname));
|
||||
// set the thread name here
|
||||
pthread_setname_np(mThandle, lname);
|
||||
|
||||
|
|
|
@ -505,8 +505,13 @@ int LocTimerDelegate::ranks(LocRankable& rankable) {
|
|||
LocTimerDelegate* timer = (LocTimerDelegate*)(&rankable);
|
||||
if (timer) {
|
||||
// larger time ranks lower!!!
|
||||
// IOW, if input obj has bigger tv_sec, this obj outRanks higher
|
||||
// IOW, if input obj has bigger tv_sec/tv_nsec, this obj outRanks higher
|
||||
rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec;
|
||||
if(0 == rank)
|
||||
{
|
||||
//rank against tv_nsec for msec accuracy
|
||||
rank = (int)(timer->mFutureTime.tv_nsec - mFutureTime.tv_nsec);
|
||||
}
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,12 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); }
|
|||
} \
|
||||
} 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)
|
||||
|
|
Loading…
Reference in a new issue