removed warning from scons build for Android EDR
authorjihwan.seo <jihwan.seo@samsung.com>
Tue, 4 Aug 2015 11:46:23 +0000 (20:46 +0900)
committerJon A. Cruz <jonc@osg.samsung.com>
Tue, 4 Aug 2015 21:13:27 +0000 (21:13 +0000)
Change-Id: Ic54b6cbdd7582c6c2ff7ef0074cf56e58d5e400e
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2105
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/csdk/connectivity/inc/caedrinterface.h
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrclient.c
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrclient.h
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrnwmonitor.c
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrserver.c
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrserver.h
resource/csdk/connectivity/src/bt_edr_adapter/android/caedrutils.c
resource/csdk/connectivity/src/bt_edr_adapter/caedradapter.c
resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrclient.c
resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrendpoint.c
resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrendpoint.h

index df00dd8..989faa4 100644 (file)
@@ -269,22 +269,20 @@ CAResult_t CAEDRGetAdapterEnableState(bool *state);
  * @param[in]  serviceUUID     Service UUID of the device.
  * @param[in]  data            Data to be sent.
  * @param[in]  dataLength      Length of the data to be sent.
- * @param[out]  sentLength      Length of the actual sent data.
  * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
-                                      const void *data, uint32_t dataLength, uint32_t *sentLength);
+                                      const void *data, uint32_t dataLength);
 
 /**
  * This function sends data to all bluetooth devices running OIC service.
  * @param[in]  serviceUUID     Service UUID of the device.
  * @param[in]  data            Data to be sent.
  * @param[in]  dataLength      Length of the data to be sent.
- * @param[out]  sentLength      Length of the actual sent data.
  * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
-                                        uint32_t dataLength, uint32_t *sentLength);
+                                        uint32_t dataLength);
 
 /**
  * This function gets bonded bluetooth device list
index 0a58c91..0a8d994 100644 (file)
@@ -202,7 +202,7 @@ CAResult_t CAEDRManagerReadData(void)
 }
 
 CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
-                                      const void *data, uint32_t dataLength, uint32_t *sentLength)
+                                      const void *data, uint32_t dataLength)
 {
     OIC_LOG(DEBUG, TAG, "IN");
     CAResult_t result = CAEDRSendUnicastMessage(remoteAddress, (const char*) data, dataLength);
@@ -211,7 +211,7 @@ CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *ser
 }
 
 CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
-                                        uint32_t dataLength, uint32_t *sentLength)
+                                        uint32_t dataLength)
 {
     OIC_LOG(DEBUG, TAG, "IN");
     CAResult_t result = CAEDRSendMulticastMessage((const char*) data, dataLength);
@@ -689,7 +689,7 @@ CAResult_t CAEDRSendUnicastMessageImpl(const char* address, const char* data, ui
         // find address
         if (!strcmp(remoteAddress, address))
         {
-            CAResult_t res = CAEDRNativeSendData(env, remoteAddress, data, dataLen, i);
+            CAResult_t res = CAEDRNativeSendData(env, remoteAddress, data, dataLen);
             if (CA_STATUS_OK != res)
             {
                 (*env)->ReleaseStringUTFChars(env, j_str_address, remoteAddress);
@@ -746,7 +746,7 @@ CAResult_t CAEDRSendMulticastMessageImpl(JNIEnv *env, const char* data, uint32_t
                   "[EDR][Native] getBondedDevices: ~~device address is %s", remoteAddress);
 
         // find address
-        CAResult_t res = CAEDRNativeSendData(env, remoteAddress, data, dataLen, i);
+        CAResult_t res = CAEDRNativeSendData(env, remoteAddress, data, dataLen);
         (*env)->ReleaseStringUTFChars(env, j_str_address, remoteAddress);
         if (CA_STATUS_OK != res)
         {
@@ -764,7 +764,7 @@ CAResult_t CAEDRSendMulticastMessageImpl(JNIEnv *env, const char* data, uint32_t
  * EDR Method
  */
 CAResult_t CAEDRNativeSendData(JNIEnv *env, const char *address, const char *data,
-                               uint32_t dataLength, uint32_t id)
+                               uint32_t dataLength)
 {
     OIC_LOG_V(DEBUG, TAG, "[EDR][Native] btSendData logic start : %s, %d", data, dataLength);
 
@@ -786,7 +786,7 @@ CAResult_t CAEDRNativeSendData(JNIEnv *env, const char *address, const char *dat
         }
         else
         {
-            CAResult_t res = CAEDRNativeConnect(env, address, id);
+            CAResult_t res = CAEDRNativeConnect(env, address);
             if (CA_STATUS_OK != res)
             {
                 return res;
@@ -881,7 +881,7 @@ CAResult_t CAEDRNativeSendData(JNIEnv *env, const char *address, const char *dat
     return CA_STATUS_OK;
 }
 
-CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address, uint32_t id)
+CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address)
 {
     OIC_LOG(DEBUG, TAG, "[EDR][Native] btConnect..");
 
@@ -1037,7 +1037,7 @@ CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address, uint32_t id)
     return CA_STATUS_OK;
 }
 
-void CAEDRNativeSocketClose(JNIEnv *env, const char *address, uint32_t id)
+void CAEDRNativeSocketClose(JNIEnv *env, const char *address)
 {
 
     jclass jni_cid_BTSocket = (*env)->FindClass(env, "android/bluetooth/BluetoothSocket");
index e655193..08456a4 100644 (file)
@@ -137,29 +137,26 @@ CAResult_t CAEDRSendMulticastMessageImpl(JNIEnv *env, const char *data, uint32_t
  * @param  address          [IN] Remote Address
  * @param  data             [IN] Data to be transmitted from EDR
  * @param  dataLength       [IN] Length of data
- * @param  id               [IN] index of remote address
  * @return #CA_STATUS_OK or Appropriate error code
  */
 CAResult_t CAEDRNativeSendData(JNIEnv *env, const char* address, const char* data,
-                               uint32_t dataLength, uint32_t id);
+                               uint32_t dataLength);
 
 /**
  * @brief  This function will connect to remote device.
  * @param  env              [IN] JNI interface pointer
  * @param  address          [IN] Remote Address
- * @param  id               [IN] index of remote address
  * @return #CA_STATUS_OK or Appropriate error code
  */
-CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address, uint32_t id);
+CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address);
 
 /**
  * @brief  This function will close socket.
  * @param  env              [IN] JNI interface pointer
  * @param  address          [IN] Remote Address
- * @param  id               [IN] index of remote address
  * @return None
  */
-void CAEDRNativeSocketClose(JNIEnv *env, const char *address, uint32_t id);
+void CAEDRNativeSocketClose(JNIEnv *env, const char *address);
 
 #ifdef __cplusplus
 } /* extern "C" */
index 64053cc..6bfdc5e 100644 (file)
@@ -107,8 +107,14 @@ CAResult_t CAEDRClientSetCallbacks(void)
 
 JNIEXPORT void JNICALL
 Java_org_iotivity_ca_CaEdrInterface_caEdrStateChangedCallback(JNIEnv *env, jobject obj,
-                                                               jint status)
+                                                              jint status)
 {
+    if (!env || !obj)
+    {
+        OIC_LOG(ERROR, TAG, "parameter is null");
+        return;
+    }
+
     // STATE_ON:12, STATE_OFF:10
     OIC_LOG(DEBUG, TAG, "CaEdrInterface - Network State Changed");
 
@@ -158,8 +164,14 @@ Java_org_iotivity_ca_CaEdrInterface_caEdrStateChangedCallback(JNIEnv *env, jobje
 
 JNIEXPORT void JNICALL
 Java_org_iotivity_ca_CaEdrInterface_caEdrBondStateChangedCallback(JNIEnv *env, jobject obj,
-                                                                   jstring addr)
+                                                                  jstring addr)
 {
+    if (!env || !obj)
+    {
+        OIC_LOG(ERROR, TAG, "parameter is null");
+        return;
+    }
+
     OIC_LOG(DEBUG, TAG, "CaEdrInterface - Bond State Changed");
 
     if (addr)
index 72e1522..c335b75 100644 (file)
@@ -646,7 +646,7 @@ CAResult_t CAEDRStartUnicastServer(bool isSecured)
     return CA_STATUS_OK;
 }
 
-CAResult_t CAEDRStartMulticastServer(bool isSecured)
+CAResult_t CAEDRStartMulticastServer()
 {
     OIC_LOG(DEBUG, TAG, "CAEDRStartMulticastServer");
 
@@ -689,7 +689,7 @@ CAResult_t CAEDRStartMulticastServer(bool isSecured)
     return CA_STATUS_OK;
 }
 
-CAResult_t CAEDRStopUnicastServer(int32_t serverID)
+CAResult_t CAEDRStopUnicastServer()
 {
     OIC_LOG(DEBUG, TAG, "CAEDRStopUnicastServer");
 
@@ -700,7 +700,7 @@ CAResult_t CAEDRStopUnicastServer(int32_t serverID)
     return CA_STATUS_OK;
 }
 
-CAResult_t CAEDRStopMulticastServer(int32_t serverID)
+CAResult_t CAEDRStopMulticastServer()
 {
     OIC_LOG(DEBUG, TAG, "CAEDRStopMulticastServer");
 
index 5128b9a..676b4bd 100644 (file)
@@ -63,24 +63,21 @@ CAResult_t CAEDRStartUnicastServer(bool isSecured);
 
 /**
  * Start multicast server.
- * @param[in]   isSecured       multicst server type.
  * @return ::CA_STATUS_OK or Appropriate error code.
  */
-CAResult_t CAEDRStartMulticastServer(bool isSecured);
+CAResult_t CAEDRStartMulticastServer();
 
 /**
  * Stop unicast server.
- * @param[in]   serverID        unicast server id.
  * @return ::CA_STATUS_OK or Appropriate error code.
  */
-CAResult_t CAEDRStopUnicastServer(int32_t serverID);
+CAResult_t CAEDRStopUnicastServer();
 
 /**
  * Stop multicast server.
- * @param[in]   serverID        multicast server id.
  * @return ::CA_STATUS_OK or Appropriate error code.
  */
-CAResult_t CAEDRStopMulticastServer(int32_t serverID);
+CAResult_t CAEDRStopMulticastServer();
 
 // EDR Method
 
index 7c8d870..22dc24f 100644 (file)
@@ -336,7 +336,7 @@ void CAEDRUpdateDeviceState(CAConnectedState_t state, const char *address)
         OIC_LOG(ERROR, TAG, "[EDR][Native] newstate is null");
         return;
     }
-    OICStrcpy(newstate->address, sizeof(newstate->address), address);
+    OICStrcpy((char*) newstate->address, sizeof(newstate->address), address);
     newstate->state = state;
 
     CAEDRNativeAddDeviceStateToList(newstate);
@@ -356,9 +356,10 @@ void CAEDRNativeAddDeviceStateToList(state_t *state)
         return;
     }
 
-    if (CAEDRNativeIsDeviceInList(state->address))
+    if (CAEDRNativeIsDeviceInList((const char*) state->address))
     {
-        CAEDRNativeRemoveDevice(state->address); // delete previous state for update new state
+        // delete previous state for update new state
+        CAEDRNativeRemoveDevice((const char*) state->address);
     }
     u_arraylist_add(g_deviceStateList, state); // update new state
     OIC_LOG_V(DEBUG, TAG, "Set State Info to List : %d", state->state);
@@ -383,7 +384,7 @@ bool CAEDRNativeIsDeviceInList(const char* remoteAddress)
             return false;
         }
 
-        if (!strcmp(remoteAddress, state->address))
+        if (!strcmp(remoteAddress, (const char*) state->address))
         {
             OIC_LOG(DEBUG, TAG, "the device is already set");
             return true;
@@ -452,7 +453,7 @@ void CAEDRNativeRemoveDevice(const char *remoteAddress)
             continue;
         }
 
-        if (!strcmp(state->address, remoteAddress))
+        if (!strcmp((const char*) state->address, remoteAddress))
         {
             OIC_LOG_V(DEBUG, TAG, "[EDR][Native] remove state : %s", remoteAddress);
             OICFree(state);
@@ -491,7 +492,7 @@ CAConnectedState_t CAEDRIsConnectedDevice(const char *remoteAddress)
             continue;
         }
 
-        if (!strcmp(state->address, remoteAddress))
+        if (!strcmp((const char*) state->address, remoteAddress))
         {
             OIC_LOG(DEBUG, TAG, "[EDR][Native] check whether it is connected or not");
 
index 5c17eba..e2adb85 100644 (file)
@@ -58,12 +58,6 @@ static CAQueueingThread_t *g_sendQueueHandle = NULL;
 static CAQueueingThread_t *g_recvQueueHandle = NULL;
 
 /**
- * @var g_isHeaderAvailable
- * @brief to differentiate btw header and data packet.
- */
-static bool g_isHeaderAvailable = false;
-
-/**
  * @var g_adapterState
  * @brief Storing Adapter state information
  */
@@ -123,7 +117,7 @@ CAResult_t CAAdapterSendData(const char *remoteAddress, const char *serviceUUID,
 CAEDRNetworkEvent *CAEDRCreateNetworkEvent(CAEndpoint_t *connectivity,
                                            CANetworkStatus_t status);
 CAResult_t CAEDRClientSendData(const char *remoteAddress, const char *serviceUUID,
-                               const void *data, uint32_t dataLength, uint32_t *sentLength);
+                               const void *data, uint32_t dataLength);
 /**
  * @fn CACreateEDRData
  * @brief Helper function to create CAEDRData
@@ -542,7 +536,6 @@ void CAAdapterDataSendHandler(void *context)
 
     const char *remoteAddress = NULL;
     const char *serviceUUID = OIC_EDR_SERVICE_ID;
-    uint32_t sentLength = 0;
 
     if (NULL == message->remoteEndpoint)
     {
@@ -562,7 +555,7 @@ void CAAdapterDataSendHandler(void *context)
     }
 
     CAResult_t result = CAEDRClientSendData(remoteAddress, serviceUUID, message->data,
-                                            message->dataLen, &sentLength);
+                                            message->dataLen);
     if(CA_STATUS_OK != result)
     {
         OIC_LOG(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
@@ -574,7 +567,7 @@ void CAAdapterDataSendHandler(void *context)
 }
 
 CAResult_t CAEDRClientSendData(const char *remoteAddress, const char *serviceUUID,
-                               const void *data, uint32_t dataLength, uint32_t *sentLength)
+                               const void *data, uint32_t dataLength)
 {
 
     CAResult_t result = CA_SEND_FAILED;
@@ -583,7 +576,7 @@ CAResult_t CAEDRClientSendData(const char *remoteAddress, const char *serviceUUI
     if ((NULL != remoteAddress) && (0 < strlen(remoteAddress))) //Unicast data
     {
         result = CAEDRClientSendUnicastData(remoteAddress, serviceUUID, data,
-                                            dataLength, sentLength);
+                                            dataLength);
         if (CA_STATUS_OK != result)
         {
             OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send unicast data !");
@@ -593,8 +586,7 @@ CAResult_t CAEDRClientSendData(const char *remoteAddress, const char *serviceUUI
     else
     {
         OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "sending multicast data : %s", data);
-        result = CAEDRClientSendMulticastData(serviceUUID, data, dataLength,
-                                              sentLength);
+        result = CAEDRClientSendMulticastData(serviceUUID, data, dataLength);
 
         if (CA_STATUS_OK != result)
         {
index f0b50da..38927f3 100644 (file)
@@ -191,10 +191,9 @@ void CAEDRSocketConnectionStateCallback(int result, bt_socket_connection_state_e
                 device->socketFD = connection->socket_fd;
                 while (device->pendingDataList)
                 {
-                    uint32_t sentData = 0;
                     EDRData *edrData = device->pendingDataList->data;
                     res = CAEDRSendData(device->socketFD, edrData->data,
-                                                     edrData->dataLength, &sentData);
+                                        edrData->dataLength);
                     if (CA_STATUS_OK != res)
                     {
                         OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send pending data [%s]",
@@ -585,7 +584,7 @@ void CAEDRClientDisconnectAll(void)
 
 
 CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
-                                      const void *data, uint32_t dataLength, uint32_t *sentLength)
+                                      const void *data, uint32_t dataLength)
 {
     OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
 
@@ -595,7 +594,6 @@ CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *ser
     VERIFY_NON_NULL(remoteAddress, EDR_ADAPTER_TAG, "Remote address is null");
     VERIFY_NON_NULL(serviceUUID, EDR_ADAPTER_TAG, "service UUID is null");
     VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
-    VERIFY_NON_NULL(sentLength, EDR_ADAPTER_TAG, "Sent data length holder is null");
 
     if (0 >= dataLength)
     {
@@ -669,11 +667,10 @@ CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *ser
             CARemoveEDRDeviceFromList(&g_edrDeviceList, remoteAddress);
             return CA_STATUS_FAILED;
         }
-        *sentLength = dataLength;
     }
     else
     {
-        result = CAEDRSendData(device->socketFD, data, dataLength, sentLength);
+        result = CAEDRSendData(device->socketFD, data, dataLength);
         if (CA_STATUS_OK != result)
         {
             OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send data!");
@@ -686,14 +683,13 @@ CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *ser
 }
 
 CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
-                                        uint32_t dataLength, uint32_t *sentLength)
+                                        uint32_t dataLength)
 {
     OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
 
     // Input validation
     VERIFY_NON_NULL(serviceUUID, EDR_ADAPTER_TAG, "service UUID is null");
     VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
-    VERIFY_NON_NULL(sentLength, EDR_ADAPTER_TAG, "Sent data length holder is null");
 
     if (0 >= dataLength)
     {
@@ -701,8 +697,6 @@ CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *dat
         return CA_STATUS_INVALID_PARAM;
     }
 
-    *sentLength = dataLength;
-
     // Send the packet to all OIC devices
     ca_mutex_lock(g_edrDeviceListMutex);
     EDRDeviceList *curList = g_edrDeviceList;
@@ -752,7 +746,7 @@ CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *dat
         else
         {
             OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN3");
-            result = CAEDRSendData(device->socketFD, data, dataLength, sentLength);
+            result = CAEDRSendData(device->socketFD, data, dataLength);
             if (CA_STATUS_OK != result)
             {
                 OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send data to [%s] !",
index bcf2e89..18061e7 100644 (file)
@@ -29,8 +29,7 @@
 #include "caedrutils.h"
 #include "logger.h"
 
-CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength,
-                         uint32_t *sentDataLen)
+CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength)
 {
     OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
 
@@ -47,11 +46,9 @@ CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength,
     if (dataLen == -1)
     {
         OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "sending data failed!, soketid [%d]", serverFD);
-        *sentDataLen = 0;
         return CA_SOCKET_OPERATION_FAILED;
     }
 
-    *sentDataLen = dataLen;
     OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
     return CA_STATUS_OK;
 }
index 3df03f3..0f882ad 100644 (file)
@@ -42,15 +42,13 @@ extern "C"
  * @param  serverFD         [IN] The RFCOMM connection socket file descriptor.
  * @param  data             [IN] The data needs to be sent.
  * @param  dataLength       [IN] The length of data.
- * @param  sentDataLength   [IN] The length of data which actually sent successful.
  *
  * @return #CA_STATUS_OK or Appropriate error code
  * @retval #CA_STATUS_OK  Successful
  * @retval #CA_STATUS_INVALID_PARAM  Invalid input argumets
  * @retval #CA_STATUS_FAILED Operation failed
  */
-CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength,
-                        uint32_t *sentDataLength);
+CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength);
 
 #ifdef __cplusplus
 } /* extern "C" */