cout << "\tresource Error!" << endl;
}
}
-
- // p_platform.bindResource(resourceHandle, foundResourceHandle);
-
}
}
catch (std::exception& e)
{
- std::cout << "" << std::endl;
+ std::cout << "Exception in foundResource:"<< e.what() << std::endl;
}
}
-int main()
+int main(int argc, char* argv[])
{
+ ostringstream requestURI;
+
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
cout << "registerResource is called." << endl;
- OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light", &foundResource);
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
+
+ OCPlatform::findResource("", requestURI.str(),
+ OC_ALL, &foundResource);
+
OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
int selectedMenu;
- while (true)
+ bool isRun = true;
+ while (isRun)
{
+ cout << endl << "0 :: Quit 1 :: UNREGISTER RESOURCES\n" << endl;
std::cin >> selectedMenu;
- if (selectedMenu == 1)
+ switch(selectedMenu)
{
+ case 0:
+ isRun = false;
+ break;
+ case 1:
+ std::cout << "Unregistering resources" << std::endl;
for (unsigned int i = 0; i < resourceHandleVector.size(); ++i)
{
OCPlatform::unregisterResource(resourceHandleVector.at(i));
}
+ break;
+ default:
+ cout << "Invalid option" << endl;
}
}
}
catch (OCException& e)
{
-
+ oclog() << "Exception in main: "<< e.what();
}
return 0;
}
+