Addition of new LocApi thread

1. LocApiBase to create its own MsgTask thread to allow QMI calls
to be made asynchronously. It shall no longer share the adapter's thread.
2. Implementation of new LocApiResponse classes for generic response type
from LocApi layer to Adapter layers.
3. GnssAdapter modified to handle the asynchronous nature of LocApi calls.

CRs-Fixed: 2218658

Change-Id: I6e401a89f16791ec144763ac5f070b7ee1dad931
This commit is contained in:
Bhavna Sharma 2018-01-22 16:04:50 -08:00
parent 87c52f1f37
commit ae28b29898
12 changed files with 842 additions and 557 deletions

View file

@ -42,6 +42,10 @@ namespace loc_core {
loc_gps_cfg_s_type ContextBase::mGps_conf {};
loc_sap_cfg_s_type ContextBase::mSap_conf {};
bool ContextBase::sIsEngineCapabilitiesKnown = false;
uint64_t ContextBase::sSupportedMsgMask = 0;
bool ContextBase::sGnssMeasurementSupported = false;
uint8_t ContextBase::sFeaturesSupported[MAX_FEATURE_LENGTH];
const loc_param_s_type ContextBase::mGps_conf_table[] =
{
@ -215,7 +219,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
// Check the target
if (TARGET_NO_GNSS != loc_get_target()){
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
if (NULL == (locApi = mLBSProxy->getLocApi(exMask, this))) {
void *handle = NULL;
//try to see if LocApiV02 is present
if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
@ -224,7 +228,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
if (getter != NULL) {
LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
__LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
locApi = (*getter)(exMask, this);
}
}
// only RPC is the option now
@ -237,7 +241,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
if (NULL != getter) {
LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
__LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
locApi = (*getter)(exMask, this);
}
}
}
@ -247,7 +251,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
// locApi could still be NULL at this time
// we would then create a dummy one
if (NULL == locApi) {
locApi = new LocApiBase(mMsgTask, exMask, this);
locApi = new LocApiBase(exMask, this);
}
return locApi;
@ -263,4 +267,33 @@ ContextBase::ContextBase(const MsgTask* msgTask,
{
}
void ContextBase::setEngineCapabilities(uint64_t supportedMsgMask,
uint8_t *featureList, bool gnssMeasurementSupported) {
if (ContextBase::sIsEngineCapabilitiesKnown == false) {
ContextBase::sSupportedMsgMask = supportedMsgMask;
ContextBase::sGnssMeasurementSupported = gnssMeasurementSupported;
if (featureList != NULL) {
memcpy((void *)ContextBase::sFeaturesSupported,
(void *)featureList, sizeof(ContextBase::sFeaturesSupported));
}
ContextBase::sIsEngineCapabilitiesKnown = true;
}
}
bool ContextBase::isFeatureSupported(uint8_t featureVal)
{
uint8_t arrayIndex = featureVal >> 3;
uint8_t bitPos = featureVal & 7;
if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
return ((ContextBase::sFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
}
bool ContextBase::gnssConstellationConfig() {
return sGnssMeasurementSupported;
}
}

View file

@ -116,6 +116,7 @@ protected:
const MsgTask* mMsgTask;
LocApiBase* mLocApi;
LocApiProxyBase *mLocApiProxy;
public:
ContextBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
@ -140,12 +141,111 @@ public:
static loc_gps_cfg_s_type mGps_conf;
static loc_sap_cfg_s_type mSap_conf;
static bool sIsEngineCapabilitiesKnown;
static uint64_t sSupportedMsgMask;
static uint8_t sFeaturesSupported[MAX_FEATURE_LENGTH];
static bool sGnssMeasurementSupported;
void readConfig();
static uint32_t getCarrierCapabilities();
void setEngineCapabilities(uint64_t supportedMsgMask,
uint8_t *featureList, bool gnssMeasurementSupported);
static inline bool isEngineCapabilitiesKnown() {
return sIsEngineCapabilitiesKnown;
}
static inline bool isMessageSupported(LocCheckingMessagesID msgID) {
// confirm if msgID is not larger than the number of bits in
// mSupportedMsg
if ((uint64_t)msgID > (sizeof(sSupportedMsgMask) << 3)) {
return false;
} else {
uint32_t messageChecker = 1 << msgID;
return (messageChecker & sSupportedMsgMask) == messageChecker;
}
}
/*
Check if a feature is supported
*/
static bool isFeatureSupported(uint8_t featureVal);
/*
Check if gnss measurement is supported
*/
static bool gnssConstellationConfig();
};
struct LocApiResponse: LocMsg {
private:
ContextBase& mContext;
std::function<void (LocationError err)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationError);
}
protected:
LocationError mLocationError;
public:
inline LocApiResponse(ContextBase& context,
std::function<void (LocationError err)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
void returnToSender(const LocationError err) {
mLocationError = err;
mContext.sendMsg(this);
}
};
struct LocApiCollectiveResponse: LocMsg {
private:
ContextBase& mContext;
std::function<void (std::vector<LocationError> errs)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationErrors);
}
protected:
std::vector<LocationError> mLocationErrors;
public:
inline LocApiCollectiveResponse(ContextBase& context,
std::function<void (std::vector<LocationError> errs)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
inline virtual ~LocApiCollectiveResponse() {
}
void returnToSender(std::vector<LocationError>& errs) {
mLocationErrors = errs;
mContext.sendMsg(this);
}
};
template <typename DATA>
struct LocApiResponseData: LocMsg {
private:
ContextBase& mContext;
std::function<void (LocationError err, DATA data)> mProcImpl;
inline virtual void proc() const {
mProcImpl(mLocationError, mData);
}
protected:
LocationError mLocationError;
DATA mData;
public:
inline LocApiResponseData(ContextBase& context,
std::function<void (LocationError err, DATA data)> procImpl ) :
mContext(context), mProcImpl(procImpl) {}
void returnToSender(const LocationError err, const DATA data) {
mLocationError = err;
mData = data;
mContext.sendMsg(this);
}
};
} // namespace loc_core
#endif //__LOC_CONTEXT_BASE__

View file

@ -29,7 +29,6 @@
#ifndef IZAT_PROXY_BASE_H
#define IZAT_PROXY_BASE_H
#include <gps_extended.h>
#include <MsgTask.h>
namespace loc_core {
@ -40,11 +39,9 @@ class ContextBase;
class LBSProxyBase {
friend class ContextBase;
inline virtual LocApiBase*
getLocApi(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context) const {
(void)msgTask;
(void)exMask;
(void)context;
return NULL;

View file

@ -161,4 +161,10 @@ bool LocAdapterBase::
reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportZppBestAvailableFix(LocGpsLocation& /*zppLoc*/,
GpsLocationExtended& /*location_extended*/, LocPosTechMask /*tech_mask*/)
DEFAULT_IMPL(false)
} // namespace loc_core

View file

@ -107,7 +107,7 @@ public:
}
inline bool isFeatureSupported(uint8_t featureVal) {
return mLocApi->isFeatureSupported(featureVal);
return ContextBase::isFeatureSupported(featureVal);
}
uint32_t generateSessionId();
@ -153,6 +153,8 @@ public:
virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
int msInWeek);
virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
};
} // namespace loc_core

View file

@ -126,14 +126,36 @@ struct LocOpenMsg : public LocMsg {
}
};
LocApiBase::LocApiBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
struct LocCloseMsg : public LocMsg {
LocApiBase* mLocApi;
inline LocCloseMsg(LocApiBase* locApi) :
LocMsg(), mLocApi(locApi)
{
locallog();
}
inline virtual void proc() const {
mLocApi->close();
}
inline void locallog() const {
LOC_LOGV("%s]: LocCloseMsg");
}
inline virtual void log() const {
locallog();
}
};
MsgTask* LocApiBase::mMsgTask;
LocApiBase::LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context) :
mMsgTask(msgTask), mContext(context), mSupportedMsg(0),
mContext(context),
mMask(0), mExcludedMask(excludedMask)
{
memset(mLocAdapters, 0, sizeof(mLocAdapters));
memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
if (nullptr == mMsgTask) {
mMsgTask = new MsgTask("LocApiMsgTask", false);
}
}
LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
@ -197,7 +219,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
// if we have an empty list of adapters
if (0 == i) {
close();
mMsgTask->sendMsg(new LocCloseMsg(this));
} else {
// else we need to remove the bit
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
@ -208,14 +230,11 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter)
void LocApiBase::updateEvtMask()
{
open(getEvtMask());
mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
}
void LocApiBase::handleEngineUpEvent()
{
// This will take care of renegotiating the loc handle
mMsgTask->sendMsg(new LocSsrMsg(this));
LocDualContext::injectFeatureConfig(mContext);
// loop through adapters, and deliver to all adapters.
@ -223,7 +242,9 @@ void LocApiBase::handleEngineUpEvent()
}
void LocApiBase::handleEngineDownEvent()
{
{ // This will take care of renegotiating the loc handle
sendMsg(new LocSsrMsg(this));
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
}
@ -239,7 +260,7 @@ void LocApiBase::reportPosition(UlpLocation& location,
"timestamp: %" PRId64 "\n"
"Session status: %d\n Technology mask: %u\n "
"SV used in fix (gps/glo/bds/gal/qzss) : \
(%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 ")",
(0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 ")",
location.gpsLocation.flags, location.position_source,
location.gpsLocation.latitude, location.gpsLocation.longitude,
location.gpsLocation.altitude, location.gpsLocation.speed,
@ -263,6 +284,15 @@ void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
}
void LocApiBase::reportZppBestAvailableFix(LocGpsLocation &zppLoc,
GpsLocationExtended &location_extended, LocPosTechMask tech_mask)
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportZppBestAvailableFix(zppLoc,
location_extended, tech_mask));
}
void LocApiBase::reportSv(GnssSvNotification& svNotify)
{
const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
@ -384,16 +414,6 @@ void LocApiBase::requestNiNotify(GnssNiNotification &notify, const void* data)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
}
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)
@ -415,86 +435,72 @@ enum loc_api_adapter_err LocApiBase::
close()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
startFix(const LocPosMode& /*posMode*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
void LocApiBase::startFix(const LocPosMode& /*posMode*/, LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
stopFix()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
void LocApiBase::stopFix(LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
LocationError LocApiBase::
deleteAidingData(const GnssAidingData& /*data*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
void LocApiBase::
deleteAidingData(const GnssAidingData& /*data*/, LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
enableData(int /*enable*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
setAPN(char* /*apn*/, int /*len*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
void LocApiBase::
injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
void LocApiBase::
setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
setXtraData(char* /*data*/, int /*length*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
requestXtraServer()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/,
void LocApiBase::
atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/, uint32_t /*apnLen*/,
AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
void LocApiBase::
atlCloseStatus(int /*handle*/, int /*is_succ*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
DEFAULT_IMPL()
enum loc_api_adapter_err LocApiBase::
void LocApiBase::
setPositionMode(const LocPosMode& /*posMode*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
DEFAULT_IMPL()
LocationError LocApiBase::
setServer(const char* /*url*/, int /*len*/)
setServerSync(const char* /*url*/, int /*len*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
LocationError LocApiBase::
setServer(unsigned int /*ip*/, int /*port*/, LocServerType /*type*/)
setServerSync(unsigned int /*ip*/, int /*port*/, LocServerType /*type*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
LocationError LocApiBase::
void LocApiBase::
informNiResponse(GnssNiResponse /*userResponse*/, const void* /*passThroughData*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
DEFAULT_IMPL()
LocationError LocApiBase::
setSUPLVersion(GnssConfigSuplVersion /*version*/)
setSUPLVersionSync(GnssConfigSuplVersion /*version*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
setNMEATypes (uint32_t /*typesMask*/)
setNMEATypesSync (uint32_t /*typesMask*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
LocationError LocApiBase::
setLPPConfig(GnssConfigLppProfile /*profile*/)
setLPPConfigSync(GnssConfigLppProfile /*profile*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
setSensorControlConfig(int /*sensorUsage*/,
setSensorControlConfigSync(int /*sensorUsage*/,
int /*sensorProvider*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
setSensorProperties(bool /*gyroBiasVarianceRandomWalk_valid*/,
setSensorPropertiesSync(bool /*gyroBiasVarianceRandomWalk_valid*/,
float /*gyroBiasVarianceRandomWalk*/,
bool /*accelBiasVarianceRandomWalk_valid*/,
float /*accelBiasVarianceRandomWalk*/,
@ -507,7 +513,7 @@ enum loc_api_adapter_err LocApiBase::
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
setSensorPerfControlConfig(int /*controlMode*/,
setSensorPerfControlConfigSync(int /*controlMode*/,
int /*accelSamplesPerBatch*/,
int /*accelBatchesPerSec*/,
int /*gyroSamplesPerBatch*/,
@ -520,37 +526,36 @@ enum loc_api_adapter_err LocApiBase::
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
LocationError LocApiBase::
setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask /*aGlonassProtocol*/)
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask /*aGlonassProtocol*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
LocationError LocApiBase::
setLPPeProtocolCp(GnssConfigLppeControlPlaneMask /*lppeCP*/)
setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask /*lppeCP*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
LocationError LocApiBase::
setLPPeProtocolUp(GnssConfigLppeUserPlaneMask /*lppeUP*/)
setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask /*lppeUP*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
GnssConfigSuplVersion LocApiBase::convertSuplVersion(const uint32_t /*suplVersion*/)
DEFAULT_IMPL(GNSS_CONFIG_SUPL_VERSION_1_0_0)
GnssConfigLppProfile LocApiBase::convertLppProfile(const uint32_t /*lppProfile*/)
DEFAULT_IMPL(GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE)
GnssConfigLppeControlPlaneMask LocApiBase::convertLppeCp(const uint32_t /*lppeControlPlaneMask*/)
DEFAULT_IMPL(0)
GnssConfigLppeUserPlaneMask LocApiBase::convertLppeUp(const uint32_t /*lppeUserPlaneMask*/)
DEFAULT_IMPL(0)
enum loc_api_adapter_err LocApiBase::
getWwanZppFix()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
getBestAvailableZppFix(LocGpsLocation& zppLoc)
{
memset(&zppLoc, 0, sizeof(zppLoc));
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
}
enum loc_api_adapter_err LocApiBase::
getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
LocPosTechMask & tech_mask)
{
memset(&zppLoc, 0, sizeof(zppLoc));
memset(&tech_mask, 0, sizeof(tech_mask));
memset(&locationExtended, 0, sizeof (locationExtended));
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
}
void LocApiBase::
getBestAvailableZppFix()
DEFAULT_IMPL()
int LocApiBase::
initDataServiceClient(bool /*isDueToSsr*/)
@ -573,7 +578,7 @@ void LocApiBase::
DEFAULT_IMPL()
LocationError LocApiBase::
setGpsLock(GnssConfigGpsLock /*lock*/)
setGpsLockSync(GnssConfigGpsLock /*lock*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
void LocApiBase::
@ -587,21 +592,7 @@ int LocApiBase::
DEFAULT_IMPL(-1)
LocationError LocApiBase::
setXtraVersionCheck(uint32_t /*check*/)
setXtraVersionCheckSync(uint32_t /*check*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
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

View file

@ -37,7 +37,9 @@
#include <log_util.h>
namespace loc_core {
class ContextBase;
struct LocApiResponse;
int hexcode(char *hexstring, int string_size,
const char *data, int data_size);
@ -66,6 +68,28 @@ class LocAdapterBase;
struct LocSsrMsg;
struct LocOpenMsg;
typedef struct
{
uint32_t accumulatedDistance;
uint32_t numOfBatchedPositions;
} LocApiBatchData;
typedef struct
{
uint32_t hwId;
} LocApiGeofenceData;
struct LocApiMsg: LocMsg {
private:
std::function<void ()> mProcImpl;
inline virtual void proc() const {
mProcImpl();
}
public:
inline LocApiMsg(std::function<void ()> procImpl ) :
mProcImpl(procImpl) {}
};
class LocApiProxyBase {
public:
inline LocApiProxyBase() {}
@ -78,22 +102,21 @@ class LocApiBase {
//LocOpenMsg calls open() which makes it necessary to declare
//it as a friend
friend struct LocOpenMsg;
friend struct LocCloseMsg;
friend class ContextBase;
const MsgTask* mMsgTask;
ContextBase *mContext;
static MsgTask* mMsgTask;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
uint64_t mSupportedMsg;
uint8_t mFeaturesSupported[MAX_FEATURE_LENGTH];
protected:
ContextBase *mContext;
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
LOC_API_ADAPTER_EVENT_MASK_T getEvtMask();
LOC_API_ADAPTER_EVENT_MASK_T mMask;
LocApiBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
LocApiBase(LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context = NULL);
inline virtual ~LocApiBase() { close(); }
bool isInSession();
@ -130,10 +153,10 @@ public:
void reportDataCallOpened();
void reportDataCallClosed();
void requestNiNotify(GnssNiNotification &notify, const void* data);
void saveSupportedMsgList(uint64_t supportedMsgList);
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
void saveSupportedFeatureList(uint8_t *featureList);
void reportWwanZppFix(LocGpsLocation &zppLoc);
void reportZppBestAvailableFix(LocGpsLocation &zppLoc, GpsLocationExtended &location_extended,
LocPosTechMask tech_mask);
// downward calls
// All below functions are to be defined by adapter specific modules:
@ -141,45 +164,43 @@ public:
virtual void* getSibling();
virtual LocApiProxyBase* getLocApiProxy();
virtual enum loc_api_adapter_err
startFix(const LocPosMode& posMode);
virtual enum loc_api_adapter_err
stopFix();
virtual LocationError
deleteAidingData(const GnssAidingData& data);
virtual enum loc_api_adapter_err
enableData(int enable);
virtual enum loc_api_adapter_err
setAPN(char* apn, int len);
virtual enum loc_api_adapter_err
virtual void startFix(const LocPosMode& fixCriteria, LocApiResponse* adapterResponse);
virtual void
stopFix(LocApiResponse* adapterResponse);
virtual void
deleteAidingData(const GnssAidingData& data, LocApiResponse* adapterResponse);
virtual void
injectPosition(double latitude, double longitude, float accuracy);
virtual enum loc_api_adapter_err
virtual void
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
// // TODO:: called from izatapipds
virtual enum loc_api_adapter_err
setXtraData(char* data, int length);
virtual enum loc_api_adapter_err
requestXtraServer();
virtual enum loc_api_adapter_err
atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, LocAGpsType agpsType);
virtual enum loc_api_adapter_err
virtual void
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen,
AGpsBearerType bear, LocAGpsType agpsType);
virtual void
atlCloseStatus(int handle, int is_succ);
virtual enum loc_api_adapter_err
virtual void
setPositionMode(const LocPosMode& posMode);
virtual LocationError
setServer(const char* url, int len);
setServerSync(const char* url, int len);
virtual LocationError
setServer(unsigned int ip, int port,
setServerSync(unsigned int ip, int port,
LocServerType type);
virtual LocationError
virtual void
informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError setSUPLVersion(GnssConfigSuplVersion version);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err
setNMEATypes (uint32_t typesMask);
virtual LocationError setLPPConfig(GnssConfigLppProfile profile);
setNMEATypesSync(uint32_t typesMask);
virtual LocationError setLPPConfigSync(GnssConfigLppProfile profile);
virtual enum loc_api_adapter_err
setSensorControlConfig(int sensorUsage, int sensorProvider);
setSensorControlConfigSync(int sensorUsage, int sensorProvider);
virtual enum loc_api_adapter_err
setSensorProperties(bool gyroBiasVarianceRandomWalk_valid,
setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid,
float gyroBiasVarianceRandomWalk,
bool accelBiasVarianceRandomWalk_valid,
float accelBiasVarianceRandomWalk,
@ -190,7 +211,7 @@ public:
bool velocityBiasVarianceRandomWalk_valid,
float velocityBiasVarianceRandomWalk);
virtual enum loc_api_adapter_err
setSensorPerfControlConfig(int controlMode,
setSensorPerfControlConfigSync(int controlMode,
int accelSamplesPerBatch,
int accelBatchesPerSec,
int gyroSamplesPerBatch,
@ -201,16 +222,18 @@ public:
int gyroBatchesPerSecHigh,
int algorithmConfig);
virtual LocationError
setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP);
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
virtual GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
virtual enum loc_api_adapter_err
getWwanZppFix();
virtual enum loc_api_adapter_err
getBestAvailableZppFix(LocGpsLocation & zppLoc);
virtual enum loc_api_adapter_err
getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
LocPosTechMask & tech_mask);
virtual void
getBestAvailableZppFix();
virtual int initDataServiceClient(bool isDueToSsr);
virtual int openAndStartDataCall();
virtual void stopDataCall();
@ -223,21 +246,11 @@ public:
(void)inSession;
}
inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
// 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;
return (messageChecker & mSupportedMsg) == messageChecker;
}
}
void updateEvtMask();
virtual LocationError setGpsLock(GnssConfigGpsLock lock);
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
/*
Returns
Current value of GPS Lock on success
@ -245,20 +258,11 @@ public:
*/
virtual int getGpsLock(void);
virtual LocationError setXtraVersionCheck(uint32_t check);
/*
Check if the modem support the service
*/
virtual bool gnssConstellationConfig();
virtual LocationError setXtraVersionCheckSync(uint32_t check);
/*
Check if a feature is supported
*/
bool isFeatureSupported(uint8_t featureVal);
};
typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
typedef LocApiBase* (getLocApi_t)(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context);
} // namespace loc_core

View file

@ -360,13 +360,13 @@ void AgpsStateMachine::notifyEventToSubscriber(
case AGPS_EVENT_GRANTED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 1, getAPN(),
subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(),
getBearer(), mAgpsType);
break;
case AGPS_EVENT_DENIED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 0, getAPN(),
subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(),
getBearer(), mAgpsType);
break;
@ -661,7 +661,7 @@ void DSStateMachine::notifyEventToSubscriber(
case AGPS_EVENT_GRANTED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 1, NULL,
subscriberToNotify->mConnHandle, 1, NULL, 0,
AGPS_APN_BEARER_INVALID, LOC_AGPS_TYPE_SUPL_ES);
break;
@ -778,7 +778,7 @@ void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType){
LOC_LOGE("No AGPS State Machine for agpsType: %d", agpsType);
mAtlOpenStatusCb(
connHandle, 0, NULL, AGPS_APN_BEARER_INVALID, agpsType);
connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType);
return;
}

View file

@ -40,7 +40,7 @@
/* ATL callback function pointers
* Passed in by Adapter to AgpsManager */
typedef std::function<void(
int handle, int isSuccess, char* apn,
int handle, int isSuccess, char* apn, uint32_t apnLen,
AGpsBearerType bearerType, AGpsExtType agpsType)> AgpsAtlOpenStatusCb;
typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
@ -169,6 +169,7 @@ public:
/* Getter/Setter methods */
void setAPN(char* apn, unsigned int len);
inline char* getAPN() const { return (char*)mAPN; }
inline uint32_t getAPNLen() const { return mAPNLen; }
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
inline AGpsBearerType getBearer() const { return mBearer; }
inline AGpsExtType getType() const { return mAgpsType; }

File diff suppressed because it is too large Load diff

View file

@ -157,7 +157,7 @@ public:
LocationCallbacks getClientCallbacks(LocationAPI* client);
LocationCapabilitiesMask getCapabilities();
void broadcastCapabilities(LocationCapabilitiesMask);
LocationError setSuplHostServer(const char* server, int port);
void setSuplHostServer(const char* server, int port);
/* ==== TRACKING ======================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
@ -180,12 +180,16 @@ public:
void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
bool setUlpPositionMode(const LocPosMode& mode);
LocPosMode& getUlpPositionMode() { return mUlpPositionMode; }
LocationError startTrackingMultiplex(const LocationOptions& options);
LocationError startTracking(const LocationOptions& options);
LocationError stopTrackingMultiplex(LocationAPI* client, uint32_t id);
LocationError stopTracking();
LocationError updateTrackingMultiplex(LocationAPI* client, uint32_t id,
bool startTrackingMultiplex(LocationAPI* client, uint32_t sessionId,
const LocationOptions& options);
bool startTracking(LocationAPI* client, uint32_t sessionId,
const LocationOptions& options);
bool stopTrackingMultiplex(LocationAPI* client, uint32_t id);
bool stopTracking(LocationAPI* client, uint32_t id);
bool updateTrackingMultiplex(LocationAPI* client, uint32_t id,
const LocationOptions& options);
bool updateTracking(LocationAPI* client, uint32_t sessionId,
const LocationOptions& updatedOptions, const LocationOptions& oldOptions);
/* ==== NI ============================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
@ -203,9 +207,11 @@ public:
void setControlCallbacksCommand(LocationControlCallbacks& controlCallbacks);
void readConfigCommand();
void setConfigCommand();
void requestUlpCommand();
void initEngHubProxyCommand();
uint32_t* gnssUpdateConfigCommand(GnssConfig config);
uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
void deleteAidingData(const GnssAidingData &data, uint32_t sessionId);
void gnssUpdateXtraThrottleCommand(const bool enabled);
void initDefaultAgpsCommand();
@ -224,7 +230,6 @@ public:
{ mControlCallbacks = controlCallbacks; }
void setPowerVoteId(uint32_t id) { mPowerVoteId = id; }
uint32_t getPowerVoteId() { return mPowerVoteId; }
bool resolveInAddress(const char* hostAddress, struct in_addr* inAddress);
virtual bool isInSession() { return !mTrackingSessions.empty(); }
void initDefaultAgps();
bool initEngHubProxy();
@ -249,6 +254,8 @@ public:
virtual bool requestSuplES(int connHandle);
virtual bool reportDataCallOpened();
virtual bool reportDataCallClosed();
virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc,
GpsLocationExtended &location_extended, LocPosTechMask tech_mask);
/* ======== UTILITIES ================================================================= */
bool needReport(const UlpLocation& ulpLocation,
@ -276,15 +283,11 @@ public:
static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);
static GnssConfigGpsLock convertGpsLock(const uint32_t gpsLock);
static uint32_t convertSuplVersion(const GnssConfigSuplVersion suplVersion);
static GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
static uint32_t convertLppProfile(const GnssConfigLppProfile lppProfile);
static GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
static uint32_t convertEP4ES(const GnssConfigEmergencyPdnForEmergencySupl);
static uint32_t convertSuplEs(const GnssConfigSuplEmergencyServices suplEmergencyServices);
static uint32_t convertLppeCp(const GnssConfigLppeControlPlaneMask lppeControlPlaneMask);
static GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
static uint32_t convertLppeUp(const GnssConfigLppeUserPlaneMask lppeUserPlaneMask);
static GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
static uint32_t convertAGloProt(const GnssConfigAGlonassPositionProtocolMask);
static uint32_t convertSuplMode(const GnssConfigSuplModeMask suplModeMask);
static void convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,

View file

@ -7,7 +7,7 @@ AM_CFLAGS = \
-I../utils \
-I$(WORKSPACE)/hardware/qcom/gps/core/data-items \
-I../location \
-std=c++11
-std=c++1y
libgnss_la_SOURCES = \
location_gnss.cpp \