X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fexamples%2Fgroupserver.cpp;h=f4b5e4dd7d8c1703fe55b311b351c4df45569599;hb=4f8835183378264d6f358632ad2da9ab10dc5cea;hp=02111135122668d480a84f9e9a4429a498046be3;hpb=1b3989f5777db18d830407badd8e0332c1b1e33e;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/examples/groupserver.cpp b/resource/examples/groupserver.cpp old mode 100644 new mode 100755 index 0211113..f4b5e4d --- a/resource/examples/groupserver.cpp +++ b/resource/examples/groupserver.cpp @@ -33,6 +33,12 @@ namespace PH = std::placeholders; OCResourceHandle resourceHandle; std::vector< OCResourceHandle > resourceHandleVector; +static void printUsage() +{ + std::cout<<"Usage: groupclient <0|1>\n"; + std::cout<<"ConnectivityType: Default \n"; + std::cout<<"ConnectivityType 0: IP\n"; +} void foundResource(std::shared_ptr< OCResource > resource) { @@ -54,7 +60,7 @@ void foundResource(std::shared_ptr< OCResource > resource) cout << "\tResource Type : " << resource->getResourceTypes().front() << endl; if (resourceURI == "/a/light" || resourceURI == "/a/fan") { - OCResourceHandle foundResourceHandle; + OCResourceHandle foundResourceHandle = nullptr; OCStackResult result = OCPlatform::registerResource(foundResourceHandle, resource); cout << "\tresource registed!" << endl; if (result == OC_STACK_OK) @@ -80,7 +86,7 @@ int main(int argc, char* argv[]) { ostringstream requestURI; - OCConnectivityType connectivityType = CT_DEFAULT; + OCConnectivityType connectivityType = CT_ADAPTER_IP; if(argc == 2) { @@ -93,6 +99,7 @@ int main(int argc, char* argv[]) { if(optionSelected == 0) { + std::cout << "Using IP."<< std::endl; connectivityType = CT_ADAPTER_IP; } else @@ -105,16 +112,15 @@ int main(int argc, char* argv[]) std::cout << "Invalid connectivity type selected. Using default IP" << std::endl; } } - catch(exception& e) + catch(exception&) { std::cout << "Invalid input argument. Using IP as connectivity type" << std::endl; } } else { - std::cout<<"Usage: groupclient 0\n"; - std::cout<<"ConnectivityType: Default \n"; - std::cout<<"ConnectivityType 0: IP\n"; + printUsage(); + } PlatformConfig config @@ -137,7 +143,7 @@ int main(int argc, char* argv[]) cout << "registerResource is called." << endl; - requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light"; + requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light"; OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);