From: jihwan.seo Date: Wed, 16 Nov 2016 06:08:17 +0000 (+0900) Subject: fix Sample App related getPlatformInfo/getDeviceInfo X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5910047b297218f49079807b44ca3d3720581f7f;p=contrib%2Fiotivity.git fix Sample App related getPlatformInfo/getDeviceInfo Change-Id: I07e2e0e24241f0c5dd53259f8333eccc722d4e39 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/14405 Tested-by: jenkins-iotivity Reviewed-by: Larry Sachs Reviewed-by: Rick Bell Reviewed-by: Jaehong Jo Reviewed-by: Ziran Sun --- diff --git a/resource/examples/fridgeclient.cpp b/resource/examples/fridgeclient.cpp index 3641992..2fe4a29 100644 --- a/resource/examples/fridgeclient.cpp +++ b/resource/examples/fridgeclient.cpp @@ -136,38 +136,43 @@ class ClientFridge OCStackResult ret; - std::cout << "Querying for platform information... " << std::endl; + if (0 == strcmp(resource->uri().c_str(), platformDiscoveryURI.c_str())) + { + std::cout << "Querying for platform information... " << std::endl; - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - std::bind(&ClientFridge::receivedPlatformInfo, - this, PH::_1)); + ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, + resource->connectivityType(), + std::bind(&ClientFridge::receivedPlatformInfo, + this, PH::_1)); - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else - { - std::cout << "Get platform information failed." << std::endl; + 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; + if (0 == strcmp(resource->uri().c_str(), deviceDiscoveryURI.c_str())) + { + std::cout << "Querying for device information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), - std::bind(&ClientFridge::receivedDeviceInfo, - this, PH::_1)); + ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, + resource->connectivityType(), + std::bind(&ClientFridge::receivedDeviceInfo, + this, PH::_1)); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; - } - else - { - std::cout << "Getting device information failed." << std::endl; + 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. diff --git a/resource/examples/garageclient.cpp b/resource/examples/garageclient.cpp index 0cd8844..a544d2a 100644 --- a/resource/examples/garageclient.cpp +++ b/resource/examples/garageclient.cpp @@ -322,34 +322,41 @@ void foundResource(std::shared_ptr resource) } OCStackResult ret; - std::cout << "Querying for platform information... " << std::endl; - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); - - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) { - std::cout << "Get platform information failed." << std::endl; - } - - std::cout << "Querying for device information... " << std::endl; + std::cout << "Querying for platform information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), - &receivedDeviceInfo); + ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Get platform information is done." << std::endl; + } + else + { + std::cout << "Get platform information failed." << std::endl; + } } - else + + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) { - std::cout << "Getting device information failed." << std::endl; + std::cout << "Querying for device information... " << std::endl; + + ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, + resource->connectivityType(), + &receivedDeviceInfo); + + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } if(resourceURI == "/a/garage") diff --git a/resource/examples/presenceclient.cpp b/resource/examples/presenceclient.cpp index 55698d7..329c321 100644 --- a/resource/examples/presenceclient.cpp +++ b/resource/examples/presenceclient.cpp @@ -181,34 +181,41 @@ void foundResource(std::shared_ptr resource) std::cout << "\t\t" << resourceInterfaces << std::endl; } - std::cout << "Querying for platform information... " << std::endl; + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) + { + std::cout << "Querying for platform information... " << std::endl; - OCStackResult ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); + OCStackResult ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else - { - std::cout << "Get platform information failed." << std::endl; + 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; + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) + { + std::cout << "Querying for device information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), - &receivedDeviceInfo); + OCStackResult ret = OCPlatform::getDeviceInfo(resource->host(), + deviceDiscoveryURI, + resource->connectivityType(), + &receivedDeviceInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; - } - else - { - std::cout << "Getting device information failed." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } if(resourceURI == "/a/light") diff --git a/resource/examples/roomclient.cpp b/resource/examples/roomclient.cpp index 50c5584..c6bdac0 100644 --- a/resource/examples/roomclient.cpp +++ b/resource/examples/roomclient.cpp @@ -258,33 +258,40 @@ void foundResource(std::shared_ptr resource) } OCStackResult ret; - std::cout << "Querying for platform information... " << std::endl; - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); - - if (ret == OC_STACK_OK) + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) { - std::cout << "Get platform information is done." << std::endl; - } - else - { - std::cout << "Get platform information failed." << std::endl; - } + std::cout << "Querying for platform information... " << std::endl; - std::cout << "Querying for device information... " << std::endl; + ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), - &receivedDeviceInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Get platform information is done." << std::endl; + } + else + { + std::cout << "Get platform information failed." << std::endl; + } } - else + + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) { - std::cout << "Getting device information failed." << std::endl; + std::cout << "Querying for device information... " << std::endl; + + ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, + resource->connectivityType(), + &receivedDeviceInfo); + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } if(resourceURI == "/a/room") diff --git a/resource/examples/simpleclient.cpp b/resource/examples/simpleclient.cpp index 8e16f45..4eeba94 100644 --- a/resource/examples/simpleclient.cpp +++ b/resource/examples/simpleclient.cpp @@ -431,35 +431,40 @@ void foundResource(std::shared_ptr resource) hostAddress = resource->host(); std::cout << "\tHost address of the resource: " << hostAddress << std::endl; - OCStackResult ret; - - std::cout << "Querying for platform information... " << std::endl; - - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); - - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) { - std::cout << "Get platform information failed." << std::endl; + std::cout << "Querying for platform information... " << std::endl; + OCStackResult ret = OCPlatform::getPlatformInfo(resource->host(), + platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); + 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; + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) + { + std::cout << "Querying for device information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), &receivedDeviceInfo); + OCStackResult ret = OCPlatform::getDeviceInfo(resource->host(), + deviceDiscoveryURI, + resource->connectivityType(), + &receivedDeviceInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; - } - else - { - std::cout << "Getting device information failed." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } // Get the resource types diff --git a/resource/examples/simpleclientHQ.cpp b/resource/examples/simpleclientHQ.cpp index d75a84a..d6c482a 100644 --- a/resource/examples/simpleclientHQ.cpp +++ b/resource/examples/simpleclientHQ.cpp @@ -394,34 +394,39 @@ void foundResource(std::shared_ptr resource) std::cout << "\tHost address of the resource: " << hostAddress << std::endl; OCStackResult ret; + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) + { + std::cout << "Querying for platform information... " << std::endl; - std::cout << "Querying for platform information... " << std::endl; - - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); + ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else - { - std::cout << "Get platform information failed." << std::endl; + 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; + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) + { + std::cout << "Querying for device information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), &receivedDeviceInfo); + ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, + resource->connectivityType(), &receivedDeviceInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; - } - else - { - std::cout << "Getting device information failed." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } // Get the resource types diff --git a/resource/examples/winuiclient.cpp b/resource/examples/winuiclient.cpp index bc677cb..95d2f79 100644 --- a/resource/examples/winuiclient.cpp +++ b/resource/examples/winuiclient.cpp @@ -197,35 +197,41 @@ void WinUIClientApp::foundResource(std::shared_ptr resource) } OCStackResult ret; - std::cout << "Querying for platform information... " << std::endl; - - ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, - resource->connectivityType(), - &receivedPlatformInfo); - - if (ret == OC_STACK_OK) - { - std::cout << "Get platform information is done." << std::endl; - } - else + if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str())) { - std::cout << "Get platform information failed." << std::endl; + std::cout << "Querying for platform information... " << std::endl; + + ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI, + resource->connectivityType(), + &receivedPlatformInfo); + + 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; + if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str())) + { + std::cout << "Querying for device information... " << std::endl; - ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, - resource->connectivityType(), - &receivedDeviceInfo); + ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI, + resource->connectivityType(), + &receivedDeviceInfo); - if (ret == OC_STACK_OK) - { - std::cout << "Getting device information is done." << std::endl; - } - else - { - std::cout << "Getting device information failed." << std::endl; + if (ret == OC_STACK_OK) + { + std::cout << "Getting device information is done." << std::endl; + } + else + { + std::cout << "Getting device information failed." << std::endl; + } } if (resourceURI == "/a/media")