Commit d147b915 authored by Doug Hudson's avatar Doug Hudson Committed by Erich Keane

Remove WiFi and Ethernet connectivity type options in RI.

- 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: default avatarDoug Hudson <douglas.hudson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/995Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarSakthivel Samidurai <sakthivel.samidurai@intel.com>
Reviewed-by: default avatarJoseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: default avatarMandeep Shetty <mandeep.shetty@intel.com>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent 581024e2
...@@ -39,7 +39,7 @@ void MiddleClient::findResources() ...@@ -39,7 +39,7 @@ void MiddleClient::findResources()
{ {
m_resourceMap.clear(); 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) void MiddleClient::foundOCResource(shared_ptr<OCResource> resource)
......
...@@ -201,8 +201,8 @@ typedef enum ...@@ -201,8 +201,8 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
OC_ETHERNET = 0, OC_IPV4 = 0,
OC_WIFI, OC_IPV6,
OC_EDR, OC_EDR,
OC_LE, OC_LE,
OC_ALL // Multicast message: send over all the interfaces. OC_ALL // Multicast message: send over all the interfaces.
......
...@@ -35,9 +35,9 @@ static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oc/core"; ...@@ -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 * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oc/core/d";
static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d"; static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d";
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core"; static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
//The following variable determines the interface (wifi, ethernet etc.) //The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to WIFI. //to be used for sending unicast messages. Default set to IPv4.
static OCConnectivityType OC_CONNTYPE = OC_WIFI; static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static std::string putPayload = "{\"oc\":[{\"rep\":{\"power\":15,\"state\":true}}]}"; static std::string putPayload = "{\"oc\":[{\"rep\":{\"power\":15,\"state\":true}}]}";
static std::string coapServerIP = "255.255.255.255"; static std::string coapServerIP = "255.255.255.255";
static std::string coapServerPort = "5683"; static std::string coapServerPort = "5683";
...@@ -74,7 +74,7 @@ static void PrintUsage() ...@@ -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, "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, "-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 1 : Discover Resources");
OC_LOG(INFO, TAG, "-t 2 : Discover Resources and Initiate Nonconfirmable Get Request"); 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" OC_LOG(INFO, TAG, "-t 3 : Discover Resources and Initiate Nonconfirmable Get Request"
...@@ -741,7 +741,10 @@ int main(int argc, char* argv[]) ...@@ -741,7 +741,10 @@ int main(int argc, char* argv[])
TEST_CASE = atoi(optarg); TEST_CASE = atoi(optarg);
break; break;
case 'c': 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; break;
default: default:
PrintUsage(); PrintUsage();
...@@ -856,11 +859,11 @@ std::string getConnectivityType (OCConnectivityType connType) ...@@ -856,11 +859,11 @@ std::string getConnectivityType (OCConnectivityType connType)
{ {
switch (connType) switch (connType)
{ {
case OC_ETHERNET: case OC_IPV4:
return "Ethernet"; return "IPv4";
case OC_WIFI: case OC_IPV6:
return "WiFi"; return "IPv6";
case OC_LE: case OC_LE:
return "BLE"; return "BLE";
......
...@@ -41,9 +41,9 @@ static int TEST_CASE = 0; ...@@ -41,9 +41,9 @@ static int TEST_CASE = 0;
static const char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oc/core"; static const char UNICAST_DISCOVERY_QUERY[] = "coap://%s:6298/oc/core";
static std::string putPayload = "{\"state\":\"off\",\"power\":10}"; static std::string putPayload = "{\"state\":\"off\",\"power\":10}";
//The following variable determines the interface (wifi, ethernet etc.) //The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to WIFI. //to be used for sending unicast messages. Default set to IPv4.
static OCConnectivityType OC_CONNTYPE = OC_WIFI; static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core"; static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
int gQuitFlag = 0; int gQuitFlag = 0;
...@@ -69,8 +69,8 @@ static void PrintUsage() ...@@ -69,8 +69,8 @@ static void PrintUsage()
" Initiate Nonconfirmable Get/Put/Post Requests"); " Initiate Nonconfirmable Get/Put/Post Requests");
OC_LOG(INFO, TAG, "-t 3 : Discover Resources and Initiate " OC_LOG(INFO, TAG, "-t 3 : Discover Resources and Initiate "
"Confirmable Get/Put/Post Requests"); "Confirmable Get/Put/Post Requests");
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, "Default connectivityType WIFI"); OC_LOG(INFO, TAG, "Default connectivityType IPv4");
} }
/* /*
...@@ -645,11 +645,14 @@ void printResourceList() ...@@ -645,11 +645,14 @@ void printResourceList()
printf("port = %s\n", iter->port); printf("port = %s\n", iter->port);
switch (iter->connType) switch (iter->connType)
{ {
case OC_ETHERNET: case OC_IPV4:
printf("connType = %s\n","Ethernet"); printf("connType = %s\n","IPv4");
break; break;
case OC_WIFI: case OC_IPV6:
printf("connType = %s\n","WiFi"); // 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; break;
case OC_LE: case OC_LE:
printf("connType = %s\n","BLE"); printf("connType = %s\n","BLE");
...@@ -698,7 +701,10 @@ int main(int argc, char* argv[]) ...@@ -698,7 +701,10 @@ int main(int argc, char* argv[])
TEST_CASE = atoi(optarg); TEST_CASE = atoi(optarg);
break; break;
case 'c': 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; break;
default: default:
PrintUsage(); PrintUsage();
......
...@@ -76,9 +76,9 @@ testToTextMap queryInterface[] = { ...@@ -76,9 +76,9 @@ testToTextMap queryInterface[] = {
static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}"; static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}";
//The following variable determines the interface (wifi, ethernet etc.) //The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to WIFI. //to be used for sending unicast messages. Default set to IPv4.
static OCConnectivityType OC_CONNTYPE = OC_WIFI; static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core"; static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
// The handle for the observe registration // The handle for the observe registration
...@@ -107,24 +107,24 @@ int InitDiscovery(); ...@@ -107,24 +107,24 @@ int InitDiscovery();
void PrintUsage() void PrintUsage()
{ {
OC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case> -c <CA connectivity Type>"); 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, "-c <0|1> : IPv4/IPv6 (IPv6 not currently supported)");
OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an"\ OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an "\
"available resource using default interface."); "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."); "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."); "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."); "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."); "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."); "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."); "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."); "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."); "unavailable resource using link list interface.");
} }
...@@ -358,7 +358,9 @@ int main(int argc, char* argv[]) ...@@ -358,7 +358,9 @@ int main(int argc, char* argv[])
TEST = atoi(optarg); TEST = atoi(optarg);
break; break;
case 'c': 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; break;
default: default:
PrintUsage(); PrintUsage();
......
...@@ -37,9 +37,9 @@ static std::string coapServerIP = "255.255.255.255"; ...@@ -37,9 +37,9 @@ static std::string coapServerIP = "255.255.255.255";
static std::string coapServerPort = "5683"; static std::string coapServerPort = "5683";
static std::string coapServerResource = "/a/led"; static std::string coapServerResource = "/a/led";
//The following variable determines the interface (wifi, ethernet etc.) //The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to WIFI. //to be used for sending unicast messages. Default set to IPv4.
static OCConnectivityType OC_CONNTYPE = OC_WIFI; static OCConnectivityType OC_CONNTYPE = OC_IPV4;
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core"; static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
static int IPV4_ADDR_SIZE = 16; static int IPV4_ADDR_SIZE = 16;
void StripNewLineChar(char* str); void StripNewLineChar(char* str);
...@@ -58,7 +58,7 @@ void handleSigInt(int signum) ...@@ -58,7 +58,7 @@ void handleSigInt(int signum)
static void PrintUsage() static void PrintUsage()
{ {
OC_LOG(INFO, TAG, "Usage : occlient -c <0|1> -u <0|1> -t <1|2|3>"); 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, "-u <0|1> : Perform multicast/unicast discovery of resources");
OC_LOG(INFO, TAG, "-t 1 : Discover Resources"); 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 2 : Discover Resources and Initiate Nonconfirmable Get Request");
...@@ -241,7 +241,9 @@ int main(int argc, char* argv[]) ...@@ -241,7 +241,9 @@ int main(int argc, char* argv[])
TEST_CASE = atoi(optarg); TEST_CASE = atoi(optarg);
break; break;
case 'c': 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; break;
default: default:
PrintUsage(); PrintUsage();
......
...@@ -258,9 +258,7 @@ int InitDiscovery() ...@@ -258,9 +258,7 @@ int InitDiscovery()
OC_LOG(ERROR, TAG, "!! Bad input for IPV4 address. !!"); OC_LOG(ERROR, TAG, "!! Bad input for IPV4 address. !!");
return OC_STACK_INVALID_PARAM; return OC_STACK_INVALID_PARAM;
} }
printf("Select Connectivity type on which discovery request needs to be send : "); discoveryReqConnType = OC_IPV4;
printf("0:ETH, 1:WIFI\n");
discoveryReqConnType = ((getchar() - '0') == 0) ? OC_ETHERNET : OC_WIFI;
} }
else else
{ {
......
...@@ -654,11 +654,11 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_ ...@@ -654,11 +654,11 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_
switch(ocConType) switch(ocConType)
{ {
case OC_ETHERNET: case OC_IPV4:
*caConType = CA_IPV4; *caConType = CA_IPV4;
break; break;
case OC_WIFI: case OC_IPV6:
*caConType = CA_IPV4; *caConType = CA_IPV6;
break; break;
case OC_EDR: case OC_EDR:
*caConType = CA_EDR; *caConType = CA_EDR;
...@@ -667,7 +667,7 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_ ...@@ -667,7 +667,7 @@ OCStackResult OCToCATransportType(OCConnectivityType ocConType, CATransportType_
*caConType = CA_LE; *caConType = CA_LE;
break; break;
case OC_ALL: 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 // Add other connectivity types as they are enabled in future
*caConType = (CATransportType_t) (CA_IPV4); *caConType = (CATransportType_t) (CA_IPV4);
break; break;
...@@ -685,7 +685,10 @@ OCStackResult CAToOCConnectivityType(CATransportType_t caConType, OCConnectivity ...@@ -685,7 +685,10 @@ OCStackResult CAToOCConnectivityType(CATransportType_t caConType, OCConnectivity
switch(caConType) switch(caConType)
{ {
case CA_IPV4: case CA_IPV4:
*ocConType = OC_ETHERNET; *ocConType = OC_IPV4;
break;
case CA_IPV6:
*ocConType = OC_IPV6;
break; break;
case CA_EDR: case CA_EDR:
*ocConType = OC_EDR; *ocConType = OC_EDR;
......
...@@ -905,16 +905,12 @@ OCStackResult SendAction(OCDoHandle *handle, const char *targetUri, ...@@ -905,16 +905,12 @@ OCStackResult SendAction(OCDoHandle *handle, const char *targetUri,
cbdata.cd = NULL; cbdata.cd = NULL;
cbdata.context = (void*)DEFAULT_CONTEXT_VALUE; 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 // It is temporary change as OC_ALL is not working currently. Remove this code and use OC_ALL
// once it is functioning. // 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, return OCDoResource(handle, OC_REST_PUT, targetUri,
NULL, (char *) action, OC_ETHERNET, OC_NA_QOS, &cbdata, NULL, 0); NULL, (char *) action, OC_IPV4, OC_NA_QOS, &cbdata, NULL, 0);
#endif
} }
OCStackResult DoAction(OCResource* resource, OCActionSet* actionset, OCStackResult DoAction(OCResource* resource, OCActionSet* actionset,
......
...@@ -200,7 +200,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery) ...@@ -200,7 +200,7 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
szQueryUri, szQueryUri,
0, 0,
0, 0,
OC_WIFI, OC_IPV4,
OC_LOW_QOS, OC_LOW_QOS,
&cbData, &cbData,
NULL, NULL,
...@@ -236,7 +236,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI) ...@@ -236,7 +236,7 @@ TEST(StackResource, DISABLED_UpdateResourceNullURI)
szQueryUri, szQueryUri,
0, 0,
0, 0,
OC_WIFI, OC_IPV4,
OC_LOW_QOS, OC_LOW_QOS,
&cbData, &cbData,
NULL, NULL,
......
...@@ -116,7 +116,7 @@ int main(int argc, char* argv[]) { ...@@ -116,7 +116,7 @@ int main(int argc, char* argv[]) {
std::ostringstream requestURI; std::ostringstream requestURI;
std::string deviceDiscoveryURI = "/oc/core/d"; std::string deviceDiscoveryURI = "/oc/core/d";
OCConnectivityType connectivityType = OC_WIFI; OCConnectivityType connectivityType = OC_IPV4;
if(argc == 2) if(argc == 2)
{ {
...@@ -129,34 +129,37 @@ int main(int argc, char* argv[]) { ...@@ -129,34 +129,37 @@ int main(int argc, char* argv[]) {
{ {
if(optionSelected == 0) if(optionSelected == 0)
{ {
connectivityType = OC_ETHERNET; connectivityType = OC_IPV4;
} }
else if(optionSelected == 1) 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 else
{ {
std::cout << "Invalid connectivity type selected. Using default WIFI" std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl; << std::endl;
} }
} }
else 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&) 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 else
{ {
std::cout << "Usage devicediscoveryclient <connectivityType(0|1)>" << std::endl; std::cout << "Usage devicediscoveryclient <connectivityType(0|1)>" << std::endl;
std::cout<<"connectivityType: Default WIFI" << std::endl; std::cout << "connectivityType: Default IPv4" << std::endl;
std::cout << "connectivityType 0: ETHERNET" << std::endl; std::cout << "connectivityType 0: IPv4" << std::endl;
std::cout << "connectivityType 1: WIFI" << std::endl; std::cout << "connectivityType 1: IPv6 (not currently supported)" << std::endl;
} }
// Create PlatformConfig object // Create PlatformConfig object
PlatformConfig cfg { PlatformConfig cfg {
......
...@@ -267,7 +267,7 @@ class ClientFridge ...@@ -267,7 +267,7 @@ class ClientFridge
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
OCConnectivityType connectivityType = OC_WIFI; OCConnectivityType connectivityType = OC_IPV4;
if(argc == 2) if(argc == 2)
{ {
try try
...@@ -279,34 +279,37 @@ int main(int argc, char* argv[]) ...@@ -279,34 +279,37 @@ int main(int argc, char* argv[])
{ {
if(optionSelected == 0) if(optionSelected == 0)
{ {
connectivityType = OC_ETHERNET; connectivityType = OC_IPV4;
} }
else if(optionSelected == 1) 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 else
{ {
std::cout << "Invalid connectivity type selected. Using default WIFI" std::cout << "Invalid connectivity type selected. Using default IPv4"
<< std::endl; << std::endl;
} }
} }
else 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&) 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 else
{ {
std::cout<<"Usage: fridgeclient <ConnectivityType(0|1)>\n"; std::cout << "Usage: fridgeclient <ConnectivityType(0|1)>\n";
std::cout<<"ConnectivityType: Default WIFI\n"; std::cout << "connectivityType: Default IPv4" << std::endl;
std::cout<<"ConnectivityType 0: ETHERNET\n"; std::cout << "connectivityType 0: IPv4" << std::endl;
std::cout<<"ConnectivityType 1: WIFI\n"; std::cout << "connectivityType 1: IPv6 (not currently supported)" << std::endl;
} }
PlatformConfig cfg PlatformConfig cfg
......
...@@ -288,49 +288,6 @@ int main(int argc, char* argv[]) { ...@@ -288,49 +288,6 @@ int main(int argc, char* argv[]) {
std::ostringstream requestURI; 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;
}