Fixed bug while merging iotcon discovery results 64/85264/1
authorkmook <kmook.choi@samsung.com>
Wed, 24 Aug 2016 09:34:54 +0000 (18:34 +0900)
committerkmook <kmook.choi@samsung.com>
Wed, 24 Aug 2016 09:34:54 +0000 (18:34 +0900)
Change-Id: Iecc5e33251f78d2b5c611e6935c35ba9a007846a
Signed-off-by: kmook <kmook.choi@samsung.com>
daemon/DiscoveryManager.cpp
daemon/IDevice.h
daemon/discovery_provider/iotcon/DeviceAdapter.cpp
daemon/discovery_provider/iotcon/DeviceAdapter.h

index 9f94ee2..e4fb71c 100755 (executable)
@@ -374,6 +374,9 @@ int conv::DiscoveryManager::appendDiscoveredResult(conv::IDevice* discoveredDevi
                _D("update discovered device's info [%s]", discoveredDevice->getId().c_str());
                IDevice* currentDevice = iterDiscovered->second;
 
+               if (currentDevice->getAddress().empty() && !discoveredDevice->getAddress().empty())
+                       currentDevice->setAddress(discoveredDevice->getAddress());
+
                int countNewServices = mergeExcludeServices(currentDevice, discoveredDevice);
                if (countNewServices == 0)
                        return CONV_ERROR_NONE;
index b933557..30dac5f 100644 (file)
@@ -34,6 +34,7 @@ namespace conv {
                        virtual string getName() = 0;
                        virtual string getId() = 0;
                        virtual string getAddress() = 0;
+                       virtual int setAddress(std::string host_address) = 0;
        };
 }
 
index 78b5ef2..f701a7b 100755 (executable)
@@ -81,3 +81,9 @@ int conv::DeviceAdapter::getServiceList(std::list<IService*> *list)
        }
        return CONV_ERROR_NONE;
 }
+
+int conv::DeviceAdapter::setAddress(string id)
+{
+       m_resource_h.setHostAddress(id);
+       return CONV_ERROR_NONE;
+}
index 035a6bd..fcf599e 100644 (file)
@@ -35,6 +35,7 @@ namespace conv {
                        string getName();
                        string getId();
                        string getAddress();
+                       int setAddress(std::string host_address);
 
                private :
                        ResourceHandle  m_resource_h;