Applied Discovery callback policy 50/84550/1
authorkmook <kmook.choi@samsung.com>
Fri, 19 Aug 2016 07:29:55 +0000 (16:29 +0900)
committerkmook <kmook.choi@samsung.com>
Fri, 19 Aug 2016 07:31:28 +0000 (16:31 +0900)
- Now callbacks always deliver superset of discovered results

Change-Id: I9a97d834f1a40064cf329bb925f6d03c3f28f16f
Signed-off-by: kmook <kmook.choi@samsung.com>
daemon/DiscoveryManager.cpp

index ea649be..9f94ee2 100755 (executable)
@@ -315,7 +315,7 @@ int conv::DiscoveryManager::mergeExcludeServices(conv::IDevice* orgDevice, conv:
                        std::find_if(orgServiceList.begin(), orgServiceList.end(), std::bind(serviceComparision, std::placeholders::_1, currentService->getServiceType()));
                if (orgIter != orgServiceList.end()) {
                        // already exists in orgDevice.. means it's not new!.. so remove the service from new!!
-                       newDevice->removeService(currentService);
+                       //newDevice->removeService(currentService);
                        _D("Service[%d] has been already found in Device[%s]", currentService->getServiceType(), orgDevice->getName().c_str() );
                } else {
                        _D("New Service[%d] found in Device[%s]", currentService->getServiceType(), orgDevice->getName().c_str() );
@@ -377,11 +377,13 @@ int conv::DiscoveryManager::appendDiscoveredResult(conv::IDevice* discoveredDevi
                int countNewServices = mergeExcludeServices(currentDevice, discoveredDevice);
                if (countNewServices == 0)
                        return CONV_ERROR_NONE;
+
+               deviceInfoToPublish = currentDevice;
        } else {
                _D("newbie!! discovered device's info [%s]", discoveredDevice->getId().c_str());
                discoveredResults.insert(DiscoveredDeviceMap::value_type(discoveredDevice->getId(), discoveredDevice));
+               deviceInfoToPublish = discoveredDevice;
        }
-       deviceInfoToPublish = discoveredDevice;
 
        _D("Convert device_info into Json type..");
        Json deviceJson;