[CA] [All] URI support , Optimization , License verification
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / wifi_adapter / arduino / cawificlient.cpp
index 30e11d9..8ddc4d6 100644 (file)
 
 #define MOD_NAME "WC"
 
-static int16_t CAParseIPv4AddressLocal(unsigned char *ipAddrStr, uint8_t *ipAddr, uint16_t *port);
-
-static int32_t gSockID = 0;
-
 static WiFiUDP Udp;
 
 void CAWiFiSetUnicastSocket(const int32_t socketID)
 {
-    OIC_LOG(DEBUG, MOD_NAME, "IN");
-    if (0 < socketID)
-    {
-        gSockID = socketID;
-        return;
-    }
 
-    OIC_LOG(DEBUG, MOD_NAME, "OUT");
-    return;
 }
 
 uint32_t CAWiFiSendData(const char *remoteAddress, const uint32_t port,
@@ -63,78 +51,15 @@ uint32_t CAWiFiSendData(const char *remoteAddress, const uint32_t port,
 {
     OIC_LOG(DEBUG, MOD_NAME, "IN");
 
-    uint32_t ip;
-    uint16_t rem, send;
-
     VERIFY_NON_NULL(data, MOD_NAME, "data");
     VERIFY_NON_NULL(remoteAddress, MOD_NAME, "address");
 
     int32_t ret = 1;
     OIC_LOG_V(DEBUG, MOD_NAME, "remoteip: %s", remoteAddress);
-    OIC_LOG_V(DEBUG, MOD_NAME, "sending to port: %d", port);
+    OIC_LOG_V(DEBUG, MOD_NAME, "port: %d", port);
     Udp.beginPacket(remoteAddress, port);
     ret = (int32_t)Udp.write((char *)data);
     Udp.endPacket();
     OIC_LOG(DEBUG, MOD_NAME, "OUT");
     return ret;
 }
-
-int16_t CAParseIPv4AddressLocal(unsigned char *ipAddrStr, uint8_t *ipAddr, uint16_t *port)
-{
-    size_t index = 0;
-    unsigned char *itr;
-    uint8_t dotCount = 0;
-
-    ipAddr[index] = 0;
-    *port = 0;
-    itr = ipAddrStr;
-    if (!isdigit((unsigned char) *ipAddrStr))
-    {
-        return -1;
-    }
-    ipAddrStr = itr;
-
-    while (*ipAddrStr)
-    {
-        if (isdigit((unsigned char) *ipAddrStr))
-        {
-            ipAddr[index] *= 10;
-            ipAddr[index] += *ipAddrStr - '0';
-        }
-        else if ((unsigned char) *ipAddrStr == '.')
-        {
-            index++;
-            dotCount++;
-            ipAddr[index] = 0;
-        }
-        else
-        {
-            break;
-        }
-        ipAddrStr++;
-    }
-    if (*ipAddrStr == ':')
-    {
-        ipAddrStr++;
-        while (*ipAddrStr)
-        {
-            if (isdigit((unsigned char) *ipAddrStr))
-            {
-                *port *= 10;
-                *port += *ipAddrStr - '0';
-            }
-            else
-            {
-                break;
-            }
-            ipAddrStr++;
-        }
-    }
-    if (ipAddr[0] < 255 && ipAddr[1] < 255 && ipAddr[2] < 255 && ipAddr[3] < 255
-        && dotCount == 3)
-    {
-        return 1;
-    }
-    return 0;
-}
-