Allow endpoint adapter type to filter discovery adapters
authorJohn Light <john.j.light@intel.com>
Tue, 28 Jul 2015 19:47:05 +0000 (12:47 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 4 Aug 2015 16:12:44 +0000 (16:12 +0000)
Change-Id: I1424b906ac4084180d6982623911accdf993237f
Signed-off-by: John Light <john.j.light@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2009
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/src/cainterfacecontroller.c

index 666bec0..b5beea1 100644 (file)
@@ -138,8 +138,10 @@ typedef enum
     CA_ADAPTER_RFCOMM_BTEDR  = (1 << 2),   // RFCOMM over Bluetooth EDR
 
     #ifdef RA_ADAPTER
-    CA_ADAPTER_REMOTE_ACCESS = (1 << 3)   // Remote Access over XMPP.
+    CA_ADAPTER_REMOTE_ACCESS = (1 << 3),   // Remote Access over XMPP.
     #endif
+
+    CA_ALL_ADAPTERS          = 0xffffffff
 } CATransportAdapter_t;
 
 typedef enum
index c90e070..9df1da3 100644 (file)
@@ -393,13 +393,14 @@ CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data, u
     OIC_LOG(DEBUG, TAG, "IN");
 
     u_arraylist_t *list = CAGetSelectedNetworkList();
-
     if (!list)
     {
         OIC_LOG(DEBUG, TAG, "No selected network");
         return CA_SEND_FAILED;
     }
 
+    CATransportFlags_t requestedAdapter = endpoint->adapter ? endpoint->adapter : CA_ALL_ADAPTERS;
+
     for (uint32_t i = 0; i < u_arraylist_length(list); i++)
     {
         void* ptrType = u_arraylist_get(list, i);
@@ -410,6 +411,10 @@ CAResult_t CASendMulticastData(const CAEndpoint_t *endpoint, const void *data, u
         }
 
         CATransportAdapter_t connType = *(CATransportAdapter_t *)ptrType;
+        if ((connType & requestedAdapter) == 0)
+        {
+            continue;
+        }
 
         int index = CAGetAdapterIndex(connType);