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)
{
{
ostringstream requestURI;
+ OCConnectivityType connectivityType = CT_ADAPTER_IP;
+
+ if(argc == 2)
+ {
+ try
+ {
+ std::size_t inputValLen;
+ int optionSelected = 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(exception& e)
+ {
+ std::cout << "Invalid input argument. Using IP as connectivity type" << std::endl;
+ }
+ }
+ else
+ {
+ printUsage();
+
+ }
+
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
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(),
- OC_ALL, &foundResource);
+ connectivityType, &foundResource);
OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);