* @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
}
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);
}
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);
// 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);
"[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)
{
* 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);
}
else
{
- CAResult_t res = CAEDRNativeConnect(env, address, id);
+ CAResult_t res = CAEDRNativeConnect(env, address);
if (CA_STATUS_OK != res)
{
return res;
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..");
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");
* @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" */
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");
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)
return CA_STATUS_OK;
}
-CAResult_t CAEDRStartMulticastServer(bool isSecured)
+CAResult_t CAEDRStartMulticastServer()
{
OIC_LOG(DEBUG, TAG, "CAEDRStartMulticastServer");
return CA_STATUS_OK;
}
-CAResult_t CAEDRStopUnicastServer(int32_t serverID)
+CAResult_t CAEDRStopUnicastServer()
{
OIC_LOG(DEBUG, TAG, "CAEDRStopUnicastServer");
return CA_STATUS_OK;
}
-CAResult_t CAEDRStopMulticastServer(int32_t serverID)
+CAResult_t CAEDRStopMulticastServer()
{
OIC_LOG(DEBUG, TAG, "CAEDRStopMulticastServer");
/**
* 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
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);
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);
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;
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);
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");
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
*/
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
const char *remoteAddress = NULL;
const char *serviceUUID = OIC_EDR_SERVICE_ID;
- uint32_t sentLength = 0;
if (NULL == message->remoteEndpoint)
{
}
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");
}
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;
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 !");
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)
{
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]",
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");
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)
{
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!");
}
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)
{
return CA_STATUS_INVALID_PARAM;
}
- *sentLength = dataLength;
-
// Send the packet to all OIC devices
ca_mutex_lock(g_edrDeviceListMutex);
EDRDeviceList *curList = g_edrDeviceList;
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] !",
#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");
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;
}
* @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" */