From 596fd461f0a603c861ca9df4076f24a66e732cb5 Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Sat, 20 Jan 2018 10:25:47 +0800 Subject: msm8996: gps: Squashed update to LA.UM.6.5.r1-05300-8x96.0 Change-Id: I76b39dd5329a050d44f126c684edb44b0184f0fc Signed-off-by: Davide Garberi --- gps/core/SystemStatus.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'gps/core/SystemStatus.cpp') 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 #include #include +#include #include #include @@ -1212,7 +1213,8 @@ IOsObserver* SystemStatus::getOsObserver() } SystemStatus::SystemStatus(const MsgTask* msgTask) : - mSysStatusObsvr(msgTask) + mSysStatusObsvr(msgTask), + mConnected(false) { int result = 0; ENTRY_LOG (); @@ -1413,6 +1415,28 @@ bool SystemStatus::setPositionFailure(const SystemStatusPQWS1& nmea) return true; } +/****************************************************************************** + SystemStatus - storing dataitems +******************************************************************************/ +bool SystemStatus::setNetworkInfo(IDataItemCore* dataitem) +{ + SystemStatusNetworkInfo* data = reinterpret_cast(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 @@ -1533,6 +1557,26 @@ bool SystemStatus::eventPosition(const UlpLocation& location, return true; } +/****************************************************************************** +@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 @@ -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 dl(0); + dl.push_back(networkinfo); + mSysStatusObsvr.notify(dl); + } + return true; +} + } // namespace loc_core -- cgit v1.2.3