Remove WiFi and Ethernet connectivity type options in RI.
authorDoug Hudson <douglas.hudson@intel.com>
Thu, 14 May 2015 17:44:55 +0000 (13:44 -0400)
committerErich Keane <erich.keane@intel.com>
Fri, 15 May 2015 21:57:33 +0000 (21:57 +0000)
- 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>
33 files changed:
examples/OICMiddle/Client.cpp
resource/csdk/stack/include/octypes.h
resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp
resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp
resource/csdk/stack/src/ocstack.c
resource/csdk/stack/src/oicgroup.c
resource/csdk/stack/test/stacktests.cpp
resource/examples/devicediscoveryclient.cpp
resource/examples/fridgeclient.cpp
resource/examples/garageclient.cpp
resource/examples/groupclient.cpp
resource/examples/groupserver.cpp
resource/examples/presenceclient.cpp
resource/examples/roomclient.cpp
resource/examples/simpleclient.cpp
resource/examples/simpleclientHQ.cpp
resource/examples/simpleclientserver.cpp
resource/examples/threadingsample.cpp
resource/unittests/OCPlatformTest.cpp
resource/unittests/OCResourceTest.cpp
service/notification-manager/NotificationManager/include/hosting.h
service/notification-manager/SampleApp/linux/sampleConsumer/SampleConsumer.cpp
service/protocol-plugin/sample-app/linux/mqtt/mqttclient.cpp
service/protocol-plugin/sample-app/tizen/PPMSampleApp/src/ppmsampleapp.cpp
service/soft-sensor-manager/SSMCore/src/SensorProcessor/ResourceFinder.cpp
service/things-manager/sampleapp/linux/groupaction/groupserver.cpp
service/things-manager/sampleapp/linux/groupsyncaction/group.cpp
service/things-manager/sdk/src/GroupManager.cpp
service/things-manager/sdk/src/GroupSynchronization.cpp
service/things-manager/sdk/src/ThingsConfiguration.cpp

index c8576d6..b753b94 100644 (file)
@@ -39,7 +39,7 @@ void MiddleClient::findResources()
 {
     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)
index 7868428..5210210 100644 (file)
@@ -201,8 +201,8 @@ typedef enum
  */
 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.
index c6f175f..46fac55 100644 (file)
@@ -35,9 +35,9 @@ static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oc/core";
 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";
@@ -74,7 +74,7 @@ static void PrintUsage()
 {
     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"
@@ -741,7 +741,10 @@ int main(int argc, char* argv[])
                 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();
@@ -856,11 +859,11 @@ std::string getConnectivityType (OCConnectivityType connType)
 {
     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";
index f844666..30f79d9 100644 (file)
@@ -41,9 +41,9 @@ static int TEST_CASE = 0;
 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;
@@ -69,8 +69,8 @@ static void PrintUsage()
             " 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");
 }
 
 /*
@@ -645,11 +645,14 @@ void printResourceList()
         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");
@@ -698,7 +701,10 @@ int main(int argc, char* argv[])
                 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();
index dddf827..f609aea 100644 (file)
@@ -76,9 +76,9 @@ testToTextMap queryInterface[] = {
 
 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
@@ -107,24 +107,24 @@ int InitDiscovery();
 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.");
 }
 
@@ -358,7 +358,9 @@ int main(int argc, char* argv[])
                 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();
index 6a9a66e..5fc29c6 100644 (file)
@@ -37,9 +37,9 @@ static std::string coapServerIP = "255.255.255.255";
 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);
@@ -58,7 +58,7 @@ void handleSigInt(int signum)
 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");
@@ -241,7 +241,9 @@ int main(int argc, char* argv[])
                 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();
index 186a5f8..5f8d7b6 100644 (file)
@@ -258,9 +258,7 @@ int InitDiscovery()
             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
     {
index 44ed5ac..8c6d004 100644 (file)
@@ -654,11 +654,11 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_
 
     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;
@@ -667,7 +667,7 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_
             *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;
@@ -685,7 +685,10 @@ OCStackResult CAToOCConnectivityType(CATransportType_t caConType, OCConnectivity
     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;
index 66fce6c..47d34be 100755 (executable)
@@ -905,16 +905,12 @@ OCStackResult SendAction(OCDoHandle *handle, const char *targetUri,
     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,
index ce85f70..bf3722a 100644 (file)
@@ -200,7 +200,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
                                         szQueryUri,
                                         0,
                                         0,
-                                        OC_WIFI,
+                                        OC_IPV4,
                                         OC_LOW_QOS,
                                         &cbData,
                                         NULL,
@@ -236,7 +236,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI)
                                         szQueryUri,
                                         0,
                                         0,
-                                        OC_WIFI,
+                                        OC_IPV4,
                                         OC_LOW_QOS,
                                         &cbData,
                                         NULL,
index e3dba58..5c7511c 100644 (file)
@@ -116,7 +116,7 @@ int main(int argc, char* argv[]) {
     std::ostringstream requestURI;
     std::string deviceDiscoveryURI = "/oc/core/d";
 
-    OCConnectivityType connectivityType = OC_WIFI;
+    OCConnectivityType connectivityType = OC_IPV4;
 
     if(argc == 2)
     {
@@ -129,34 +129,37 @@ int main(int argc, char* argv[]) {
             {
                 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 {
index 259aec4..501ad75 100644 (file)
@@ -267,7 +267,7 @@ class ClientFridge
 
 int main(int argc, char* argv[])
 {
-    OCConnectivityType connectivityType = OC_WIFI;
+    OCConnectivityType connectivityType = OC_IPV4;
     if(argc == 2)
     {
         try
@@ -279,34 +279,37 @@ int main(int argc, char* argv[])
             {
                 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
index 8dcc6b2..c64528d 100644 (file)
@@ -288,49 +288,6 @@ int main(int argc, char* argv[]) {
 
     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,
index cd8d6f6..89c5a61 100644 (file)
@@ -173,49 +173,6 @@ int main(int argc, char* argv[])
     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 };
 
index fc4aaef..c4b069d 100644 (file)
@@ -80,49 +80,6 @@ int main(int argc, char* argv[])
 {
     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 };
 
index 5a3c686..305bfe5 100644 (file)
@@ -35,7 +35,7 @@ std::shared_ptr<OCResource> curResource;
 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
@@ -63,9 +63,9 @@ void printUsage()
               << 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
@@ -221,21 +221,26 @@ int main(int argc, char* argv[]) {
                     {
                         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;
@@ -247,7 +252,7 @@ int main(int argc, char* argv[]) {
     }
     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;
     }
 
index 6d5c759..fdba60d 100644 (file)
@@ -224,47 +224,6 @@ int main(int argc, char* argv[]) {
 
     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 {
index e3b2f39..e06d731 100644 (file)
@@ -36,7 +36,6 @@ typedef std::map<OCResourceIdentifier, std::shared_ptr<OCResource>> DiscoveredRe
 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
@@ -388,12 +387,9 @@ void printUsage()
 {
     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";
 }
 
@@ -416,25 +412,6 @@ void checkObserverValue(int value)
     }
 }
 
-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;
@@ -444,19 +421,11 @@ int main(int argc, char* argv[]) {
         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
         {
index 98bc93d..af0bea4 100644 (file)
@@ -370,61 +370,35 @@ void foundResource(std::shared_ptr<OCResource> resource)
 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
@@ -435,10 +409,9 @@ int main(int argc, char* argv[]) {
     }
     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,
index 25019a4..43f4899 100644 (file)
@@ -300,7 +300,7 @@ struct FooResource
 
 int main(int argc, char* argv[])
 {
-    OCConnectivityType connectivityType = OC_WIFI;
+    OCConnectivityType connectivityType = OC_IPV4;
 
     if(argc == 2)
     {
@@ -313,34 +313,37 @@ int main(int argc, char* argv[])
             {
                 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 {
index 95e0489..9d4b5e9 100644 (file)
@@ -35,8 +35,6 @@
 #include "OCApi.h"
 using namespace OC;
 
-static OCConnectivityType connectivityType = OC_WIFI;
-
 static std::ostringstream requestURI;
 
 struct FooResource
@@ -336,47 +334,6 @@ void server()
 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 {
index 4154d61..2264e37 100644 (file)
@@ -478,13 +478,13 @@ namespace OCPlatformTest
       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)
@@ -492,7 +492,7 @@ namespace OCPlatformTest
       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)
@@ -500,7 +500,7 @@ namespace OCPlatformTest
       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)
@@ -508,7 +508,7 @@ namespace OCPlatformTest
       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)
@@ -516,7 +516,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -525,7 +525,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -534,7 +534,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -543,7 +543,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -556,7 +556,7 @@ namespace OCPlatformTest
         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)
@@ -564,7 +564,7 @@ namespace OCPlatformTest
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         EXPECT_ANY_THROW(
-                OCPlatform::getDeviceInfo("", nullptr, OC_WIFI, &receivedDeviceInfo));
+                OCPlatform::getDeviceInfo("", nullptr, OC_IPV4, &receivedDeviceInfo));
     }
 
     TEST(GetDeviceInfoTest, GetDeviceInfoWithNullDeviceInfoHandler)
@@ -575,7 +575,7 @@ namespace OCPlatformTest
         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);
     }
 
@@ -587,7 +587,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -599,7 +599,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -611,7 +611,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -623,7 +623,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -662,7 +662,7 @@ namespace OCPlatformTest
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle, hostAddress,
-                 OC_WIFI, &presenceHandler));
+                 OC_IPV4, &presenceHandler));
     }
 
     TEST(SubscribePresenceTest, SubscribePresenceWithNullHost)
@@ -670,7 +670,7 @@ namespace OCPlatformTest
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
-                 OC_WIFI, &presenceHandler));
+                 OC_IPV4, &presenceHandler));
     }
 
     TEST(SubscribePresenceTest, SubscribePresenceWithNullPresenceHandler)
@@ -678,7 +678,7 @@ namespace OCPlatformTest
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
-                 OC_WIFI, NULL));
+                 OC_IPV4, NULL));
     }
 
     TEST(SubscribePresenceTest, DISABLED_SubscribePresenceWithResourceType)
@@ -686,7 +686,7 @@ namespace OCPlatformTest
         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)
@@ -694,7 +694,7 @@ namespace OCPlatformTest
         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)
@@ -702,7 +702,7 @@ namespace OCPlatformTest
         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));
     }
 
@@ -717,7 +717,7 @@ namespace OCPlatformTest
         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));
     }
 
index daf4517..d647c1f 100644 (file)
@@ -49,7 +49,7 @@ namespace OCResourceTest
     //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};
 
@@ -450,7 +450,7 @@ namespace OCResourceTest
     {
         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
index 7d224d1..c85eea8 100755 (executable)
 #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" {
@@ -65,4 +58,4 @@ OCStackResult OICStopCoordinate();
 }
 #endif // __cplusplus
 
-#endif //_HOSTING_H_
\ No newline at end of file
+#endif //_HOSTING_H_
index 7c2c8ef..054465d 100755 (executable)
@@ -224,7 +224,7 @@ void foundResource(std::shared_ptr< OCResource > resource)
 
 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)
index 679667f..ec6d2ed 100644 (file)
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
         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)
         {
index 1d3c21c..05c1287 100644 (file)
@@ -543,7 +543,7 @@ send_msg_clicked_cb(void *data , Evas_Object *obj , void *event_info)
             // 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)
index c44d242..ba7342c 100644 (file)
@@ -78,13 +78,7 @@ void CResourceFinder::presenceHandler(OCStackResult result, const unsigned int n
         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)
@@ -133,27 +127,14 @@ SSMRESULT CResourceFinder::startResourceFinder()
     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)
@@ -235,14 +216,7 @@ void CResourceFinder::onExecute(void *pArg)
                 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)
index 8d0c5ab..b49b215 100755 (executable)
@@ -484,7 +484,7 @@ int main()
 
                     OCPlatform::findResource("",
                             query,
-                            OC_ETHERNET,
+                            OC_ALL,
                             &foundResource);
 
                     // OCPlatform::findResource("",
@@ -500,7 +500,7 @@ int main()
 
                     OCPlatform::findResource("",
                             query,
-                            OC_ETHERNET,
+                            OC_ALL,
                             &foundResource);
                     // OCPlatform::findResource("",
                     //         query,
index 45c1ced..0a55c0e 100644 (file)
@@ -118,12 +118,12 @@ int main(int argc, char* argv[])
                 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)
@@ -141,12 +141,7 @@ int main(int argc, char* argv[])
                 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)
index 581b3bb..90d7e12 100755 (executable)
@@ -229,14 +229,7 @@ OCStackResult GroupManager::findCandidateResources(
 
         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)));
@@ -369,18 +362,7 @@ void GroupManager::checkCollectionRepresentation(const OCRepresentation& rep,
             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) >(
@@ -428,7 +410,7 @@ OCStackResult GroupManager::subscribeCollectionPresence(
     {
         return OC_STACK_ERROR;
     }
-    
+
     OCStackResult result = OC_STACK_OK;
     //callback("core.room",OC_STACK_OK);
 
@@ -645,7 +627,7 @@ OCStackResult GroupManager::addActionSet(std::shared_ptr< OCResource > resource,
     {
         if(newActionSet->mDelay < 0)
         {
-            return OC_STACK_INVALID_PARAM; 
+            return OC_STACK_INVALID_PARAM;
         }
 
         std::string message = getStringFromActionSet(newActionSet);
index e9b8abe..00aed30 100644 (file)
@@ -78,9 +78,8 @@ namespace OIC
             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));
         }
 
@@ -286,10 +285,10 @@ namespace OIC
         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,
@@ -467,8 +466,7 @@ OCStackResult GroupSynchronization::leaveGroup(
 
         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);
@@ -511,7 +509,7 @@ OCStackResult GroupSynchronization::leaveGroup(
     {
         if (0 == collectionResourceType.length())
         {
-            OC_LOG(DEBUG, TAG, 
+            OC_LOG(DEBUG, TAG,
                 "GroupSynchronization::deleteGroup : Error! Input params are wrong.");
             return;
         }
@@ -630,13 +628,13 @@ OCStackResult GroupSynchronization::leaveGroup(
                 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);
                 }
@@ -713,8 +711,7 @@ OCStackResult GroupSynchronization::leaveGroup(
                         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));
 
@@ -739,7 +736,7 @@ OCStackResult GroupSynchronization::leaveGroup(
 
                             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);
 
@@ -749,13 +746,13 @@ OCStackResult GroupSynchronization::leaveGroup(
                                         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);
@@ -764,13 +761,13 @@ OCStackResult GroupSynchronization::leaveGroup(
                                 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);
@@ -937,7 +934,7 @@ OCStackResult GroupSynchronization::leaveGroup(
             {
                 if( 0 == foundHostUri.compare(savedHostAddress) )
                 {
-                    OC_LOG(DEBUG, TAG, 
+                    OC_LOG(DEBUG, TAG,
                         "GroupSynchronization::IsSameGroup : Found! The same group is found.");
                     return true;
                 }
@@ -1083,7 +1080,7 @@ OCStackResult GroupSynchronization::leaveGroup(
         OCRepresentation child;
 
         OC_LOG(DEBUG, TAG, "GroupSynchronization::onGetJoinedRemoteChild");
-#ifndef NDEBUG      
+#ifndef NDEBUG
         // debugging
         // Get the resource URI
         resourceURI = rep.getUri();
index 82b8d5e..43c6895 100755 (executable)
@@ -326,16 +326,8 @@ namespace OIC
 
             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);
         }