std::shared_ptr<OCResource> curResource;
std::mutex curResourceLock;
+static void printUsage()
+{
+ std::cout<<"Usage: garageclient <0|1> \n";
+ std::cout<<"ConnectivityType: Default IP\n";
+ std::cout<<"ConnectivityType 0: IP \n";
+}
+
class Garage
{
public:
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
+ {
+ printUsage();
+ std::cout << "Invalid input argument. Using IP as connectivity type" << std::endl;
+ }
+
// Create PlatformConfig object
PlatformConfig cfg {
OC::ServiceType::InProc,
try
{
// Find all resources
- requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.garage";
+ requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.garage";
OCPlatform::findResource("", requestURI.str(),
- OC_ALL, &foundResource);
+ connectivityType, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;