diff --git a/core/ContextBase.h b/core/ContextBase.h index bd9a19f9..e32e9829 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -58,6 +58,8 @@ typedef struct loc_gps_cfg_s 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 diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index f92ccee4..2c7a2e84 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -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,6 +78,10 @@ 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) { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 7c114702..bda3dfd1 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2016, 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() @@ -356,6 +357,11 @@ 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) @@ -490,6 +496,10 @@ enum loc_api_adapter_err LocApiBase:: setAGLONASSProtocol(unsigned long aGlonassProtocol) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) +enum loc_api_adapter_err LocApiBase:: + setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP) + DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) + enum loc_api_adapter_err LocApiBase:: getWwanZppFix(GpsLocation& zppLoc) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) @@ -552,4 +562,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 diff --git a/core/LocApiBase.h b/core/LocApiBase.h index e92cdaa6..372fc74c 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2016, 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 @@ -131,6 +133,7 @@ public: void requestNiNotify(GpsNiNotification ¬ify, const void* data); void saveSupportedMsgList(uint64_t supportedMsgList); void reportGnssMeasurementData(GnssData &gnssMeasurementData); + void saveSupportedFeatureList(uint8_t *featureList); // downward calls // All below functions are to be defined by adapter specific modules: @@ -203,6 +206,8 @@ public: 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 @@ -258,6 +263,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, diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 9b677b87..f6f96f68 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2016, 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 @@ -87,6 +87,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; diff --git a/etc/gps.conf b/etc/gps.conf index f4153149..01188132 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -109,3 +109,17 @@ SGLTE_TARGET=0 # 0x2: RRLP UPlane # 0x4: LLP Uplane A_GLONASS_POS_PROTOCOL_SELECT = 0 + +################################################## +# Select technology for LPPe Control Plane +################################################## +# 0x1: DBH for LPPe CP +# 0x2: WLAN AP Measurements for LPPe CP +LPPE_CP_TECHNOLOGY = 0 + +################################################## +# Select technology for LPPe User Plane +################################################## +# 0x1: DBH for LPPe UP +# 0x2: WLAN AP Measurements for LPPe UP +LPPE_UP_TECHNOLOGY = 0 diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index b7f28f33..329104b2 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -236,6 +236,11 @@ public: { 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(); diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index f150bc36..f04a221d 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -86,6 +86,8 @@ 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'}, {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'}, @@ -138,6 +140,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; @@ -456,6 +462,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; @@ -1826,6 +1855,8 @@ 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) { diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index b1cfe72c..56ea2efa 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -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 @@ -142,6 +142,7 @@ typedef struct loc_eng_data_s loc_ext_parser sv_ext_parser; } loc_eng_data_s_type; + //loc_eng functions int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,