Commit 5910047b authored by jihwan.seo's avatar jihwan.seo Committed by Ziran Sun

fix Sample App related getPlatformInfo/getDeviceInfo

Change-Id: I07e2e0e24241f0c5dd53259f8333eccc722d4e39
Signed-off-by: default avatarjihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14405Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
Reviewed-by: default avatarJaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: default avatarZiran Sun <ziran.sun@samsung.com>
parent c3824918
......@@ -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.
......
......@@ -322,34 +322,41 @@ void foundResource(std::shared_ptr<OCResource> 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")
......
......@@ -181,34 +181,41 @@ void foundResource(std::shared_ptr<OCResource> 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")
......
......@@ -258,33 +258,40 @@ void foundResource(std::shared_ptr<OCResource> 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")
......
......@@ -431,35 +431,40 @@ void foundResource(std::shared_ptr<OCResource> 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
......
......@@ -394,34 +394,39 @@ void foundResource(std::shared_ptr<OCResource> 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
......
......@@ -197,35 +197,41 @@ void WinUIClientApp::foundResource(std::shared_ptr<OCResource> 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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment