--- /dev/null
+#ifndef __IOT_DEVICE_FINDER_H__
+#define __IOT_DEVICE_FINDER_H__
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "OCPlatform.h"
+#include "OCApi.h"
+
+class IOT_DeviceFinder
+{
+public:
+ IOT_DeviceFinder() = default;
+ IOT_DeviceFinder(const IOT_DeviceFinder&) = delete;
+
+ ~IOT_DeviceFinder() = default;
+
+ IOT_DeviceFinder& operator=(const IOT_DeviceFinder&) = delete;
+
+ std::vector<std::shared_ptr<OC::OCResource>> operator()( const std::string& _host = "",
+ const std::string& _request_uri = "/oic/res?rt=oic.wk.prov",
+ OCConnectivityType _connectivity_type = CT_DEFAULT,
+ OC::QualityOfService _QoS = OC::QualityOfService::LowQos,
+ int _wait_for_sec = 3 );
+
+private:
+ std::vector<std::shared_ptr<OC::OCResource>> m_devices;
+};
+
+#endif /* __IOT_DEVICE_FINDER_H__ */
--- /dev/null
+#include <iostream>
+#include <memory>
+#include <string>
+#include <vector>
+#include <thread>
+#include <chrono>
+
+#include "OCPlatform.h"
+#include "OCApi.h"
+
+#include "IOT_DeviceFinder.h"
+
+std::vector<std::shared_ptr<OC::OCResource>> IOT_DeviceFinder::operator()( const std::string& _host /*= ""*/,
+ const std::string& _request_uri /*= "/oic/res?rt=oic.wk.prov"*/,
+ OCConnectivityType _connectivity_type /*= CT_DEFAULT*/,
+ 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::copy(_resources.begin(), _resources.end(), std::back_inserter(this->m_devices));
+ },
+ _QoS );
+ std::this_thread::sleep_for(std::chrono::seconds(_wait_for_sec));
+ return m_devices;
+}