/// Authority + URI string to prefix well known queries
#define OC_WELL_KNOWN_QUERY "224.0.1.187:5683/oc/core"
+#define OC_MULTICAST_DISCOVERY_URI "/oc/core"
#define OC_EXPLICIT_DEVICE_DISCOVERY_URI "224.0.1.187:5683/oc/core/d?rt=core.led"
/// Multicast address and port string to prefix multicast queries
#define OC_MULTICAST_PREFIX "224.0.1.187:5683"
m_callsMade(0),m_connectivityType(ct)
{
std::ostringstream requestURI;
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=intel.fridge";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=intel.fridge";
std::cout << "Fridge Client has started " <<std::endl;
FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1));
OCStackResult result = OCPlatform::findResource(
- "", requestURI.str(), m_connectivityType, f);
+ "", requestURI.str(), OC_ALL, f);
if(OC_STACK_OK != result)
{
try
{
// Find all resources
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.garage";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.garage";
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;
int main(int argc, char* argv[])
{
ostringstream requestURI;
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=a.collection";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=a.collection";
OCConnectivityType connectivityType = OC_WIFI;
string resourceTypeName = "a.collection";
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
//Non-intensive block until foundResource callback is called by OCPlatform
//and onGet gets resource.
cout << "registerResource is called." << endl;
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
else
{
// Find all resources
- requestURI << OC_WELL_KNOWN_QUERY;
+ requestURI << OC_MULTICAST_DISCOVERY_URI;
result = OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
if(result == OC_STACK_OK)
{
std::cout << "Finding Resource... " << std::endl;
try
{
// Find all resources
- requestURI << OC_WELL_KNOWN_QUERY;
+ requestURI << OC_MULTICAST_DISCOVERY_URI;
- OCPlatform::findResource("", requestURI.str(), connectivityType, &foundResource);
+ OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;
// A condition variable will free the mutex it is given, then do a non-
// makes it so that all boolean values are printed as 'true/false' in this stream
std::cout.setf(std::ios::boolalpha);
// Find all resources
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
std::cout<< "Finding Resource... " <<std::endl;
// Find resource is done twice so that we discover the original resources a second time.
// These resources will have the same uniqueidentifier (yet be different objects), so that
// we can verify/show the duplicate-checking code in foundResource(above);
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource);
+ OC_ALL, &foundResource);
std::cout<< "Finding Resource for second time..." << std::endl;
// A condition variable will free the mutex it is given, then do a non-
try
{
// Find all resources
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource, OC::QualityOfService::LowQos);
+ OC_ALL, &foundResource, OC::QualityOfService::LowQos);
std::cout<< "Finding Resource... " <<std::endl;
// Find resource is done twice so that we discover the original resources a second time.
// These resources will have the same uniqueidentifier (yet be different objects), so that
// we can verify/show the duplicate-checking code in foundResource(above);
OCPlatform::findResource("", requestURI.str(),
- connectivityType, &foundResource, OC::QualityOfService::LowQos);
+ OC_ALL, &foundResource, OC::QualityOfService::LowQos);
std::cout<< "Finding Resource for second time... " <<std::endl;
// A condition variable will free the mutex it is given, then do a non-
void start()
{
std::ostringstream requestURI;
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.foo";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.foo";
std::cout<<"Starting Client find:"<<std::endl;
FindCallback f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
std::cout<<"result:" <<
- OCPlatform::findResource("", requestURI.str(), m_connectivityType, f)
+ OCPlatform::findResource("", requestURI.str(), OC_ALL, f)
<< std::endl;
std::cout<<"Finding Resource..."<<std::endl;
{
std::cout << "in client1\n";
std::cout<<"result1:" << OCPlatform::findResource("", requestURI.str(),
- connectivityType, foundResource1)<< std::endl;
+ OC_ALL, foundResource1)<< std::endl;
// A condition variable will free the mutex it is given, then do a non-
// intensive block until 'notify' is called on it. In this case, since we
std::cout << "in client2\n";
std::cout<<"result2:" << OCPlatform::findResource("",
requestURI.str(),
- connectivityType, foundResource2)<< std::endl;
+ OC_ALL, foundResource2)<< std::endl;
// A condition variable will free the mutex it is given, then do a non-
// intensive block until 'notify' is called on it. In this case, since we
std::cout << " ConnectivityType : 1 - WIFI" << std::endl;
}
- requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.foo";
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.foo";
PlatformConfig cfg {
OC::ServiceType::InProc,