void foundDevice(std::shared_ptr<OCResource> resource)
{
using namespace OC::OCPlatform;
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
if(resource && resource->uri() == "/device")
{
std::cout << "Discovered a device object"<<std::endl;
std::cout << "\tURI: "<<resource->uri() <<std::endl;
}
- OCStackResult ret;
-
- std::cout << "Querying for platform information... " << std::endl;
-
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP, NULL);
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Get platform information is done." << std::endl;
- }
- else
- {
- std::cout << "Get platform information failed." << std::endl;
- }
-
- std::cout << "Querying for device information... " << std::endl;
-
- ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
- resource->connectivityType(), NULL);
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Getting device information is done." << std::endl;
- }
- else
- {
- std::cout << "Getting device information failed." << std::endl;
- }
-
// we have now found a resource, so lets create a few resource objects
// for the other resources that we KNOW are associated with the intel.fridge
// server, and query them.