1 //******************************************************************
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 // OCClient.cpp : Defines the entry point for the console application.
10 #include "OCPlatform.h"
14 void foundResource(std::shared_ptr<OCResource> resource){
18 // Do some operations with resource object.
21 std::cout << "URI of the resource: " << resource->uri() << std::endl;
23 std::cout << "Host address of the resource: " << resource->host() << std::endl;
28 std::cout << "Resource invalid" << std::endl;
32 catch(OC::OCReflect::reflection_exception& e)
36 catch(std::exception& e)
45 // Create PlatformConfig object
48 cfg.ipAddress = "134.134.161.166";
50 cfg.mode = ModeType::Client;
51 cfg.serviceType = ServiceType::InProc;
53 // Create a OCPlatform instance.
54 // Note: Platform creation is synchronous call.
58 OCPlatform platform(cfg);
61 platform.findResource("", "coap://224.0.1.187/oc/core", &foundResource);