Fix send LE adapter sendRequestToAll
authorjnashok <jn.ashok@samsung.com>
Tue, 30 Jun 2015 13:42:43 +0000 (22:42 +0900)
committerErich Keane <erich.keane@intel.com>
Thu, 2 Jul 2015 16:23:31 +0000 (16:23 +0000)
Change-Id: I5892851829b56e4a52d5b66d1711554b4b7c4530
Signed-off-by: jnashok <jn.ashok@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1458
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: jihwan seo <jihwan.seo@samsung.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/src/bt_edr_adapter/android/SConscript
resource/csdk/connectivity/src/bt_edr_adapter/caedradapter.c
resource/csdk/connectivity/src/bt_le_adapter/SConscript
resource/csdk/connectivity/src/bt_le_adapter/android/SConscript
resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c
resource/csdk/connectivity/src/bt_le_adapter/arduino/SConscript
resource/csdk/connectivity/src/bt_le_adapter/caleadapter.c

index ad6ce8c..ab60d17 100644 (file)
@@ -7,8 +7,7 @@ import os.path
 
 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'android') ])
 
-src_files = [ 'caedradapter.c',
-              'caedrclient.c',
+src_files = [ 'caedrclient.c',
               'caedrutils.c',
               'caedrnwmonitor.c',
               'caedrserver.c', ]
index 030a83d..8135659 100644 (file)
@@ -832,7 +832,7 @@ void CAEDRErrorHandler(const char *remoteAddress, const char *serviceUUID, const
     VERIFY_NON_NULL_VOID(data, EDR_ADAPTER_TAG, "Data is null");
 
     // Create remote endpoint
-    CAEndpoint_t *remoteEndpoint = CAAdapterCreateEndpoint(0, CA_ADAPTER_RFCOMM_BTEDR,
+    CAEndpoint_t *remoteEndpoint = CACreateEndpointObject(0, CA_ADAPTER_RFCOMM_BTEDR,
                                                            remoteAddress, 0);
     if (!remoteEndpoint)
     {
@@ -843,7 +843,7 @@ void CAEDRErrorHandler(const char *remoteAddress, const char *serviceUUID, const
     g_errorCallback(remoteEndpoint, data, dataLength, result);
 
     // Free remote endpoint
-    CAAdapterFreeEndpoint(remoteEndpoint);
+    CAFreeEndpoint(remoteEndpoint);
 
     OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
 }
index 7c2ab5a..d6cfe61 100644 (file)
@@ -13,7 +13,7 @@ src_dir = os.path.join(os.curdir, 'bt_le_adapter')
 
 # Source files to build common for all platforms.
 common_files = None
-if target_os is not 'arduino':
+if target_os != 'arduino':
         common_files = [ os.path.join(src_dir,
                                       'caleadapter.c') ]
 else:
index 7c9c7fe..7ee11e6 100644 (file)
@@ -8,7 +8,7 @@ import os.path
 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'android') ])
 
 src_files = [ 'caleclient.c',
-              'caleserver.c'
+              'caleserver.c',
               'calenwmonitor.c',
               'caleutils.c' ]
 
index 1c67fba..190459b 100644 (file)
@@ -1010,7 +1010,7 @@ CAResult_t CALEClientStartScan()
     // scan gatt server with UUID
     if (g_leScanCallback && g_uuidList)
     {
-#ifndef FULL_SCAN
+#ifdef UUID_SCAN
         ret = CALEClientStartScanWithUUIDImpl(env, g_uuidList, g_leScanCallback);
         if(CA_STATUS_OK != ret)
         {
index 8817fbe..b1ef61e 100644 (file)
@@ -8,6 +8,6 @@ import os.path
 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'arduino') ])
 
 src_files = [ 'cableserver.cpp',
-              'cablenwmonitor.cpp'])
+              'cablenwmonitor.cpp']
 
 Return('src_files')
index 8afb907..22381d9 100644 (file)
@@ -526,7 +526,7 @@ int32_t CASendLEMulticastData(const CAEndpoint_t *endpoint, const void *data, ui
     ca_mutex_lock(g_bleIsServerMutex);
     if (true  == g_isServer)
     {
-        result = CABLEServerSendData(endpoint, data, dataLen);
+        result = CABLEServerSendData(NULL, data, dataLen);
         if (CA_STATUS_OK != result)
         {
             OIC_LOG(ERROR, CALEADAPTER_TAG,
@@ -538,7 +538,7 @@ int32_t CASendLEMulticastData(const CAEndpoint_t *endpoint, const void *data, ui
     }
     else
     {
-        result = CABLEClientSendData(endpoint, data, dataLen);
+        result = CABLEClientSendData(NULL, data, dataLen);
         if (CA_STATUS_OK != result)
         {
             OIC_LOG(ERROR, CALEADAPTER_TAG,
@@ -1410,7 +1410,7 @@ void CABLEServerSendDataThread(void *threadData)
         {
             OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
                       result);
-            g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+            CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
             OICFree(dataSegment);
             return;
         }
@@ -1426,7 +1426,7 @@ void CABLEServerSendDataThread(void *threadData)
             {
                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
                           result);
-                g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
                 OICFree(dataSegment);
                 return;
             }
@@ -1445,7 +1445,7 @@ void CABLEServerSendDataThread(void *threadData)
             {
                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics failed, result [%d]",
                           result);
-                g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
                 OICFree(dataSegment);
                 return;
             }
@@ -1578,7 +1578,7 @@ void CABLEClientSendDataThread(void *threadData)
         {
             OIC_LOG_V(ERROR, CALEADAPTER_TAG,
                       "Update characteristics (all) failed, result [%d]", result);
-            g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+            CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
             OICFree(dataSegment);
             return ;
         }
@@ -1593,7 +1593,7 @@ void CABLEClientSendDataThread(void *threadData)
             {
                 OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Update characteristics (all) failed, result [%d]",
                           result);
-                g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
                 OICFree(dataSegment);
                 return;
             }
@@ -1613,7 +1613,7 @@ void CABLEClientSendDataThread(void *threadData)
             {
                 OIC_LOG_V(ERROR, CALEADAPTER_TAG,
                           "Update characteristics (all) failed, result [%d]", result);
-                g_errorHandler(bleData->remoteEndpoint, bleData->data, bleData->dataLen, result);
+                CALEErrorHandler(NULL, bleData->data, bleData->dataLen, result);
                 OICFree(dataSegment);
                 return;
             }
@@ -1855,25 +1855,11 @@ void CALEErrorHandler(const char *remoteAddress, const void *data, uint32_t data
     OIC_LOG(DEBUG, CALEADAPTER_TAG, "CALEErrorHandler IN");
 
     VERIFY_NON_NULL_VOID(data, CALEADAPTER_TAG, "Data is null");
-    CAEndpoint_t *rep = OICCalloc(1, sizeof(CAEndpoint_t));
-
-    if (!rep)
-    {
-        OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create remote endpoint !");
-        return;
-    }
-
-    if (remoteAddress)
-    {
-        OICStrcpy(rep->addr, sizeof(rep->addr), remoteAddress);
-    }
-
-    rep->adapter = CA_ADAPTER_GATT_BTLE;
-    rep->flags = CA_DEFAULT_FLAGS;
-
+    CAEndpoint_t *rep = CACreateEndpointObject(CA_DEFAULT_FLAGS, CA_ADAPTER_GATT_BTLE,
+                                               remoteAddress, 0);
     //if required, will be used to build remote end point
     g_errorHandler(rep, data, dataLen, result);
-    CAAdapterFreeEndpoint(rep);
 
+    CAFreeEndpoint(rep);
     OIC_LOG(DEBUG, CALEADAPTER_TAG, "CALEErrorHandler OUT");
 }