From 0ef26aa4cef7be4fedaf0b305392b4aba6cfbe44 Mon Sep 17 00:00:00 2001 From: Ziran Sun Date: Mon, 21 Nov 2016 11:12:21 +0000 Subject: [PATCH] Remove Client side sample code. This code is not needed and not in right place either. Bug: https://jira.iotivity.org/browse/IOT-1384 Change-Id: I60d89ba42b01962d68ab9fd903c32b776ae06605 Signed-off-by: Ziran Sun Reviewed-on: https://gerrit.iotivity.org/gerrit/14565 Tested-by: jenkins-iotivity Reviewed-by: JungYong KIM --- resource/examples/fridgeclient.cpp | 90 ------------------------------------ resource/examples/garageclient.cpp | 90 ------------------------------------ resource/examples/presenceclient.cpp | 88 ----------------------------------- resource/examples/roomclient.cpp | 88 ----------------------------------- resource/examples/simpleclient.cpp | 89 ----------------------------------- resource/examples/simpleclientHQ.cpp | 89 ----------------------------------- resource/examples/winuiclient.cpp | 89 ----------------------------------- 7 files changed, 623 deletions(-) diff --git a/resource/examples/fridgeclient.cpp b/resource/examples/fridgeclient.cpp index 2fe4a29..bbbc748 100644 --- a/resource/examples/fridgeclient.cpp +++ b/resource/examples/fridgeclient.cpp @@ -73,60 +73,9 @@ class ClientFridge } 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 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"<uri() <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. diff --git a/resource/examples/garageclient.cpp b/resource/examples/garageclient.cpp index a544d2a..9a91da9 100644 --- a/resource/examples/garageclient.cpp +++ b/resource/examples/garageclient.cpp @@ -229,55 +229,6 @@ void getLightRepresentation(std::shared_ptr 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 resource) { @@ -290,9 +241,6 @@ void foundResource(std::shared_ptr resource) std::string resourceURI; std::string hostAddress; - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; - try { // Do some operations with resource object. @@ -321,44 +269,6 @@ void foundResource(std::shared_ptr resource) 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; diff --git a/resource/examples/presenceclient.cpp b/resource/examples/presenceclient.cpp index 329c321..72b672a 100644 --- a/resource/examples/presenceclient.cpp +++ b/resource/examples/presenceclient.cpp @@ -90,54 +90,6 @@ void presenceHandler(OCStackResult result, const unsigned int nonce, const std:: } } -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 resource) { @@ -150,9 +102,6 @@ void foundResource(std::shared_ptr resource) std::string resourceURI; std::string hostAddress; - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; - try { // Do some operations with resource object. @@ -181,43 +130,6 @@ void foundResource(std::shared_ptr resource) 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; diff --git a/resource/examples/roomclient.cpp b/resource/examples/roomclient.cpp index c6bdac0..6d04a7d 100644 --- a/resource/examples/roomclient.cpp +++ b/resource/examples/roomclient.cpp @@ -166,55 +166,6 @@ void onPut(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, } } -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 resource) { @@ -227,8 +178,6 @@ void foundResource(std::shared_ptr resource) std::string resourceURI; std::string hostAddress; - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; try { // Do some operations with resource object. @@ -257,43 +206,6 @@ void foundResource(std::shared_ptr resource) 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; diff --git a/resource/examples/simpleclient.cpp b/resource/examples/simpleclient.cpp index 4eeba94..924e88c 100644 --- a/resource/examples/simpleclient.cpp +++ b/resource/examples/simpleclient.cpp @@ -338,65 +338,12 @@ void getLightRepresentation(std::shared_ptr 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 resource) { std::cout << "In foundResource\n"; std::string resourceURI; std::string hostAddress; - - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; - try { { @@ -431,42 +378,6 @@ void foundResource(std::shared_ptr resource) 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()) diff --git a/resource/examples/simpleclientHQ.cpp b/resource/examples/simpleclientHQ.cpp index d6c482a..6d631d3 100644 --- a/resource/examples/simpleclientHQ.cpp +++ b/resource/examples/simpleclientHQ.cpp @@ -302,64 +302,11 @@ void getLightRepresentation(std::shared_ptr 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 resource) { std::string resourceURI; std::string hostAddress; - - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; - try { // Do some operations with resource object. @@ -393,42 +340,6 @@ void foundResource(std::shared_ptr resource) 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()) diff --git a/resource/examples/winuiclient.cpp b/resource/examples/winuiclient.cpp index 95d2f79..1b892cd 100644 --- a/resource/examples/winuiclient.cpp +++ b/resource/examples/winuiclient.cpp @@ -82,55 +82,6 @@ void WinUIClientApp::Run() } } -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 WinUIClientApp::FindResources() { std::ostringstream requestURI; @@ -146,8 +97,6 @@ void WinUIClientApp::foundResource(std::shared_ptr resource) std::cout << "In foundResource\n"; std::string resourceURI; std::string hostAddress; - std::string platformDiscoveryURI = "/oic/p"; - std::string deviceDiscoveryURI = "/oic/d"; try { { @@ -196,44 +145,6 @@ void WinUIClientApp::foundResource(std::shared_ptr resource) 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/media") { curResource = resource; -- 2.7.4