Fixed easy setup rejected device resource with "wrong connectivity type" error.
authorLomtev Dmytro <d.lomtev@samsung.com>
Tue, 13 Jun 2017 04:27:34 +0000 (07:27 +0300)
committerLomtev Dmytro <d.lomtev@samsung.com>
Tue, 13 Jun 2017 04:27:34 +0000 (07:27 +0300)
agent/scripts/gbs.conf
device_core/iotivity_lib/easy-setup/mediator/richsdk/src/EasySetup.cpp
device_core/iotivity_lib/src/IOT_DeviceFinder.cpp
device_core/iotivity_lib/src/iotivity.cpp

index 006a7bf..d1e6998 100644 (file)
@@ -1,6 +1,5 @@
 [general]
-#profile = profile.Main2017_KantM
-profile = profile.tizen_phone_arm64_3_0
+profile = repo.tzmb_3.0_TM1_base
 
 [obs.tizen_org]
 url = https://api.tizen.org
@@ -20,7 +19,7 @@ url = http://106.125.46.44/repo/kantm/packages/
 url=~/GBS_ROOT_3.0/local/repos/Main2017/armv7l
 [repo.product_Main2017_KantM]
 url=http://10.103.211.119/releases/tizen-3.0-product-main2017/product/KantM/latest/repos/product/armv7l/packages/
-url=http://10.103.211.119/releases/tizen-3.0-product-main2017/product/KantM/TIZEN-3.0-MAIN2017-KantM-RELEASE_20170419.1/repos/product/armv7l/packages/
+#url=http://10.103.211.119/releases/tizen-3.0-product-main2017/product/KantM/TIZEN-3.0-MAIN2017-KantM-RELEASE_20170419.1/repos/product/armv7l/packages/
 
 
 [profile.Main2017_KantM]
@@ -28,15 +27,14 @@ obs = obs.tizentv
 repos = repo.base_Main2017, repo.srk_Main2017, repo.product_Main2017_KantM, repo.local_Main2017
 buildroot = ~/GBS_ROOT_3.0
 
+
 ############################################# Profile [profile.tzmb_3.0_TM2]
 
 [repo.tzmb_3.0_TM2_base]
-#url = http://download.tizen.org/snapshots/tizen/base/tizen-base_20170421.1/repos/arm64/packages/
 url = http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages/
 [repo.tzmb_3.0_TM2_srk]
 url = http://106.125.46.44/repo/tm2/packages/
 [repo.tzmb_4.0_unified]
-#url = http://download.tizen.org/snapshots/tizen/unified/tizen-unified_20170421.1/repos/standard/packages/
 url = http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/
 
 [profile.tzmb_3.0_TM2]
@@ -57,3 +55,17 @@ url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm-wayland/
 obs = obs.tizen_org
 repos = repo.tzmb_3.0_TM1_base, repo.tzmb_3.0_TM1_srk, repo.tzmb_4.0_unified
 buildroot = ~/GBS_ROOT_3.0_TM1
+
+############################################# KantM Tizen 4.0
+
+[repo.product_Main2017_KantM_4.0]
+url=http://10.103.211.119/220svr/releases/adv-tizen-4.0-product-migration/KantM_ATSC/latest/repos/product/armv7l/packages/
+[repo.base_Main2017_KantM_4.0]
+url=http://10.103.211.119/220svr/base/adv-tizen-4.0-base-migration/standard/latest/repos/base/armv7l/packages
+[repo.KantM_4.0_srk]
+url = http://106.125.46.44/repo/kantm4.0/packages/
+
+[profile.Main2017_KantM_4.0]
+obs = obs.tizen_org
+repos = repo.base_Main2017_KantM_4.0, repo.KantM_4.0_srk, repo.product_Main2017_KantM_4.0
+buildroot = ~/GBS_ROOT_4.0_kantm
index 5d14e95..4e74b76 100644 (file)
@@ -55,7 +55,7 @@ namespace OIC
             if(resource)
             {
                 if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_PROV ||
-                   resource->connectivityType() & (CT_ADAPTER_TCP | CT_IP_USE_V4))
+                   (resource->connectivityType() & CT_ADAPTER_TCP))
                 {
                     OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is not valid due to wrong rt or conntype");
                     return nullptr;
index 6f5e95d..60cba6c 100644 (file)
@@ -19,15 +19,19 @@ std::vector<std::shared_ptr<OC::OCResource>> IOT_DeviceFinder::operator()(  cons
                                                                             OC::QualityOfService _QoS /*= OC::QualityOfService::LowQos*/,
                                                                             int _wait_for_sec /*= 3*/   )
 {
-    OC::OCPlatform::findResourceList(   _host,
-                                        _request_uri,
-                                        _connectivity_type,
-                                        [this](std::vector<std::shared_ptr<OC::OCResource>> _resources)
-                                        {
-                                            std::unique_lock<std::mutex> lock{vector_mtx};
-                                            std::copy(_resources.begin(), _resources.end(), std::back_inserter(this->m_devices));
-                                        },
-                                        _QoS    );
+    auto find_callback = [this, _connectivity_type](std::vector<std::shared_ptr<OC::OCResource>> _resources)
+    {
+        std::unique_lock<std::mutex> lock{vector_mtx};
+        for (auto resource: _resources)
+        {
+            if (_connectivity_type == CT_DEFAULT || (resource->connectivityType() & _connectivity_type))
+            {
+                this->m_devices.push_back(resource);
+            }
+        }
+    };
+
+    OC::OCPlatform::findResourceList(_host, _request_uri, CT_DEFAULT, find_callback, _QoS);
     std::this_thread::sleep_for(std::chrono::seconds(_wait_for_sec));
     return m_devices;
 }
index b9d6020..e62c415 100644 (file)
@@ -634,33 +634,28 @@ const IoTDevicesMap& IoTivity::getOwnedDevices()
 const IoTDevicesMap& IoTivity::getUnOwnedDevices()
 {
     FN_VISIT
-
-    static const std::string COAP_IF{"coap:"};
-
     params->unowned.clear();
-
-    auto devs = IOT_DeviceFinder()();
+    IOT_DeviceFinder dev_finder;
+    auto devs = dev_finder("", "/oic/res?rt=oic.wk.prov", CT_ADAPTER_IP);
 
     for (auto d : devs)
     {
         std::shared_ptr<IoTDevice> dev(new IoTDevice_impl(d));
-        if (dev->getUUID().empty())
-            continue;
+
+        if (dev->getUUID().empty()) continue;
 
         auto it = params->unowned.find(dev->getUUID());
-        if(it != params->unowned.end())
-        {
-            if(dev->getHost().compare(0, COAP_IF.length(), COAP_IF) == 0)
-                it->second = dev;
-        }
-        else
+
+        if (it == params->unowned.end())
         {
             auto res = params->unowned.emplace(dev->getUUID(), dev);
-            if(!res.second)
+
+            if (!res.second)
+            {
                 throw IoTInternalError("Out of memory");
+            }
         }
     }
-
     return params->unowned;
 }