#include <pthread.h>
#include <mutex>
#include <condition_variable>
-
+#include <getopt.h>
#include "OCPlatform.h"
#include "OCApi.h"
<< std::endl;
std::cout << "-t 6 : Discover Resources and Initiate Multicast Presence with two Filters"
<< std::endl;
- std::cout<<"ConnectivityType: Default IPv4" << std::endl;
- std::cout << "-c 0 : Send message with IPv4" << std::endl;
- std::cout << "-c 1 : Send message with IPv6 (Currently Not Supported)" << std::endl;
+ std::cout<<"ConnectivityType: Default IP" << std::endl;
+ std::cout << "-c 0 : Send message with IP" << std::endl;
}
// Callback to presence
{
if(optionSelected == 0)
{
- std::cout << "Using IPv4."<< std::endl;
- connectivityType = CT_IP_USE_V4;
- }
- else if(optionSelected == 1)
- {
- std::cout << "IPv6 is currently not supported."<< std::endl;
- printUsage();
- return -1;
- //TODO: printUsage to be removed when IPv6 is available.
- //connectivityType = CT_IP_USE_V6;
+ std::cout << "Using IP."<< std::endl;
+ connectivityType = CT_ADAPTER_IP;
}
else
{
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
OCStackResult result = OC_STACK_OK;
- std::ostringstream multicastPresenceURI;
- multicastPresenceURI << "coap://" << OC_MULTICAST_PREFIX;
-
if(TEST_CASE == TEST_MULTICAST_PRESENCE_NORMAL)
{
result = OCPlatform::subscribePresence(presenceHandle,
- multicastPresenceURI.str(), connectivityType, presenceHandler);
+ "",
+ connectivityType,
+ presenceHandler);
if(result == OC_STACK_OK)
{
}
else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTER)
{
- result = OCPlatform::subscribePresence(presenceHandle, multicastPresenceURI.str(), "core.light",
- connectivityType, &presenceHandler);
+ result = OCPlatform::subscribePresence(presenceHandle,
+ "", "core.light",
+ connectivityType,
+ &presenceHandler);
if(result == OC_STACK_OK)
{
std::cout << "Subscribed to multicast presence with resource type";
}
else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTERS)
{
- result = OCPlatform::subscribePresence(presenceHandle, multicastPresenceURI.str(), "core.light",
- connectivityType, &presenceHandler);
+ result = OCPlatform::subscribePresence(presenceHandle,
+ "", "core.light",
+ connectivityType,
+ &presenceHandler);
if(result == OC_STACK_OK)
{
std::cout << "Subscribed to multicast presence with resource type";
}
std::cout << "\"core.light\"." << std::endl;
- result = OCPlatform::subscribePresence(presenceHandle, multicastPresenceURI.str(), "core.fan",
- connectivityType, &presenceHandler);
+ result = OCPlatform::subscribePresence(presenceHandle,
+ "", "core.fan",
+ connectivityType,
+ &presenceHandler);
if(result == OC_STACK_OK)
{
std::cout<< "Subscribed to multicast presence with resource type";