From f821183252422d863073553f8e067622faa003f1 Mon Sep 17 00:00:00 2001 From: "vimala.v" Date: Tue, 28 Jun 2016 16:53:49 +0530 Subject: [PATCH] [ARDUINO] Resolved build error for WITH_TCP=TRUE Change-Id: I46e116467d30b48c54d4ff51303edad95c9748a7 Signed-off-by: vimala.v Reviewed-on: https://gerrit.iotivity.org/gerrit/8995 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- resource/csdk/connectivity/inc/catcpinterface.h | 2 +- .../src/tcp_adapter/arduino/catcpserver_eth.cpp | 9 ++++++++- resource/csdk/stack/src/oickeepalive.c | 18 +++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/resource/csdk/connectivity/inc/catcpinterface.h b/resource/csdk/connectivity/inc/catcpinterface.h index 05e7601..1ce03a7 100644 --- a/resource/csdk/connectivity/inc/catcpinterface.h +++ b/resource/csdk/connectivity/inc/catcpinterface.h @@ -143,7 +143,7 @@ void CATCPSetPacketReceiveCallback(CATCPPacketReceivedCallback callback); /** * Set this callback for receiving the changed connection information from peer devices. * - * @param[in] callback Callback to be notified when connection state changes. + * @param[in] connHandler Callback to be notified when connection state changes. */ void CATCPSetConnectionChangedCallback(CATCPConnectionHandleCallback connHandler); diff --git a/resource/csdk/connectivity/src/tcp_adapter/arduino/catcpserver_eth.cpp b/resource/csdk/connectivity/src/tcp_adapter/arduino/catcpserver_eth.cpp index 3cc0e7d..b290eb3 100644 --- a/resource/csdk/connectivity/src/tcp_adapter/arduino/catcpserver_eth.cpp +++ b/resource/csdk/connectivity/src/tcp_adapter/arduino/catcpserver_eth.cpp @@ -159,6 +159,11 @@ void CATCPSetPacketReceiveCallback(CATCPPacketReceivedCallback callback) OIC_LOG(DEBUG, TAG, "OUT"); } +void CATCPSetConnectionChangedCallback(CATCPConnectionHandleCallback connHandler) +{ + return; +} + void CATCPSetErrorHandler(CATCPErrorHandleCallback errorHandleCallback) { return; @@ -232,7 +237,9 @@ void CATCPReadDataInternal() if (totalLen == totalReceivedLen) { CASecureEndpoint_t ep = - {.endpoint = {.adapter = CA_ADAPTER_TCP, .port = tcpClientPort}}; + {.endpoint = {.adapter = CA_ADAPTER_TCP, + .flags = CA_DEFAULT_FLAGS, + .port = tcpClientPort}}; IPAddress clientIP = tcpClientIP; int ret = snprintf(ep.endpoint.addr, sizeof(ep.endpoint.addr), "%d.%d.%d.%d", diff --git a/resource/csdk/stack/src/oickeepalive.c b/resource/csdk/stack/src/oickeepalive.c index 5f428b9..2dd2b2f 100644 --- a/resource/csdk/stack/src/oickeepalive.c +++ b/resource/csdk/stack/src/oickeepalive.c @@ -468,7 +468,8 @@ void ProcessKeepAlive() for (uint32_t i = 0; i < len; i++) { - KeepAliveEntry_t *entry = u_arraylist_get(g_keepAliveConnectionTable, i); + KeepAliveEntry_t *entry = (KeepAliveEntry_t *)u_arraylist_get(g_keepAliveConnectionTable, + i); if (NULL == entry) { continue; @@ -548,7 +549,8 @@ OCStackResult SendDisconnectMessage(const KeepAliveEntry_t *entry) * If CA get the empty message from RI, CA will disconnect a connection. */ CARequestInfo_t requestInfo = { .method = CA_PUT }; - return CASendRequest(&entry->remoteAddr, &requestInfo); + CAResult_t result = CASendRequest(&entry->remoteAddr, &requestInfo); + return CAResultToOCResult(result); } OCStackResult SendPingMessage(KeepAliveEntry_t *entry) @@ -556,7 +558,7 @@ OCStackResult SendPingMessage(KeepAliveEntry_t *entry) VERIFY_NON_NULL(entry, FATAL, OC_STACK_INVALID_PARAM); // Send ping message. - OCCallbackData pingData = { .cb = PingRequestCallback }; + OCCallbackData pingData = { .context = NULL, .cb = PingRequestCallback }; OCDevAddr devAddr = { .adapter = OC_ADAPTER_TCP }; CopyEndpointToDevAddr(&(entry->remoteAddr), &devAddr); @@ -615,7 +617,8 @@ KeepAliveEntry_t *GetEntryFromEndpoint(const CAEndpoint_t *endpoint, uint32_t *i for (uint32_t i = 0; i < len; i++) { - KeepAliveEntry_t *entry = u_arraylist_get(g_keepAliveConnectionTable, i); + KeepAliveEntry_t *entry = (KeepAliveEntry_t *)u_arraylist_get(g_keepAliveConnectionTable, + i); if (NULL == entry) { continue; @@ -699,7 +702,8 @@ OCStackResult RemoveKeepAliveEntry(const CAEndpoint_t *endpoint) return OC_STACK_ERROR; } - KeepAliveEntry_t *removedEntry = u_arraylist_remove(g_keepAliveConnectionTable, index); + KeepAliveEntry_t *removedEntry = (KeepAliveEntry_t *) + u_arraylist_remove(g_keepAliveConnectionTable, index); if (NULL == removedEntry) { OIC_LOG(ERROR, TAG, "Removed Entry is NULL"); @@ -725,12 +729,12 @@ void HandleKeepAliveConnCB(const CAEndpoint_t *endpoint, bool isConnected) OIC_LOG(DEBUG, TAG, "Received the connected device information from CA"); // Send discover message to find ping resource - OCCallbackData pingData = { .cb = PingRequestCallback }; + OCCallbackData pingData = {.context = NULL, .cb = PingRequestCallback }; OCDevAddr devAddr = { .adapter = OC_ADAPTER_TCP }; CopyEndpointToDevAddr(endpoint, &devAddr); OCDoResource(NULL, OC_REST_DISCOVER, KEEPALIVE_RESOURCE_URI, &devAddr, NULL, - OC_ADAPTER_TCP, OC_HIGH_QOS, &pingData, NULL, 0); + CT_ADAPTER_TCP, OC_HIGH_QOS, &pingData, NULL, 0); } else { -- 2.7.4