From: vimala.v Date: Wed, 29 Jul 2015 11:15:03 +0000 (+0530) Subject: [ARDUINO] Fixed send data failure in IP adapter X-Git-Tag: 1.2.0+RC1~1317 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aeb5afefb16538634c05d4230b81a7207f1f4105;p=platform%2Fupstream%2Fiotivity.git [ARDUINO] Fixed send data failure in IP adapter Change-Id: I8f3cbd6414fca8f92e22f5d3d7ce8c3eebcb4b71 Signed-off-by: vimala.v Reviewed-on: https://gerrit.iotivity.org/gerrit/1975 Tested-by: jenkins-iotivity Reviewed-by: Erich Keane --- diff --git a/resource/csdk/connectivity/src/ip_adapter/arduino/caipclient_eth.cpp b/resource/csdk/connectivity/src/ip_adapter/arduino/caipclient_eth.cpp index 3e234df..cd31bec 100644 --- a/resource/csdk/connectivity/src/ip_adapter/arduino/caipclient_eth.cpp +++ b/resource/csdk/connectivity/src/ip_adapter/arduino/caipclient_eth.cpp @@ -33,6 +33,7 @@ #include "caipadapterutils_eth.h" #include "caadapterutils.h" #include "oic_malloc.h" +#include "oic_string.h" #define TAG "IPC" @@ -44,6 +45,8 @@ static int g_sockID = 0; */ static uint16_t g_unicastPort = 0; +#define IPv4_MULTICAST "224.0.1.187" + void CAIPSetUnicastSocket(int socketID) { OIC_LOG(DEBUG, TAG, "IN"); @@ -83,14 +86,16 @@ void CAIPSendData(CAEndpoint_t *endpoint, const void *buf, uint16_t port = endpoint->port; if (isMulticast) { + port = CA_COAP; + OICStrcpy(endpoint->addr, sizeof(endpoint->addr), IPv4_MULTICAST); if (CAArduinoInitMulticastUdpSocket(endpoint->addr, port, g_unicastPort, &socketID) != CA_STATUS_OK) { OIC_LOG(ERROR, TAG, "init mcast err"); return; } - OIC_LOG_V(DEBUG, TAG, "MPORT:%d", port); - OIC_LOG_V(DEBUG, TAG, "LPORT:%d", g_unicastPort); + OIC_LOG_V(DEBUG, TAG, "MPORT:%u", port); + OIC_LOG_V(DEBUG, TAG, "LPORT:%u", g_unicastPort); OIC_LOG_V(DEBUG, TAG, "SOCKET ID:%d", socketID); } else diff --git a/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_eth.cpp b/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_eth.cpp index 09098dc..099e6d3 100644 --- a/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_eth.cpp +++ b/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_eth.cpp @@ -102,7 +102,7 @@ CAResult_t CAIPStartUnicastServer(const char *localAddress, uint16_t *port, g_unicastSocket = serverFD; CAIPSetUnicastSocket(g_unicastSocket); CAIPSetUnicastPort(g_unicastPort); - OIC_LOG_V(DEBUG, TAG, "g_unicastPort: %d", g_unicastPort); + OIC_LOG_V(DEBUG, TAG, "g_unicastPort: %u", g_unicastPort); OIC_LOG_V(DEBUG, TAG, "g_unicastSocket: %d", g_unicastSocket); OIC_LOG(DEBUG, TAG, "OUT"); return CA_STATUS_OK; diff --git a/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_wifi.cpp b/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_wifi.cpp index 153dc52..0086b22 100644 --- a/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_wifi.cpp +++ b/resource/csdk/connectivity/src/ip_adapter/arduino/caipserver_wifi.cpp @@ -105,7 +105,7 @@ CAResult_t CAIPStartUnicastServer(const char *localAddress, uint16_t *port, return CA_STATUS_FAILED; } - OIC_LOG_V(DEBUG, TAG, "port: %d", *port); + OIC_LOG_V(DEBUG, TAG, "port: %u", *port); Udp.begin((uint16_t ) *port); gServerRunning = true; diff --git a/resource/csdk/connectivity/src/ip_adapter/caipadapter.c b/resource/csdk/connectivity/src/ip_adapter/caipadapter.c index dd9ceca2..c2dea29 100644 --- a/resource/csdk/connectivity/src/ip_adapter/caipadapter.c +++ b/resource/csdk/connectivity/src/ip_adapter/caipadapter.c @@ -354,6 +354,7 @@ static int32_t CAQueueIPData(bool isMulticast, const CAEndpoint_t *endpoint, #ifdef SINGLE_THREAD CAIPSendData(endpoint, data, dataLength, isMulticast); + return dataLength; #else