diff options
author | dianlujitao <dianlujitao@lineageos.org> | 2018-01-20 10:25:47 +0800 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2018-01-27 23:40:16 +0100 |
commit | 596fd461f0a603c861ca9df4076f24a66e732cb5 (patch) | |
tree | 6eaf2d1255b13d5dcc14e938eed2f1321d4ba309 /gps/core/SystemStatus.cpp | |
parent | 18fc14ac0a3a0e622d679e7a6f708b4e468e1cfb (diff) |
msm8996: gps: Squashed update to LA.UM.6.5.r1-05300-8x96.0
Change-Id: I76b39dd5329a050d44f126c684edb44b0184f0fc
Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'gps/core/SystemStatus.cpp')
-rw-r--r-- | gps/core/SystemStatus.cpp | 74 |
1 files changed, 73 insertions, 1 deletions
diff --git a/gps/core/SystemStatus.cpp b/gps/core/SystemStatus.cpp index dc03604..52d28c7 100644 --- a/gps/core/SystemStatus.cpp +++ b/gps/core/SystemStatus.cpp @@ -37,6 +37,7 @@ #include <platform_lib_log_util.h> #include <MsgTask.h> #include <loc_nmea.h> +#include <DataItemsFactoryProxy.h> #include <SystemStatus.h> #include <SystemStatusOsObserver.h> @@ -1212,7 +1213,8 @@ IOsObserver* SystemStatus::getOsObserver() } SystemStatus::SystemStatus(const MsgTask* msgTask) : - mSysStatusObsvr(msgTask) + mSysStatusObsvr(msgTask), + mConnected(false) { int result = 0; ENTRY_LOG (); @@ -1414,6 +1416,28 @@ bool SystemStatus::setPositionFailure(const SystemStatusPQWS1& nmea) } /****************************************************************************** + SystemStatus - storing dataitems +******************************************************************************/ +bool SystemStatus::setNetworkInfo(IDataItemCore* dataitem) +{ + SystemStatusNetworkInfo* data = reinterpret_cast<SystemStatusNetworkInfo*>(dataitem); + SystemStatusNetworkInfo s(data->mType,data->mTypeName,data->mSubTypeName, + data->mAvailable,data->mConnected,data->mRoaming); + s.dump(); + mConnected = data->mConnected; + + if (!mCache.mNetworkInfo.empty() && mCache.mNetworkInfo.back().equals(s)) { + mCache.mNetworkInfo.back().mUtcReported = s.mUtcReported; + } else { + mCache.mNetworkInfo.push_back(s); + if (mCache.mNetworkInfo.size() > maxNetworkInfo) { + mCache.mNetworkInfo.erase(mCache.mNetworkInfo.begin()); + } + } + return true; +} + +/****************************************************************************** @brief API to set report data into internal buffer @param[In] data pointer to the NMEA string @@ -1534,6 +1558,26 @@ bool SystemStatus::eventPosition(const UlpLocation& location, } /****************************************************************************** +@brief API to set report DataItem event into internal buffer + +@param[In] DataItem + +@return true when successfully done +******************************************************************************/ +bool SystemStatus::eventDataItemNotify(IDataItemCore* dataitem) +{ + pthread_mutex_lock(&mMutexSystemStatus); + switch(dataitem->getId()) + { + case NETWORKINFO_DATA_ITEM_ID: + setNetworkInfo(dataitem); + break; + } + pthread_mutex_unlock(&mMutexSystemStatus); + return true; +} + +/****************************************************************************** @brief API to get report data into a given buffer @param[In] reference to report buffer @@ -1712,5 +1756,33 @@ bool SystemStatus::setDefaultReport(void) return true; } +/****************************************************************************** +@brief API to handle connection status update event from GnssRil + +@param[In] Connection status + +@return true when successfully done +******************************************************************************/ +bool SystemStatus::eventConnectionStatus(bool connected, uint8_t type) +{ + if (connected != mConnected) { + mConnected = connected; + + // send networkinof dataitem to systemstatus observer clients + SystemStatusNetworkInfo s(type, "", "", false, connected, false); + IDataItemCore *networkinfo = + DataItemsFactoryProxy::createNewDataItem(NETWORKINFO_DATA_ITEM_ID); + if (nullptr == networkinfo) { + LOC_LOGE("Unable to create dataitemd"); + return false; + } + networkinfo->copy(&s); + list<IDataItemCore*> dl(0); + dl.push_back(networkinfo); + mSysStatusObsvr.notify(dl); + } + return true; +} + } // namespace loc_core |