diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2018-05-30 17:44:25 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-06 15:35:57 -0700 |
commit | dd85ce83f35bd4b54bf61e2df0b21555ee9bf691 (patch) | |
tree | bb7864363d097a09fd4359e03c97b33246cc8a5c | |
parent | dab99a6cb5df2a5af29434af0e5b70aa257efdb8 (diff) | |
download | gps-dd85ce83f35bd4b54bf61e2df0b21555ee9bf691.tar.gz |
DataItem changes to fix incorrect NetworkInfo connect handling
NetworkInfoBaase added a type to allTypes protected method so
that derived class can use it. Also, the SystemStatusNetworkInfo
no longer compares names in its equal(), as it only is going to
return false when comparing GnssLocationProvider NetworkInfo and
OsAgent NetworkInfo.
Change-Id: I363f27f4ed7be4aab2a4c4c033d5dff69d0a47d9
CRs-Fixed: 2251564
-rw-r--r-- | core/SystemStatus.cpp | 2 | ||||
-rw-r--r-- | core/SystemStatus.h | 13 | ||||
-rw-r--r-- | core/data-items/DataItemConcreteTypesBase.h | 7 |
3 files changed, 7 insertions, 15 deletions
diff --git a/core/SystemStatus.cpp b/core/SystemStatus.cpp index 5d5c4b0..b3260bd 100644 --- a/core/SystemStatus.cpp +++ b/core/SystemStatus.cpp @@ -1680,7 +1680,7 @@ bool SystemStatus::setDefaultGnssEngineStates(void) bool SystemStatus::eventConnectionStatus(bool connected, int8_t type) { // send networkinof dataitem to systemstatus observer clients - SystemStatusNetworkInfo s(type, "", "", false, connected, false); + SystemStatusNetworkInfo s(type, "", "", connected); mSysStatusObsvr.notify({&s}); return true; diff --git a/core/SystemStatus.h b/core/SystemStatus.h index 1c3adc8..657720d 100644 --- a/core/SystemStatus.h +++ b/core/SystemStatus.h @@ -466,7 +466,6 @@ public: int32_t type=0, std::string typeName="", string subTypeName="", - bool available=false, bool connected=false, bool roaming=false) : NetworkInfoDataItemBase( @@ -474,7 +473,7 @@ public: type, typeName, subTypeName, - available, + connected && (!roaming), connected, roaming), mSrcObjPtr(nullptr) {} @@ -484,15 +483,7 @@ public: mType = itemBase.getType(); } inline bool equals(const SystemStatusNetworkInfo& peer) { - if ((mAllTypes == peer.mAllTypes) && - (mTypeName == peer.mTypeName) && - (mSubTypeName == peer.mSubTypeName) && - (mAvailable == peer.mAvailable) && - (mConnected == peer.mConnected) && - (mRoaming == peer.mRoaming)) { - return true; - } - return false; + return (mAllTypes == peer.mAllTypes); } inline virtual SystemStatusItemBase& collate(SystemStatusItemBase& curInfo) { uint64_t allTypes = (static_cast<SystemStatusNetworkInfo&>(curInfo)).mAllTypes; diff --git a/core/data-items/DataItemConcreteTypesBase.h b/core/data-items/DataItemConcreteTypesBase.h index 065366d..45cd325 100644 --- a/core/data-items/DataItemConcreteTypesBase.h +++ b/core/data-items/DataItemConcreteTypesBase.h @@ -236,8 +236,7 @@ public: NetworkInfoDataItemBase( NetworkType initialType, int32_t type, string typeName, string subTypeName, bool available, bool connected, bool roaming ): - mAllTypes((initialType >= TYPE_UNKNOWN || initialType < TYPE_MOBILE) ? - 0 : (1<<initialType)), + mAllTypes(typeToAllTypes(initialType)), mType(type), mTypeName(typeName), mSubTypeName(subTypeName), @@ -263,7 +262,9 @@ public: bool mRoaming; protected: DataItemId mId; - + inline uint64_t typeToAllTypes(NetworkType type) { + return (type >= TYPE_UNKNOWN || type < TYPE_MOBILE) ? 0 : (1<<type); + } }; class ServiceStatusDataItemBase : public IDataItemCore { |