- Replace with IPv4 and IPv6 options.
- Note that IPv6 is not currently supported
- Update C/C++ sample apps
- Update C/C++ unit tests
- Update several services files to support mod.
Change-Id: I086580d76665355d14cfa240347252cef969fa64
Signed-off-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/995
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sakthivel Samidurai <sakthivel.samidurai@intel.com>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
{
m_resourceMap.clear();
- OC::OCPlatform::findResource("", OC_WELL_KNOWN_QUERY, OC_WIFI, m_findCB);
+ OC::OCPlatform::findResource("", OC_WELL_KNOWN_QUERY, OC_ALL, m_findCB);
}
void MiddleClient::foundOCResource(shared_ptr<OCResource> resource)
*/
typedef enum
{
- OC_ETHERNET = 0,
- OC_WIFI,
+ OC_IPV4 = 0,
+ OC_IPV6,
OC_EDR,
OC_LE,
OC_ALL // Multicast message: send over all the interfaces.
static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oc/core/d";
static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d";
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to WIFI.
-static OCConnectivityType OC_CONNTYPE = OC_WIFI;
+//The following variable determines the interface protocol (IPv4, IPv6, etc)
+//to be used for sending unicast messages. Default set to IPv4.
+static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static std::string putPayload = "{\"oc\":[{\"rep\":{\"power\":15,\"state\":true}}]}";
static std::string coapServerIP = "255.255.255.255";
static std::string coapServerPort = "5683";
{
OC_LOG(INFO, TAG, "Usage : occlient -u <0|1> -t <1..17> -c <0|1>");
OC_LOG(INFO, TAG, "-u <0|1> : Perform multicast/unicast discovery of resources");
- OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI");
+ OC_LOG(INFO, TAG, "-c <0|1> : IPv4/IPv6 (IPv6 not currently supported)");
OC_LOG(INFO, TAG, "-t 1 : Discover Resources");
OC_LOG(INFO, TAG, "-t 2 : Discover Resources and Initiate Nonconfirmable Get Request");
OC_LOG(INFO, TAG, "-t 3 : Discover Resources and Initiate Nonconfirmable Get Request"
TEST_CASE = atoi(optarg);
break;
case 'c':
- OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ OC_CONNTYPE = OC_IPV4;
+ OC_LOG(INFO, TAG, "IPv6 not currently supported, using IPv4.");
break;
default:
PrintUsage();
{
switch (connType)
{
- case OC_ETHERNET:
- return "Ethernet";
+ case OC_IPV4:
+ return "IPv4";
- case OC_WIFI:
- return "WiFi";
+ case OC_IPV6:
+ return "IPv6";
case OC_LE:
return "BLE";
static const char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oc/core";
static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to WIFI.
-static OCConnectivityType OC_CONNTYPE = OC_WIFI;
+//The following variable determines the interface protocol (IPv4, IPv6, etc)
+//to be used for sending unicast messages. Default set to IPv4.
+static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
int gQuitFlag = 0;
" Initiate Nonconfirmable Get/Put/Post Requests");
OC_LOG(INFO, TAG, "-t 3 : Discover Resources and Initiate "
"Confirmable Get/Put/Post Requests");
- OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI.");
- OC_LOG(INFO, TAG, "Default connectivityType WIFI");
+ OC_LOG(INFO, TAG, "-c <0|1> : IPv4/IPv6 (IPv6 not currently supported)");
+ OC_LOG(INFO, TAG, "Default connectivityType IPv4");
}
/*
printf("port = %s\n", iter->port);
switch (iter->connType)
{
- case OC_ETHERNET:
- printf("connType = %s\n","Ethernet");
+ case OC_IPV4:
+ printf("connType = %s\n","IPv4");
break;
- case OC_WIFI:
- printf("connType = %s\n","WiFi");
+ case OC_IPV6:
+ // TODO: Allow IPv6 when support is added
+ printf("IPv6 not currently supported, default to IPv4\n");
+ //printf("connType = %s\n","IPv6");
+ printf("connType = %s\n","IPv4");
break;
case OC_LE:
printf("connType = %s\n","BLE");
TEST_CASE = atoi(optarg);
break;
case 'c':
- OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ OC_CONNTYPE = OC_IPV4;
+ OC_LOG(INFO, TAG, "Using default IPv4, IPv6 not currently supported.");
break;
default:
PrintUsage();
static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}";
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to WIFI.
-static OCConnectivityType OC_CONNTYPE = OC_WIFI;
+//The following variable determines the interface protocol (IPv4, IPv6, etc)
+//to be used for sending unicast messages. Default set to IPv4.
+static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
// The handle for the observe registration
void PrintUsage()
{
OC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case> -c <CA connectivity Type>");
- OC_LOG(INFO, TAG, "-c <0|1> : Send messages over Ethernet or WIFI");
- OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "-c <0|1> : IPv4/IPv6 (IPv6 not currently supported)");
+ OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an "\
"available resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 2 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 2 : Discover Resources && Initiate GET Request on an "\
"available resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 3 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 3 : Discover Resources && Initiate GET Request on an "\
"available resource using link list interface.");
- OC_LOG(INFO, TAG, "Test Case 4 : Discover Resources && Initiate GET & PUT Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 4 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 5 : Discover Resources && Initiate GET & PUT Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 5 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 6 : Discover Resources && Initiate GET & PUT Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 6 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using link list interface.");
- OC_LOG(INFO, TAG, "Test Case 7 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 7 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 8 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 8 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 9 : Discover Resources && Initiate GET Request on an"\
+ OC_LOG(INFO, TAG, "Test Case 9 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using link list interface.");
}
TEST = atoi(optarg);
break;
case 'c':
- OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ OC_CONNTYPE = OC_IPV4;
break;
default:
PrintUsage();
static std::string coapServerPort = "5683";
static std::string coapServerResource = "/a/led";
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to WIFI.
-static OCConnectivityType OC_CONNTYPE = OC_WIFI;
+//The following variable determines the interface protocol (IPv4, IPv6, etc)
+//to be used for sending unicast messages. Default set to IPv4.
+static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
static int IPV4_ADDR_SIZE = 16;
void StripNewLineChar(char* str);
static void PrintUsage()
{
OC_LOG(INFO, TAG, "Usage : occlient -c <0|1> -u <0|1> -t <1|2|3>");
- OC_LOG(INFO, TAG, "-c <0|1> : Send unicast messages over Ethernet or WIFI");
+ OC_LOG(INFO, TAG, "-c <0|1> : IPv4/IPv6 (IPv6 not currently supported)");
OC_LOG(INFO, TAG, "-u <0|1> : Perform multicast/unicast discovery of resources");
OC_LOG(INFO, TAG, "-t 1 : Discover Resources");
OC_LOG(INFO, TAG, "-t 2 : Discover Resources and Initiate Nonconfirmable Get Request");
TEST_CASE = atoi(optarg);
break;
case 'c':
- OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // OC_CONNTYPE = OCConnectivityType(atoi(optarg));
+ OC_CONNTYPE = OC_IPV4;
break;
default:
PrintUsage();
OC_LOG(ERROR, TAG, "!! Bad input for IPV4 address. !!");
return OC_STACK_INVALID_PARAM;
}
- printf("Select Connectivity type on which discovery request needs to be send : ");
- printf("0:ETH, 1:WIFI\n");
- discoveryReqConnType = ((getchar() - '0') == 0) ? OC_ETHERNET : OC_WIFI;
+ discoveryReqConnType = OC_IPV4;
}
else
{
switch(ocConType)
{
- case OC_ETHERNET:
+ case OC_IPV4:
*caConType = CA_IPV4;
break;
- case OC_WIFI:
- *caConType = CA_IPV4;
+ case OC_IPV6:
+ *caConType = CA_IPV6;
break;
case OC_EDR:
*caConType = CA_EDR;
*caConType = CA_LE;
break;
case OC_ALL:
- // Currently OC_ALL represents WIFI and ETHERNET
+ // Currently OC_ALL represents IPv4
// Add other connectivity types as they are enabled in future
*caConType = (CATransportType_t) (CA_IPV4);
break;
switch(caConType)
{
case CA_IPV4:
- *ocConType = OC_ETHERNET;
+ *ocConType = OC_IPV4;
+ break;
+ case CA_IPV6:
+ *ocConType = OC_IPV6;
break;
case CA_EDR:
*ocConType = OC_EDR;
cbdata.cd = NULL;
cbdata.context = (void*)DEFAULT_CONTEXT_VALUE;
-// TODO: Selecting OC_WIFI for android, tizen and OC_ETHERNET for linux platform.
+// TODO: Selecting OC_IPV4.
// It is temporary change as OC_ALL is not working currently. Remove this code and use OC_ALL
// once it is functioning.
-#if defined(__ANDROID__) || defined(__TIZEN__)
- return OCDoResource(handle, OC_REST_PUT, targetUri,
- NULL, (char *) action, OC_WIFI, OC_NA_QOS, &cbdata, NULL, 0);
-#else
+
return OCDoResource(handle, OC_REST_PUT, targetUri,
- NULL, (char *) action, OC_ETHERNET, OC_NA_QOS, &cbdata, NULL, 0);
-#endif
+ NULL, (char *) action, OC_IPV4, OC_NA_QOS, &cbdata, NULL, 0);
}
OCStackResult DoAction(OCResource* resource, OCActionSet* actionset,
szQueryUri,
0,
0,
- OC_WIFI,
+ OC_IPV4,
OC_LOW_QOS,
&cbData,
NULL,
szQueryUri,
0,
0,
- OC_WIFI,
+ OC_IPV4,
OC_LOW_QOS,
&cbData,
NULL,
std::ostringstream requestURI;
std::string deviceDiscoveryURI = "/oc/core/d";
- OCConnectivityType connectivityType = OC_WIFI;
+ OCConnectivityType connectivityType = OC_IPV4;
if(argc == 2)
{
{
if(optionSelected == 0)
{
- connectivityType = OC_ETHERNET;
+ connectivityType = OC_IPV4;
}
else if(optionSelected == 1)
{
- connectivityType = OC_WIFI;
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ //connectivityType = OC_IPV6;
+ connectivityType = OC_IPV4;
+ std::cout << "IPv6 not currently supported. Using default IPv4" << std::endl;
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI"
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl;
}
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
+ std::cout << "Invalid connectivity type selected. Using default IPv4" << std::endl;
}
}
catch(std::exception&)
{
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
+ std::cout << "Invalid input argument. Using IPv4 as connectivity type" << std::endl;
}
}
else
{
std::cout << "Usage devicediscoveryclient <connectivityType(0|1)>" << std::endl;
- std::cout<<"connectivityType: Default WIFI" << std::endl;
- std::cout << "connectivityType 0: ETHERNET" << std::endl;
- std::cout << "connectivityType 1: WIFI" << std::endl;
+ std::cout << "connectivityType: Default IPv4" << std::endl;
+ std::cout << "connectivityType 0: IPv4" << std::endl;
+ std::cout << "connectivityType 1: IPv6 (not currently supported)" << std::endl;
}
// Create PlatformConfig object
PlatformConfig cfg {
int main(int argc, char* argv[])
{
- OCConnectivityType connectivityType = OC_WIFI;
+ OCConnectivityType connectivityType = OC_IPV4;
if(argc == 2)
{
try
{
if(optionSelected == 0)
{
- connectivityType = OC_ETHERNET;
+ connectivityType = OC_IPV4;
}
else if(optionSelected == 1)
{
- connectivityType = OC_WIFI;
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ //connectivityType = OC_IPV6;
+ connectivityType = OC_IPV4;
+ std::cout << "IPv6 not currently supported. Using default IPv4" << std::endl;
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI"
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl;
}
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
+ std::cout << "Invalid connectivity type selected. Using default IPv4" << std::endl;
}
}
catch(std::exception&)
{
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
+ std::cout << "Invalid input argument. Using IPv4 as connectivity type" << std::endl;
}
}
else
{
- std::cout<<"Usage: fridgeclient <ConnectivityType(0|1)>\n";
- std::cout<<"ConnectivityType: Default WIFI\n";
- std::cout<<"ConnectivityType 0: ETHERNET\n";
- std::cout<<"ConnectivityType 1: WIFI\n";
+ std::cout << "Usage: fridgeclient <ConnectivityType(0|1)>\n";
+ std::cout << "connectivityType: Default IPv4" << std::endl;
+ std::cout << "connectivityType 0: IPv4" << std::endl;
+ std::cout << "connectivityType 1: IPv6 (not currently supported)" << std::endl;
}
PlatformConfig cfg
std::ostringstream requestURI;
- OCConnectivityType connectivityType = OC_WIFI;
-
- if(argc == 2)
- {
- try
- {
- std::size_t inputValLen;
- int optionSelected = std::stoi(argv[1], &inputValLen);
-
- if(inputValLen == strlen(argv[1]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
- }
- }
- catch(std::exception&)
- {
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
- }
- }
- else
- {
- std::cout<<"Usage: garageclient <ConnectivityType(0|1)>\n";
- std::cout<<"ConnectivityType: Default WIFI\n";
- std::cout<<"ConnectivityType 0: ETHERNET\n";
- std::cout<<"ConnectivityType 1: WIFI\n";
- }
-
// Create PlatformConfig object
PlatformConfig cfg {
OC::ServiceType::InProc,
ostringstream requestURI;
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=a.collection";
- OCConnectivityType connectivityType = OC_WIFI;
-
- if(argc == 2)
- {
- try
- {
- std::size_t inputValLen;
- int optionSelected = stoi(argv[1], &inputValLen);
-
- if(inputValLen == strlen(argv[1]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
- }
- }
- catch(exception&)
- {
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
- }
- }
- else
- {
- std::cout<<"Usage: groupclient <ConnectivityType(0|1)>\n";
- std::cout<<"ConnectivityType: Default WIFI\n";
- std::cout<<"ConnectivityType 0: ETHERNET\n";
- std::cout<<"ConnectivityType 1: WIFI\n";
- }
-
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos };
{
ostringstream requestURI;
- OCConnectivityType connectivityType = OC_WIFI;
-
- if(argc == 2)
- {
- try
- {
- std::size_t inputValLen;
- int optionSelected = stoi(argv[1], &inputValLen);
-
- if(inputValLen == strlen(argv[1]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
- }
- }
- catch(exception&)
- {
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
- }
- }
- else
- {
- std::cout<<"Usage: groupclient <ConnectivityType(0|1)>\n";
- std::cout<<"ConnectivityType: Default WIFI\n";
- std::cout<<"ConnectivityType 0: ETHERNET\n";
- std::cout<<"ConnectivityType 1: WIFI\n";
- }
-
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
std::mutex resourceLock;
static int TEST_CASE = 0;
-static OCConnectivityType connectivityType = OC_WIFI;
+static OCConnectivityType connectivityType = OC_IPV4;
/**
* List of methods that can be inititated from the client
<< std::endl;
std::cout << "-t 6 : Discover Resources and Initiate Multicast Presence with two Filters"
<< std::endl;
- std::cout<<"ConnectivityType: Default WIFI" << std::endl;
- std::cout << "-c 0 : Send message over ETHERNET interface" << std::endl;
- std::cout << "-c 1 : Send message over WIFI interface" << 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" << std::endl;
}
// Callback to presence
{
if(optionSelected == 0)
{
- connectivityType = OC_ETHERNET;
+ connectivityType = OC_IPV4;
}
else if(optionSelected == 1)
{
- connectivityType = OC_WIFI;
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6
+ // is supported
+ //connectivityType = OC_IPV6;
+ connectivityType = OC_IPV4;
+ std::cout << "IPv6 not currently supported. Using default IPv4"
+ << std::endl;
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI"
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl;
}
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI"
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl;
}
break;
}
catch(std::exception& )
{
- std::cout << "Invalid input argument. Using WIFI as connectivity type"
+ std::cout << "Invalid input argument. Using IPv4 as connectivity type"
<< std::endl;
}
std::ostringstream requestURI;
- OCConnectivityType connectivityType = OC_WIFI;
- if(argc == 2)
- {
- try
- {
- std::size_t inputValLen;
- int optionSelected = std::stoi(argv[1], &inputValLen);
-
- if(inputValLen == strlen(argv[1]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
- }
- }
- catch(std::exception& )
- {
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
- }
- }
- else
- {
- std::cout << "Usage roomclient <connectivityType(0|1)>" << std::endl;
- std::cout<<"connectivityType: Default WIFI" << std::endl;
- std::cout << "connectivityType 0: ETHERNET" << std::endl;
- std::cout << "connectivityType 1: WIFI" << std::endl;
- }
// Create PlatformConfig object
PlatformConfig cfg {
DiscoveredResourceMap discoveredResources;
std::shared_ptr<OCResource> curResource;
static ObserveType OBSERVE_TYPE_TO_USE = ObserveType::Observe;
-static OCConnectivityType connectivityType = OC_WIFI;
std::mutex curResourceLock;
class Light
{
std::cout << std::endl;
std::cout << "---------------------------------------------------------------------\n";
- std::cout << "Usage : simpleclient <ObserveType> <ConnectivityType>" << std::endl;
+ std::cout << "Usage : simpleclient <ObserveType>" << std::endl;
std::cout << " ObserveType : 1 - Observe" << std::endl;
std::cout << " ObserveType : 2 - ObserveAll" << std::endl;
- std::cout << " connectivityType: Default WIFI" << std::endl;
- std::cout << " ConnectivityType : 0 - ETHERNET"<< std::endl;
- std::cout << " ConnectivityType : 1 - WIFI"<< std::endl;
std::cout << "---------------------------------------------------------------------\n\n";
}
}
}
-void checkConnectivityValue(int value)
-{
- if(value == 0)
- {
- connectivityType = OC_ETHERNET;
- std::cout << "<===Setting connectivityType to Ethernet===>\n\n";
- }
- else if(value == 1)
- {
- connectivityType = OC_WIFI;
- std::cout << "<===Setting connectivityType to WIFI===>\n\n";
- }
- else
- {
- std::cout << "<===Invalid ConnectivitType selected."
- <<"Setting ConnectivityType to WIFI===>\n\n";
- }
-}
-
int main(int argc, char* argv[]) {
std::ostringstream requestURI;
printUsage();
if (argc == 1)
{
- std::cout << "<===Setting ObserveType to Observe and ConnectivityType to WIFI===>\n\n";
+ std::cout << "<===Setting ObserveType to Observe and ConnectivityType to IPv4===>\n\n";
}
else if (argc == 2)
{
-
- checkObserverValue(std::stoi(argv[1]));
- std::cout << "<===No ConnectivtyType selected. "
- << "Setting ConnectivityType to WIFI===>\n\n";
- }
- else if(argc == 3)
- {
checkObserverValue(std::stoi(argv[1]));
- checkConnectivityValue(std::stoi(argv[2]));
}
else
{
void PrintUsage()
{
std::cout << std::endl;
- std::cout << "Usage : simpleclientHQ <ObserveType> <ConnectivityType>" << std::endl;
+ std::cout << "Usage : simpleclientHQ <ObserveType>" << std::endl;
std::cout << " ObserveType : 1 - Observe" << std::endl;
std::cout << " ObserveType : 2 - ObserveAll" << std::endl;
- std::cout<<" ConnectivityType: Default WIFI" << std::endl;
- std::cout << " ConnectivityType : 0 - ETHERNET"<< std::endl;
- std::cout << " ConnectivityType : 1 - WIFI"<< std::endl;
}
int main(int argc, char* argv[]) {
std::ostringstream requestURI;
- OCConnectivityType connectivityType = OC_WIFI;
try
{
if (argc == 1)
{
OBSERVE_TYPE_TO_USE = ObserveType::Observe;
}
- else if (argc ==2 || argc==3)
+ else if (argc == 2)
{
int value = std::stoi(argv[1]);
if (value == 1)
+ {
OBSERVE_TYPE_TO_USE = ObserveType::Observe;
+ }
else if (value == 2)
+ {
OBSERVE_TYPE_TO_USE = ObserveType::ObserveAll;
+ }
else
- OBSERVE_TYPE_TO_USE = ObserveType::Observe;
-
- if(argc == 3)
{
- std::size_t inputValLen;
- int optionSelected = std::stoi(argv[2], &inputValLen);
-
- if(inputValLen == strlen(argv[2]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
+ OBSERVE_TYPE_TO_USE = ObserveType::Observe;
}
}
else
}
catch(std::exception&)
{
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
+ std::cout << "Invalid input argument. Using Observe as observe type" << std::endl;
}
-
// Create PlatformConfig object
PlatformConfig cfg {
OC::ServiceType::InProc,
int main(int argc, char* argv[])
{
- OCConnectivityType connectivityType = OC_WIFI;
+ OCConnectivityType connectivityType = OC_IPV4;
if(argc == 2)
{
{
if(optionSelected == 0)
{
- connectivityType = OC_ETHERNET;
+ connectivityType = OC_IPV4;
}
else if(optionSelected == 1)
{
- connectivityType = OC_WIFI;
+ // TODO: re-enable IPv4/IPv6 command line selection when IPv6 is supported
+ // connectivityType = OC_IPV6;
+ connectivityType = OC_IPV4;
+ std::cout << "IPv6 not currently supported. Using default IPv4" << std::endl;
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI"
+ std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl;
}
}
else
{
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
+ std::cout << "Invalid connectivity type selected. Using default IPv4" << std::endl;
}
}
catch(std::exception& )
{
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
+ std::cout << "Invalid input argument. Using IPv4 as connectivity type" << std::endl;
}
}
else
{
std::cout<< "Usage simpleclientserver <ConnectivityType(0|1)>" << std::endl;
- std::cout<<" ConnectivityType: Default WIFI" << std::endl;
- std::cout << " ConnectivityType : 0 - ETHERNET" << std::endl;
- std::cout << " ConnectivityType : 1 - WIFI" << std::endl;
+ std::cout<< " ConnectivityType: Default IPv4" << std::endl;
+ std::cout << " ConnectivityType : 0 - IPv4" << std::endl;
+ std::cout << " ConnectivityType : 1 - IPv6 (not currently supported)" << std::endl;
}
PlatformConfig cfg {
#include "OCApi.h"
using namespace OC;
-static OCConnectivityType connectivityType = OC_WIFI;
-
static std::ostringstream requestURI;
struct FooResource
int main(int argc, char* argv[])
{
- if(argc == 2)
- {
- try
- {
- std::size_t inputValLen;
- int optionSelected = std::stoi(argv[1], &inputValLen);
-
- if(inputValLen == strlen(argv[1]))
- {
- if(optionSelected == 0)
- {
- connectivityType = OC_ETHERNET;
- }
- else if(optionSelected == 1)
- {
- connectivityType = OC_WIFI;
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI"
- << std::endl;
- }
- }
- else
- {
- std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
- }
- }
- catch(std::exception& )
- {
- std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
- }
- }
- else
- {
- std::cout<< "Usage threadingsample <ConnectivityType(0|1)>" << std::endl;
- std::cout<<"ConnectivityType: Default WIFI" << std::endl;
- std::cout << " ConnectivityType : 0 - ETHERNET" << std::endl;
- std::cout << " ConnectivityType : 1 - WIFI" << std::endl;
- }
-
requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.foo";
PlatformConfig cfg {
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK, OCPlatform::findResource("", requestURI.str(),
- OC_WIFI, &foundResource));
+ OC_IPV4, &foundResource));
}
TEST(FindResourceTest, FindResourceNullResourceURI)
{
EXPECT_ANY_THROW(OCPlatform::findResource("", nullptr,
- OC_WIFI, &foundResource));
+ OC_IPV4, &foundResource));
}
TEST(FindResourceTest, FindResourceNullResourceURI1)
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
- OC_WIFI, &foundResource));
+ OC_IPV4, &foundResource));
}
TEST(FindResourceTest, FindResourceNullHost)
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
- OC_WIFI, &foundResource));
+ OC_IPV4, &foundResource));
}
TEST(FindResourceTest, FindResourceNullresourceHandler)
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_THROW(OCPlatform::findResource("", requestURI.str(),
- OC_WIFI, NULL), OC::OCException);
+ OC_IPV4, NULL), OC::OCException);
}
TEST(FindResourceTest, DISABLED_FindResourceWithLowQoS)
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+ OCPlatform::findResource("", requestURI.str(), OC_IPV4, &foundResource,
OC::QualityOfService::LowQos));
}
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+ OCPlatform::findResource("", requestURI.str(), OC_IPV4, &foundResource,
OC::QualityOfService::MidQos));
}
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+ OCPlatform::findResource("", requestURI.str(), OC_IPV4, &foundResource,
OC::QualityOfService::HighQos));
}
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+ OCPlatform::findResource("", requestURI.str(), OC_IPV4, &foundResource,
OC::QualityOfService::NaQos));
}
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo));
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, &receivedDeviceInfo));
}
TEST(GetDeviceInfoTest, GetDeviceInfoNullDeviceURI)
PlatformConfig cfg;
OCPlatform::Configure(cfg);
EXPECT_ANY_THROW(
- OCPlatform::getDeviceInfo("", nullptr, OC_WIFI, &receivedDeviceInfo));
+ OCPlatform::getDeviceInfo("", nullptr, OC_IPV4, &receivedDeviceInfo));
}
TEST(GetDeviceInfoTest, GetDeviceInfoWithNullDeviceInfoHandler)
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_THROW(
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, NULL),
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, NULL),
OC::OCException);
}
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, &receivedDeviceInfo,
OC::QualityOfService::LowQos));
}
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, &receivedDeviceInfo,
OC::QualityOfService::MidQos));
}
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, &receivedDeviceInfo,
OC::QualityOfService::HighQos));
}
std::ostringstream requestURI;
requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
EXPECT_EQ(OC_STACK_OK,
- OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+ OCPlatform::getDeviceInfo("", requestURI.str(), OC_IPV4, &receivedDeviceInfo,
OC::QualityOfService::NaQos));
}
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle, hostAddress,
- OC_WIFI, &presenceHandler));
+ OC_IPV4, &presenceHandler));
}
TEST(SubscribePresenceTest, SubscribePresenceWithNullHost)
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
- OC_WIFI, &presenceHandler));
+ OC_IPV4, &presenceHandler));
}
TEST(SubscribePresenceTest, SubscribePresenceWithNullPresenceHandler)
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
- OC_WIFI, NULL));
+ OC_IPV4, NULL));
}
TEST(SubscribePresenceTest, DISABLED_SubscribePresenceWithResourceType)
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
- OC_MULTICAST_IP, "core.light", OC_WIFI, &presenceHandler));
+ OC_MULTICAST_IP, "core.light", OC_IPV4, &presenceHandler));
}
TEST(SubscribePresenceTest, SubscribePresenceWithNullResourceType)
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle,
- OC_MULTICAST_IP, nullptr, OC_WIFI, &presenceHandler));
+ OC_MULTICAST_IP, nullptr, OC_IPV4, &presenceHandler));
}
TEST(SubscribePresenceTest, DISABLED_UnsubscribePresenceWithValidHandleAndRT)
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
- OC_MULTICAST_IP, "core.light", OC_WIFI, &presenceHandler));
+ OC_MULTICAST_IP, "core.light", OC_IPV4, &presenceHandler));
EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
}
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
- OC_MULTICAST_IP, OC_WIFI, &presenceHandler));
+ OC_MULTICAST_IP, OC_IPV4, &presenceHandler));
EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
}
//Helper method
OCResource::Ptr ConstructResourceObject(std::string host, std::string uri)
{
- OCConnectivityType connectivityType = OC_WIFI;
+ OCConnectivityType connectivityType = OC_IPV4;
std::vector<std::string> types = {"intel.rpost"};
std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
{
OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");
EXPECT_TRUE(resource != NULL);
- EXPECT_TRUE(resource->connectivityType() == OC_WIFI);
+ EXPECT_TRUE(resource->connectivityType() == OC_IPV4);
}
//IsObservable Test
#include "ocstack.h"
#include "logger.h"
-// TODO: Selecting OC_WIFI for android, tizen and OC_ETHERNET for linux platform
-// is temporary change as OC_ALL is not working currently. Remove this code and use OC_ALL
-// once it is functioning.
-#if defined(__ANDROID__) || defined(__TIZEN__)
-#define OC_TRANSPORT OC_WIFI
-#else
-#define OC_TRANSPORT OC_ETHERNET
-#endif
+#define OC_TRANSPORT OC_ALL
#ifdef __cplusplus
extern "C" {
}
#endif // __cplusplus
-#endif //_HOSTING_H_
\ No newline at end of file
+#endif //_HOSTING_H_
OCStackResult nmfindResource(const std::string &host , const std::string &resourceName)
{
- return OCPlatform::findResource(host , resourceName , OC_ETHERNET, &foundResource);
+ return OCPlatform::findResource(host , resourceName , OC_ALL, &foundResource);
}
void getRepresentation(std::shared_ptr< OCResource > resource)
std::cout.setf(std::ios::boolalpha);
// Find all resources
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.fan";
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResourceFan);
+ OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResourceFan);
std::cout << "Finding Resource... " << std::endl;
while (true)
{
// Find fan resources
std::ostringstream requestURI;
requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.fan";
- OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResourceFan);
+ OCPlatform::findResource("", requestURI.str(), OC_ALL, &foundResourceFan);
std::cout << "Finding Resource... " << std::endl;
}
catch (OCException &e)
case OC_STACK_OK:
requestURI << "coap://" << hostAddress << "/oc/core?rt=SSManager.Sensor";
- ret = OC::OCPlatform::findResource("", requestURI.str(), OC_WIFI,
- std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-
- if (ret != OC_STACK_OK)
- SSM_CLEANUP_ASSERT(SSM_E_FAIL);
-
- ret = OC::OCPlatform::findResource("", requestURI.str(), OC_ETHERNET,
+ ret = OC::OCPlatform::findResource("", requestURI.str(), OC_ALL,
std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
if (ret != OC_STACK_OK)
std::ostringstream multicastPresenceURI;
multicastPresenceURI << "coap://" << OC_MULTICAST_PREFIX;
- ret = OC::OCPlatform::findResource("", requestURI.str(), OC_WIFI,
+ ret = OC::OCPlatform::findResource("", requestURI.str(), OC_ALL,
std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
if (ret != OC_STACK_OK)
SSM_CLEANUP_ASSERT(SSM_E_FAIL);
- ret = OC::OCPlatform::findResource("", requestURI.str(), OC_ETHERNET,
- std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
-
- if (ret != OC_STACK_OK)
- SSM_CLEANUP_ASSERT(SSM_E_FAIL);
-
- ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, multicastPresenceURI.str(),
- "SSManager.Sensor", OC_WIFI, std::bind(&CResourceFinder::presenceHandler, this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-
- if (ret != OC_STACK_OK)
- SSM_CLEANUP_ASSERT(SSM_E_FAIL);
-
ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, multicastPresenceURI.str(),
- "SSManager.Sensor", OC_ETHERNET, std::bind(&CResourceFinder::presenceHandler, this,
+ "SSManager.Sensor", OC_ALL, std::bind(&CResourceFinder::presenceHandler, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
if (ret != OC_STACK_OK)
m_mapResourcePresenceHandles.end())
{
ret = OC::OCPlatform::subscribePresence(presenceHandle, ((ISSMResource *)pMessage[1])->ip,
- "SSManager.Sensor", OC_WIFI, std::bind(&CResourceFinder::presenceHandler, this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-
- if (ret != OC_STACK_OK)
- SSM_CLEANUP_ASSERT(SSM_E_FAIL);
-
- ret = OC::OCPlatform::subscribePresence(presenceHandle, ((ISSMResource *)pMessage[1])->ip,
- "SSManager.Sensor", OC_ETHERNET, std::bind(&CResourceFinder::presenceHandler, this,
+ "SSManager.Sensor", OC_ALL, std::bind(&CResourceFinder::presenceHandler, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
if (ret != OC_STACK_OK)
OCPlatform::findResource("",
query,
- OC_ETHERNET,
+ OC_ALL,
&foundResource);
// OCPlatform::findResource("",
OCPlatform::findResource("",
query,
- OC_ETHERNET,
+ OC_ALL,
&foundResource);
// OCPlatform::findResource("",
// query,
cout << query.str() << endl;
result = OCPlatform::findResource("",
query.str(),
- OC_ETHERNET,
+ OC_ALL,
onFindResource);
result = OCPlatform::findResource("",
"coap://224.0.1.187/oc/core?rt=core.musicplayer",
- OC_WIFI,
+ OC_ALL,
onFindResource);
if (OC_STACK_OK == result)
query << OC_WELL_KNOWN_QUERY << "?rt=core.speaker";
result = OCPlatform::findResource("",
query.str(),
- OC_ETHERNET,
- onFindResource);
-
- result = OCPlatform::findResource("",
- "coap://224.0.1.187/oc/core?rt=core.speaker",
- OC_WIFI,
+ OC_ALL,
onFindResource);
if (OC_STACK_OK == result)
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,
+ OC_ALL,
std::function < void(std::shared_ptr < OCResource > resource)
> (std::bind(&GroupManager::onFoundResource, this, std::placeholders::_1,
waitsec)));
result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
// resourceType,
resourceTypes.front(),
- OC_ETHERNET,
- 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())));
-
- result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
- // resourceType,
- resourceTypes.front(),
- OC_WIFI,
+ OC_ALL,
std::function<
void(OCStackResult result, const unsigned int nonce,
const std::string& hostAddress) >(
{
return OC_STACK_ERROR;
}
-
+
OCStackResult result = OC_STACK_OK;
//callback("core.room",OC_STACK_OK);
{
if(newActionSet->mDelay < 0)
{
- return OC_STACK_INVALID_PARAM;
+ return OC_STACK_INVALID_PARAM;
}
std::string message = getStringFromActionSet(newActionSet);
query.append(collectionResourceTypes.at(i));
OCPlatform::findResource("", query,
- // we will change to OC_ALL when OC_ALL flag is stable.
- OC_ETHERNET,
- std::bind(&GroupSynchronization::onFindGroup, this,
+ OC_ALL,
+ std::bind(&GroupSynchronization::onFindGroup, this,
std::placeholders::_1));
}
std::vector< std::string > resourceInterface;
resourceInterface.push_back(DEFAULT_INTERFACE);
- OCResource::Ptr groupSyncResource =
+ OCResource::Ptr groupSyncResource =
OCPlatform::constructResourceObject(host, uri,
- // we will change to OC_ALL when OC_ALL flag is stable.
- OC_ETHERNET, false,
+
+ OC_ALL, false,
resourceTypes, resourceInterface);
// OCResource::Ptr groupSyncResource = OCPlatform::constructResourceObject(host, uri,
OCResource::Ptr groupSyncResource;
groupSyncResource = OCPlatform::constructResourceObject(host, uri,
- // we will change to OC_ALL when OC_ALL flag is stable.
- OC_ETHERNET, false,
+ OC_ALL, false,
resourceTypes, resourceInterface);
// groupSyncResource = OCPlatform::constructResourceObject(host, uri,
// OC_WIFI, false, resourceTypes, resourceInterface);
{
if (0 == collectionResourceType.length())
{
- OC_LOG(DEBUG, TAG,
+ OC_LOG(DEBUG, TAG,
"GroupSynchronization::deleteGroup : Error! Input params are wrong.");
return;
}
result = OCPlatform::unregisterResource(resourceHandle);
if (OC_STACK_OK == result)
{
- OC_LOG_V(DEBUG, TAG,
+ OC_LOG_V(DEBUG, TAG,
"GroupSynchronization::deleteGroup : UnregisterResource(%d)" \
" was successful.", i + 1);
}
else
{
- OC_LOG_V(DEBUG, TAG,
+ OC_LOG_V(DEBUG, TAG,
"GroupSynchronization::deleteGroup : UnregisterResource(%d)" \
" was unsuccessful. result - ", i + 1, result);
}
resourceRequest = request;
OCPlatform::findResource("", resourceName,
- // we will change to OC_ALL when OC_ALL flag is stable.
- OC_ETHERNET,
+ OC_ALL,
std::bind(&GroupSynchronization::onFindResource, this,
std::placeholders::_1));
if (0 == resourceType.compare(type))
{
- OC_LOG_V(DEBUG, TAG,
+ OC_LOG_V(DEBUG, TAG,
"GroupSynchronization::groupEntityHandler : " \
"Found! The resource to leave is found. - %s", type);
collectionResourceHandle, resourceHandle);
if (OC_STACK_OK == result)
{
- OC_LOG(DEBUG, TAG,
+ OC_LOG(DEBUG, TAG,
"GroupSynchronization::groupEntityHandler : " \
"To unbind resource was successful.");
}
else
{
- OC_LOG_V(DEBUG, TAG,
+ OC_LOG_V(DEBUG, TAG,
"GroupSynchronization::groupEntityHandler : " \
"To unbind resource was unsuccessful. result - %d",
result);
result = OCPlatform::unregisterResource(resourceHandle);
if (OC_STACK_OK == result)
{
- OC_LOG(DEBUG, TAG,
+ OC_LOG(DEBUG, TAG,
"GroupSynchronization::groupEntityHandler : " \
"To unregister resource was successful.");
}
else
{
- OC_LOG_V(DEBUG, TAG,
+ OC_LOG_V(DEBUG, TAG,
"GroupSynchronization::groupEntityHandler : "
"To unregister resource was unsuccessful. result - %d",
result);
{
if( 0 == foundHostUri.compare(savedHostAddress) )
{
- OC_LOG(DEBUG, TAG,
+ OC_LOG(DEBUG, TAG,
"GroupSynchronization::IsSameGroup : Found! The same group is found.");
return true;
}
OCRepresentation child;
OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild");
-#ifndef NDEBUG
+#ifndef NDEBUG
// debugging
// Get the resource URI
resourceURI = rep.getUri();
std::string host = getHostFromURI(oit->getUri());
-// TODO: Selecting OC_WIFI for android, tizen and OC_ETHERNET for linux platform.
-// It is temporary change as OC_ALL is not working currently. Remove this code and use OC_ALL
-// once it is functioning.
-#if defined(__ANDROID__) || defined(__TIZEN__)
- tempResource = OCPlatform::constructResourceObject(host, uri, OC_WIFI, true,
+ tempResource = OCPlatform::constructResourceObject(host, uri, OC_ALL, true,
oit->getResourceTypes(), m_if);
-#else
- tempResource = OCPlatform::constructResourceObject(host, uri, OC_ETHERNET, true,
- oit->getResourceTypes(), m_if);
-#endif
p_resources.push_back(tempResource);
}