for (unsigned int i = 0; i < resourceTypes.size(); ++i)
{
- std::cout << "resourceTypes : " << resourceTypes.at(i) << std::endl;
- std::string query = "coap://224.0.1.187/oc/core?rt=";
+ std::string query = "coap://224.0.1.187:5298/oc/core?rt=";
+ // std::cout << "resourceTypes : " << resourceTypes.at(i) << std::endl;
query.append(resourceTypes.at(i));
+
+#ifdef CA_INT
+ OCPlatform::findResource("", query.c_str(),
+ OC_ETHERNET | OC_WIFI,
+ std::function < void(std::shared_ptr < OCResource > resource)
+ > (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
+ waitsec)));
+#else
OCPlatform::findResource("", query.c_str(),
std::function < void(std::shared_ptr < OCResource > resource)
- > (std::bind(&GroupManager::onFoundResource, this,
- std::placeholders::_1, waitsec)));
+ > (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
+ waitsec)));
+#endif
}
if (waitsec >= 0)
std::cout << "\t\tconvertRT : " << resourceType << std::endl;
std::cout << "\t\thost : " << hostAddress << std::endl;
OCPlatform::OCPresenceHandle presenceHandle;
+
+#ifdef CA_INT
+ OCStackResult result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
+ resourceType,
+ OC_ETHERNET | OC_WIFI,
+ std::function<
+ void(OCStackResult result, const unsigned int nonce,
+ const std::string& hostAddress) >(
+ std::bind(&GroupManager::collectionPresenceHandler, this,
+ std::placeholders::_1, std::placeholders::_2,
+ std::placeholders::_3, hostAddress, oit->getUri())));
+#else
OCStackResult result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
resourceType,
std::function<
std::bind(&GroupManager::collectionPresenceHandler, this,
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, hostAddress, oit->getUri())));
+#endif
if (result == OC_STACK_OK)
{
std::vector< std::string > resourceInterface;
resourceInterface.push_back(DEFAULT_INTERFACE);
+
+#ifdef CA_INT
+ OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri,
+ OC_ETHERNET | OC_WIFI, 1, resourceTypes, resourceInterface);
+#else
OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri, 1,
resourceTypes, resourceInterface);
+#endif
groupSyncResourceList[type[0]] = groupSyncResource;
cout << "GroupSynchronization::joinGroup : creating groupSyncResource." << endl;