return ++oc;
}
+static void printUsage()
+{
+ std::cout << "Usage roomclient <0|1>" << std::endl;
+ std::cout<<"connectivityType: Default" << std::endl;
+ std::cout << "connectivityType 0: IP" << std::endl;
+}
// Forward declaration
void putRoomRepresentation(std::shared_ptr<OCResource> resource);
void onPut(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode);
}
catch(std::exception& e)
{
- std::cerr << "Exception in foundResource: "<< e.what() <<std::endl;
//log(e.what());
}
}
std::ostringstream requestURI;
+ OCConnectivityType connectivityType = CT_ADAPTER_IP;
+ if(argc == 2)
+ {
+ try
+ {
+ std::size_t inputValLen;
+ int optionSelected = std::stoi(argv[1], &inputValLen);
+
+ if(inputValLen == strlen(argv[1]))
+ {
+ if(optionSelected == 0)
+ {
+ std::cout << "Using IP."<< std::endl;
+ connectivityType = CT_ADAPTER_IP;
+ }
+ else
+ {
+ std::cout << "Invalid connectivity type selected. Using default IP"<< std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "Invalid connectivity type selected. Using default IP" << std::endl;
+ }
+ }
+ catch(std::exception& e)
+ {
+ std::cout << "Invalid input argument. Using IP as connectivity type" << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "Default input argument. Using IP as Default connectivity type" << std::endl;
+ printUsage();
+ }
// Create PlatformConfig object
PlatformConfig cfg {
try
{
// Find all resources
- requestURI << OC_MULTICAST_DISCOVERY_URI;
+ requestURI << OC_RSRVD_WELL_KNOWN_URI;
- OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResource);
+ OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;
// A condition variable will free the mutex it is given, then do a non-