From 7656285551870fc982e17ee300e3ba57b7cafe8d Mon Sep 17 00:00:00 2001 From: Davide Garberi Date: Wed, 10 Oct 2018 16:48:02 +0200 Subject: msm8996-common: gps: Update from LA.UM.7.2.r1-04000-sdm660.0 * The vendor blobs from LA.UM.7.2.r1-04000-sdm660.0 - B2N_sprout:9/PPR1.180610.011/00WW_3_22C * Update gnsspps from CAF's location repo Change-Id: I6afc29a05459bf6d1951cb36b746d8cc781bc48f Signed-off-by: Davide Garberi --- gps/core/SystemStatus.h | 91 +++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 33 deletions(-) (limited to 'gps/core/SystemStatus.h') diff --git a/gps/core/SystemStatus.h b/gps/core/SystemStatus.h index 1bcef10..b2f4fb6 100644 --- a/gps/core/SystemStatus.h +++ b/gps/core/SystemStatus.h @@ -30,9 +30,10 @@ #define __SYSTEM_STATUS__ #include -#include +#include #include -#include +#include +#include #include #include #include @@ -70,14 +71,17 @@ public: static const uint32_t maxItem = 5; SystemStatusItemBase() { - timeval tv; - gettimeofday(&tv, NULL); + struct timespec tv; + clock_gettime(CLOCK_MONOTONIC, &tv); mUtcTime.tv_sec = tv.tv_sec; - mUtcTime.tv_nsec = tv.tv_usec *1000ULL; + mUtcTime.tv_nsec = tv.tv_nsec; mUtcReported = mUtcTime; }; - virtual ~SystemStatusItemBase() { }; - virtual void dump(void) { }; + virtual ~SystemStatusItemBase() {}; + inline virtual SystemStatusItemBase& collate(SystemStatusItemBase&) { + return *this; + } + virtual void dump(void) {}; }; class SystemStatusLocation : public SystemStatusItemBase @@ -92,7 +96,7 @@ public: const GpsLocationExtended& locationEx) : mValid(true), mLocation(location), - mLocationEx(locationEx) { } + mLocationEx(locationEx) {} bool equals(const SystemStatusLocation& peer); void dump(void); }; @@ -152,6 +156,12 @@ public: double mAgcGlo; double mAgcBds; double mAgcGal; + uint32_t mGloBpAmpI; + uint32_t mGloBpAmpQ; + uint32_t mBdsBpAmpI; + uint32_t mBdsBpAmpQ; + uint32_t mGalBpAmpI; + uint32_t mGalBpAmpQ; inline SystemStatusRfAndParams() : mPgaGain(0), mGpsBpAmpI(0), @@ -165,7 +175,13 @@ public: mAgcGps(0), mAgcGlo(0), mAgcBds(0), - mAgcGal(0) {} + mAgcGal(0), + mGloBpAmpI(0), + mGloBpAmpQ(0), + mBdsBpAmpI(0), + mBdsBpAmpQ(0), + mGalBpAmpI(0), + mGalBpAmpQ(0) {} inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea); bool equals(const SystemStatusRfAndParams& peer); void dump(void); @@ -444,38 +460,49 @@ public: class SystemStatusNetworkInfo : public SystemStatusItemBase, public NetworkInfoDataItemBase { + NetworkInfoDataItemBase* mSrcObjPtr; public: inline SystemStatusNetworkInfo( int32_t type=0, std::string typeName="", string subTypeName="", - bool available=false, bool connected=false, bool roaming=false) : NetworkInfoDataItemBase( + (NetworkType)type, type, typeName, subTypeName, - available, + connected && (!roaming), connected, - roaming) {} + roaming), + mSrcObjPtr(nullptr) {} inline SystemStatusNetworkInfo(const NetworkInfoDataItemBase& itemBase) : - NetworkInfoDataItemBase(itemBase) { + NetworkInfoDataItemBase(itemBase), + mSrcObjPtr((NetworkInfoDataItemBase*)&itemBase) { mType = itemBase.getType(); } inline bool equals(const SystemStatusNetworkInfo& peer) { - if ((mType == peer.mType) && - (mTypeName == peer.mTypeName) && - (mSubTypeName == peer.mSubTypeName) && - (mAvailable == peer.mAvailable) && - (mConnected == peer.mConnected) && - (mRoaming == peer.mRoaming)) { - return true; + return (mAllTypes == peer.mAllTypes); + } + inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) { + uint64_t allTypes = (static_cast(curInfo)).mAllTypes; + if (mConnected) { + mAllTypes |= allTypes; + } else if (0 != mAllTypes) { + mAllTypes = (allTypes & (~mAllTypes)); + } // else (mConnected == false && mAllTypes == 0) + // we keep mAllTypes as 0, which means no more connections. + + if (nullptr != mSrcObjPtr) { + // this is critical, changing mAllTypes of the original obj + mSrcObjPtr->mAllTypes = mAllTypes; } - return false; + return *this; } inline void dump(void) override { - LOC_LOGD("NetworkInfo: type=%u connected=%u", mType, mConnected); + LOC_LOGD("NetworkInfo: mAllTypes=%" PRIx64 " connected=%u mType=%x", + mAllTypes, mConnected, mType); } }; @@ -487,8 +514,9 @@ public: RilServiceInfoDataItemBase() {} inline SystemStatusServiceInfo(const RilServiceInfoDataItemBase& itemBase) : RilServiceInfoDataItemBase(itemBase) {} - inline bool equals(const SystemStatusServiceInfo& /*peer*/) { - return true; + inline bool equals(const SystemStatusServiceInfo& peer) { + return static_cast(peer) == + static_cast(*this); } }; @@ -500,8 +528,9 @@ public: RilCellInfoDataItemBase() {} inline SystemStatusRilCellInfo(const RilCellInfoDataItemBase& itemBase) : RilCellInfoDataItemBase(itemBase) {} - inline bool equals(const SystemStatusRilCellInfo& /*peer*/) { - return true; + inline bool equals(const SystemStatusRilCellInfo& peer) { + return static_cast(peer) == + static_cast(*this); } }; @@ -770,13 +799,9 @@ private: // Data members static pthread_mutex_t mMutexSystemStatus; SystemStatusReports mCache; - bool mConnected; - - template - bool setItemBaseinReport(TYPE_REPORT& report, const TYPE_ITEMBASE& s); template - bool setIteminReport(TYPE_REPORT& report, const TYPE_ITEM& s); + bool setIteminReport(TYPE_REPORT& report, TYPE_ITEM&& s); // set default dataitem derived item in report cache template @@ -796,8 +821,8 @@ public: bool eventDataItemNotify(IDataItemCore* dataitem); bool setNmeaString(const char *data, uint32_t len); bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const; - bool setDefaultReport(void); - bool eventConnectionStatus(bool connected, uint8_t type); + bool setDefaultGnssEngineStates(void); + bool eventConnectionStatus(bool connected, int8_t type); }; } // namespace loc_core -- cgit v1.2.3