We cannot use OC_ALL.
So we call the findResource API twice using OC_ETHERNET and OC_WIFI.
Change-Id: I303c56e7f15c36da3ee0519f9f9a00c092a83928
Signed-off-by: HyunJun Kim <hyunjun2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/728
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
int main(int argc, char* argv[])
{
-
// Create PlatformConfig object
PlatformConfig cfg
{ OC::ServiceType::InProc, OC::ModeType::Both/*OC::ModeType::Server*/, "0.0.0.0", 0,
}
else if (selectedMenu == 11)
{
+ ostringstream query;
+ query << OC_WELL_KNOWN_QUERY << "?rt=core.musicplayer";
+
+ cout << query.str() << endl;
result = OCPlatform::findResource("",
- "coap://224.0.1.187/oc/core?rt=core.musicplayer",
+ query.str(),
OC_ETHERNET,
onFindResource);
}
else if (selectedMenu == 12)
{
- result = OCPlatform::findResource("",
- "coap://224.0.1.187/oc/core?rt=core.speaker",
+ ostringstream query;
+ query << OC_WELL_KNOWN_QUERY << "?rt=core.speaker";
+ result = OCPlatform::findResource("",
+ query.str(),
OC_ETHERNET,
onFindResource);
-
- result = OCPlatform::findResource("",
+
+ result = OCPlatform::findResource("",
"coap://224.0.1.187/oc/core?rt=core.speaker",
OC_WIFI,
onFindResource);
std::string resourceInterface = DEFAULT_INTERFACE;
result = OCPlatform::registerResource(gPhoneResourceHandle, resourceURi,
- resourceTypeName, resourceInterface, NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
+ resourceTypeName, resourceInterface,
+ NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
+
if (OC_STACK_OK == result)
{
cout << "To register phone resource was successful\n";
query.append("?rt=");
query.append(resourceTypes.at(i));
- OCPlatform::findResource("",
+ OCPlatform::findResource("",
query,
OC_ETHERNET,
std::function < void(std::shared_ptr < OCResource > resource)
> (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
waitsec)));
- // OCPlatform::findResource("",
- // query,
- // OC_WIFI,
- // std::function < void(std::shared_ptr < OCResource > resource)
- // > (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
- // waitsec)));
+ OCPlatform::findResource("",
+ query,
+ OC_WIFI,
+ std::function < void(std::shared_ptr < OCResource > resource)
+ > (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
+ waitsec)));
}
if (waitsec >= 0)
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, hostAddress, oit->getUri())));
+ result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
+ // resourceType,
+ resourceTypes.front(),
+ 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())));
+
if (result == OC_STACK_OK)
{
presenceCallbacks.insert(std::make_pair(oit->getUri(), callback));
OC_ETHERNET,
std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
- // OCPlatform::findResource("", query,
- // OC_WIFI,
- // std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
+ OCPlatform::findResource("", query,
+ OC_WIFI,
+ std::bind(&GroupSynchronization::onFindGroup, this, std::placeholders::_1));
}
bIsFinding = true;
std::bind(&GroupSynchronization::onFindResource, this,
std::placeholders::_1));
- // OCPlatform::findResource("", resourceName,
- // OC_WIFI,
- // std::bind(&GroupSynchronization::onFindResource, this,
- // std::placeholders::_1));
+ OCPlatform::findResource("", resourceName,
+ OC_WIFI,
+ std::bind(&GroupSynchronization::onFindResource, this,
+ std::placeholders::_1));
return OC_EH_SLOW;
}