static int TEST_CASE = 0;
static int CONNECTIVITY = 0;
-static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oic/d";
+static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s/oic/d";
static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oic/d";
-static const char * UNICAST_PLATFORM_DISCOVERY_QUERY = "coap://%s:6298/oic/p";
+static const char * UNICAST_PLATFORM_DISCOVERY_QUERY = "coap://%s/oic/p";
static const char * MULTICAST_PLATFORM_DISCOVERY_QUERY = "/oic/p";
-static const char * UNICAST_RESOURCE_DISCOVERY_QUERY = "coap://%s:6298/oic/res";
+static const char * UNICAST_RESOURCE_DISCOVERY_QUERY = "coap://%s/oic/res";
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oic/res";
//The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to IPv4.
static std::string coapServerIP = "255.255.255.255";
static std::string coapServerPort = "5683";
static std::string coapServerResource = "/a/light";
-static const int IPV4_ADDR_SIZE = 16;
+// Size to hold IPV4_ADDRESS:PORT
+static const int IPV4_ADDR_SIZE = 24;
//Use ipv4addr for both InitDiscovery and InitPlatformOrDeviceDiscovery
char ipv4addr[IPV4_ADDR_SIZE];
void StripNewLineChar(char* str);
OC_LOG(ERROR, TAG, "OCStack init error");
return 0;
}
- if (UNICAST_DISCOVERY)
- {
- OC_LOG(INFO, TAG, "Enter IPv4 address of the Server hosting resource (Ex: 192.168.0.15)\n");
- OC_LOG(INFO, TAG, "Ipv6 is currently not supported...");
- if (fgets(ipv4addr, IPV4_ADDR_SIZE, stdin))
- {
- //Strip newline char from ipv4addr
- StripNewLineChar(ipv4addr);
- }
- else
- {
- OC_LOG(ERROR, TAG, "!! Bad input for IPV4 address. !!");
- return OC_STACK_INVALID_PARAM;
- }
- }
- if(CONNECTIVITY == CT_ADAPTER_DEFAULT)
- {
- OC_CONNTYPE = CT_DEFAULT;
- }
- else if(CONNECTIVITY == CT_IPV4)
+ if(CONNECTIVITY == CT_ADAPTER_DEFAULT || CONNECTIVITY == CT_IPV4)
{
- OC_CONNTYPE = CT_IP_USE_V4;
+ OC_CONNTYPE = CT_ADAPTER_IP;
}
else if(CONNECTIVITY == CT_IPV6)
{
- OC_CONNTYPE = CT_IP_USE_V6;
-
//TODO: Remove when IPv6 is available.
OC_LOG(ERROR, TAG, "IPv6 is currently not supported !!!!");
PrintUsage();
PrintUsage();
}
+ if (UNICAST_DISCOVERY)
+ {
+ OC_LOG(INFO, TAG, "Enter IP address with port number of the Server hosting resource");
+ OC_LOG(INFO, TAG, "as follows - eg: 192.168.0.15:45454 (IP:Port) \n");
+
+ if (fgets(ipv4addr, IPV4_ADDR_SIZE, stdin))
+ {
+ //Strip newline char from ipv4addr
+ StripNewLineChar(ipv4addr);
+ }
+ else
+ {
+ OC_LOG(ERROR, TAG, "!! Bad input for IPV4 address. !!");
+ return OC_STACK_INVALID_PARAM;
+ }
+ }
+
if(UNICAST_DISCOVERY == 0 && TEST_CASE == TEST_DISCOVER_DEV_REQ)
{
InitDeviceDiscovery(OC_LOW_QOS);