needed and not in right place either.
Bug: https://jira.iotivity.org/browse/IOT-1384
Change-Id: I60d89ba42b01962d68ab9fd903c32b776ae06605
Signed-off-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14565
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
}
private:
- void receivedPlatformInfo(const OCRepresentation& rep)
- {
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
- }
-
- void receivedDeviceInfo(const OCRepresentation& rep)
- {
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
- }
-
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;
-
- 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));
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Get platform information is done." << std::endl;
- }
- else
- {
- std::cout << "Get platform information failed." << 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));
-
- 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.
}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
-
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::string resourceURI;
std::string hostAddress;
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
-
try
{
// Do some operations with resource object.
std::cout << "\t\t" << resourceInterfaces << std::endl;
}
- OCStackResult ret;
-
- if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str()))
- {
- 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;
- }
- }
-
- 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);
-
- 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")
{
curResource = resource;
}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]) ; i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::string resourceURI;
std::string hostAddress;
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
-
try
{
// Do some operations with resource object.
std::cout << "\t\t" << resourceInterfaces << 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);
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Get platform information is done." << std::endl;
- }
- else
- {
- std::cout << "Get platform information failed." << std::endl;
- }
- }
-
- if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str()))
- {
- std::cout << "Querying for device information... " << std::endl;
-
- 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(resourceURI == "/a/light")
{
OCStackResult result = OC_STACK_OK;
}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
-
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::string resourceURI;
std::string hostAddress;
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
try
{
// Do some operations with resource object.
std::cout << "\t\t" << resourceInterfaces << std::endl;
}
- OCStackResult ret;
-
- if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str()))
- {
- 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;
- }
- }
-
- 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);
- 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")
{
curResource = resource;
}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
-
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::cout << "In foundResource\n";
std::string resourceURI;
std::string hostAddress;
-
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
-
try
{
{
hostAddress = resource->host();
std::cout << "\tHost address of the resource: " << hostAddress << std::endl;
- if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str()))
- {
- 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;
- }
- }
-
- if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str()))
- {
- std::cout << "Querying for device information... " << std::endl;
-
- 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;
- }
- }
-
// Get the resource types
std::cout << "\tList of resource types: " << std::endl;
for(auto &resourceTypes : resource->getResourceTypes())
}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "pi", "Platform ID ",
- "mnmn", "Manufacturer name ",
- "mnml", "Manufacturer url ",
- "mnmo", "Manufacturer Model No ",
- "mndt", "Manufactured Date ",
- "mnpv", "Manufacturer Platform Version ",
- "mnos", "Manufacturer OS version ",
- "mnhw", "Manufacturer hardware version ",
- "mnfv", "Manufacturer firmware version ",
- "mnsl", "Manufacturer support url ",
- "st", "Manufacturer system time "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
-
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::string resourceURI;
std::string hostAddress;
-
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
-
try
{
// Do some operations with resource object.
hostAddress = resource->host();
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;
-
- 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 (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);
-
- 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
std::cout << "\tList of resource types: " << std::endl;
for(auto &resourceTypes : resource->getResourceTypes())
}\r
}\r
\r
-void receivedPlatformInfo(const OCRepresentation& rep)\r
-{\r
- std::cout << "\nPlatform Information received ---->\n";\r
- std::string value;\r
- std::string values[] =\r
- {\r
- "pi", "Platform ID ",\r
- "mnmn", "Manufacturer name ",\r
- "mnml", "Manufacturer url ",\r
- "mnmo", "Manufacturer Model No ",\r
- "mndt", "Manufactured Date ",\r
- "mnpv", "Manufacturer Platform Version ",\r
- "mnos", "Manufacturer OS version ",\r
- "mnhw", "Manufacturer hardware version ",\r
- "mnfv", "Manufacturer firmware version ",\r
- "mnsl", "Manufacturer support url ",\r
- "st", "Manufacturer system time "\r
- };\r
-\r
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)\r
- {\r
- if(rep.getValue(values[i], value))\r
- {\r
- std::cout << values[i + 1] << " : "<< value << std::endl;\r
- }\r
- }\r
-}\r
-\r
-void receivedDeviceInfo(const OCRepresentation& rep)\r
-{\r
- std::cout << "\nDevice Information received ---->\n";\r
- std::string value;\r
- std::string values[] =\r
- {\r
- "di", "Device ID ",\r
- "n", "Device name ",\r
- "lcv", "Spec version url ",\r
- "dmv", "Data Model Model ",\r
- };\r
-\r
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)\r
- {\r
- if (rep.getValue(values[i], value))\r
- {\r
- std::cout << values[i + 1] << " : " << value << std::endl;\r
- }\r
- }\r
-}\r
-\r
void WinUIClientApp::FindResources()\r
{\r
std::ostringstream requestURI;\r
std::cout << "In foundResource\n";\r
std::string resourceURI;\r
std::string hostAddress;\r
- std::string platformDiscoveryURI = "/oic/p";\r
- std::string deviceDiscoveryURI = "/oic/d";\r
try\r
{\r
{\r
std::cout << "\t\t" << resourceInterfaces << std::endl;\r
}\r
\r
- OCStackResult ret;\r
- if (0 == strcmp(resourceURI.c_str(), platformDiscoveryURI.c_str()))\r
- {\r
- std::cout << "Querying for platform information... " << std::endl;\r
-\r
- ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,\r
- resource->connectivityType(),\r
- &receivedPlatformInfo);\r
-\r
- if (ret == OC_STACK_OK)\r
- {\r
- std::cout << "Get platform information is done." << std::endl;\r
- }\r
- else\r
- {\r
- std::cout << "Get platform information failed." << std::endl;\r
- }\r
- }\r
-\r
- if (0 == strcmp(resourceURI.c_str(), deviceDiscoveryURI.c_str()))\r
- {\r
- std::cout << "Querying for device information... " << std::endl;\r
-\r
- ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,\r
- resource->connectivityType(),\r
- &receivedDeviceInfo);\r
-\r
-\r
- if (ret == OC_STACK_OK)\r
- {\r
- std::cout << "Getting device information is done." << std::endl;\r
- }\r
- else\r
- {\r
- std::cout << "Getting device information failed." << std::endl;\r
- }\r
- }\r
-\r
if (resourceURI == "/a/media")\r
{\r
curResource = resource;\r